rippled
Env.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/misc/NetworkOPs.h>
22 #include <ripple/app/misc/TxQ.h>
23 #include <ripple/basics/Slice.h>
24 #include <ripple/basics/contract.h>
25 #include <ripple/consensus/LedgerTiming.h>
26 #include <ripple/json/to_string.h>
27 #include <ripple/net/HTTPClient.h>
28 #include <ripple/net/RPCCall.h>
29 #include <ripple/protocol/ErrorCodes.h>
30 #include <ripple/protocol/Feature.h>
31 #include <ripple/protocol/HashPrefix.h>
32 #include <ripple/protocol/Indexes.h>
33 #include <ripple/protocol/LedgerFormats.h>
34 #include <ripple/protocol/Serializer.h>
35 #include <ripple/protocol/SystemParameters.h>
36 #include <ripple/protocol/TER.h>
37 #include <ripple/protocol/TxFlags.h>
38 #include <ripple/protocol/UintTypes.h>
39 #include <ripple/protocol/jss.h>
40 #include <memory>
41 #include <test/jtx/Env.h>
42 #include <test/jtx/JSONRPCClient.h>
43 #include <test/jtx/balance.h>
44 #include <test/jtx/fee.h>
45 #include <test/jtx/flags.h>
46 #include <test/jtx/pay.h>
47 #include <test/jtx/require.h>
48 #include <test/jtx/seq.h>
49 #include <test/jtx/sig.h>
50 #include <test/jtx/trust.h>
51 #include <test/jtx/utility.h>
52 
53 namespace ripple {
54 namespace test {
55 namespace jtx {
56 
57 //------------------------------------------------------------------------------
58 
60  beast::unit_test::suite& suite,
64  : AppBundle()
65 {
66  using namespace beast::severities;
67  if (logs)
68  {
69  setDebugLogSink(logs->makeSink("Debug", kFatal));
70  }
71  else
72  {
73  logs = std::make_unique<SuiteLogs>(suite);
74  // Use kFatal threshold to reduce noise from STObject.
76  std::make_unique<SuiteJournalSink>("Debug", kFatal, suite));
77  }
78  auto timeKeeper_ = std::make_unique<ManualTimeKeeper>();
79  timeKeeper = timeKeeper_.get();
80  // Hack so we don't have to call Config::setup
83  std::move(config), std::move(logs), std::move(timeKeeper_));
84  app = owned.get();
85  app->logs().threshold(thresh);
86  if (!app->setup())
87  Throw<std::runtime_error>("Env::AppBundle: setup failed");
88  timeKeeper->set(app->getLedgerMaster().getClosedLedger()->info().closeTime);
89  app->start(false /*don't start timers*/);
90  thread = std::thread([&]() { app->run(); });
91 
93 }
94 
96 {
97  client.reset();
98  // Make sure all jobs finish, otherwise tests
99  // might not get the coverage they expect.
100  if (app)
101  {
103  app->signalStop();
104  }
105  if (thread.joinable())
106  thread.join();
107 
108  // Remove the debugLogSink before the suite goes out of scope.
109  setDebugLogSink(nullptr);
110 }
111 
112 //------------------------------------------------------------------------------
113 
116 {
117  return app().getLedgerMaster().getClosedLedger();
118 }
119 
120 bool
122  NetClock::time_point closeTime,
124 {
125  // Round up to next distinguishable value
126  using namespace std::chrono_literals;
127  bool res = true;
128  closeTime += closed()->info().closeTimeResolution - 1s;
129  timeKeeper().set(closeTime);
130  // Go through the rpc interface unless we need to simulate
131  // a specific consensus delay.
132  if (consensusDelay)
133  app().getOPs().acceptLedger(consensusDelay);
134  else
135  {
136  auto resp = rpc("ledger_accept");
137  if (resp["result"]["status"] != std::string("success"))
138  {
139  std::string reason = "internal error";
140  if (resp.isMember("error_what"))
141  reason = resp["error_what"].asString();
142  else if (resp.isMember("error_message"))
143  reason = resp["error_message"].asString();
144  else if (resp.isMember("error"))
145  reason = resp["error"].asString();
146 
147  JLOG(journal.error()) << "Env::close() failed: " << reason;
148  res = false;
149  }
150  }
151  timeKeeper().set(closed()->info().closeTime);
152  return res;
153 }
154 
155 void
156 Env::memoize(Account const& account)
157 {
158  map_.emplace(account.id(), account);
159 }
160 
161 Account const&
162 Env::lookup(AccountID const& id) const
163 {
164  auto const iter = map_.find(id);
165  if (iter == map_.end())
166  Throw<std::runtime_error>("Env::lookup:: unknown account ID");
167  return iter->second;
168 }
169 
170 Account const&
171 Env::lookup(std::string const& base58ID) const
172 {
173  auto const account = parseBase58<AccountID>(base58ID);
174  if (!account)
175  Throw<std::runtime_error>("Env::lookup: invalid account ID");
176  return lookup(*account);
177 }
178 
180 Env::balance(Account const& account) const
181 {
182  auto const sle = le(account);
183  if (!sle)
184  return XRP(0);
185  return {sle->getFieldAmount(sfBalance), ""};
186 }
187 
189 Env::balance(Account const& account, Issue const& issue) const
190 {
191  if (isXRP(issue.currency))
192  return balance(account);
193  auto const sle = le(keylet::line(account.id(), issue));
194  if (!sle)
195  return {STAmount(issue, 0), account.name()};
196  auto amount = sle->getFieldAmount(sfBalance);
197  amount.setIssuer(issue.account);
198  if (account.id() > issue.account)
199  amount.negate();
200  return {amount, lookup(issue.account).name()};
201 }
202 
204 Env::seq(Account const& account) const
205 {
206  auto const sle = le(account);
207  if (!sle)
208  Throw<std::runtime_error>("missing account root");
209  return sle->getFieldU32(sfSequence);
210 }
211 
213 Env::le(Account const& account) const
214 {
215  return le(keylet::account(account.id()));
216 }
217 
219 Env::le(Keylet const& k) const
220 {
221  return current()->read(k);
222 }
223 
224 void
225 Env::fund(bool setDefaultRipple, STAmount const& amount, Account const& account)
226 {
227  memoize(account);
228  if (setDefaultRipple)
229  {
230  // VFALCO NOTE Is the fee formula correct?
231  apply(
232  pay(master, account, amount + drops(current()->fees().base)),
235  sig(jtx::autofill));
236  apply(
237  fset(account, asfDefaultRipple),
240  sig(jtx::autofill));
241  require(flags(account, asfDefaultRipple));
242  }
243  else
244  {
245  apply(
246  pay(master, account, amount),
249  sig(jtx::autofill));
250  require(nflags(account, asfDefaultRipple));
251  }
252  require(jtx::balance(account, amount));
253 }
254 
255 void
256 Env::trust(STAmount const& amount, Account const& account)
257 {
258  auto const start = balance(account);
259  apply(
260  jtx::trust(account, amount),
263  sig(jtx::autofill));
264  apply(
265  pay(master, account, drops(current()->fees().base)),
268  sig(jtx::autofill));
269  test.expect(balance(account) == start);
270 }
271 
274 {
275  TER ter;
276  if (jr.isObject() && jr.isMember(jss::result) &&
277  jr[jss::result].isMember(jss::engine_result_code))
278  ter = TER::fromInt(jr[jss::result][jss::engine_result_code].asInt());
279  else
280  ter = temINVALID;
282 }
283 
284 void
286 {
287  bool didApply;
288  if (jt.stx)
289  {
290  txid_ = jt.stx->getTransactionID();
291  Serializer s;
292  jt.stx->add(s);
293  auto const jr = rpc("submit", strHex(s.slice()));
294 
295  std::tie(ter_, didApply) = parseResult(jr);
296  }
297  else
298  {
299  // Parsing failed or the JTx is
300  // otherwise missing the stx field.
301  ter_ = temMALFORMED;
302  didApply = false;
303  }
304  return postconditions(jt, ter_, didApply);
305 }
306 
307 void
309 {
310  bool didApply;
311 
312  auto const account = lookup(jt.jv[jss::Account].asString());
313  auto const& passphrase = account.name();
314 
315  Json::Value jr;
316  if (params.isNull())
317  {
318  // Use the command line interface
319  auto const jv = boost::lexical_cast<std::string>(jt.jv);
320  jr = rpc("submit", passphrase, jv);
321  }
322  else
323  {
324  // Use the provided parameters, and go straight
325  // to the (RPC) client.
326  assert(params.isObject());
327  if (!params.isMember(jss::secret) && !params.isMember(jss::key_type) &&
328  !params.isMember(jss::seed) && !params.isMember(jss::seed_hex) &&
329  !params.isMember(jss::passphrase))
330  {
331  params[jss::secret] = passphrase;
332  }
333  params[jss::tx_json] = jt.jv;
334  jr = client().invoke("submit", params);
335  }
336 
337  if (!txid_.parseHex(jr[jss::result][jss::tx_json][jss::hash].asString()))
338  txid_.zero();
339 
340  std::tie(ter_, didApply) = parseResult(jr);
341 
342  return postconditions(jt, ter_, didApply);
343 }
344 
345 void
346 Env::postconditions(JTx const& jt, TER ter, bool didApply)
347 {
348  if (jt.ter &&
349  !test.expect(
350  ter == *jt.ter,
351  "apply: Got " + transToken(ter) + " (" + transHuman(ter) +
352  "); Expected " + transToken(*jt.ter) + " (" +
353  transHuman(*jt.ter) + ")"))
354  {
355  test.log << pretty(jt.jv) << std::endl;
356  // Don't check postconditions if
357  // we didn't get the expected result.
358  return;
359  }
360  if (trace_)
361  {
362  if (trace_ > 0)
363  --trace_;
364  test.log << pretty(jt.jv) << std::endl;
365  }
366  for (auto const& f : jt.require)
367  f(*this);
368 }
369 
372 {
373  close();
374  auto const item = closed()->txRead(txid_);
375  return item.second;
376 }
377 
379 Env::tx() const
380 {
381  return current()->txRead(txid_).first;
382 }
383 
384 void
386 {
387  auto& jv = jt.jv;
388  if (jt.signer)
389  return jt.signer(*this, jt);
390  if (!jt.fill_sig)
391  return;
392  auto const account = lookup(jv[jss::Account].asString());
393  if (!app().checkSigs())
394  {
395  jv[jss::SigningPubKey] = strHex(account.pk().slice());
396  // dummy sig otherwise STTx is invalid
397  jv[jss::TxnSignature] = "00";
398  return;
399  }
400  auto const ar = le(account);
401  if (ar && ar->isFieldPresent(sfRegularKey))
402  jtx::sign(jv, lookup(ar->getAccountID(sfRegularKey)));
403  else
404  jtx::sign(jv, account);
405 }
406 
407 void
409 {
410  auto& jv = jt.jv;
411  if (jt.fill_fee)
412  jtx::fill_fee(jv, *current());
413  if (jt.fill_seq)
414  jtx::fill_seq(jv, *current());
415  // Must come last
416  try
417  {
418  autofill_sig(jt);
419  }
420  catch (parse_error const&)
421  {
422  test.log << "parse failed:\n" << pretty(jv) << std::endl;
423  Rethrow();
424  }
425 }
426 
428 Env::st(JTx const& jt)
429 {
430  // The parse must succeed, since we
431  // generated the JSON ourselves.
433  try
434  {
435  obj = jtx::parse(jt.jv);
436  }
437  catch (jtx::parse_error const&)
438  {
439  test.log << "Exception: parse_error\n" << pretty(jt.jv) << std::endl;
440  Rethrow();
441  }
442 
443  try
444  {
445  return sterilize(STTx{std::move(*obj)});
446  }
447  catch (std::exception const&)
448  {
449  }
450  return nullptr;
451 }
452 
455  std::vector<std::string> const& args,
457 {
458  return rpcClient(args, app().config(), app().logs(), headers).second;
459 }
460 
461 void
463 {
464  // Env::close() must be called for feature
465  // enable to take place.
466  app().config().features.insert(feature);
467 }
468 
469 } // namespace jtx
470 
471 } // namespace test
472 } // namespace ripple
ripple::test::jtx::Env::AppBundle::app
Application * app
Definition: Env.h:125
ripple::test::jtx::Account::name
std::string const & name() const
Return the name.
Definition: Account.h:78
ripple::test::jtx::Env::autofill_sig
void autofill_sig(JTx &jt)
Definition: Env.cpp:385
ripple::test::jtx::XRP
const XRP_t XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:105
ripple::test::jtx::parse_error
Thrown when parse fails.
Definition: utility.h:34
ripple::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:38
ripple::Application::start
virtual void start(bool withTimers)=0
ripple::Issue
A currency issued by an account.
Definition: Issue.h:34
Json::Value::isObject
bool isObject() const
Definition: json_value.cpp:1027
std::string
STL class.
std::shared_ptr
STL class.
std::exception
STL class.
ripple::test::jtx::Env::map_
std::unordered_map< AccountID, Account > map_
Definition: Env.h:678
ripple::test::jtx::Env::ter_
TER ter_
Definition: Env.h:637
ripple::test::jtx::drops
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Definition: amount.h:241
ripple::test::jtx::Env::AppBundle::client
std::unique_ptr< AbstractClient > client
Definition: Env.h:129
ripple::test::jtx::Env::tx
std::shared_ptr< STTx const > tx() const
Return the tx data for the last JTx.
Definition: Env.cpp:379
ripple::test::jtx::ter
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition: ter.h:33
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:581
ripple::test::jtx::Env::require
void require(Args const &... args)
Check a set of requirements.
Definition: Env.h:465
ripple::test::jtx::Env::apply
void apply(JsonValue &&jv, FN const &... fN)
Apply funclets and submit.
Definition: Env.h:497
ripple::test::jtx::Env::closed
std::shared_ptr< ReadView const > closed()
Returns the last closed ledger.
Definition: Env.cpp:115
std::pair
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::sfRegularKey
const SF_ACCOUNT sfRegularKey
ripple::test::jtx::balance
A balance matches.
Definition: balance.h:38
ripple::test::jtx::Env::AppBundle::AppBundle
AppBundle()=default
std::vector< std::string >
ripple::test::jtx::Env::enableFeature
void enableFeature(uint256 const feature)
Definition: Env.cpp:462
ripple::test::jtx::Env::AppBundle::timeKeeper
ManualTimeKeeper * timeKeeper
Definition: Env.h:127
ripple::test::jtx::trust
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition: trust.cpp:30
ripple::test::jtx::Env::txid_
uint256 txid_
Definition: Env.h:636
ripple::test::jtx::Env::AppBundle::~AppBundle
~AppBundle()
Definition: Env.cpp:95
ripple::test::jtx::JTx::stx
std::shared_ptr< STTx const > stx
Definition: JTx.h:50
ripple::asfDefaultRipple
const std::uint32_t asfDefaultRipple
Definition: TxFlags.h:72
ripple::test::jtx::Env::jt
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Definition: Env.h:438
ripple::test::jtx::fill_seq
void fill_seq(Json::Value &jv, ReadView const &view)
Set the sequence number automatically.
Definition: utility.cpp:63
ripple::Issue::currency
Currency currency
Definition: Issue.h:37
ripple::transToken
std::string transToken(TER code)
Definition: TER.cpp:196
ripple::test::jtx::Env::journal
const beast::Journal journal
Definition: Env.h:143
ripple::test::jtx::JTx::ter
std::optional< TER > ter
Definition: JTx.h:46
ripple::test::makeJSONRPCClient
std::unique_ptr< AbstractClient > makeJSONRPCClient(Config const &cfg, unsigned rpc_version)
Returns a client using JSON-RPC over HTTP/S.
Definition: JSONRPCClient.cpp:155
beast::severities
A namespace for easy access to logging severity values.
Definition: Journal.h:29
ripple::test::jtx::Env::sign_and_submit
void sign_and_submit(JTx const &jt, Json::Value params=Json::nullValue)
Use the submit RPC command with a provided JTx object.
Definition: Env.cpp:308
ripple::test::jtx::Env::AppBundle::thread
std::thread thread
Definition: Env.h:128
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:180
Json::Value::isNull
bool isNull() const
isNull() tests to see if this field is null.
Definition: json_value.cpp:967
ripple::test::jtx::JTx::require
requires_t require
Definition: JTx.h:45
ripple::test::jtx::sign
void sign(Json::Value &jv, Account const &account)
Sign automatically.
Definition: utility.cpp:44
ripple::test::jtx::Env::ter
TER ter() const
Return the TER for the last JTx.
Definition: Env.h:512
ripple::isTecClaim
bool isTecClaim(TER x)
Definition: TER.h:587
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:256
ripple::debugLog
beast::Journal debugLog()
Returns a debug journal.
Definition: Log.cpp:452
ripple::Application::getOPs
virtual NetworkOPs & getOPs()=0
ripple::test::jtx::autofill
static const autofill_t autofill
Definition: tags.h:42
ripple::test::jtx::Env::st
std::shared_ptr< STTx const > st(JTx const &jt)
Create a STTx from a JTx The framework requires that JSON is valid.
Definition: Env.cpp:428
ripple::test::jtx::Env::parseResult
static std::pair< TER, bool > parseResult(Json::Value const &jr)
Gets the TER result and didApply flag from a RPC Json result object.
Definition: Env.cpp:273
std::tie
T tie(T... args)
ripple::base_uint< 160, detail::AccountIDTag >
std::thread::joinable
T joinable(T... args)
ripple::test::jtx::Env::meta
std::shared_ptr< STObject const > meta()
Return metadata for the last JTx.
Definition: Env.cpp:371
std::thread
STL class.
ripple::Application::getLedgerMaster
virtual LedgerMaster & getLedgerMaster()=0
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:130
ripple::Rethrow
void Rethrow()
Rethrow the exception currently being handled.
Definition: contract.h:48
ripple::test::jtx::Env::postconditions
void postconditions(JTx const &jt, TER ter, bool didApply)
Check expected postconditions of JTx submission.
Definition: Env.cpp:346
ripple::Application::config
virtual Config & config()=0
ripple::TERSubset< CanCvtToTER >
ripple::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition: JTx.h:42
ripple::setDebugLogSink
std::unique_ptr< beast::Journal::Sink > setDebugLogSink(std::unique_ptr< beast::Journal::Sink > sink)
Set the sink for the debug journal.
Definition: Log.cpp:446
ripple::test::jtx::JTx::jv
Json::Value jv
Definition: JTx.h:44
ripple::test::jtx::fill_fee
void fill_fee(Json::Value &jv, ReadView const &view)
Set the fee automatically.
Definition: utility.cpp:55
ripple::test::jtx::fset
Json::Value fset(Account const &account, std::uint32_t on, std::uint32_t off=0)
Add and/or remove flag.
Definition: flags.cpp:28
ripple::Application::getJobQueue
virtual JobQueue & getJobQueue()=0
ripple::test::jtx::Env::submit
virtual void submit(JTx const &jt)
Submit an existing JTx.
Definition: Env.cpp:285
ripple::STAmount
Definition: STAmount.h:43
ripple::Serializer::slice
Slice slice() const noexcept
Definition: Serializer.h:63
beast::Journal::error
Stream error() const
Definition: Journal.h:333
std::chrono::time_point
ripple::Application::logs
virtual Logs & logs()=0
ripple::STTx
Definition: STTx.h:42
ripple::test::jtx::Env::lookup
Account const & lookup(AccountID const &id) const
Returns the Account given the AccountID.
Definition: Env.cpp:162
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:89
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
std::uint32_t
ripple::test::jtx::sig
Set the regular signature on a JTx.
Definition: sig.h:34
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:190
ripple::test::jtx::Env::seq
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
Definition: Env.cpp:204
ripple::test::jtx::Env::test
beast::unit_test::suite & test
Definition: Env.h:118
ripple::test::jtx::JTx::signer
std::function< void(Env &, JTx &)> signer
Definition: JTx.h:51
ripple::JobQueue::rendezvous
void rendezvous()
Block until no jobs running.
Definition: JobQueue.cpp:261
memory
ripple::transHuman
std::string transHuman(TER code)
Definition: TER.cpp:205
ripple::test::jtx::fee
Set the fee on a JTx.
Definition: fee.h:35
ripple::Serializer
Definition: Serializer.h:39
ripple::test::jtx::seq
Set the sequence number on a JTx.
Definition: seq.h:33
ripple::LedgerMaster::getClosedLedger
std::shared_ptr< Ledger const > getClosedLedger()
Definition: LedgerMaster.h:98
ripple::Logs::threshold
beast::severities::Severity threshold() const
Definition: Log.cpp:150
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sterilize
std::shared_ptr< STTx const > sterilize(STTx const &stx)
Sterilize a transaction.
Definition: STTx.cpp:530
ripple::Config::features
std::unordered_set< uint256, beast::uhash<> > features
Definition: Config.h:224
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:108
std::endl
T endl(T... args)
ripple::test::jtx::Env::autofill
virtual void autofill(JTx &jt)
Definition: Env.cpp:408
ripple::test::jtx::Env::do_rpc
Json::Value do_rpc(std::vector< std::string > const &args, std::unordered_map< std::string, std::string > const &headers={})
Definition: Env.cpp:454
ripple::test::jtx::pay
Json::Value pay(Account const &account, Account const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
ripple::test::jtx::JTx::fill_seq
bool fill_seq
Definition: JTx.h:48
ripple::test::jtx::JTx::fill_sig
bool fill_sig
Definition: JTx.h:49
ripple::test::jtx::Env::close
bool close()
Close and advance the ledger.
Definition: Env.h:361
beast::severities::Severity
Severity
Severity level / threshold of a Journal message.
Definition: Journal.h:31
ripple::base_uint::zero
void zero()
Definition: base_uint.h:518
ripple::TERSubset< CanCvtToTER >::fromInt
static constexpr TERSubset fromInt(int from)
Definition: TER.h:346
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:225
ripple::test::jtx::Env::le
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition: Env.cpp:213
ripple::rpcClient
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition: RPCCall.cpp:1522
ripple::test::jtx::Env::AppBundle::owned
std::unique_ptr< Application > owned
Definition: Env.h:126
ripple::test::jtx::Env::master
Account const & master
Definition: Env.h:120
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::NetworkOPs::acceptLedger
virtual std::uint32_t acceptLedger(std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)=0
Accepts the current transaction tree, return the new ledger's sequence.
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:125
std::optional< std::chrono::milliseconds >
ripple::Application::signalStop
virtual void signalStop()=0
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
std::make_pair
T make_pair(T... args)
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:45
ripple::temMALFORMED
@ temMALFORMED
Definition: TER.h:82
beast::severities::kFatal
@ kFatal
Definition: Journal.h:39
ripple::base_uint::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:472
ripple::test::ManualTimeKeeper::set
void set(time_point now)
Definition: ManualTimeKeeper.cpp:81
ripple::test::jtx::parse
STObject parse(Json::Value const &jv)
Convert JSON to STObject.
Definition: utility.cpp:35
ripple::test::jtx::Env::memoize
void memoize(Account const &account)
Associate AccountID with account.
Definition: Env.cpp:156
std::unique_ptr
STL class.
ripple::test::jtx::JTx::fill_fee
bool fill_fee
Definition: JTx.h:47
std::unordered_map
STL class.
ripple::Application::setup
virtual bool setup()=0
ripple::HTTPClient::initializeSSLContext
static void initializeSSLContext(Config const &config, beast::Journal j)
Definition: HTTPClient.cpp:38
ripple::test::jtx::Env::current
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition: Env.h:299
ripple::make_Application
std::unique_ptr< Application > make_Application(std::unique_ptr< Config > config, std::unique_ptr< Logs > logs, std::unique_ptr< TimeKeeper > timeKeeper)
Definition: Application.cpp:2136
ripple::test::jtx::Env::AppBundle
Definition: Env.h:123
ripple::Application::run
virtual void run()=0
ripple::Issue::account
AccountID account
Definition: Issue.h:38
ripple::temINVALID
@ temINVALID
Definition: TER.h:105
std::thread::join
T join(T... args)
ripple::test::jtx::Env::rpc
Json::Value rpc(std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
Definition: Env.h:683
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::test::jtx::PrettyAmount
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
Definition: amount.h:73
ripple::test::jtx::Env::trace_
int trace_
Definition: Env.h:634
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469