1#include <test/jtx/Account.h>
2#include <test/jtx/CheckMessageLogs.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/JTx.h>
5#include <test/jtx/amount.h>
6#include <test/jtx/envconfig.h>
7#include <test/jtx/noop.h>
9#include <xrpld/app/ledger/LedgerHistory.h>
10#include <xrpld/app/ledger/LedgerMaster.h>
12#include <xrpl/basics/base_uint.h>
13#include <xrpl/basics/chrono.h>
14#include <xrpl/beast/insight/NullCollector.h>
15#include <xrpl/beast/unit_test/suite.h>
16#include <xrpl/ledger/ApplyView.h>
17#include <xrpl/ledger/Ledger.h>
18#include <xrpl/ledger/OpenView.h>
19#include <xrpl/nodestore/NodeObject.h>
20#include <xrpl/protocol/STTx.h>
21#include <xrpl/tx/apply.h>
53 env.
app().config().fees.toFees(),
61 OpenView accum(&*res);
65 res->updateSkipList();
75 res->header().closeTime,
76 res->header().closeTimeResolution,
94 auto const genesis =
makeLedger({}, env, lh, 0s);
110 auto const genesis =
makeLedger({}, env, lh, 0s);
111 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
112 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
129 auto const genesis =
makeLedger({}, env, lh, 0s);
130 auto const ledgerA =
makeLedger(genesis, env, lh, 4s);
131 auto const ledgerB =
makeLedger(genesis, env, lh, 40s);
132 auto const ledgerAC =
makeLedger(ledgerA, env, lh, 4s);
133 auto const ledgerBD =
makeLedger(ledgerB, env, lh, 4s);
144 for (
bool const txBug : {
true,
false})
146 std::string const msg = txBug ?
"MISMATCH with same consensus transaction set"
147 :
"MISMATCH on consensus transaction set";
154 env.
fund(
XRP(1000), alice, bob);
160 auto const ledgerA =
makeLedger(ledgerBase, env, lh, 4s, txAlice.
stx);
163 auto const ledgerB =
makeLedger(ledgerBase, env, lh, 4s, txBob.
stx);
169 ledgerB, txBug ? txAlice.
stx->getTransactionID() : txBob.
stx->getTransactionID());
static std::shared_ptr< Collector > make()
TestcaseT testcase
Memberspace for declaring test cases.
virtual Config & config()=0
std::unordered_set< uint256, beast::Uhash<> > features
Retains historical ledgers.
void validatedLedger(std::shared_ptr< Ledger const > const &, std::optional< uint256 > const &consensusHash)
Report that we have validated a particular ledger.
bool insert(std::shared_ptr< Ledger const > const &ledger, bool validated)
Track a ledger.
void builtLedger(std::shared_ptr< Ledger const > const &, uint256 const &consensusHash, json::Value)
Report that we have locally built a particular ledger.
std::shared_ptr< Ledger const > getClosedLedger()
std::chrono::duration< rep, period > duration
Rules controlling protocol behavior.
virtual LedgerMaster & getLedgerMaster()=0
virtual Family & getNodeFamily()=0
static std::shared_ptr< Ledger > makeLedger(std::shared_ptr< Ledger const > const &prev, jtx::Env &env, LedgerHistory &lh, NetClock::duration closeOffset, std::shared_ptr< STTx const > stx={})
Generate a new ledger by hand, applying a specific close time offset and optionally inserting a trans...
void run() override
Runs the suite.
void testHandleMismatch()
Immutable cryptographic account descriptor.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
beast::Journal const journal
XrpT const XRP
Converts to XRP Issue or STAmount.
json::Value noop(Account const &account)
The null transaction.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
CreateGenesisT const kCreateGenesis
ApplyTransactionResult applyTransaction(ServiceRegistry ®istry, OpenView &view, STTx const &tx, bool retryAssured, ApplyFlags flags, beast::Journal journal)
Transaction application helper.
Execution context for applying a JSON transaction.
std::shared_ptr< STTx const > stx