mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 08:17:13 +00:00
Implement enhanced Ticket support:
Tickets are a mechanism to allow for the "out-of-order" execution of transactions on the XRP Ledger. This commit, if merged, reworks the existing support for tickets and introduces support for 'ticket batching', completing the feature set needed for tickets. The code is gated under the newly-introduced `TicketBatch` amendment and the `Tickets` amendment, which is not presently active on the network, is being removed. The specification for this change can be found at: https://github.com/xrp-community/standards-drafts/issues/16
This commit is contained in:
committed by
Nik Bougalis
parent
01bd5a2646
commit
7724cca384
@@ -1480,6 +1480,50 @@ public:
|
||||
env.require(owners(daria, 0));
|
||||
}
|
||||
|
||||
void
|
||||
test_signersWithTickets(FeatureBitset features)
|
||||
{
|
||||
testcase("Signers With Tickets");
|
||||
|
||||
using namespace jtx;
|
||||
Env env{*this, features};
|
||||
Account const alice{"alice", KeyType::ed25519};
|
||||
env.fund(XRP(2000), alice);
|
||||
env.close();
|
||||
|
||||
// If featureTicketBatch is not enabled expect massive failures.
|
||||
BEAST_EXPECT(features[featureTicketBatch]);
|
||||
|
||||
// Create a few tickets that alice can use up.
|
||||
std::uint32_t aliceTicketSeq{env.seq(alice) + 1};
|
||||
env(ticket::create(alice, 20));
|
||||
env.close();
|
||||
std::uint32_t const aliceSeq = env.seq(alice);
|
||||
|
||||
// Attach phantom signers to alice using a ticket.
|
||||
env(signers(alice, 1, {{bogie, 1}, {demon, 1}}),
|
||||
ticket::use(aliceTicketSeq++));
|
||||
env.close();
|
||||
env.require(tickets(alice, env.seq(alice) - aliceTicketSeq));
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq);
|
||||
|
||||
// This should work.
|
||||
auto const baseFee = env.current()->fees().base;
|
||||
env(noop(alice),
|
||||
msig(bogie, demon),
|
||||
fee(3 * baseFee),
|
||||
ticket::use(aliceTicketSeq++));
|
||||
env.close();
|
||||
env.require(tickets(alice, env.seq(alice) - aliceTicketSeq));
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq);
|
||||
|
||||
// Should also be able to remove the signer list using a ticket.
|
||||
env(signers(alice, jtx::none), ticket::use(aliceTicketSeq++));
|
||||
env.close();
|
||||
env.require(tickets(alice, env.seq(alice) - aliceTicketSeq));
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq);
|
||||
}
|
||||
|
||||
void
|
||||
testAll(FeatureBitset features)
|
||||
{
|
||||
@@ -1499,13 +1543,14 @@ public:
|
||||
test_noMultiSigners(features);
|
||||
test_multisigningMultisigner(features);
|
||||
test_signForHash(features);
|
||||
test_signersWithTickets(features);
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = supported_amendments();
|
||||
auto const all = supported_amendments() | featureTicketBatch;
|
||||
|
||||
// The reserve required on a signer list changes based on.
|
||||
// featureMultiSignReserve. Test both with and without.
|
||||
|
||||
Reference in New Issue
Block a user