bug fixes

This commit is contained in:
Richard Holland
2023-12-03 21:39:55 +00:00
parent deb4b34b9b
commit df9ed403ad
8 changed files with 58 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ Attest::preclaim(PreclaimContext const& ctx)
uint32_t flags = ctx.tx.getFlags();
bool const isDelete = (flags | tfDeleteAttestation) == tfDeleteAttestation;
bool const isDelete = (flags & tfDeleteAttestation) == tfDeleteAttestation;
bool const exists = ctx.view.exists(kl);
if (exists && !isDelete)
@@ -95,7 +95,18 @@ Attest::doApply()
if (!sle)
return tefINTERNAL;
Keylet kl =
ctx_.tx.isFieldPresent(sfAttestedTxnID)
? keylet::attestationTxn(account_, ctx_.tx.getFieldH256(sfAttestedTxnID))
: keylet::attestationAcc(account_, ctx_.tx.getAccountID(sfAttestedAccID));
uint32_t flags = ctx_.tx.getFlags();
bool const isDelete = (flags & tfDeleteAttestation) == tfDeleteAttestation;
bool const exists = view().exists(kl);
// check for sufficient reserves
if (!isDelete)
{
STAmount const reserve{
view().fees().accountReserve(sle->getFieldU32(sfOwnerCount) + 1)};
@@ -107,16 +118,6 @@ Attest::doApply()
return tecINSUFFICIENT_RESERVE;
}
Keylet kl =
ctx_.tx.isFieldPresent(sfAttestedTxnID)
? keylet::attestationTxn(account_, ctx_.tx.getFieldH256(sfAttestedTxnID))
: keylet::attestationAcc(account_, ctx_.tx.getAccountID(sfAttestedAccID));
uint32_t flags = ctx_.tx.getFlags();
bool const isDelete = (flags | tfDeleteAttestation) == tfDeleteAttestation;
bool const exists = view().exists(kl);
// delete mode
if (exists && isDelete)
{
@@ -142,6 +143,7 @@ Attest::doApply()
{
auto sleA = std::make_shared<SLE>(kl);
sleA->setFieldU16(sfLedgerEntryType, ltATTESTATION);
sleA->setAccountID(sfOwner, account_);
if (ctx_.tx.isFieldPresent(sfAttestedTxnID))

View File

@@ -492,6 +492,7 @@ LedgerEntryTypesMatch::visitEntry(
case ltURI_TOKEN:
case ltIMPORT_VLSEQ:
case ltUNL_REPORT:
case ltATTESTATION:
break;
default:
invalidTypeAdded_ = true;

View File

@@ -553,6 +553,7 @@ extern SF_ACCOUNT const sfEmitCallback;
// account (uncommon)
extern SF_ACCOUNT const sfHookAccount;
extern SF_ACCOUNT const sfNFTokenMinter;
extern SF_ACCOUNT const sfInform;
extern SF_ACCOUNT const sfAttestedAccID;
// path set
@@ -564,6 +565,7 @@ extern SF_VECTOR256 const sfHashes;
extern SF_VECTOR256 const sfAmendments;
extern SF_VECTOR256 const sfNFTokenOffers;
extern SF_VECTOR256 const sfHookNamespaces;
extern SF_VECTOR256 const sfURITokenIDs;
// inner object
// OBJECT/1 is reserved for end of object
@@ -592,6 +594,8 @@ extern SField const sfHookGrant;
extern SField const sfActiveValidator;
extern SField const sfImportVLKey;
extern SField const sfHookEmission;
extern SField const sfMintURIToken;
extern SField const sfAmountEntry;
extern SField const sfAttesterEntry;
// array of objects (common)
@@ -620,6 +624,7 @@ extern SField const sfGenesisMints;
extern SField const sfActiveValidators;
extern SField const sfImportVLKeys;
extern SField const sfHookEmissions;
extern SField const sfAmounts;
extern SField const sfAttesters;
//------------------------------------------------------------------------------

View File

@@ -149,6 +149,9 @@ enum TxType : std::uint16_t
/** This transaction acts as an attestation for another txn currently in the TxQ */
ttATTEST = 94,
/* A payment transactor that delivers only the exact amounts specified, creating accounts and TLs as needed
* that the sender pays for. */
ttREMIT = 95,
/** This transaction can only be used by the genesis account, which is controlled exclusively by
* rewards/governance hooks, to print new XRP to be delivered directly to an array of destinations,

View File

@@ -142,6 +142,21 @@ InnerObjectFormats::InnerObjectFormats()
{sfAccount, soeOPTIONAL},
});
add(sfAmountEntry.jsonName.c_str(),
sfAmountEntry.getCode(),
{
{sfAmount, soeREQUIRED},
{sfFlags, soeOPTIONAL},
});
add(sfMintURIToken.jsonName.c_str(),
sfMintURIToken.getCode(),
{
{sfURI, soeREQUIRED},
{sfDigest, soeOPTIONAL},
{sfFlags, soeOPTIONAL},
});
add(sfAttesterEntry.jsonName.c_str(),
sfAttesterEntry.getCode(),
{

View File

@@ -306,6 +306,7 @@ CONSTRUCT_TYPED_SFIELD(sfEmitCallback, "EmitCallback", ACCOUNT,
// account (uncommon)
CONSTRUCT_TYPED_SFIELD(sfHookAccount, "HookAccount", ACCOUNT, 16);
CONSTRUCT_TYPED_SFIELD(sfInform, "Inform", ACCOUNT, 99);
CONSTRUCT_TYPED_SFIELD(sfAttestedAccID, "AttestedAccID", ACCOUNT, 98);
// vector of 256-bit
@@ -314,6 +315,7 @@ CONSTRUCT_TYPED_SFIELD(sfHashes, "Hashes", VECTOR25
CONSTRUCT_TYPED_SFIELD(sfAmendments, "Amendments", VECTOR256, 3);
CONSTRUCT_TYPED_SFIELD(sfNFTokenOffers, "NFTokenOffers", VECTOR256, 4);
CONSTRUCT_TYPED_SFIELD(sfHookNamespaces, "HookNamespaces", VECTOR256, 5);
CONSTRUCT_TYPED_SFIELD(sfURITokenIDs, "URITokenIDs", VECTOR256, 99);
// path set
CONSTRUCT_UNTYPED_SFIELD(sfPaths, "Paths", PATHSET, 1);
@@ -348,6 +350,8 @@ CONSTRUCT_UNTYPED_SFIELD(sfGenesisMint, "GenesisMint", OBJECT,
CONSTRUCT_UNTYPED_SFIELD(sfActiveValidator, "ActiveValidator", OBJECT, 95);
CONSTRUCT_UNTYPED_SFIELD(sfImportVLKey, "ImportVLKey", OBJECT, 94);
CONSTRUCT_UNTYPED_SFIELD(sfHookEmission, "HookEmission", OBJECT, 93);
CONSTRUCT_UNTYPED_SFIELD(sfMintURIToken, "MintURIToken", OBJECT, 92);
CONSTRUCT_UNTYPED_SFIELD(sfAmountEntry, "AmountEntry", OBJECT, 91);
CONSTRUCT_UNTYPED_SFIELD(sfAttesterEntry, "AttesterEntry", OBJECT, 90);
// array of objects
@@ -373,6 +377,7 @@ CONSTRUCT_UNTYPED_SFIELD(sfGenesisMints, "GenesisMints", ARRAY,
CONSTRUCT_UNTYPED_SFIELD(sfActiveValidators, "ActiveValidators", ARRAY, 95);
CONSTRUCT_UNTYPED_SFIELD(sfImportVLKeys, "ImportVLKeys", ARRAY, 94);
CONSTRUCT_UNTYPED_SFIELD(sfHookEmissions, "HookEmissions", ARRAY, 93);
CONSTRUCT_UNTYPED_SFIELD(sfAmounts, "Amounts", ARRAY, 92);
CONSTRUCT_UNTYPED_SFIELD(sfAttesters, "Attesters", ARRAY, 91);
// clang-format on

View File

@@ -117,6 +117,21 @@ TxFormats::TxFormats()
},
commonFields);
add(jss::Remit,
ttREMIT,
{
{sfDestination, soeREQUIRED},
{sfAmounts, soeOPTIONAL},
{sfURITokenIDs, soeOPTIONAL},
{sfMintURIToken, soeOPTIONAL},
{sfInvoiceID, soeOPTIONAL},
{sfDestinationTag, soeOPTIONAL},
{sfTicketSequence, soeOPTIONAL},
{sfBlob, soeOPTIONAL},
{sfInform, soeOPTIONAL},
},
commonFields);
add(jss::EscrowCreate,
ttESCROW_CREATE,
{

View File

@@ -120,6 +120,7 @@ JSS(Payment); // transaction type.
JSS(PaymentChannelClaim); // transaction type.
JSS(PaymentChannelCreate); // transaction type.
JSS(PaymentChannelFund); // transaction type.
JSS(Remit); // transaction type.
JSS(RippleState); // ledger type.
JSS(SLE_hit_rate); // out: GetCounts.
JSS(SetFee); // transaction type.