Add Batch feature (XLS-56) (#5060)

- Specification: [XRPLF/XRPL-Standards 56](https://github.com/XRPLF/XRPL-Standards/blob/master/XLS-0056d-batch/README.md)
- Amendment: `Batch`
- Implements execution of multiple transactions within a single batch transaction with four execution modes: `tfAllOrNothing`, `tfOnlyOne`, `tfUntilFailure`, and `tfIndependent`.
- Enables atomic multi-party transactions where multiple accounts can participate in a single batch, with up to 8 inner transactions and 8 batch signers per batch transaction.
- Inner transactions use `tfInnerBatchTxn` flag with zero fees, no signature, and empty signing public key.
- Inner transactions are applied after the outer batch succeeds via the `applyBatchTransactions` function in apply.cpp.
- Network layer prevents relay of transactions with `tfInnerBatchTxn` flag - each peer applies inner transactions locally from the batch.
- Batch transactions are excluded from AccountDelegate permissions but inner transactions retain full delegation support.
- Metadata includes `ParentBatchID` linking inner transactions to their containing batch for traceability and auditing.
- Extended STTx with batch-specific signature verification methods and added protocol structures (`sfRawTransactions`, `sfBatchSigners`).
This commit is contained in:
Denis Angell
2025-05-23 21:53:53 +02:00
committed by GitHub
parent 40ce8a8833
commit 2a61aee562
69 changed files with 6400 additions and 744 deletions

View File

@@ -460,7 +460,7 @@ public:
// Attempt a multisigned transaction that meets the quorum.
auto const baseFee = env.current()->fees().base;
std::uint32_t aliceSeq = env.seq(alice);
env(noop(alice), msig(msig::Reg{cheri, cher}), fee(2 * baseFee));
env(noop(alice), msig(Reg{cheri, cher}), fee(2 * baseFee));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -480,7 +480,7 @@ public:
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
aliceSeq = env.seq(alice);
env(noop(alice), msig(msig::Reg{becky, beck}), fee(2 * baseFee));
env(noop(alice), msig(Reg{becky, beck}), fee(2 * baseFee));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -488,7 +488,7 @@ public:
aliceSeq = env.seq(alice);
env(noop(alice),
fee(3 * baseFee),
msig(msig::Reg{becky, beck}, msig::Reg{cheri, cher}));
msig(Reg{becky, beck}, Reg{cheri, cher}));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
}
@@ -783,12 +783,12 @@ public:
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
aliceSeq = env.seq(alice);
env(noop(alice), msig(msig::Reg{cheri, cher}), fee(2 * baseFee));
env(noop(alice), msig(Reg{cheri, cher}), fee(2 * baseFee));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
aliceSeq = env.seq(alice);
env(noop(alice), msig(msig::Reg{daria, dari}), fee(2 * baseFee));
env(noop(alice), msig(Reg{daria, dari}), fee(2 * baseFee));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -801,7 +801,7 @@ public:
aliceSeq = env.seq(alice);
env(noop(alice),
fee(5 * baseFee),
msig(becky, msig::Reg{cheri, cher}, msig::Reg{daria, dari}, jinni));
msig(becky, Reg{cheri, cher}, Reg{daria, dari}, jinni));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -820,7 +820,7 @@ public:
aliceSeq = env.seq(alice);
env(noop(alice),
fee(9 * baseFee),
msig(becky, msig::Reg{cheri, cher}, msig::Reg{daria, dari}, jinni));
msig(becky, Reg{cheri, cher}, Reg{daria, dari}, jinni));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -828,7 +828,7 @@ public:
aliceSeq = env.seq(alice);
env(noop(alice),
fee(5 * baseFee),
msig(becky, cheri, msig::Reg{daria, dari}, jinni));
msig(becky, cheri, Reg{daria, dari}, jinni));
env.close();
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
@@ -853,8 +853,8 @@ public:
fee(9 * baseFee),
msig(
becky,
msig::Reg{cheri, cher},
msig::Reg{daria, dari},
Reg{cheri, cher},
Reg{daria, dari},
haunt,
jinni,
phase,
@@ -1349,7 +1349,7 @@ public:
// Becky cannot 2-level multisign for alice. 2-level multisigning
// is not supported.
env(noop(alice),
msig(msig::Reg{becky, bogie}),
msig(Reg{becky, bogie}),
fee(2 * baseFee),
ter(tefBAD_SIGNATURE));
env.close();
@@ -1358,7 +1358,7 @@ public:
// not yet enabled.
Account const beck{"beck", KeyType::ed25519};
env(noop(alice),
msig(msig::Reg{becky, beck}),
msig(Reg{becky, beck}),
fee(2 * baseFee),
ter(tefBAD_SIGNATURE));
env.close();
@@ -1368,13 +1368,13 @@ public:
env(regkey(becky, beck), msig(demon), fee(2 * baseFee));
env.close();
env(noop(alice), msig(msig::Reg{becky, beck}), fee(2 * baseFee));
env(noop(alice), msig(Reg{becky, beck}), fee(2 * baseFee));
env.close();
// The presence of becky's regular key does not influence whether she
// can 2-level multisign; it still won't work.
env(noop(alice),
msig(msig::Reg{becky, demon}),
msig(Reg{becky, demon}),
fee(2 * baseFee),
ter(tefBAD_SIGNATURE));
env.close();