mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +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
@@ -198,6 +198,58 @@ public:
|
||||
env(jv, ter(temINVALID_FLAG));
|
||||
}
|
||||
|
||||
void
|
||||
testTicketRegularKey()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
testcase("Ticket regular key");
|
||||
Env env{*this, supported_amendments() | featureTicketBatch};
|
||||
Account const alice{"alice", KeyType::ed25519};
|
||||
env.fund(XRP(1000), alice);
|
||||
env.close();
|
||||
|
||||
// alice makes herself some tickets.
|
||||
env(ticket::create(alice, 4));
|
||||
env.close();
|
||||
std::uint32_t ticketSeq{env.seq(alice)};
|
||||
|
||||
// Make sure we can give a regular key using a ticket.
|
||||
Account const alie{"alie", KeyType::secp256k1};
|
||||
env(regkey(alice, alie), ticket::use(--ticketSeq));
|
||||
env.close();
|
||||
|
||||
// Disable alice's master key using a ticket.
|
||||
env(fset(alice, asfDisableMaster),
|
||||
sig(alice),
|
||||
ticket::use(--ticketSeq));
|
||||
env.close();
|
||||
|
||||
// alice should be able to sign using the regular key but not the
|
||||
// master key.
|
||||
std::uint32_t const aliceSeq{env.seq(alice)};
|
||||
env(noop(alice), sig(alice), ter(tefMASTER_DISABLED));
|
||||
env(noop(alice), sig(alie), ter(tesSUCCESS));
|
||||
env.close();
|
||||
BEAST_EXPECT(env.seq(alice) == aliceSeq + 1);
|
||||
|
||||
// Re-enable the master key using a ticket.
|
||||
env(fclear(alice, asfDisableMaster),
|
||||
sig(alie),
|
||||
ticket::use(--ticketSeq));
|
||||
env.close();
|
||||
|
||||
// Disable the regular key using a ticket.
|
||||
env(regkey(alice, disabled), sig(alie), ticket::use(--ticketSeq));
|
||||
env.close();
|
||||
|
||||
// alice should be able to sign using the master key but not the
|
||||
// regular key.
|
||||
env(noop(alice), sig(alice), ter(tesSUCCESS));
|
||||
env(noop(alice), sig(alie), ter(tefBAD_AUTH));
|
||||
env.close();
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -207,6 +259,7 @@ public:
|
||||
testDisableRegularKeyAfterFix();
|
||||
testPasswordSpent();
|
||||
testUniversalMask();
|
||||
testTicketRegularKey();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user