From f07d4e350be7db1e585a69ed547db95b01f98cf7 Mon Sep 17 00:00:00 2001 From: Shawn Xie Date: Mon, 28 Oct 2024 14:29:55 -0400 Subject: [PATCH 1/2] rename --- include/xrpl/protocol/detail/sfields.macro | 2 +- include/xrpl/protocol/detail/transactions.macro | 6 +++--- src/test/app/MPToken_test.cpp | 2 +- src/test/jtx/impl/mpt.cpp | 4 ++-- src/test/jtx/impl/trust.cpp | 2 +- src/xrpld/app/tx/detail/Clawback.cpp | 11 +++++------ src/xrpld/app/tx/detail/InvariantCheck.cpp | 2 +- src/xrpld/app/tx/detail/MPTokenAuthorize.cpp | 6 +++--- src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp | 6 +++--- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/include/xrpl/protocol/detail/sfields.macro b/include/xrpl/protocol/detail/sfields.macro index 3d75593a40d..315207f0250 100644 --- a/include/xrpl/protocol/detail/sfields.macro +++ b/include/xrpl/protocol/detail/sfields.macro @@ -270,7 +270,7 @@ TYPED_SFIELD(sfUnauthorize, ACCOUNT, 6) TYPED_SFIELD(sfRegularKey, ACCOUNT, 8) TYPED_SFIELD(sfNFTokenMinter, ACCOUNT, 9) TYPED_SFIELD(sfEmitCallback, ACCOUNT, 10) -TYPED_SFIELD(sfMPTokenHolder, ACCOUNT, 11) +TYPED_SFIELD(sfHolder, ACCOUNT, 11) // account (uncommon) TYPED_SFIELD(sfHookAccount, ACCOUNT, 16) diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index 3696405b430..30e27da4167 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -224,7 +224,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, ({ /** This transaction claws back issued tokens. */ TRANSACTION(ttCLAWBACK, 30, Clawback, ({ {sfAmount, soeREQUIRED, soeMPTSupported}, - {sfMPTokenHolder, soeOPTIONAL}, + {sfHolder, soeOPTIONAL}, })) /** This transaction type creates an AMM instance */ @@ -403,13 +403,13 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, ({ /** This transaction type sets flags on a MPTokensIssuance or MPToken instance */ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, ({ {sfMPTokenIssuanceID, soeREQUIRED}, - {sfMPTokenHolder, soeOPTIONAL}, + {sfHolder, soeOPTIONAL}, })) /** This transaction type authorizes a MPToken instance */ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, ({ {sfMPTokenIssuanceID, soeREQUIRED}, - {sfMPTokenHolder, soeOPTIONAL}, + {sfHolder, soeOPTIONAL}, })) /** This system-generated transaction type is used to update the status of the various amendments. diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 803ccd21458..e666abbd2bd 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -1648,7 +1648,7 @@ class MPToken_test : public beast::unit_test::suite void testTxJsonMetaFields(FeatureBitset features) { - // checks synthetically parsed mptissuanceid from `tx` response + // checks synthetically injected mptissuanceid from `tx` response testcase("Test synthetic fields from tx response"); using namespace test::jtx; diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index 93bef83721a..b68fd4446de 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -157,7 +157,7 @@ MPTTester::authorize(MPTAuthorize const& arg) jv[sfMPTokenIssuanceID] = to_string(*id_); } if (arg.holder) - jv[sfMPTokenHolder] = arg.holder->human(); + jv[sfHolder] = arg.holder->human(); if (auto const result = submit(arg, jv); result == tesSUCCESS) { // Issuer authorizes @@ -230,7 +230,7 @@ MPTTester::set(MPTSet const& arg) jv[sfMPTokenIssuanceID] = to_string(*id_); } if (arg.holder) - jv[sfMPTokenHolder] = arg.holder->human(); + jv[sfHolder] = arg.holder->human(); if (submit(arg, jv) == tesSUCCESS && arg.flags.value_or(0)) { auto require = [&](std::optional const& holder, diff --git a/src/test/jtx/impl/trust.cpp b/src/test/jtx/impl/trust.cpp index 320c7d05c7c..dee4b282367 100644 --- a/src/test/jtx/impl/trust.cpp +++ b/src/test/jtx/impl/trust.cpp @@ -75,7 +75,7 @@ claw( jv[jss::TransactionType] = jss::Clawback; if (mptHolder) - jv[sfMPTokenHolder.jsonName] = mptHolder->human(); + jv[sfHolder.jsonName] = mptHolder->human(); return jv; } diff --git a/src/xrpld/app/tx/detail/Clawback.cpp b/src/xrpld/app/tx/detail/Clawback.cpp index b4e68ab7c73..f1040790a42 100644 --- a/src/xrpld/app/tx/detail/Clawback.cpp +++ b/src/xrpld/app/tx/detail/Clawback.cpp @@ -36,7 +36,7 @@ template <> NotTEC preflightHelper(PreflightContext const& ctx) { - if (ctx.tx.isFieldPresent(sfMPTokenHolder)) + if (ctx.tx.isFieldPresent(sfHolder)) return temMALFORMED; AccountID const issuer = ctx.tx[sfAccount]; @@ -58,7 +58,7 @@ preflightHelper(PreflightContext const& ctx) if (!ctx.rules.enabled(featureMPTokensV1)) return temDISABLED; - auto const mptHolder = ctx.tx[~sfMPTokenHolder]; + auto const mptHolder = ctx.tx[~sfHolder]; auto const clawAmount = ctx.tx[sfAmount]; if (!mptHolder) @@ -199,9 +199,8 @@ Clawback::preclaim(PreclaimContext const& ctx) { AccountID const issuer = ctx.tx[sfAccount]; auto const clawAmount = ctx.tx[sfAmount]; - AccountID const holder = clawAmount.holds() - ? clawAmount.getIssuer() - : ctx.tx[sfMPTokenHolder]; + AccountID const holder = + clawAmount.holds() ? clawAmount.getIssuer() : ctx.tx[sfHolder]; auto const sleIssuer = ctx.view.read(keylet::account(issuer)); auto const sleHolder = ctx.view.read(keylet::account(holder)); @@ -260,7 +259,7 @@ applyHelper(ApplyContext& ctx) { AccountID const issuer = ctx.tx[sfAccount]; auto clawAmount = ctx.tx[sfAmount]; - AccountID const holder = ctx.tx[sfMPTokenHolder]; + AccountID const holder = ctx.tx[sfHolder]; // Get the spendable balance. Must use `accountHolds`. STAmount const spendableAmount = accountHolds( diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index 625f8c7b284..e8bbd0283b5 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -1031,7 +1031,7 @@ ValidMPTIssuance::finalize( if (tx.getTxnType() == ttMPTOKEN_AUTHORIZE) { - bool const submittedByIssuer = tx.isFieldPresent(sfMPTokenHolder); + bool const submittedByIssuer = tx.isFieldPresent(sfHolder); if (mptIssuancesCreated_ > 0) { diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp index b63d111a207..5b589530cfb 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp +++ b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp @@ -37,7 +37,7 @@ MPTokenAuthorize::preflight(PreflightContext const& ctx) if (ctx.tx.getFlags() & tfMPTokenAuthorizeMask) return temINVALID_FLAG; - if (ctx.tx[sfAccount] == ctx.tx[~sfMPTokenHolder]) + if (ctx.tx[sfAccount] == ctx.tx[~sfHolder]) return temMALFORMED; return preflight2(ctx); @@ -47,7 +47,7 @@ TER MPTokenAuthorize::preclaim(PreclaimContext const& ctx) { auto const accountID = ctx.tx[sfAccount]; - auto const holderID = ctx.tx[~sfMPTokenHolder]; + auto const holderID = ctx.tx[~sfHolder]; // if non-issuer account submits this tx, then they are trying either: // 1. Unauthorize/delete MPToken @@ -262,7 +262,7 @@ MPTokenAuthorize::doApply() .mptIssuanceID = tx[sfMPTokenIssuanceID], .account = account_, .flags = tx.getFlags(), - .holderID = tx[~sfMPTokenHolder]}); + .holderID = tx[~sfHolder]}); } } // namespace ripple diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp index 352fa674cb8..4e395c30be6 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp @@ -44,7 +44,7 @@ MPTokenIssuanceSet::preflight(PreflightContext const& ctx) return temINVALID_FLAG; auto const accountID = ctx.tx[sfAccount]; - auto const holderID = ctx.tx[~sfMPTokenHolder]; + auto const holderID = ctx.tx[~sfHolder]; if (holderID && accountID == holderID) return temMALFORMED; @@ -68,7 +68,7 @@ MPTokenIssuanceSet::preclaim(PreclaimContext const& ctx) if ((*sleMptIssuance)[sfIssuer] != ctx.tx[sfAccount]) return tecNO_PERMISSION; - if (auto const holderID = ctx.tx[~sfMPTokenHolder]) + if (auto const holderID = ctx.tx[~sfHolder]) { // make sure holder account exists if (!ctx.view.exists(keylet::account(*holderID))) @@ -88,7 +88,7 @@ MPTokenIssuanceSet::doApply() { auto const mptIssuanceID = ctx_.tx[sfMPTokenIssuanceID]; auto const txFlags = ctx_.tx.getFlags(); - auto const holderID = ctx_.tx[~sfMPTokenHolder]; + auto const holderID = ctx_.tx[~sfHolder]; std::shared_ptr sle; if (holderID) From fc4f11711cbb0fff0dc45a5df8461b4e445503bc Mon Sep 17 00:00:00 2001 From: Shawn Xie Date: Mon, 28 Oct 2024 14:31:03 -0400 Subject: [PATCH 2/2] space --- include/xrpl/protocol/detail/sfields.macro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xrpl/protocol/detail/sfields.macro b/include/xrpl/protocol/detail/sfields.macro index 315207f0250..e3a93fc7f46 100644 --- a/include/xrpl/protocol/detail/sfields.macro +++ b/include/xrpl/protocol/detail/sfields.macro @@ -270,7 +270,7 @@ TYPED_SFIELD(sfUnauthorize, ACCOUNT, 6) TYPED_SFIELD(sfRegularKey, ACCOUNT, 8) TYPED_SFIELD(sfNFTokenMinter, ACCOUNT, 9) TYPED_SFIELD(sfEmitCallback, ACCOUNT, 10) -TYPED_SFIELD(sfHolder, ACCOUNT, 11) +TYPED_SFIELD(sfHolder, ACCOUNT, 11) // account (uncommon) TYPED_SFIELD(sfHookAccount, ACCOUNT, 16)