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,
63  : AppBundle()
64 {
65  using namespace beast::severities;
66  // Use kFatal threshold to reduce noise from STObject.
67  setDebugLogSink(std::make_unique<SuiteJournalSink>("Debug", kFatal, suite));
68  auto timeKeeper_ = std::make_unique<ManualTimeKeeper>();
69  timeKeeper = timeKeeper_.get();
70  // Hack so we don't have to call Config::setup
73  std::move(config), std::move(logs), std::move(timeKeeper_));
74  app = owned.get();
76  if (!app->setup())
77  Throw<std::runtime_error>("Env::AppBundle: setup failed");
78  timeKeeper->set(app->getLedgerMaster().getClosedLedger()->info().closeTime);
79  app->doStart(false /*don't start timers*/);
80  thread = std::thread([&]() { app->run(); });
81 
83 }
84 
86 {
87  client.reset();
88  // Make sure all jobs finish, otherwise tests
89  // might not get the coverage they expect.
90  if (app)
91  {
93  app->signalStop();
94  }
95  if (thread.joinable())
96  thread.join();
97 
98  // Remove the debugLogSink before the suite goes out of scope.
99  setDebugLogSink(nullptr);
100 }
101 
102 //------------------------------------------------------------------------------
103 
106 {
107  return app().getLedgerMaster().getClosedLedger();
108 }
109 
110 bool
112  NetClock::time_point closeTime,
113  boost::optional<std::chrono::milliseconds> consensusDelay)
114 {
115  // Round up to next distinguishable value
116  using namespace std::chrono_literals;
117  bool res = true;
118  closeTime += closed()->info().closeTimeResolution - 1s;
119  timeKeeper().set(closeTime);
120  // Go through the rpc interface unless we need to simulate
121  // a specific consensus delay.
122  if (consensusDelay)
123  app().getOPs().acceptLedger(consensusDelay);
124  else
125  {
126  auto resp = rpc("ledger_accept");
127  if (resp["result"]["status"] != std::string("success"))
128  {
129  JLOG(journal.error())
130  << "Env::close() failed: " << resp["result"]["status"]
131  << std::endl;
132  res = false;
133  }
134  }
135  timeKeeper().set(closed()->info().closeTime);
136  return res;
137 }
138 
139 void
140 Env::memoize(Account const& account)
141 {
142  map_.emplace(account.id(), account);
143 }
144 
145 Account const&
146 Env::lookup(AccountID const& id) const
147 {
148  auto const iter = map_.find(id);
149  if (iter == map_.end())
150  Throw<std::runtime_error>("Env::lookup:: unknown account ID");
151  return iter->second;
152 }
153 
154 Account const&
155 Env::lookup(std::string const& base58ID) const
156 {
157  auto const account = parseBase58<AccountID>(base58ID);
158  if (!account)
159  Throw<std::runtime_error>("Env::lookup: invalid account ID");
160  return lookup(*account);
161 }
162 
164 Env::balance(Account const& account) const
165 {
166  auto const sle = le(account);
167  if (!sle)
168  return XRP(0);
169  return {sle->getFieldAmount(sfBalance), ""};
170 }
171 
173 Env::balance(Account const& account, Issue const& issue) const
174 {
175  if (isXRP(issue.currency))
176  return balance(account);
177  auto const sle = le(keylet::line(account.id(), issue));
178  if (!sle)
179  return {STAmount(issue, 0), account.name()};
180  auto amount = sle->getFieldAmount(sfBalance);
181  amount.setIssuer(issue.account);
182  if (account.id() > issue.account)
183  amount.negate();
184  return {amount, lookup(issue.account).name()};
185 }
186 
188 Env::seq(Account const& account) const
189 {
190  auto const sle = le(account);
191  if (!sle)
192  Throw<std::runtime_error>("missing account root");
193  return sle->getFieldU32(sfSequence);
194 }
195 
197 Env::le(Account const& account) const
198 {
199  return le(keylet::account(account.id()));
200 }
201 
203 Env::le(Keylet const& k) const
204 {
205  return current()->read(k);
206 }
207 
208 void
209 Env::fund(bool setDefaultRipple, STAmount const& amount, Account const& account)
210 {
211  memoize(account);
212  if (setDefaultRipple)
213  {
214  // VFALCO NOTE Is the fee formula correct?
215  apply(
216  pay(master, account, amount + drops(current()->fees().base)),
219  sig(jtx::autofill));
220  apply(
221  fset(account, asfDefaultRipple),
224  sig(jtx::autofill));
225  require(flags(account, asfDefaultRipple));
226  }
227  else
228  {
229  apply(
230  pay(master, account, amount),
233  sig(jtx::autofill));
234  require(nflags(account, asfDefaultRipple));
235  }
236  require(jtx::balance(account, amount));
237 }
238 
239 void
240 Env::trust(STAmount const& amount, Account const& account)
241 {
242  auto const start = balance(account);
243  apply(
244  jtx::trust(account, amount),
247  sig(jtx::autofill));
248  apply(
249  pay(master, account, drops(current()->fees().base)),
252  sig(jtx::autofill));
253  test.expect(balance(account) == start);
254 }
255 
258 {
259  TER ter;
260  if (jr.isObject() && jr.isMember(jss::result) &&
261  jr[jss::result].isMember(jss::engine_result_code))
262  ter = TER::fromInt(jr[jss::result][jss::engine_result_code].asInt());
263  else
264  ter = temINVALID;
266 }
267 
268 void
270 {
271  bool didApply;
272  if (jt.stx)
273  {
274  txid_ = jt.stx->getTransactionID();
275  Serializer s;
276  jt.stx->add(s);
277  auto const jr = rpc("submit", strHex(s.slice()));
278 
279  std::tie(ter_, didApply) = parseResult(jr);
280  }
281  else
282  {
283  // Parsing failed or the JTx is
284  // otherwise missing the stx field.
285  ter_ = temMALFORMED;
286  didApply = false;
287  }
288  return postconditions(jt, ter_, didApply);
289 }
290 
291 void
293 {
294  bool didApply;
295 
296  auto const account = lookup(jt.jv[jss::Account].asString());
297  auto const& passphrase = account.name();
298 
299  Json::Value jr;
300  if (params.isNull())
301  {
302  // Use the command line interface
303  auto const jv = boost::lexical_cast<std::string>(jt.jv);
304  jr = rpc("submit", passphrase, jv);
305  }
306  else
307  {
308  // Use the provided parameters, and go straight
309  // to the (RPC) client.
310  assert(params.isObject());
311  if (!params.isMember(jss::secret) && !params.isMember(jss::key_type) &&
312  !params.isMember(jss::seed) && !params.isMember(jss::seed_hex) &&
313  !params.isMember(jss::passphrase))
314  {
315  params[jss::secret] = passphrase;
316  }
317  params[jss::tx_json] = jt.jv;
318  jr = client().invoke("submit", params);
319  }
320  txid_.SetHex(jr[jss::result][jss::tx_json][jss::hash].asString());
321 
322  std::tie(ter_, didApply) = parseResult(jr);
323 
324  return postconditions(jt, ter_, didApply);
325 }
326 
327 void
328 Env::postconditions(JTx const& jt, TER ter, bool didApply)
329 {
330  if (jt.ter &&
331  !test.expect(
332  ter == *jt.ter,
333  "apply: " + transToken(ter) + " (" + transHuman(ter) + ") != " +
334  transToken(*jt.ter) + " (" + transHuman(*jt.ter) + ")"))
335  {
336  test.log << pretty(jt.jv) << std::endl;
337  // Don't check postconditions if
338  // we didn't get the expected result.
339  return;
340  }
341  if (trace_)
342  {
343  if (trace_ > 0)
344  --trace_;
345  test.log << pretty(jt.jv) << std::endl;
346  }
347  for (auto const& f : jt.requires)
348  f(*this);
349 }
350 
353 {
354  close();
355  auto const item = closed()->txRead(txid_);
356  return item.second;
357 }
358 
360 Env::tx() const
361 {
362  return current()->txRead(txid_).first;
363 }
364 
365 void
367 {
368  auto& jv = jt.jv;
369  if (jt.signer)
370  return jt.signer(*this, jt);
371  if (!jt.fill_sig)
372  return;
373  auto const account = lookup(jv[jss::Account].asString());
374  if (!app().checkSigs())
375  {
376  jv[jss::SigningPubKey] = strHex(account.pk().slice());
377  // dummy sig otherwise STTx is invalid
378  jv[jss::TxnSignature] = "00";
379  return;
380  }
381  auto const ar = le(account);
382  if (ar && ar->isFieldPresent(sfRegularKey))
383  jtx::sign(jv, lookup(ar->getAccountID(sfRegularKey)));
384  else
385  jtx::sign(jv, account);
386 }
387 
388 void
390 {
391  auto& jv = jt.jv;
392  if (jt.fill_fee)
393  jtx::fill_fee(jv, *current());
394  if (jt.fill_seq)
395  jtx::fill_seq(jv, *current());
396  // Must come last
397  try
398  {
399  autofill_sig(jt);
400  }
401  catch (parse_error const&)
402  {
403  test.log << "parse failed:\n" << pretty(jv) << std::endl;
404  Rethrow();
405  }
406 }
407 
409 Env::st(JTx const& jt)
410 {
411  // The parse must succeed, since we
412  // generated the JSON ourselves.
413  boost::optional<STObject> obj;
414  try
415  {
416  obj = jtx::parse(jt.jv);
417  }
418  catch (jtx::parse_error const&)
419  {
420  test.log << "Exception: parse_error\n" << pretty(jt.jv) << std::endl;
421  Rethrow();
422  }
423 
424  try
425  {
426  return sterilize(STTx{std::move(*obj)});
427  }
428  catch (std::exception const&)
429  {
430  }
431  return nullptr;
432 }
433 
436  std::vector<std::string> const& args,
438 {
439  return rpcClient(args, app().config(), app().logs(), headers).second;
440 }
441 
442 void
444 {
445  // Env::close() must be called for feature
446  // enable to take place.
447  app().config().features.insert(feature);
448 }
449 
450 } // namespace jtx
451 
452 } // namespace test
453 } // namespace ripple
ripple::test::jtx::Env::AppBundle::app
Application * app
Definition: Env.h:124
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:366
ripple::sfRegularKey
const SF_Account sfRegularKey(access, STI_ACCOUNT, 8, "RegularKey")
Definition: SField.h:483
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::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:677
ripple::test::jtx::Env::ter_
TER ter_
Definition: Env.h:636
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:128
ripple::test::jtx::Env::tx
std::shared_ptr< STTx const > tx() const
Return the tx data for the last JTx.
Definition: Env.cpp:360
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:576
ripple::test::jtx::Env::require
void require(Args const &... args)
Check a set of requirements.
Definition: Env.h:464
ripple::test::jtx::Env::apply
void apply(JsonValue &&jv, FN const &... fN)
Apply funclets and submit.
Definition: Env.h:496
ripple::test::jtx::Env::closed
std::shared_ptr< ReadView const > closed()
Returns the last closed ledger.
Definition: Env.cpp:105
std::pair
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:443
ripple::test::jtx::Env::AppBundle::timeKeeper
ManualTimeKeeper * timeKeeper
Definition: Env.h:126
ripple::sfSequence
const SF_U32 sfSequence(access, STI_UINT32, 4, "Sequence")
Definition: SField.h:355
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:635
ripple::test::jtx::Env::AppBundle::~AppBundle
~AppBundle()
Definition: Env.cpp:85
ripple::test::jtx::JTx::stx
std::shared_ptr< STTx const > stx
Definition: JTx.h:49
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:437
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:279
ripple::test::jtx::Env::journal
const beast::Journal journal
Definition: Env.h:141
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:151
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:292
ripple::test::jtx::Env::AppBundle::thread
std::thread thread
Definition: Env.h:127
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:164
Json::Value::isNull
bool isNull() const
isNull() tests to see if this field is null.
Definition: json_value.cpp:967
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:511
ripple::isTecClaim
bool isTecClaim(TER x)
Definition: TER.h:582
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:240
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:409
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:257
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:352
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:120
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:328
ripple::Application::config
virtual Config & config()=0
ripple::TERSubset< CanCvtToTER >
ripple::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition: JTx.h:41
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:43
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:269
ripple::STAmount
Definition: STAmount.h:42
ripple::base_uint::SetHex
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
Definition: base_uint.h:406
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::test::jtx::JTx::ter
boost::optional< TER > ter
Definition: JTx.h:45
ripple::Application::doStart
virtual void doStart(bool withTimers)=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:146
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:118
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:33
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:172
ripple::test::jtx::Env::seq
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
Definition: Env.cpp:188
ripple::test::jtx::Env::test
beast::unit_test::suite & test
Definition: Env.h:117
ripple::test::jtx::JTx::signer
std::function< void(Env &, JTx &)> signer
Definition: JTx.h:50
ripple::JobQueue::rendezvous
void rendezvous()
Block until no tasks running.
Definition: JobQueue.cpp:276
memory
ripple::transHuman
std::string transHuman(TER code)
Definition: TER.cpp:288
ripple::test::jtx::fee
Set the fee on a JTx.
Definition: fee.h:34
ripple::Serializer
Definition: Serializer.h:39
beast::severities::kError
@ kError
Definition: Journal.h:38
ripple::test::jtx::seq
Set the sequence number on a JTx.
Definition: seq.h:32
ripple::LedgerMaster::getClosedLedger
std::shared_ptr< Ledger const > getClosedLedger()
Definition: LedgerMaster.h:83
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:515
ripple::Config::features
std::unordered_set< uint256, beast::uhash<> > features
Definition: Config.h:181
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:389
ripple::sfBalance
const SF_Amount sfBalance(access, STI_AMOUNT, 2, "Balance")
Definition: SField.h:440
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:435
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:47
ripple::test::jtx::JTx::fill_sig
bool fill_sig
Definition: JTx.h:48
ripple::test::jtx::Env::close
bool close()
Close and advance the ledger.
Definition: Env.h:360
ripple::test::jtx::JTx::requires
requires_t requires
Definition: JTx.h:44
ripple::TERSubset< CanCvtToTER >::fromInt
static constexpr TERSubset fromInt(int from)
Definition: TER.h:341
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:209
ripple::test::jtx::Env::le
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition: Env.cpp:197
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:1513
ripple::test::jtx::Env::AppBundle::owned
std::unique_ptr< Application > owned
Definition: Env.h:125
ripple::test::jtx::Env::master
Account const & master
Definition: Env.h:119
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:125
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:67
ripple::NetworkOPs::acceptLedger
virtual std::uint32_t acceptLedger(boost::optional< std::chrono::milliseconds > consensusDelay=boost::none)=0
Accepts the current transaction tree, return the new ledger's sequence.
ripple::temMALFORMED
@ temMALFORMED
Definition: TER.h:82
beast::severities::kFatal
@ kFatal
Definition: Journal.h:39
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:140
std::unique_ptr
STL class.
ripple::test::jtx::JTx::fill_fee
bool fill_fee
Definition: JTx.h:46
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:297
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:2394
ripple::test::jtx::Env::AppBundle
Definition: Env.h:122
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:682
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:633
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469