From 0d500343ed48c0ec73d9d7b1e3419306a3cab0b7 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Thu, 4 Sep 2025 14:08:54 -0400 Subject: [PATCH] New invariant privilege "mayDeleteMPT", used by VauleDeposit & Clawback --- include/xrpl/protocol/detail/transactions.macro | 4 ++-- src/xrpld/app/tx/detail/InvariantCheck.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index f9f74d2492..09e1c183b2 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -844,7 +844,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, #endif TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, Delegation::delegatable, - noPriv, + mayDeleteMPT, ({ {sfVaultID, soeREQUIRED}, {sfAmount, soeREQUIRED, soeMPTSupported}, @@ -858,7 +858,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, #endif TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, Delegation::delegatable, - noPriv, + mayDeleteMPT, ({ {sfVaultID, soeREQUIRED}, {sfHolder, soeREQUIRED}, diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index 201419e149..1a2b69c579 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -76,6 +76,8 @@ enum Privilege { // object (except by issuer) mayAuthorizeMPT = 0x0200, // The transaction MAY create or delete an MPT // object (except by issuer) + mayDeleteMPT = + 0x0400, // The transaction MAY delete an MPT object. May not create. }; constexpr Privilege operator|(Privilege lhs, Privilege rhs) @@ -1554,10 +1556,9 @@ ValidMPTIssuance::finalize( return true; } - if ((tx.getTxnType() == ttVAULT_CLAWBACK || - tx.getTxnType() == ttVAULT_WITHDRAW) && - mptokensDeleted_ == 1 && mptokensCreated_ == 0 && - mptIssuancesCreated_ == 0 && mptIssuancesDeleted_ == 0) + if (hasPrivilege(tx, mayDeleteMPT) && mptokensDeleted_ == 1 && + mptokensCreated_ == 0 && mptIssuancesCreated_ == 0 && + mptIssuancesDeleted_ == 0) return true; }