From 998daf6e203bd91e418f1393a1f9bf1dc5a54504 Mon Sep 17 00:00:00 2001 From: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:41:19 +0200 Subject: [PATCH] refactor: Add transaction-specific invariant checking (#6551) --- include/xrpl/basics/Buffer.h | 2 +- include/xrpl/core/JobTypes.h | 3 +- include/xrpl/tx/Transactor.h | 76 +++++++++ .../tx/transactors/account/AccountDelete.h | 14 ++ .../xrpl/tx/transactors/account/AccountSet.h | 14 ++ .../tx/transactors/account/SetRegularKey.h | 14 ++ .../tx/transactors/account/SignerListSet.h | 14 ++ .../xrpl/tx/transactors/bridge/XChainBridge.h | 112 +++++++++++++ .../xrpl/tx/transactors/check/CheckCancel.h | 14 ++ include/xrpl/tx/transactors/check/CheckCash.h | 14 ++ .../xrpl/tx/transactors/check/CheckCreate.h | 14 ++ .../credentials/CredentialAccept.h | 14 ++ .../credentials/CredentialCreate.h | 14 ++ .../credentials/CredentialDelete.h | 14 ++ .../tx/transactors/delegate/DelegateSet.h | 14 ++ include/xrpl/tx/transactors/dex/AMMBid.h | 14 ++ include/xrpl/tx/transactors/dex/AMMClawback.h | 14 ++ include/xrpl/tx/transactors/dex/AMMCreate.h | 14 ++ include/xrpl/tx/transactors/dex/AMMDelete.h | 14 ++ include/xrpl/tx/transactors/dex/AMMDeposit.h | 14 ++ include/xrpl/tx/transactors/dex/AMMVote.h | 14 ++ include/xrpl/tx/transactors/dex/AMMWithdraw.h | 14 ++ include/xrpl/tx/transactors/dex/OfferCancel.h | 14 ++ include/xrpl/tx/transactors/dex/OfferCreate.h | 14 ++ include/xrpl/tx/transactors/did/DIDDelete.h | 14 ++ include/xrpl/tx/transactors/did/DIDSet.h | 14 ++ .../xrpl/tx/transactors/escrow/EscrowCancel.h | 14 ++ .../xrpl/tx/transactors/escrow/EscrowCreate.h | 14 ++ .../xrpl/tx/transactors/escrow/EscrowFinish.h | 14 ++ .../lending/LoanBrokerCoverClawback.h | 14 ++ .../lending/LoanBrokerCoverDeposit.h | 14 ++ .../lending/LoanBrokerCoverWithdraw.h | 14 ++ .../tx/transactors/lending/LoanBrokerDelete.h | 14 ++ .../tx/transactors/lending/LoanBrokerSet.h | 14 ++ .../xrpl/tx/transactors/lending/LoanDelete.h | 14 ++ .../xrpl/tx/transactors/lending/LoanManage.h | 14 ++ include/xrpl/tx/transactors/lending/LoanPay.h | 14 ++ include/xrpl/tx/transactors/lending/LoanSet.h | 14 ++ .../tx/transactors/nft/NFTokenAcceptOffer.h | 14 ++ include/xrpl/tx/transactors/nft/NFTokenBurn.h | 14 ++ .../tx/transactors/nft/NFTokenCancelOffer.h | 14 ++ .../tx/transactors/nft/NFTokenCreateOffer.h | 14 ++ include/xrpl/tx/transactors/nft/NFTokenMint.h | 14 ++ .../xrpl/tx/transactors/nft/NFTokenModify.h | 14 ++ .../xrpl/tx/transactors/oracle/OracleDelete.h | 14 ++ .../xrpl/tx/transactors/oracle/OracleSet.h | 14 ++ .../tx/transactors/payment/DepositPreauth.h | 14 ++ include/xrpl/tx/transactors/payment/Payment.h | 14 ++ .../payment_channel/PaymentChannelClaim.h | 14 ++ .../payment_channel/PaymentChannelCreate.h | 14 ++ .../payment_channel/PaymentChannelFund.h | 14 ++ .../PermissionedDomainDelete.h | 14 ++ .../PermissionedDomainSet.h | 14 ++ include/xrpl/tx/transactors/system/Batch.h | 14 ++ include/xrpl/tx/transactors/system/Change.h | 14 ++ .../tx/transactors/system/LedgerStateFix.h | 14 ++ .../xrpl/tx/transactors/system/TicketCreate.h | 14 ++ include/xrpl/tx/transactors/token/Clawback.h | 14 ++ .../tx/transactors/token/MPTokenAuthorize.h | 14 ++ .../transactors/token/MPTokenIssuanceCreate.h | 14 ++ .../token/MPTokenIssuanceDestroy.h | 14 ++ .../tx/transactors/token/MPTokenIssuanceSet.h | 14 ++ include/xrpl/tx/transactors/token/TrustSet.h | 14 ++ .../xrpl/tx/transactors/vault/VaultClawback.h | 14 ++ .../xrpl/tx/transactors/vault/VaultCreate.h | 14 ++ .../xrpl/tx/transactors/vault/VaultDelete.h | 14 ++ .../xrpl/tx/transactors/vault/VaultDeposit.h | 14 ++ include/xrpl/tx/transactors/vault/VaultSet.h | 14 ++ .../xrpl/tx/transactors/vault/VaultWithdraw.h | 14 ++ src/libxrpl/tx/ApplyContext.cpp | 4 +- src/libxrpl/tx/Transactor.cpp | 67 +++++++- src/libxrpl/tx/applySteps.cpp | 13 ++ .../tx/transactors/account/AccountDelete.cpp | 21 +++ .../tx/transactors/account/AccountSet.cpp | 17 ++ .../tx/transactors/account/SetRegularKey.cpp | 23 +++ .../tx/transactors/account/SignerListSet.cpp | 24 +++ .../tx/transactors/bridge/XChainBridge.cpp | 148 ++++++++++++++++++ .../tx/transactors/check/CheckCancel.cpp | 18 +++ .../tx/transactors/check/CheckCash.cpp | 16 ++ .../tx/transactors/check/CheckCreate.cpp | 17 ++ .../credentials/CredentialAccept.cpp | 22 +++ .../credentials/CredentialCreate.cpp | 21 +++ .../credentials/CredentialDelete.cpp | 22 +++ .../tx/transactors/delegate/DelegateSet.cpp | 17 ++ src/libxrpl/tx/transactors/dex/AMMBid.cpp | 18 +++ .../tx/transactors/dex/AMMClawback.cpp | 18 +++ src/libxrpl/tx/transactors/dex/AMMCreate.cpp | 15 ++ src/libxrpl/tx/transactors/dex/AMMDelete.cpp | 19 +++ src/libxrpl/tx/transactors/dex/AMMDeposit.cpp | 18 +++ src/libxrpl/tx/transactors/dex/AMMVote.cpp | 18 +++ .../tx/transactors/dex/AMMWithdraw.cpp | 16 ++ .../tx/transactors/dex/OfferCancel.cpp | 19 +++ .../tx/transactors/dex/OfferCreate.cpp | 14 ++ src/libxrpl/tx/transactors/did/DIDDelete.cpp | 17 ++ src/libxrpl/tx/transactors/did/DIDSet.cpp | 18 +++ .../tx/transactors/escrow/EscrowCancel.cpp | 22 +++ .../tx/transactors/escrow/EscrowCreate.cpp | 20 +++ .../tx/transactors/escrow/EscrowFinish.cpp | 21 +++ .../lending/LoanBrokerCoverClawback.cpp | 22 +++ .../lending/LoanBrokerCoverDeposit.cpp | 24 +++ .../lending/LoanBrokerCoverWithdraw.cpp | 24 +++ .../transactors/lending/LoanBrokerDelete.cpp | 24 +++ .../tx/transactors/lending/LoanBrokerSet.cpp | 22 +++ .../tx/transactors/lending/LoanDelete.cpp | 21 +++ .../tx/transactors/lending/LoanManage.cpp | 18 +++ .../tx/transactors/lending/LoanPay.cpp | 17 ++ .../tx/transactors/lending/LoanSet.cpp | 16 ++ .../tx/transactors/nft/NFTokenAcceptOffer.cpp | 22 +++ .../tx/transactors/nft/NFTokenBurn.cpp | 19 +++ .../tx/transactors/nft/NFTokenCancelOffer.cpp | 23 +++ .../tx/transactors/nft/NFTokenCreateOffer.cpp | 24 +++ .../tx/transactors/nft/NFTokenMint.cpp | 19 +++ .../tx/transactors/nft/NFTokenModify.cpp | 25 +++ .../tx/transactors/oracle/OracleDelete.cpp | 22 +++ .../tx/transactors/oracle/OracleSet.cpp | 17 ++ .../tx/transactors/payment/DepositPreauth.cpp | 22 +++ .../tx/transactors/payment/Payment.cpp | 15 ++ .../payment_channel/PaymentChannelClaim.cpp | 22 +++ .../payment_channel/PaymentChannelCreate.cpp | 21 +++ .../payment_channel/PaymentChannelFund.cpp | 25 +++ .../PermissionedDomainDelete.cpp | 24 +++ .../PermissionedDomainSet.cpp | 22 +++ src/libxrpl/tx/transactors/system/Batch.cpp | 16 ++ src/libxrpl/tx/transactors/system/Change.cpp | 17 ++ .../tx/transactors/system/LedgerStateFix.cpp | 24 +++ .../tx/transactors/system/TicketCreate.cpp | 21 +++ src/libxrpl/tx/transactors/token/Clawback.cpp | 18 +++ .../tx/transactors/token/MPTokenAuthorize.cpp | 22 +++ .../token/MPTokenIssuanceCreate.cpp | 23 +++ .../token/MPTokenIssuanceDestroy.cpp | 24 +++ .../transactors/token/MPTokenIssuanceSet.cpp | 23 +++ src/libxrpl/tx/transactors/token/TrustSet.cpp | 17 ++ .../tx/transactors/vault/VaultClawback.cpp | 22 +++ .../tx/transactors/vault/VaultCreate.cpp | 17 ++ .../tx/transactors/vault/VaultDelete.cpp | 19 +++ .../tx/transactors/vault/VaultDeposit.cpp | 23 +++ src/libxrpl/tx/transactors/vault/VaultSet.cpp | 19 +++ .../tx/transactors/vault/VaultWithdraw.cpp | 23 +++ src/test/app/Invariants_test.cpp | 22 ++- 139 files changed, 2653 insertions(+), 13 deletions(-) diff --git a/include/xrpl/basics/Buffer.h b/include/xrpl/basics/Buffer.h index 02926e9420..52c092981c 100644 --- a/include/xrpl/basics/Buffer.h +++ b/include/xrpl/basics/Buffer.h @@ -92,7 +92,7 @@ public: { // Ensure the slice isn't a subset of the buffer. XRPL_ASSERT( - s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_, + s.empty() || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_, "xrpl::Buffer::operator=(Slice) : input not a subset"); if (auto p = alloc(s.size())) diff --git a/include/xrpl/core/JobTypes.h b/include/xrpl/core/JobTypes.h index 98de97a1b4..1fb6f61573 100644 --- a/include/xrpl/core/JobTypes.h +++ b/include/xrpl/core/JobTypes.h @@ -33,8 +33,7 @@ private: std::chrono::milliseconds avgLatency, std::chrono::milliseconds peakLatency) { XRPL_ASSERT( - m_map.find(jt) == m_map.end(), - "xrpl::JobTypes::JobTypes::add : unique job type input"); + !m_map.contains(jt), "xrpl::JobTypes::JobTypes::add : unique job type input"); [[maybe_unused]] auto const inserted = m_map diff --git a/include/xrpl/tx/Transactor.h b/include/xrpl/tx/Transactor.h index 52cebe9769..a3b0af821e 100644 --- a/include/xrpl/tx/Transactor.h +++ b/include/xrpl/tx/Transactor.h @@ -124,6 +124,7 @@ public: Transactor& operator=(Transactor const&) = delete; enum ConsequencesFactoryType { Normal, Blocker, Custom }; + /** Process the transaction. */ ApplyResult operator()(); @@ -140,6 +141,20 @@ public: return ctx_.view(); } + /** Check all invariants for the current transaction. + * + * Runs transaction-specific invariants first (visitInvariantEntry + + * finalizeInvariants), then protocol-level invariants. Both layers + * always run; the worst failure code is returned. + * + * @param result the tentative TER from transaction processing. + * @param fee the fee consumed by the transaction. + * + * @return the final TER after all invariant checks. + */ + [[nodiscard]] TER + checkInvariants(TER result, XRPAmount fee); + ///////////////////////////////////////////////////// /* These static functions are called from invoke_preclaim @@ -230,6 +245,52 @@ protected: virtual TER doApply() = 0; + /** Inspect a single ledger entry modified by this transaction. + * + * Called once for every SLE created, modified, or deleted by the + * transaction, before finalizeInvariants. Implementations should + * accumulate whatever state they need to verify transaction-specific + * post-conditions. + * + * @param isDelete true if the entry was erased from the ledger. + * @param before the entry's state before the transaction (nullptr + * for newly created entries). + * @param after the entry's state as supplied by the apply logic + * for this transaction. For deletions, this is the + * SLE being erased and is not guaranteed to be null; + * callers must use isDelete rather than after == nullptr + * to detect deletions. + */ + virtual void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) = 0; + + /** Check transaction-specific post-conditions after all entries have + * been visited. + * + * Called once after every modified ledger entry has been passed to + * visitInvariantEntry. Returns true if all transaction-specific + * invariants hold, or false to fail the transaction with + * tecINVARIANT_FAILED. + * + * @param tx the transaction being applied. + * @param result the tentative TER result so far. + * @param fee the fee consumed by the transaction. + * @param view read-only view of the ledger after the transaction. + * @param j journal for logging invariant failures. + * + * @return true if all invariants pass; false otherwise. + */ + [[nodiscard]] virtual bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) = 0; + /** Compute the minimum fee required to process a transaction with a given baseFee based on the current server load. @@ -335,6 +396,21 @@ private: */ static NotTEC preflight2(PreflightContext const& ctx); + + /** Check transaction-specific invariants only. + * + * Walks every modified ledger entry via visitInvariantEntry, then + * calls finalizeInvariants on the derived transactor. Returns + * tecINVARIANT_FAILED if any transaction invariant is violated. + * + * @param result the tentative TER from transaction processing. + * @param fee the fee consumed by the transaction. + * + * @return the original result if all invariants pass, or + * tecINVARIANT_FAILED otherwise. + */ + [[nodiscard]] TER + checkTransactionInvariants(TER result, XRPAmount fee); }; inline bool diff --git a/include/xrpl/tx/transactors/account/AccountDelete.h b/include/xrpl/tx/transactors/account/AccountDelete.h index 81a11152ed..23fc55da48 100644 --- a/include/xrpl/tx/transactors/account/AccountDelete.h +++ b/include/xrpl/tx/transactors/account/AccountDelete.h @@ -27,6 +27,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/account/AccountSet.h b/include/xrpl/tx/transactors/account/AccountSet.h index 0940ab0739..fd2106e20c 100644 --- a/include/xrpl/tx/transactors/account/AccountSet.h +++ b/include/xrpl/tx/transactors/account/AccountSet.h @@ -31,6 +31,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/account/SetRegularKey.h b/include/xrpl/tx/transactors/account/SetRegularKey.h index bb1dd48a68..54e574939a 100644 --- a/include/xrpl/tx/transactors/account/SetRegularKey.h +++ b/include/xrpl/tx/transactors/account/SetRegularKey.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/account/SignerListSet.h b/include/xrpl/tx/transactors/account/SignerListSet.h index 2529f0d36c..1f1a68ccc8 100644 --- a/include/xrpl/tx/transactors/account/SignerListSet.h +++ b/include/xrpl/tx/transactors/account/SignerListSet.h @@ -41,6 +41,20 @@ public: void preCompute() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + // Interface used by AccountDelete static TER removeFromLedger( diff --git a/include/xrpl/tx/transactors/bridge/XChainBridge.h b/include/xrpl/tx/transactors/bridge/XChainBridge.h index 0a2fccc18b..cd16c0b791 100644 --- a/include/xrpl/tx/transactors/bridge/XChainBridge.h +++ b/include/xrpl/tx/transactors/bridge/XChainBridge.h @@ -26,6 +26,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; class BridgeModify : public Transactor @@ -48,6 +62,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; using XChainModifyBridge = BridgeModify; @@ -81,6 +109,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ @@ -108,6 +150,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ @@ -137,6 +193,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ @@ -166,6 +236,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; class XChainAddAccountCreateAttestation : public Transactor @@ -186,6 +270,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ @@ -230,6 +328,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; using XChainAccountCreateCommit = XChainCreateAccountCommit; diff --git a/include/xrpl/tx/transactors/check/CheckCancel.h b/include/xrpl/tx/transactors/check/CheckCancel.h index f16c6d2827..14abeaa978 100644 --- a/include/xrpl/tx/transactors/check/CheckCancel.h +++ b/include/xrpl/tx/transactors/check/CheckCancel.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/check/CheckCash.h b/include/xrpl/tx/transactors/check/CheckCash.h index 3b914d2024..312c5a983e 100644 --- a/include/xrpl/tx/transactors/check/CheckCash.h +++ b/include/xrpl/tx/transactors/check/CheckCash.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/check/CheckCreate.h b/include/xrpl/tx/transactors/check/CheckCreate.h index bcb9d16ea2..ff24d36e2c 100644 --- a/include/xrpl/tx/transactors/check/CheckCreate.h +++ b/include/xrpl/tx/transactors/check/CheckCreate.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/credentials/CredentialAccept.h b/include/xrpl/tx/transactors/credentials/CredentialAccept.h index 1895e54589..f3abc80666 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialAccept.h +++ b/include/xrpl/tx/transactors/credentials/CredentialAccept.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/credentials/CredentialCreate.h b/include/xrpl/tx/transactors/credentials/CredentialCreate.h index 500b034a9c..22247feb36 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialCreate.h +++ b/include/xrpl/tx/transactors/credentials/CredentialCreate.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/credentials/CredentialDelete.h b/include/xrpl/tx/transactors/credentials/CredentialDelete.h index 26305232ce..91ea4d05ad 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialDelete.h +++ b/include/xrpl/tx/transactors/credentials/CredentialDelete.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/delegate/DelegateSet.h b/include/xrpl/tx/transactors/delegate/DelegateSet.h index cc3a8fe4cb..25cb21e9b5 100644 --- a/include/xrpl/tx/transactors/delegate/DelegateSet.h +++ b/include/xrpl/tx/transactors/delegate/DelegateSet.h @@ -22,6 +22,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + // Interface used by AccountDelete static TER deleteDelegate( diff --git a/include/xrpl/tx/transactors/dex/AMMBid.h b/include/xrpl/tx/transactors/dex/AMMBid.h index b80bfe3bef..e872c0d12d 100644 --- a/include/xrpl/tx/transactors/dex/AMMBid.h +++ b/include/xrpl/tx/transactors/dex/AMMBid.h @@ -62,6 +62,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/AMMClawback.h b/include/xrpl/tx/transactors/dex/AMMClawback.h index dd455903a2..4f44da60d2 100644 --- a/include/xrpl/tx/transactors/dex/AMMClawback.h +++ b/include/xrpl/tx/transactors/dex/AMMClawback.h @@ -28,6 +28,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + private: TER applyGuts(Sandbox& view); diff --git a/include/xrpl/tx/transactors/dex/AMMCreate.h b/include/xrpl/tx/transactors/dex/AMMCreate.h index 5deaa129ed..a3ee083b9a 100644 --- a/include/xrpl/tx/transactors/dex/AMMCreate.h +++ b/include/xrpl/tx/transactors/dex/AMMCreate.h @@ -58,6 +58,20 @@ public: /** Attempt to create the AMM instance. */ TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/AMMDelete.h b/include/xrpl/tx/transactors/dex/AMMDelete.h index 1c0996f8a2..a1708eec88 100644 --- a/include/xrpl/tx/transactors/dex/AMMDelete.h +++ b/include/xrpl/tx/transactors/dex/AMMDelete.h @@ -30,6 +30,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/AMMDeposit.h b/include/xrpl/tx/transactors/dex/AMMDeposit.h index e2a19504ae..87f2871d27 100644 --- a/include/xrpl/tx/transactors/dex/AMMDeposit.h +++ b/include/xrpl/tx/transactors/dex/AMMDeposit.h @@ -63,6 +63,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + private: std::pair applyGuts(Sandbox& view); diff --git a/include/xrpl/tx/transactors/dex/AMMVote.h b/include/xrpl/tx/transactors/dex/AMMVote.h index ab04b30993..f83cdcfcd2 100644 --- a/include/xrpl/tx/transactors/dex/AMMVote.h +++ b/include/xrpl/tx/transactors/dex/AMMVote.h @@ -47,6 +47,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/AMMWithdraw.h b/include/xrpl/tx/transactors/dex/AMMWithdraw.h index 087fd3a14c..a07cfca693 100644 --- a/include/xrpl/tx/transactors/dex/AMMWithdraw.h +++ b/include/xrpl/tx/transactors/dex/AMMWithdraw.h @@ -71,6 +71,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + /** Equal-asset withdrawal (LPTokens) of some AMM instance pools * shares represented by the number of LPTokens . * The trading fee is not charged. diff --git a/include/xrpl/tx/transactors/dex/OfferCancel.h b/include/xrpl/tx/transactors/dex/OfferCancel.h index c4c57ff3b4..d18808d236 100644 --- a/include/xrpl/tx/transactors/dex/OfferCancel.h +++ b/include/xrpl/tx/transactors/dex/OfferCancel.h @@ -22,6 +22,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/OfferCreate.h b/include/xrpl/tx/transactors/dex/OfferCreate.h index ad36f1b6e6..09c9c0dd6f 100644 --- a/include/xrpl/tx/transactors/dex/OfferCreate.h +++ b/include/xrpl/tx/transactors/dex/OfferCreate.h @@ -40,6 +40,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + private: std::pair applyGuts(Sandbox& view, Sandbox& view_cancel); diff --git a/include/xrpl/tx/transactors/did/DIDDelete.h b/include/xrpl/tx/transactors/did/DIDDelete.h index 037a57bb02..47b4112762 100644 --- a/include/xrpl/tx/transactors/did/DIDDelete.h +++ b/include/xrpl/tx/transactors/did/DIDDelete.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/did/DIDSet.h b/include/xrpl/tx/transactors/did/DIDSet.h index fe1c476b47..2e88570065 100644 --- a/include/xrpl/tx/transactors/did/DIDSet.h +++ b/include/xrpl/tx/transactors/did/DIDSet.h @@ -18,6 +18,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/escrow/EscrowCancel.h b/include/xrpl/tx/transactors/escrow/EscrowCancel.h index c8b97203f0..253d88613f 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowCancel.h +++ b/include/xrpl/tx/transactors/escrow/EscrowCancel.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/escrow/EscrowCreate.h b/include/xrpl/tx/transactors/escrow/EscrowCreate.h index 221ffee070..3cbeb47fa1 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowCreate.h +++ b/include/xrpl/tx/transactors/escrow/EscrowCreate.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/escrow/EscrowFinish.h b/include/xrpl/tx/transactors/escrow/EscrowFinish.h index 0917c35d93..6279b3a9af 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowFinish.h +++ b/include/xrpl/tx/transactors/escrow/EscrowFinish.h @@ -30,6 +30,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h index b1e539392f..9a028b6448 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h index 8dda417443..9b0cd9b176 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h index 52b14bfb67..74c35d5667 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h b/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h index b9c9851c41..3de0f6fec2 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerSet.h b/include/xrpl/tx/transactors/lending/LoanBrokerSet.h index ce1e069791..519ccd6ce9 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerSet.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerSet.h @@ -27,6 +27,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanDelete.h b/include/xrpl/tx/transactors/lending/LoanDelete.h index ff78d7db60..5c6ec46d33 100644 --- a/include/xrpl/tx/transactors/lending/LoanDelete.h +++ b/include/xrpl/tx/transactors/lending/LoanDelete.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanManage.h b/include/xrpl/tx/transactors/lending/LoanManage.h index 810e9bbf65..98b7e38ba6 100644 --- a/include/xrpl/tx/transactors/lending/LoanManage.h +++ b/include/xrpl/tx/transactors/lending/LoanManage.h @@ -58,6 +58,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanPay.h b/include/xrpl/tx/transactors/lending/LoanPay.h index 2e3cce75ed..83271cf4e7 100644 --- a/include/xrpl/tx/transactors/lending/LoanPay.h +++ b/include/xrpl/tx/transactors/lending/LoanPay.h @@ -30,6 +30,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; //------------------------------------------------------------------------------ diff --git a/include/xrpl/tx/transactors/lending/LoanSet.h b/include/xrpl/tx/transactors/lending/LoanSet.h index 86101d0735..c778582ab0 100644 --- a/include/xrpl/tx/transactors/lending/LoanSet.h +++ b/include/xrpl/tx/transactors/lending/LoanSet.h @@ -38,6 +38,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + public: static std::uint32_t constexpr minPaymentTotal = 1; static std::uint32_t constexpr defaultPaymentTotal = 1; diff --git a/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h b/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h index 60962fc9ca..7291db9a2e 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h @@ -34,6 +34,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/nft/NFTokenBurn.h b/include/xrpl/tx/transactors/nft/NFTokenBurn.h index 8737997f03..2830b7c22a 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenBurn.h +++ b/include/xrpl/tx/transactors/nft/NFTokenBurn.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h b/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h index 6d60a0bebd..540258b8d6 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h b/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h index a48e53589d..532aa5c120 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/nft/NFTokenMint.h b/include/xrpl/tx/transactors/nft/NFTokenMint.h index d04f88ed3b..6dcf8eaf12 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenMint.h +++ b/include/xrpl/tx/transactors/nft/NFTokenMint.h @@ -30,6 +30,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + // Public to support unit tests. static uint256 createNFTokenID( diff --git a/include/xrpl/tx/transactors/nft/NFTokenModify.h b/include/xrpl/tx/transactors/nft/NFTokenModify.h index a64df65783..a1076a96a9 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenModify.h +++ b/include/xrpl/tx/transactors/nft/NFTokenModify.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/oracle/OracleDelete.h b/include/xrpl/tx/transactors/oracle/OracleDelete.h index 9d1e6d3a44..5de69e980f 100644 --- a/include/xrpl/tx/transactors/oracle/OracleDelete.h +++ b/include/xrpl/tx/transactors/oracle/OracleDelete.h @@ -31,6 +31,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + static TER deleteOracle( ApplyView& view, diff --git a/include/xrpl/tx/transactors/oracle/OracleSet.h b/include/xrpl/tx/transactors/oracle/OracleSet.h index d879d14a84..426f46c2b4 100644 --- a/include/xrpl/tx/transactors/oracle/OracleSet.h +++ b/include/xrpl/tx/transactors/oracle/OracleSet.h @@ -30,6 +30,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/payment/DepositPreauth.h b/include/xrpl/tx/transactors/payment/DepositPreauth.h index b397a81748..f74be24c56 100644 --- a/include/xrpl/tx/transactors/payment/DepositPreauth.h +++ b/include/xrpl/tx/transactors/payment/DepositPreauth.h @@ -25,6 +25,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + // Interface used by AccountDelete static TER removeFromLedger(ApplyView& view, uint256 const& delIndex, beast::Journal j); diff --git a/include/xrpl/tx/transactors/payment/Payment.h b/include/xrpl/tx/transactors/payment/Payment.h index bc5bc4fee3..3baf1fa55f 100644 --- a/include/xrpl/tx/transactors/payment/Payment.h +++ b/include/xrpl/tx/transactors/payment/Payment.h @@ -39,6 +39,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h index 449e503bc4..6e9a269b8d 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h @@ -27,6 +27,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h index 7fdacf9b3a..cd0250713a 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h index 69f74a4c53..befe9ac951 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h index b5c72413a2..93879c55b2 100644 --- a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h +++ b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h @@ -22,6 +22,20 @@ public: /** Attempt to delete the Permissioned Domain. */ TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h index acf9194ee2..3187be08e1 100644 --- a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h +++ b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h @@ -25,6 +25,20 @@ public: /** Attempt to create the Permissioned Domain. */ TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/system/Batch.h b/include/xrpl/tx/transactors/system/Batch.h index 0861deb094..1d9a66ec9a 100644 --- a/include/xrpl/tx/transactors/system/Batch.h +++ b/include/xrpl/tx/transactors/system/Batch.h @@ -33,6 +33,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + static constexpr auto disabledTxTypes = std::to_array({ ttVAULT_CREATE, ttVAULT_SET, diff --git a/include/xrpl/tx/transactors/system/Change.h b/include/xrpl/tx/transactors/system/Change.h index 1bf63ff0db..b966ef73ec 100644 --- a/include/xrpl/tx/transactors/system/Change.h +++ b/include/xrpl/tx/transactors/system/Change.h @@ -18,6 +18,20 @@ public: void preCompute() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + static XRPAmount calculateBaseFee(ReadView const& view, STTx const& tx) { diff --git a/include/xrpl/tx/transactors/system/LedgerStateFix.h b/include/xrpl/tx/transactors/system/LedgerStateFix.h index 728f8c651d..a236a52c74 100644 --- a/include/xrpl/tx/transactors/system/LedgerStateFix.h +++ b/include/xrpl/tx/transactors/system/LedgerStateFix.h @@ -28,6 +28,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/system/TicketCreate.h b/include/xrpl/tx/transactors/system/TicketCreate.h index 88d83c37a7..13b6e7eca5 100644 --- a/include/xrpl/tx/transactors/system/TicketCreate.h +++ b/include/xrpl/tx/transactors/system/TicketCreate.h @@ -59,6 +59,20 @@ public: /** Precondition: fee collection is likely. Attempt to create ticket(s). */ TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/token/Clawback.h b/include/xrpl/tx/transactors/token/Clawback.h index a795115f7a..f7b77b872c 100644 --- a/include/xrpl/tx/transactors/token/Clawback.h +++ b/include/xrpl/tx/transactors/token/Clawback.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/token/MPTokenAuthorize.h b/include/xrpl/tx/transactors/token/MPTokenAuthorize.h index 67ea9d3023..0cbc683e91 100644 --- a/include/xrpl/tx/transactors/token/MPTokenAuthorize.h +++ b/include/xrpl/tx/transactors/token/MPTokenAuthorize.h @@ -33,6 +33,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h index 8518ba2f64..6718d28e4d 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h @@ -45,6 +45,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + static Expected create(ApplyView& view, beast::Journal journal, MPTCreateArgs const& args); }; diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h index 416708565a..aaac508cf5 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h index dccd4e4cee..8dc423376a 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h @@ -30,6 +30,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/token/TrustSet.h b/include/xrpl/tx/transactors/token/TrustSet.h index 2e67aaeded..cf4f042515 100644 --- a/include/xrpl/tx/transactors/token/TrustSet.h +++ b/include/xrpl/tx/transactors/token/TrustSet.h @@ -28,6 +28,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/vault/VaultClawback.h b/include/xrpl/tx/transactors/vault/VaultClawback.h index 131a1d87e7..9c69c88f75 100644 --- a/include/xrpl/tx/transactors/vault/VaultClawback.h +++ b/include/xrpl/tx/transactors/vault/VaultClawback.h @@ -22,6 +22,20 @@ public: TER doApply() override; + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; + private: Expected, TER> assetsToClawback( diff --git a/include/xrpl/tx/transactors/vault/VaultCreate.h b/include/xrpl/tx/transactors/vault/VaultCreate.h index cc35cd765b..6861c9d164 100644 --- a/include/xrpl/tx/transactors/vault/VaultCreate.h +++ b/include/xrpl/tx/transactors/vault/VaultCreate.h @@ -27,6 +27,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/vault/VaultDelete.h b/include/xrpl/tx/transactors/vault/VaultDelete.h index f881a692fd..33a86dd050 100644 --- a/include/xrpl/tx/transactors/vault/VaultDelete.h +++ b/include/xrpl/tx/transactors/vault/VaultDelete.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/vault/VaultDeposit.h b/include/xrpl/tx/transactors/vault/VaultDeposit.h index 0943596f20..5a0c63a3b1 100644 --- a/include/xrpl/tx/transactors/vault/VaultDeposit.h +++ b/include/xrpl/tx/transactors/vault/VaultDeposit.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/vault/VaultSet.h b/include/xrpl/tx/transactors/vault/VaultSet.h index fb69f132b1..6abbe80fec 100644 --- a/include/xrpl/tx/transactors/vault/VaultSet.h +++ b/include/xrpl/tx/transactors/vault/VaultSet.h @@ -24,6 +24,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/vault/VaultWithdraw.h b/include/xrpl/tx/transactors/vault/VaultWithdraw.h index ffe14a7141..b8604d039e 100644 --- a/include/xrpl/tx/transactors/vault/VaultWithdraw.h +++ b/include/xrpl/tx/transactors/vault/VaultWithdraw.h @@ -21,6 +21,20 @@ public: TER doApply() override; + + void + visitInvariantEntry( + bool isDelete, + std::shared_ptr const& before, + std::shared_ptr const& after) override; + + [[nodiscard]] bool + finalizeInvariants( + STTx const& tx, + TER result, + XRPAmount fee, + ReadView const& view, + beast::Journal const& j) override; }; } // namespace xrpl diff --git a/src/libxrpl/tx/ApplyContext.cpp b/src/libxrpl/tx/ApplyContext.cpp index 81fa517252..fa17574616 100644 --- a/src/libxrpl/tx/ApplyContext.cpp +++ b/src/libxrpl/tx/ApplyContext.cpp @@ -122,7 +122,7 @@ ApplyContext::checkInvariantsHelper( // call each check's finalizer to see that it passes if (!std::all_of(finalizers.cbegin(), finalizers.cend(), [](auto const& b) { return b; })) { - JLOG(journal.fatal()) << "Transaction has failed one or more invariants: " + JLOG(journal.fatal()) << "Transaction has failed one or more global invariants: " << to_string(tx.getJson(JsonOptions::none)); return failInvariantCheck(result); @@ -130,7 +130,7 @@ ApplyContext::checkInvariantsHelper( } catch (std::exception const& ex) { - JLOG(journal.fatal()) << "Transaction caused an exception in an invariant" + JLOG(journal.fatal()) << "Transaction caused an exception in a global invariant" << ", ex: " << ex.what() << ", tx: " << to_string(tx.getJson(JsonOptions::none)); diff --git a/src/libxrpl/tx/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp index eda1f858a1..9791ee4c9b 100644 --- a/src/libxrpl/tx/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -29,6 +29,7 @@ #include #include #include +#include // IWYU pragma: keep #include #include #include @@ -42,6 +43,7 @@ #include #include +#include #include #include #include @@ -1117,6 +1119,59 @@ Transactor::trapTransaction(uint256 txHash) const JLOG(j_.debug()) << "Transaction trapped: " << txHash; } +[[nodiscard]] TER +Transactor::checkTransactionInvariants(TER result, XRPAmount fee) +{ + try + { + // Phase 1: visit modified entries + ctx_.visit( + [this](uint256 const&, bool isDelete, SLE::const_ref before, SLE::const_ref after) { + this->visitInvariantEntry(isDelete, before, after); + }); + + // Phase 2: finalize + if (!this->finalizeInvariants(ctx_.tx, result, fee, ctx_.view(), ctx_.journal)) + { + JLOG(ctx_.journal.fatal()) << // + "Transaction has failed one or more transaction invariants, tx: " << // + to_string(ctx_.tx.getJson(JsonOptions::none)); + return tecINVARIANT_FAILED; + } + } + catch (std::exception const& ex) + { + JLOG(ctx_.journal.fatal()) << // + "Exception while checking transaction invariants: " << // + ex.what() << // + ", tx: " << // + to_string(ctx_.tx.getJson(JsonOptions::none)); + + return tecINVARIANT_FAILED; + } + + return result; +} + +[[nodiscard]] TER +Transactor::checkInvariants(TER result, XRPAmount fee) +{ + // Transaction invariants first (more specific). These check post-conditions of the specific + // transaction. If these fail, the transaction's core logic is wrong. + auto const txResult = checkTransactionInvariants(result, fee); + + // Protocol invariants second (broader). These check properties that must hold regardless of + // transaction type. + auto const protoResult = ctx_.checkInvariants(result, fee); + + // Fail if either check failed. tef (fatal) takes priority over tec. + if (protoResult == tefINVARIANT_FAILED) + return tefINVARIANT_FAILED; + if (txResult == tecINVARIANT_FAILED || protoResult == tecINVARIANT_FAILED) + return tecINVARIANT_FAILED; + + return result; +} //------------------------------------------------------------------------------ ApplyResult Transactor::operator()() @@ -1293,20 +1348,20 @@ Transactor::operator()() { // Check invariants: if `tecINVARIANT_FAILED` is not returned, we can // proceed to apply the tx - result = ctx_.checkInvariants(result, fee); - + result = checkInvariants(result, fee); if (result == tecINVARIANT_FAILED) { - // if invariants checking failed again, reset the context and - // attempt to only claim a fee. + // Reset to fee-claim only auto const resetResult = reset(fee); if (!isTesSuccess(resetResult.first)) result = resetResult.first; fee = resetResult.second; - // Check invariants again to ensure the fee claiming doesn't - // violate invariants. + // Check invariants again to ensure the fee claiming doesn't violate + // invariants. After reset, only protocol invariants are re-checked. + // Transaction invariants are not meaningful here — the transaction's + // effects have been rolled back. if (isTesSuccess(result) || isTecClaim(result)) result = ctx_.checkInvariants(result, fee); } diff --git a/src/libxrpl/tx/applySteps.cpp b/src/libxrpl/tx/applySteps.cpp index 5c184e7c2b..eb058e5ca6 100644 --- a/src/libxrpl/tx/applySteps.cpp +++ b/src/libxrpl/tx/applySteps.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #pragma push_macro("TRANSACTION") @@ -312,6 +313,18 @@ invoke_apply(ApplyContext& ctx) } } +// Test-only factory — not part of the public API. +// The returned Transactor holds a raw reference to ctx; the caller must ensure +// the ApplyContext outlives the Transactor. +std::unique_ptr +makeTransactor(ApplyContext& ctx) +{ + return with_txn_type( + ctx.view().rules(), ctx.tx.getTxnType(), [&]() -> std::unique_ptr { + return std::make_unique(ctx); + }); +} + PreflightResult preflight( ServiceRegistry& registry, diff --git a/src/libxrpl/tx/transactors/account/AccountDelete.cpp b/src/libxrpl/tx/transactors/account/AccountDelete.cpp index deac9512f5..596a8a1560 100644 --- a/src/libxrpl/tx/transactors/account/AccountDelete.cpp +++ b/src/libxrpl/tx/transactors/account/AccountDelete.cpp @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -414,4 +416,23 @@ AccountDelete::doApply() return tesSUCCESS; } +void +AccountDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AccountDelete::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/account/AccountSet.cpp b/src/libxrpl/tx/transactors/account/AccountSet.cpp index 3395740ac7..a892bd045c 100644 --- a/src/libxrpl/tx/transactors/account/AccountSet.cpp +++ b/src/libxrpl/tx/transactors/account/AccountSet.cpp @@ -16,14 +16,17 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include +#include #include namespace xrpl { @@ -654,4 +657,18 @@ AccountSet::doApply() return tesSUCCESS; } +void +AccountSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AccountSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/account/SetRegularKey.cpp b/src/libxrpl/tx/transactors/account/SetRegularKey.cpp index 0bfecfec97..bc59ed4fc1 100644 --- a/src/libxrpl/tx/transactors/account/SetRegularKey.cpp +++ b/src/libxrpl/tx/transactors/account/SetRegularKey.cpp @@ -1,16 +1,20 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include #include +#include + namespace xrpl { XRPAmount @@ -76,4 +80,23 @@ SetRegularKey::doApply() return tesSUCCESS; } +void +SetRegularKey::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +SetRegularKey::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/account/SignerListSet.cpp b/src/libxrpl/tx/transactors/account/SignerListSet.cpp index ceedf88e7f..7e236af21b 100644 --- a/src/libxrpl/tx/transactors/account/SignerListSet.cpp +++ b/src/libxrpl/tx/transactors/account/SignerListSet.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -255,6 +257,9 @@ SignerListSet::validateQuorumAndSignerEntries( } // Make sure there are no duplicate signers. + // SignerEntry only defines operator< and operator==, not the full + // std::totally_ordered set required by std::ranges::less, so the + // ranges version does not compile. NOLINTNEXTLINE(modernize-use-ranges) XRPL_ASSERT( std::is_sorted(signers.begin(), signers.end()), "xrpl::SignerListSet::validateQuorumAndSignerEntries : sorted " @@ -403,4 +408,23 @@ SignerListSet::writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t ledgerEntry->setFieldArray(sfSignerEntries, toLedger); } +void +SignerListSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +SignerListSet::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp b/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp index 4709932f9f..166e42560f 100644 --- a/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp +++ b/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -2221,4 +2222,151 @@ XChainCreateAccountCommit::doApply() return tesSUCCESS; } +void +XChainCreateBridge::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainCreateBridge::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +BridgeModify::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +BridgeModify::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +XChainClaim::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainClaim::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + +void +XChainCommit::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainCommit::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +XChainCreateClaimID::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainCreateClaimID::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +XChainAddClaimAttestation::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainAddClaimAttestation::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +XChainAddAccountCreateAttestation::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainAddAccountCreateAttestation::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + +void +XChainCreateAccountCommit::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +XChainCreateAccountCommit::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/check/CheckCancel.cpp b/src/libxrpl/tx/transactors/check/CheckCancel.cpp index 30675bfe08..c30c116e58 100644 --- a/src/libxrpl/tx/transactors/check/CheckCancel.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCancel.cpp @@ -7,10 +7,14 @@ #include #include #include +#include +#include #include +#include #include #include +#include namespace xrpl { @@ -97,4 +101,18 @@ CheckCancel::doApply() return tesSUCCESS; } +void +CheckCancel::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CheckCancel::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/check/CheckCash.cpp b/src/libxrpl/tx/transactors/check/CheckCash.cpp index 14199cdb8c..4498a3cd8e 100644 --- a/src/libxrpl/tx/transactors/check/CheckCash.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCash.cpp @@ -20,9 +20,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -584,4 +586,18 @@ CheckCash::doApply() return tesSUCCESS; } +void +CheckCash::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CheckCash::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/check/CheckCreate.cpp b/src/libxrpl/tx/transactors/check/CheckCreate.cpp index 2bb28217b3..6a13819615 100644 --- a/src/libxrpl/tx/transactors/check/CheckCreate.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCreate.cpp @@ -18,7 +18,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -244,4 +247,18 @@ CheckCreate::doApply() return tesSUCCESS; } +void +CheckCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CheckCreate::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp b/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp index c2fdc3aada..4f1bd80f26 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp @@ -12,11 +12,15 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include namespace xrpl { @@ -119,4 +123,22 @@ CredentialAccept::doApply() return tesSUCCESS; } +void +CredentialAccept::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CredentialAccept::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp b/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp index ba1668c294..402bddcfdd 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp @@ -14,8 +14,11 @@ #include #include #include +#include +#include #include #include +#include #include #include @@ -175,4 +178,22 @@ CredentialCreate::doApply() return tesSUCCESS; } +void +CredentialCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CredentialCreate::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp b/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp index 3e5d7552d9..acff3c6aa0 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp @@ -8,11 +8,15 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include namespace xrpl { @@ -92,4 +96,22 @@ CredentialDelete::doApply() return deleteSLE(view(), sleCred, j_); } +void +CredentialDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +CredentialDelete::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp b/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp index b0bace5d2c..5a73bb3561 100644 --- a/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp +++ b/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp @@ -9,7 +9,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -144,4 +147,18 @@ DelegateSet::deleteDelegate( return tesSUCCESS; } +void +DelegateSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +DelegateSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMBid.cpp b/src/libxrpl/tx/transactors/dex/AMMBid.cpp index fe71785af2..e878585d4c 100644 --- a/src/libxrpl/tx/transactors/dex/AMMBid.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMBid.cpp @@ -17,13 +17,17 @@ #include #include #include +#include +#include #include +#include #include #include #include #include #include +#include #include #include #include @@ -376,4 +380,18 @@ AMMBid::doApply() return result.first; } +void +AMMBid::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMBid::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMClawback.cpp b/src/libxrpl/tx/transactors/dex/AMMClawback.cpp index 7fd1bb96bd..20ec184670 100644 --- a/src/libxrpl/tx/transactors/dex/AMMClawback.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMClawback.cpp @@ -18,12 +18,16 @@ #include #include #include +#include +#include #include #include +#include #include #include #include +#include #include #include @@ -383,4 +387,18 @@ AMMClawback::equalWithdrawMatchingOneAmount( ctx_.journal); } +void +AMMClawback::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMClawback::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp index 7393d38394..47363531d4 100644 --- a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -391,4 +392,18 @@ AMMCreate::doApply() return result.first; } +void +AMMCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMCreate::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMDelete.cpp b/src/libxrpl/tx/transactors/dex/AMMDelete.cpp index 219a34b9ad..6d2c7b07c3 100644 --- a/src/libxrpl/tx/transactors/dex/AMMDelete.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMDelete.cpp @@ -9,9 +9,14 @@ #include #include #include +#include +#include #include +#include #include +#include + namespace xrpl { bool @@ -61,4 +66,18 @@ AMMDelete::doApply() return ter; } +void +AMMDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMDelete::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp index 6e750a3732..344e3535da 100644 --- a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp @@ -17,14 +17,18 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include #include +#include #include #include @@ -1003,4 +1007,18 @@ AMMDeposit::equalDepositInEmptyState( tfee); } +void +AMMDeposit::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMDeposit::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMVote.cpp b/src/libxrpl/tx/transactors/dex/AMMVote.cpp index 94a183a6d4..1287c8c428 100644 --- a/src/libxrpl/tx/transactors/dex/AMMVote.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMVote.cpp @@ -13,12 +13,16 @@ #include #include #include +#include +#include #include +#include #include #include #include #include +#include #include #include @@ -241,4 +245,18 @@ AMMVote::doApply() return result.first; } +void +AMMVote::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMVote::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp index f647b57412..6ab78f9cb9 100644 --- a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -1143,4 +1145,18 @@ AMMWithdraw::isWithdrawAll(STTx const& tx) return WithdrawAll::Yes; return WithdrawAll::No; } +void +AMMWithdraw::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +AMMWithdraw::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/OfferCancel.cpp b/src/libxrpl/tx/transactors/dex/OfferCancel.cpp index abb402694d..72682149a3 100644 --- a/src/libxrpl/tx/transactors/dex/OfferCancel.cpp +++ b/src/libxrpl/tx/transactors/dex/OfferCancel.cpp @@ -4,9 +4,14 @@ #include #include #include +#include +#include #include +#include #include +#include + namespace xrpl { NotTEC @@ -64,4 +69,18 @@ OfferCancel::doApply() return tesSUCCESS; } +void +OfferCancel::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +OfferCancel::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp index 5679d4f866..2d21cebbe3 100644 --- a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp @@ -956,4 +956,18 @@ OfferCreate::doApply() return result.first; } +void +OfferCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +OfferCreate::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/did/DIDDelete.cpp b/src/libxrpl/tx/transactors/did/DIDDelete.cpp index 08527317b2..a323822b9c 100644 --- a/src/libxrpl/tx/transactors/did/DIDDelete.cpp +++ b/src/libxrpl/tx/transactors/did/DIDDelete.cpp @@ -3,12 +3,16 @@ #include #include #include +#include #include #include #include #include #include +#include +#include #include +#include #include #include @@ -66,4 +70,17 @@ DIDDelete::doApply() return deleteSLE(ctx_, keylet::did(account_), account_); } +void +DIDDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +DIDDelete::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/did/DIDSet.cpp b/src/libxrpl/tx/transactors/did/DIDSet.cpp index a38d3aa3d8..3aa9966570 100644 --- a/src/libxrpl/tx/transactors/did/DIDSet.cpp +++ b/src/libxrpl/tx/transactors/did/DIDSet.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -10,7 +11,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -145,4 +149,18 @@ DIDSet::doApply() return addSLE(ctx_, sleDID, account_); } +void +DIDSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +DIDSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp b/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp index ea9960ce69..edc07fa0f7 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp @@ -17,9 +17,13 @@ #include #include #include +#include +#include #include +#include #include +#include #include namespace xrpl { @@ -215,4 +219,22 @@ EscrowCancel::doApply() return tesSUCCESS; } +void +EscrowCancel::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +EscrowCancel::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp index 9ff4d61b3e..9d16d41914 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -523,4 +525,22 @@ EscrowCreate::doApply() return tesSUCCESS; } +void +EscrowCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +EscrowCreate::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp index 9d0f037adf..c8697fbaa8 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp @@ -24,10 +24,13 @@ #include #include #include +#include +#include #include #include #include +#include #include #include @@ -396,4 +399,22 @@ EscrowFinish::doApply() return tesSUCCESS; } +void +EscrowFinish::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +EscrowFinish::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp index ae28164de1..16f95dd357 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp @@ -18,13 +18,16 @@ #include #include #include +#include #include #include #include #include +#include #include #include +#include #include #include @@ -352,6 +355,25 @@ LoanBrokerCoverClawback::doApply() return accountSend(view(), brokerPseudoID, account, clawAmount, j_, WaiveTransferFee::Yes); } +void +LoanBrokerCoverClawback::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanBrokerCoverClawback::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp index 2c80f934f6..36b5cab618 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp @@ -6,11 +6,16 @@ #include #include #include +#include #include +#include #include +#include #include #include +#include + namespace xrpl { bool @@ -128,6 +133,25 @@ LoanBrokerCoverDeposit::doApply() return tesSUCCESS; } +void +LoanBrokerCoverDeposit::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanBrokerCoverDeposit::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp index bc857cd340..c8479e941d 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp @@ -10,12 +10,17 @@ #include #include #include +#include #include +#include #include #include +#include #include #include +#include + namespace xrpl { bool @@ -181,6 +186,25 @@ LoanBrokerCoverWithdraw::doApply() return doWithdraw(view(), tx, account_, dstAcct, brokerPseudoID, preFeeBalance_, amount, j_); } +void +LoanBrokerCoverWithdraw::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanBrokerCoverWithdraw::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp index 2ab991046f..6f774eaeae 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp @@ -9,11 +9,16 @@ #include #include #include +#include #include +#include #include +#include #include #include +#include + namespace xrpl { bool @@ -185,6 +190,25 @@ LoanBrokerDelete::doApply() return tesSUCCESS; } +void +LoanBrokerDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanBrokerDelete::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp index 379fe9dfb7..3322df9fe3 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp @@ -11,9 +11,12 @@ #include #include #include +#include #include #include +#include #include +#include #include #include @@ -275,6 +278,25 @@ LoanBrokerSet::doApply() return tesSUCCESS; } +void +LoanBrokerSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanBrokerSet::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanDelete.cpp b/src/libxrpl/tx/transactors/lending/LoanDelete.cpp index 30c4e696fb..28948a4139 100644 --- a/src/libxrpl/tx/transactors/lending/LoanDelete.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanDelete.cpp @@ -1,16 +1,23 @@ #include #include +#include // IWYU pragma: keep #include #include #include #include #include +#include // IWYU pragma: keep +#include #include +#include #include +#include #include #include +#include + namespace xrpl { bool @@ -134,6 +141,20 @@ LoanDelete::doApply() return tesSUCCESS; } +void +LoanDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanDelete::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanManage.cpp b/src/libxrpl/tx/transactors/lending/LoanManage.cpp index 62dbf2a830..1b87421e71 100644 --- a/src/libxrpl/tx/transactors/lending/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanManage.cpp @@ -14,15 +14,19 @@ #include #include #include +#include #include +#include #include #include #include +#include #include #include #include #include +#include namespace xrpl { @@ -430,6 +434,20 @@ LoanManage::doApply() return result; } +void +LoanManage::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanManage::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanPay.cpp b/src/libxrpl/tx/transactors/lending/LoanPay.cpp index d81d9ebda2..8360303fd8 100644 --- a/src/libxrpl/tx/transactors/lending/LoanPay.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanPay.cpp @@ -15,7 +15,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include namespace xrpl { @@ -642,6 +645,20 @@ LoanPay::doApply() return tesSUCCESS; } +void +LoanPay::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanPay::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/lending/LoanSet.cpp b/src/libxrpl/tx/transactors/lending/LoanSet.cpp index b8b5854eaf..1027fdea9f 100644 --- a/src/libxrpl/tx/transactors/lending/LoanSet.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanSet.cpp @@ -15,9 +15,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -644,6 +646,20 @@ LoanSet::doApply() return tesSUCCESS; } +void +LoanSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LoanSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + //------------------------------------------------------------------------------ } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp index 07e03b053e..296020ff95 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp @@ -13,7 +13,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -566,4 +569,23 @@ NFTokenAcceptOffer::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } +void +NFTokenAcceptOffer::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenAcceptOffer::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp index 763cce895f..a0d10ca07d 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp @@ -1,14 +1,19 @@ #include +#include #include #include #include #include +#include +#include #include +#include #include #include #include +#include namespace xrpl { @@ -89,4 +94,18 @@ NFTokenBurn::doApply() return tesSUCCESS; } +void +NFTokenBurn::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenBurn::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp index 1e85fa7ee7..9d25a7335f 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp @@ -8,11 +8,15 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include namespace xrpl { @@ -93,4 +97,23 @@ NFTokenCancelOffer::doApply() return tesSUCCESS; } +void +NFTokenCancelOffer::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenCancelOffer::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp index 717ab4c37e..9ca5220a8c 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp @@ -1,15 +1,20 @@ #include #include +#include #include #include #include +#include +#include #include #include +#include #include #include #include +#include namespace xrpl { @@ -86,4 +91,23 @@ NFTokenCreateOffer::doApply() ctx_.tx.getFlags()); } +void +NFTokenCreateOffer::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenCreateOffer::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp b/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp index b506a199a9..b8150c3261 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp @@ -12,8 +12,11 @@ #include #include #include +#include +#include #include #include +#include #include #include @@ -22,6 +25,8 @@ #include #include #include +#include // IWYU pragma: keep +#include #include namespace xrpl { @@ -337,4 +342,18 @@ NFTokenMint::doApply() return tesSUCCESS; } +void +NFTokenMint::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenMint::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp b/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp index ddf6b218a3..392d928f02 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp @@ -1,15 +1,21 @@ #include #include +#include #include #include #include #include #include +#include +#include #include +#include #include #include +#include + namespace xrpl { NotTEC @@ -62,4 +68,23 @@ NFTokenModify::doApply() return nft::changeTokenURI(view(), owner, nftokenID, ctx_.tx[~sfURI]); } +void +NFTokenModify::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +NFTokenModify::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp b/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp index d09dc5939f..c6896b78d4 100644 --- a/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp +++ b/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp @@ -7,7 +7,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -85,4 +88,23 @@ OracleDelete::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } +void +OracleDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +OracleDelete::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/oracle/OracleSet.cpp b/src/libxrpl/tx/transactors/oracle/OracleSet.cpp index cbdba64374..4304427646 100644 --- a/src/libxrpl/tx/transactors/oracle/OracleSet.cpp +++ b/src/libxrpl/tx/transactors/oracle/OracleSet.cpp @@ -10,9 +10,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include @@ -324,4 +327,18 @@ OracleSet::doApply() return tesSUCCESS; } +void +OracleSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +OracleSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp b/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp index e85ba17387..f8dca6bb58 100644 --- a/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp +++ b/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp @@ -15,7 +15,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -293,4 +296,23 @@ DepositPreauth::removeFromLedger(ApplyView& view, uint256 const& preauthIndex, b return tesSUCCESS; } +void +DepositPreauth::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +DepositPreauth::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/payment/Payment.cpp b/src/libxrpl/tx/transactors/payment/Payment.cpp index e3a1334f2d..644d5210c0 100644 --- a/src/libxrpl/tx/transactors/payment/Payment.cpp +++ b/src/libxrpl/tx/transactors/payment/Payment.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -676,4 +677,18 @@ Payment::doApply() return tesSUCCESS; } +void +Payment::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +Payment::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp index fc3350f531..256d1e87ca 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp @@ -14,12 +14,16 @@ #include #include #include +#include +#include #include #include #include +#include #include #include +#include #include namespace xrpl { @@ -197,4 +201,22 @@ PaymentChannelClaim::doApply() return tesSUCCESS; } +void +PaymentChannelClaim::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +PaymentChannelClaim::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp index 2d852a393a..4ced2d10bc 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp @@ -14,7 +14,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -183,4 +186,22 @@ PaymentChannelCreate::doApply() return tesSUCCESS; } +void +PaymentChannelCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +PaymentChannelCreate::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp index ff368835f5..4e588eda1e 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp @@ -1,7 +1,9 @@ #include +#include #include #include +#include #include #include #include @@ -9,10 +11,15 @@ #include #include #include +#include +#include #include +#include #include #include +#include + namespace xrpl { TxConsequences @@ -99,4 +106,22 @@ PaymentChannelFund::doApply() return tesSUCCESS; } +void +PaymentChannelFund::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +PaymentChannelFund::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp index 587724743c..87794b8dc2 100644 --- a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp +++ b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp @@ -6,9 +6,14 @@ #include #include #include +#include +#include #include +#include #include +#include + namespace xrpl { NotTEC @@ -68,4 +73,23 @@ PermissionedDomainDelete::doApply() return tesSUCCESS; } +void +PermissionedDomainDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +PermissionedDomainDelete::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp index 731f50d4cb..e7853b529b 100644 --- a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp +++ b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp @@ -10,8 +10,11 @@ #include #include #include +#include #include +#include #include +#include #include #include @@ -128,4 +131,23 @@ PermissionedDomainSet::doApply() return tesSUCCESS; } +void +PermissionedDomainSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +PermissionedDomainSet::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/system/Batch.cpp b/src/libxrpl/tx/transactors/system/Batch.cpp index d89238efd0..1218f0d59f 100644 --- a/src/libxrpl/tx/transactors/system/Batch.cpp +++ b/src/libxrpl/tx/transactors/system/Batch.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -515,4 +517,18 @@ Batch::doApply() return tesSUCCESS; } +void +Batch::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +Batch::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/system/Change.cpp b/src/libxrpl/tx/transactors/system/Change.cpp index 176f08f9e5..60dbb06a17 100644 --- a/src/libxrpl/tx/transactors/system/Change.cpp +++ b/src/libxrpl/tx/transactors/system/Change.cpp @@ -14,10 +14,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -407,4 +410,18 @@ Change::applyUNLModify() return tesSUCCESS; } +void +Change::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +Change::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp b/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp index 44b014294d..27cbad2e88 100644 --- a/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp +++ b/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp @@ -1,14 +1,19 @@ #include +#include #include #include #include #include #include +#include +#include #include #include #include +#include + namespace xrpl { NotTEC @@ -67,4 +72,23 @@ LedgerStateFix::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } +void +LedgerStateFix::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +LedgerStateFix::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/system/TicketCreate.cpp b/src/libxrpl/tx/transactors/system/TicketCreate.cpp index ac5aa8d6d6..fd6b947c5e 100644 --- a/src/libxrpl/tx/transactors/system/TicketCreate.cpp +++ b/src/libxrpl/tx/transactors/system/TicketCreate.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -132,4 +134,23 @@ TicketCreate::doApply() return tesSUCCESS; } +void +TicketCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +TicketCreate::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/Clawback.cpp b/src/libxrpl/tx/transactors/token/Clawback.cpp index dce1a9633a..c9e6d32f6c 100644 --- a/src/libxrpl/tx/transactors/token/Clawback.cpp +++ b/src/libxrpl/tx/transactors/token/Clawback.cpp @@ -15,12 +15,16 @@ #include #include #include +#include +#include #include +#include #include #include #include #include +#include #include namespace xrpl { @@ -266,4 +270,18 @@ Clawback::doApply() ctx_.tx[sfAmount].asset().value()); } +void +Clawback::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +Clawback::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp index 62fd0256be..c0fbb7f10b 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp @@ -7,8 +7,11 @@ #include #include #include +#include +#include #include #include +#include #include #include @@ -153,4 +156,23 @@ MPTokenAuthorize::doApply() tx[~sfHolder]); } +void +MPTokenAuthorize::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +MPTokenAuthorize::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp index e8c79afa53..42fc037431 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp @@ -5,15 +5,19 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include #include #include #include +#include #include #include @@ -168,4 +172,23 @@ MPTokenIssuanceCreate::doApply() return result ? tesSUCCESS : result.error(); } +void +MPTokenIssuanceCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +MPTokenIssuanceCreate::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp index 674d28562b..80b185641a 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp @@ -3,9 +3,14 @@ #include #include #include +#include +#include #include +#include #include +#include + namespace xrpl { NotTEC @@ -53,4 +58,23 @@ MPTokenIssuanceDestroy::doApply() return tesSUCCESS; } +void +MPTokenIssuanceDestroy::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +MPTokenIssuanceDestroy::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp index 8234c84fd8..540dd6ef0c 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -11,9 +12,12 @@ #include #include #include +#include +#include #include #include #include +#include #include #include @@ -373,4 +377,23 @@ MPTokenIssuanceSet::doApply() return tesSUCCESS; } +void +MPTokenIssuanceSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +MPTokenIssuanceSet::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/token/TrustSet.cpp b/src/libxrpl/tx/transactors/token/TrustSet.cpp index 1bc1dfb368..1610b2e5b9 100644 --- a/src/libxrpl/tx/transactors/token/TrustSet.cpp +++ b/src/libxrpl/tx/transactors/token/TrustSet.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include @@ -25,6 +27,7 @@ #include #include +#include #include namespace { @@ -672,4 +675,18 @@ TrustSet::doApply() return terResult; } +void +TrustSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +TrustSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultClawback.cpp b/src/libxrpl/tx/transactors/vault/VaultClawback.cpp index 1e761fcf89..da22b82578 100644 --- a/src/libxrpl/tx/transactors/vault/VaultClawback.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultClawback.cpp @@ -18,9 +18,12 @@ #include #include #include +#include #include // IWYU pragma: keep #include +#include #include +#include #include #include @@ -467,4 +470,23 @@ VaultClawback::doApply() return tesSUCCESS; } +void +VaultClawback::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultClawback::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultCreate.cpp b/src/libxrpl/tx/transactors/vault/VaultCreate.cpp index dc8d98e729..cc28abfe65 100644 --- a/src/libxrpl/tx/transactors/vault/VaultCreate.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultCreate.cpp @@ -15,10 +15,13 @@ #include #include #include +#include #include // IWYU pragma: keep #include +#include #include #include +#include #include #include @@ -246,4 +249,18 @@ VaultCreate::doApply() return tesSUCCESS; } +void +VaultCreate::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultCreate::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultDelete.cpp b/src/libxrpl/tx/transactors/vault/VaultDelete.cpp index 5faa13baf9..e4542d524f 100644 --- a/src/libxrpl/tx/transactors/vault/VaultDelete.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultDelete.cpp @@ -10,10 +10,15 @@ #include #include #include +#include #include // IWYU pragma: keep +#include #include +#include #include +#include + namespace xrpl { NotTEC @@ -207,4 +212,18 @@ VaultDelete::doApply() return tesSUCCESS; } +void +VaultDelete::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultDelete::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp b/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp index 8088755ad4..fbb8908ddb 100644 --- a/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp @@ -12,11 +12,15 @@ #include #include #include +#include #include // IWYU pragma: keep #include +#include #include +#include #include +#include #include namespace xrpl { @@ -274,4 +278,23 @@ VaultDeposit::doApply() return tesSUCCESS; } +void +VaultDeposit::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultDeposit::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultSet.cpp b/src/libxrpl/tx/transactors/vault/VaultSet.cpp index 36785aea5e..a5b0b20699 100644 --- a/src/libxrpl/tx/transactors/vault/VaultSet.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultSet.cpp @@ -7,11 +7,16 @@ #include #include #include +#include #include // IWYU pragma: keep #include +#include #include +#include #include +#include + namespace xrpl { bool @@ -174,4 +179,18 @@ VaultSet::doApply() return tesSUCCESS; } +void +VaultSet::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultSet::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp b/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp index 4029076484..3e608733b6 100644 --- a/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp @@ -13,11 +13,15 @@ #include #include #include +#include #include // IWYU pragma: keep #include +#include #include +#include #include +#include #include namespace xrpl { @@ -291,4 +295,23 @@ VaultWithdraw::doApply() view(), ctx_.tx, account_, dstAcct, vaultAccount, preFeeBalance_, assetsWithdrawn, j_); } +void +VaultWithdraw::visitInvariantEntry( + bool, + std::shared_ptr const&, + std::shared_ptr const&) +{ +} + +bool +VaultWithdraw::finalizeInvariants( + STTx const&, + TER, + XRPAmount, + ReadView const&, + beast::Journal const&) +{ + return true; +} + } // namespace xrpl diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index aeb2b8c20c..5153e9d71e 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -47,6 +47,8 @@ #include #include #include +#include +#include #include #include @@ -61,6 +63,16 @@ #include #include +namespace xrpl { + +// Test-only factory — not part of the public API. +// The returned Transactor holds a raw reference to ctx; the caller must ensure +// the ApplyContext outlives the Transactor. Implemented in applySteps.cpp +std::unique_ptr +makeTransactor(ApplyContext& ctx); + +} // namespace xrpl + namespace xrpl::test { class Invariants_test : public beast::unit_test::suite @@ -170,6 +182,10 @@ class Invariants_test : public beast::unit_test::suite BEAST_EXPECT(precheck(A1, A2, ac)); + auto transactor = makeTransactor(ac); + if (!BEAST_EXPECT(transactor)) + return; + // invoke check twice to cover tec and tef cases if (!BEAST_EXPECT(ters.size() == 2)) return; @@ -177,8 +193,10 @@ class Invariants_test : public beast::unit_test::suite TER terActual = tesSUCCESS; for (TER const& terExpect : ters) { - terActual = ac.checkInvariants(terActual, fee); - BEAST_EXPECTS(terExpect == terActual, std::to_string(TERtoInt(terActual))); + terActual = transactor->checkInvariants(terActual, fee); + BEAST_EXPECTS( + terExpect == terActual, + "expected: " + transToken(terExpect) + " got: " + transToken(terActual)); auto const messages = sink.messages().str(); if (!isTesSuccess(terActual))