From d596ceca4a9f6053f268ddb0f6dddd1ef6f4ee8a Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Wed, 24 Apr 2024 13:30:12 +0200 Subject: [PATCH] update flags --- src/ripple/app/tx/impl/Batch.cpp | 29 ++++++++++++++--------------- src/ripple/protocol/TxFlags.h | 9 +++++---- src/test/app/Batch_test.cpp | 8 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/ripple/app/tx/impl/Batch.cpp b/src/ripple/app/tx/impl/Batch.cpp index a59e75182..75bee0d49 100644 --- a/src/ripple/app/tx/impl/Batch.cpp +++ b/src/ripple/app/tx/impl/Batch.cpp @@ -217,23 +217,20 @@ invoke_preclaim(PreclaimContext const& ctx) if (id != beast::zero) { - // TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j); + TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j); - // if (result != tesSUCCESS) - // return result; - - // Ignore Sequence Validation on ttBATCH txns - TER result = tesSUCCESS; + if (result != tesSUCCESS) + return result; result = T::checkPriorTxAndLastLedger(ctx); if (result != tesSUCCESS) return result; - // result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx)); + result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx)); - // if (result != tesSUCCESS) - // return result; + if (result != tesSUCCESS) + return result; result = T::checkSign(ctx); @@ -297,7 +294,7 @@ Batch::preflight(PreflightContext const& ctx) return temMALFORMED; } - if (txns.size() > 12) + if (txns.size() > 8) { JLOG(ctx.j.error()) << "Batch: txns array exceeds 12 entries."; return temMALFORMED; @@ -485,26 +482,28 @@ Batch::doApply() avi.addBatchExecutionMetaData(std::move(meta)); - std::cout << "tfBatchFirst: " << (flags & tfBatchFirst) << "\n"; - std::cout << "tfBatchOne: " << (flags & tfBatchOne) << "\n"; + std::cout << "tfAllOrNothing: " << (flags & tfAllOrNothing) << "\n"; + std::cout << "tfOnlyOne: " << (flags & tfOnlyOne) << "\n"; + std::cout << "tfUntilFailure: " << (flags & tfUntilFailure) << "\n"; + std::cout << "tfIndependent: " << (flags & tfIndependent) << "\n"; std::cout << "tfBatchAtomic: " << _result.first << "\n"; if (_result.first != tesSUCCESS) { - if (flags & tfBatchFirst) + if (flags & tfUntilFailure) { actx.discard(); result = tecBATCH_FAILURE; break; } - if (flags & tfBatchOne) + if (flags & tfOnlyOne) { actx.discard(); continue; } } - if (_result.first == tesSUCCESS && flags & tfBatchOne) + if (_result.first == tesSUCCESS && flags & tfOnlyOne) { result = tecBATCH_FAILURE; break; diff --git a/src/ripple/protocol/TxFlags.h b/src/ripple/protocol/TxFlags.h index ea9437623..150b54c2e 100644 --- a/src/ripple/protocol/TxFlags.h +++ b/src/ripple/protocol/TxFlags.h @@ -169,13 +169,14 @@ constexpr std::uint32_t const tfURITokenNonMintMask = ~tfUniversal; constexpr std::uint32_t const tfOptOut = 0x00000001; enum BatchFlags : std::uint32_t { - tfBatchAtomic = 0x00000001, - tfBatchFirst = 0x00000002, - tfBatchOne = 0x00000004, + tfAllOrNothing = 0x00000001, + tfOnlyOne = 0x00000002, + tfUntilFailure = 0x00000004, + tfIndependent = 0x00000008, }; constexpr std::uint32_t const tfBatchMask = - ~(tfUniversal | tfBatchAtomic | tfBatchFirst); + ~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent); // clang-format on diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 0b4087847..f92da8ee7 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -22,12 +22,12 @@ #include #include -// tfBatchOne +// tfOnlyOne // Tx1: Payment = tecUNFUNDED => Leave // Tx2: Payment = tesSUCCESS => Leave // TER(tesSUCCESS) -// tfBatchFirst +// tfUntilFailure // Tx1: Payment = tesSUCCESS => Leave // Tx2: Payment = tecUNFUNDED => Leave // TER(tesSUCCESS) @@ -325,7 +325,7 @@ class Batch_test : public beast::unit_test::suite Json::Value const tx2 = pay(alice, bob, XRP(999)); jv = addBatchTx(jv, tx2, alice, feeDrops, 1, seq + 2); - env(jv, fee(feeDrops * 2), txflags(tfBatchAtomic), ter(tecBATCH_FAILURE)); + env(jv, fee(feeDrops * 2), txflags(tfAllOrNothing), ter(tecBATCH_FAILURE)); env.close(); Json::Value params; @@ -389,7 +389,7 @@ class Batch_test : public beast::unit_test::suite Json::Value const tx3 = pay(alice, bob, XRP(1)); jv = addBatchTx(jv, tx3, alice, feeDrops, 2, 2); - env(jv, fee(feeDrops * 3), txflags(tfBatchFirst), ter(tecBATCH_FAILURE)); + env(jv, fee(feeDrops * 3), txflags(tfOnlyOne), ter(tecBATCH_FAILURE)); env.close(); Json::Value params;