From 1bf045d2bdfb72198da88be240a36caa2ef17d1b Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:57:42 +0100 Subject: [PATCH 1/2] removes bad files --- compile_commands.json | 1 - 1 file changed, 1 deletion(-) delete mode 120000 compile_commands.json diff --git a/compile_commands.json b/compile_commands.json deleted file mode 120000 index 4503a4b5b7..0000000000 --- a/compile_commands.json +++ /dev/null @@ -1 +0,0 @@ -.build/compile_commands.json \ No newline at end of file From b5b97bc3e66de4b2f31c3b9337b8d31a1a8d1c1a Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:10:07 +0100 Subject: [PATCH 2/2] addresses review comments --- include/xrpl/tx/Transactor.h | 6 ++++-- include/xrpl/tx/applySteps.h | 11 ----------- src/libxrpl/tx/Transactor.cpp | 12 +++++------- src/test/app/Invariants_test.cpp | 7 +++++++ 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/xrpl/tx/Transactor.h b/include/xrpl/tx/Transactor.h index efb3fce02c..86ba6f4d1f 100644 --- a/include/xrpl/tx/Transactor.h +++ b/include/xrpl/tx/Transactor.h @@ -122,7 +122,9 @@ protected: public: virtual ~Transactor() = default; + enum ConsequencesFactoryType { Normal, Blocker, Custom }; + /** Process the transaction. */ ApplyResult operator()(); @@ -142,8 +144,8 @@ public: /** Check all invariants for the current transaction. * * Runs transaction-specific invariants first (visitInvariantEntry + - * finalizeInvariants), then protocol-level invariants. Protocol - * invariants are skipped if a transaction invariant already failed. + * 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. diff --git a/include/xrpl/tx/applySteps.h b/include/xrpl/tx/applySteps.h index 79c72ae9fc..0ff71f75bc 100644 --- a/include/xrpl/tx/applySteps.h +++ b/include/xrpl/tx/applySteps.h @@ -343,15 +343,4 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); ApplyResult doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view); -class ApplyContext; -class Transactor; - -/** Create a concrete Transactor subclass for the given ApplyContext. - * - * The transaction type is determined from the STTx held in the context. - * Returns nullptr if the transaction type is unknown. - */ -std::unique_ptr -makeTransactor(ApplyContext& ctx); - } // namespace xrpl diff --git a/src/libxrpl/tx/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp index 06d22b2a20..854025a20d 100644 --- a/src/libxrpl/tx/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -1066,13 +1066,11 @@ Transactor::checkTransactionInvariants(TER result, XRPAmount fee) try { // Phase 1: visit modified entries - ctx_.visit([this]( - uint256 const&, - bool isDelete, - std::shared_ptr const& before, - std::shared_ptr const& after) { - this->visitInvariantEntry(isDelete, before, after); - }); + 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)) { diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 607febe56b..008903f725 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -22,6 +22,13 @@ #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 test { class Invariants_test : public beast::unit_test::suite