rippled
Env.h
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 #ifndef RIPPLE_TEST_JTX_ENV_H_INCLUDED
21 #define RIPPLE_TEST_JTX_ENV_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/ledger/OpenLedger.h>
25 #include <ripple/app/main/Application.h>
26 #include <ripple/app/paths/Pathfinder.h>
27 #include <ripple/basics/Log.h>
28 #include <ripple/basics/chrono.h>
29 #include <ripple/beast/utility/Journal.h>
30 #include <ripple/core/Config.h>
31 #include <ripple/json/json_value.h>
32 #include <ripple/json/to_string.h>
33 #include <ripple/ledger/CachedSLEs.h>
34 #include <ripple/protocol/Feature.h>
35 #include <ripple/protocol/Indexes.h>
36 #include <ripple/protocol/Issue.h>
37 #include <ripple/protocol/STAmount.h>
38 #include <ripple/protocol/STObject.h>
39 #include <ripple/protocol/STTx.h>
40 #include <ripple/rpc/impl/RPCHelpers.h>
41 #include <functional>
42 #include <string>
43 #include <test/jtx/AbstractClient.h>
44 #include <test/jtx/Account.h>
45 #include <test/jtx/JTx.h>
46 #include <test/jtx/ManualTimeKeeper.h>
47 #include <test/jtx/amount.h>
48 #include <test/jtx/envconfig.h>
49 #include <test/jtx/require.h>
50 #include <test/jtx/tags.h>
51 #include <test/unit_test/SuiteJournal.h>
52 #include <tuple>
53 #include <type_traits>
54 #include <unordered_map>
55 #include <utility>
56 #include <vector>
57 
58 namespace ripple {
59 namespace test {
60 namespace jtx {
61 
63 template <class... Args>
64 std::array<Account, 1 + sizeof...(Args)>
65 noripple(Account const& account, Args const&... args)
66 {
67  return {{account, args...}};
68 }
69 
70 inline FeatureBitset
72 {
73  static const FeatureBitset ids = [] {
74  auto const& sa = ripple::detail::supportedAmendments();
76  feats.reserve(sa.size());
77  for (auto const& [s, vote] : sa)
78  {
79  (void)vote;
80  if (auto const f = getRegisteredFeature(s))
81  feats.push_back(*f);
82  else
83  Throw<std::runtime_error>(
84  "Unknown feature: " + s + " in supportedAmendments.");
85  }
86  return FeatureBitset(feats);
87  }();
88  return ids;
89 }
90 
91 //------------------------------------------------------------------------------
92 
93 class SuiteLogs : public Logs
94 {
95  beast::unit_test::suite& suite_;
96 
97 public:
98  explicit SuiteLogs(beast::unit_test::suite& suite)
99  : Logs(beast::severities::kError), suite_(suite)
100  {
101  }
102 
103  ~SuiteLogs() override = default;
104 
107  std::string const& partition,
109  {
110  return std::make_unique<SuiteJournalSink>(partition, threshold, suite_);
111  }
112 };
113 
114 //------------------------------------------------------------------------------
115 
117 class Env
118 {
119 public:
120  beast::unit_test::suite& test;
121 
123 
124 private:
125  struct AppBundle
126  {
127  Application* app = nullptr;
132 
133  AppBundle() = default;
134  AppBundle(
135  beast::unit_test::suite& suite,
139  ~AppBundle();
140  };
141 
143 
144 public:
146 
147  Env() = delete;
148  Env&
149  operator=(Env const&) = delete;
150  Env(Env const&) = delete;
151 
166  // VFALCO Could wrap the suite::log in a Journal here
167  Env(beast::unit_test::suite& suite_,
169  FeatureBitset features,
170  std::unique_ptr<Logs> logs = nullptr,
172  : test(suite_)
173  , bundle_(suite_, std::move(config), std::move(logs), thresh)
174  , journal{bundle_.app->journal("Env")}
175  {
179  features, [&appFeats = app().config().features](uint256 const& f) {
180  appFeats.insert(f);
181  });
182  }
183 
197  Env(beast::unit_test::suite& suite_, FeatureBitset features)
198  : Env(suite_, envconfig(), features)
199  {
200  }
201 
214  Env(beast::unit_test::suite& suite_,
216  std::unique_ptr<Logs> logs = nullptr,
218  : Env(suite_,
219  std::move(config),
221  std::move(logs),
222  thresh)
223  {
224  }
225 
235  Env(beast::unit_test::suite& suite_) : Env(suite_, envconfig())
236  {
237  }
238 
239  virtual ~Env() = default;
240 
241  Application&
242  app()
243  {
244  return *bundle_.app;
245  }
246 
247  Application const&
248  app() const
249  {
250  return *bundle_.app;
251  }
252 
255  {
256  return *bundle_.timeKeeper;
257  }
258 
265  now()
266  {
267  return timeKeeper().now();
268  }
269 
273  {
274  return *bundle_.client;
275  }
276 
282  template <class... Args>
284  rpc(unsigned apiVersion,
286  std::string const& cmd,
287  Args&&... args);
288 
289  template <class... Args>
291  rpc(unsigned apiVersion, std::string const& cmd, Args&&... args);
292 
293  template <class... Args>
296  std::string const& cmd,
297  Args&&... args);
298 
299  template <class... Args>
301  rpc(std::string const& cmd, Args&&... args);
302 
312  current() const
313  {
314  return app().openLedger().current();
315  }
316 
325  closed();
326 
346  bool
347  close(
348  NetClock::time_point closeTime,
349  std::optional<std::chrono::milliseconds> consensusDelay = std::nullopt);
350 
358  template <class Rep, class Period>
359  bool
361  {
362  // VFALCO Is this the correct time?
363  return close(now() + elapsed);
364  }
365 
373  bool
375  {
376  // VFALCO Is this the correct time?
377  return close(std::chrono::seconds(5));
378  }
379 
383  void
384  trace(int howMany = -1)
385  {
386  trace_ = howMany;
387  }
388 
390  void
392  {
393  trace_ = 0;
394  }
395 
397  void
399  {
400  app().checkSigs(false);
401  }
402 
404  void
405  memoize(Account const& account);
406 
409  Account const&
410  lookup(AccountID const& id) const;
411 
412  Account const&
413  lookup(std::string const& base58ID) const;
420  balance(Account const& account) const;
421 
427  seq(Account const& account) const;
428 
432  // VFALCO NOTE This should return a unit-less amount
434  balance(Account const& account, Issue const& issue) const;
435 
440  le(Account const& account) const;
441 
446  le(Keylet const& k) const;
447 
449  template <class JsonValue, class... FN>
450  JTx
451  jt(JsonValue&& jv, FN const&... fN)
452  {
453  JTx jt(std::forward<JsonValue>(jv));
454  invoke(jt, fN...);
455  autofill(jt);
456  jt.stx = st(jt);
457  return jt;
458  }
459 
461  template <class JsonValue, class... FN>
462  JTx
463  jtnofill(JsonValue&& jv, FN const&... fN)
464  {
465  JTx jt(std::forward<JsonValue>(jv));
466  invoke(jt, fN...);
467  autofill_sig(jt);
468  jt.stx = st(jt);
469  return jt;
470  }
471 
475  template <class JsonValue, class... FN>
477  json(JsonValue&& jv, FN const&... fN)
478  {
479  auto tj = jt(std::forward<JsonValue>(jv), fN...);
480  return std::move(tj.jv);
481  }
482 
488  template <class... Args>
489  void
490  require(Args const&... args)
491  {
492  jtx::required(args...)(*this);
493  }
494 
497  static std::pair<TER, bool>
498  parseResult(Json::Value const& jr);
499 
503  virtual void
504  submit(JTx const& jt);
505 
509  void
511 
515  void
516  postconditions(JTx const& jt, TER ter, bool didApply);
517 
520  template <class JsonValue, class... FN>
521  void
522  apply(JsonValue&& jv, FN const&... fN)
523  {
524  submit(jt(std::forward<JsonValue>(jv), fN...));
525  }
526 
527  template <class JsonValue, class... FN>
528  void
529  operator()(JsonValue&& jv, FN const&... fN)
530  {
531  apply(std::forward<JsonValue>(jv), fN...);
532  }
536  TER
537  ter() const
538  {
539  return ter_;
540  }
541 
551  meta();
552 
565  tx() const;
566 
567  void
568  enableFeature(uint256 const feature);
569 
570  void
571  disableFeature(uint256 const feature);
572 
573 private:
574  void
575  fund(bool setDefaultRipple, STAmount const& amount, Account const& account);
576 
577  void
578  fund_arg(STAmount const& amount, Account const& account)
579  {
580  fund(true, amount, account);
581  }
582 
583  template <std::size_t N>
584  void
585  fund_arg(STAmount const& amount, std::array<Account, N> const& list)
586  {
587  for (auto const& account : list)
588  fund(false, amount, account);
589  }
590 
591 public:
618  template <class Arg, class... Args>
619  void
620  fund(STAmount const& amount, Arg const& arg, Args const&... args)
621  {
622  fund_arg(amount, arg);
623  if constexpr (sizeof...(args) > 0)
624  fund(amount, args...);
625  }
626 
645  void
646  trust(STAmount const& amount, Account const& account);
647 
648  template <class... Accounts>
649  void
651  STAmount const& amount,
652  Account const& to0,
653  Account const& to1,
654  Accounts const&... toN)
655  {
656  trust(amount, to0);
657  trust(amount, to1, toN...);
658  }
661 protected:
662  int trace_ = 0;
666 
668  do_rpc(
669  unsigned apiVersion,
670  std::vector<std::string> const& args,
672 
673  void
674  autofill_sig(JTx& jt);
675 
676  virtual void
677  autofill(JTx& jt);
678 
687  st(JTx const& jt);
688 
689  // Invoke funclets on stx
690  // Note: The STTx may not be modified
691  template <class... FN>
692  void
693  invoke(STTx& stx, FN const&... fN)
694  {
695  (fN(*this, stx), ...);
696  }
697 
698  // Invoke funclets on jt
699  template <class... FN>
700  void
701  invoke(JTx& jt, FN const&... fN)
702  {
703  (fN(*this, jt), ...);
704  }
705 
706  // Map of account IDs to Account
708 };
709 
710 template <class... Args>
713  unsigned apiVersion,
715  std::string const& cmd,
716  Args&&... args)
717 {
718  return do_rpc(
719  apiVersion,
720  std::vector<std::string>{cmd, std::forward<Args>(args)...},
721  headers);
722 }
723 
724 template <class... Args>
726 Env::rpc(unsigned apiVersion, std::string const& cmd, Args&&... args)
727 {
728  return rpc(
729  apiVersion,
731  cmd,
732  std::forward<Args>(args)...);
733 }
734 
735 template <class... Args>
739  std::string const& cmd,
740  Args&&... args)
741 {
742  return do_rpc(
744  std::vector<std::string>{cmd, std::forward<Args>(args)...},
745  headers);
746 }
747 
748 template <class... Args>
750 Env::rpc(std::string const& cmd, Args&&... args)
751 {
752  return rpc(
754  cmd,
755  std::forward<Args>(args)...);
756 }
757 
762 template <class T>
763 concept SingleVersionedTestCallable = requires(T callable, unsigned int version)
764 {
765  {
766  callable(version)
767  }
768  ->std::same_as<void>;
769 };
770 
779 template <class... T>
780 concept VersionedTestCallable = (... && SingleVersionedTestCallable<T>);
781 void
783 {
784  for (auto testVersion = RPC::apiMinimumSupportedVersion;
785  testVersion <= RPC::apiMaximumValidVersion;
786  ++testVersion)
787  {
788  (..., testCallable(testVersion));
789  }
790 }
791 
792 } // namespace jtx
793 } // namespace test
794 } // namespace ripple
795 
796 #endif
ripple::test::jtx::Env::AppBundle::app
Application * app
Definition: Env.h:127
ripple::test::jtx::Env::invoke
void invoke(STTx &stx, FN const &... fN)
Definition: Env.h:693
ripple::Application
Definition: Application.h:116
ripple::Application::checkSigs
virtual bool checkSigs() const =0
ripple::test::jtx::Env::Env
Env(beast::unit_test::suite &suite_, FeatureBitset features)
Create Env with default config and specified features.
Definition: Env.h:197
ripple::test::jtx::Env::autofill_sig
void autofill_sig(JTx &jt)
Definition: Env.cpp:388
ripple::test::jtx::SuiteLogs::suite_
beast::unit_test::suite & suite_
Definition: Env.h:95
ripple::test::jtx::Env::fund
void fund(STAmount const &amount, Arg const &arg, Args const &... args)
Create a new account with some XRP.
Definition: Env.h:620
ripple::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:38
ripple::OpenLedger::current
std::shared_ptr< OpenView const > current() const
Returns a view to the current open ledger.
Definition: OpenLedger.cpp:50
ripple::Issue
A currency issued by an account.
Definition: Issue.h:35
std::string
STL class.
std::shared_ptr
STL class.
utility
ripple::Logs
Manages partitions for logging.
Definition: Log.h:48
ripple::test::jtx::Env::map_
std::unordered_map< AccountID, Account > map_
Definition: Env.h:707
ripple::test::jtx::Env::ter_
TER ter_
Definition: Env.h:665
ripple::test::AbstractClient
Definition: AbstractClient.h:33
ripple::test::jtx::Env::rpc
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
Definition: Env.h:712
ripple::test::jtx::Env::AppBundle::client
std::unique_ptr< AbstractClient > client
Definition: Env.h:131
ripple::test::jtx::Env::tx
std::shared_ptr< STTx const > tx() const
Return the tx data for the last JTx.
Definition: Env.cpp:382
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
functional
ripple::test::jtx::Env::require
void require(Args const &... args)
Check a set of requirements.
Definition: Env.h:490
ripple::test::jtx::Env::apply
void apply(JsonValue &&jv, FN const &... fN)
Apply funclets and submit.
Definition: Env.h:522
ripple::test::jtx::Env::closed
std::shared_ptr< ReadView const > closed()
Returns the last closed ledger.
Definition: Env.cpp:115
std::pair
std::vector::reserve
T reserve(T... args)
ripple::test::jtx::Env::fund_arg
void fund_arg(STAmount const &amount, std::array< Account, N > const &list)
Definition: Env.h:585
ripple::test::jtx::Env::AppBundle::AppBundle
AppBundle()=default
vector
ripple::test::jtx::Env::enableFeature
void enableFeature(uint256 const feature)
Definition: Env.cpp:472
ripple::test::jtx::Env::AppBundle::timeKeeper
ManualTimeKeeper * timeKeeper
Definition: Env.h:129
ripple::test::jtx::Env::txid_
uint256 txid_
Definition: Env.h:664
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::test::jtx::Env::jt
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Definition: Env.h:451
std::chrono::duration
ripple::test::ManualTimeKeeper::now
time_point now() const override
Definition: ManualTimeKeeper.h:38
ripple::test::jtx::Env::journal
const beast::Journal journal
Definition: Env.h:145
ripple::test::jtx::Env::notrace
void notrace()
Turn off JSON tracing.
Definition: Env.h:391
ripple::test::jtx::Env::disable_sigs
void disable_sigs()
Turn off signature checks.
Definition: Env.h:398
ripple::test::jtx::Env::timeKeeper
ManualTimeKeeper & timeKeeper()
Definition: Env.h:254
ripple::test::jtx::SuiteLogs::~SuiteLogs
~SuiteLogs() override=default
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:311
tuple
ripple::test::jtx::Env::AppBundle::thread
std::thread thread
Definition: Env.h:130
ripple::Pathfinder::initPathTable
static void initPathTable()
Definition: Pathfinder.cpp:1300
ripple::test::jtx::forAllApiVersions
void forAllApiVersions(VersionedTestCallable auto... testCallable)
Definition: Env.h:782
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:183
ripple::test::jtx::Env::app
Application & app()
Definition: Env.h:242
ripple::test::jtx::envconfig
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition: envconfig.h:49
ripple::RPC::apiCommandLineVersion
constexpr unsigned int apiCommandLineVersion
Definition: RPCHelpers.h:238
ripple::Application::openLedger
virtual OpenLedger & openLedger()=0
ripple::test::jtx::Env::bundle_
AppBundle bundle_
Definition: Env.h:142
ripple::test::jtx::Env::ter
TER ter() const
Return the TER for the last JTx.
Definition: Env.h:537
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:259
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:436
ripple::requires
requires(T::ConsequencesFactory==Transactor::Normal) TxConsequences consequences_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:181
ripple::test::jtx::Env::Env
Env(beast::unit_test::suite &suite_, std::unique_ptr< Config > config, FeatureBitset features, std::unique_ptr< Logs > logs=nullptr, beast::severities::Severity thresh=beast::severities::kError)
Create Env using suite, Config pointer, and explicit features.
Definition: Env.h:167
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:276
std::vector::push_back
T push_back(T... args)
ripple::test::ManualTimeKeeper
Definition: ManualTimeKeeper.h:29
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:82
ripple::test::jtx::SuiteLogs::SuiteLogs
SuiteLogs(beast::unit_test::suite &suite)
Definition: Env.h:98
ripple::test::jtx::Env::stopwatch_
TestStopwatch stopwatch_
Definition: Env.h:663
ripple::test::jtx::Env::meta
std::shared_ptr< STObject const > meta()
Return metadata for the last JTx.
Definition: Env.cpp:374
ripple::foreachFeature
void foreachFeature(FeatureBitset bs, F &&f)
Definition: Feature.h:298
ripple::test::jtx::Env::close
bool close(std::chrono::duration< Rep, Period > const &elapsed)
Close and advance the ledger.
Definition: Env.h:360
ripple::test::jtx::Env::operator()
void operator()(JsonValue &&jv, FN const &... fN)
Definition: Env.h:529
std::thread
STL class.
ripple::test::jtx::Env::trace
void trace(int howMany=-1)
Turn on JSON tracing.
Definition: Env.h:384
ripple::test::jtx::Env::postconditions
void postconditions(JTx const &jt, TER ter, bool didApply)
Check expected postconditions of JTx submission.
Definition: Env.cpp:349
ripple::TERSubset< CanCvtToTER >
ripple::test::jtx::SuiteLogs
Definition: Env.h:93
ripple::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition: JTx.h:42
std::array
STL class.
ripple::test::jtx::Env::submit
virtual void submit(JTx const &jt)
Submit an existing JTx.
Definition: Env.cpp:288
ripple::STAmount
Definition: STAmount.h:46
std::chrono::time_point
ripple::STTx
Definition: STTx.h:46
ripple::test::jtx::Env::lookup
Account const & lookup(AccountID const &id) const
Returns the Account given the AccountID.
Definition: Env.cpp:162
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::test::jtx::supported_amendments
FeatureBitset supported_amendments()
Definition: Env.h:71
std::uint32_t
ripple::test::jtx::Account::master
static const Account master
The master account.
Definition: Account.h:47
ripple::test::jtx::Env::seq
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
Definition: Env.cpp:207
ripple::test::jtx::Env::app
Application const & app() const
Definition: Env.h:248
ripple::test::jtx::Env::test
beast::unit_test::suite & test
Definition: Env.h:120
ripple::test::jtx::Env::invoke
void invoke(JTx &jt, FN const &... fN)
Definition: Env.h:701
ripple::test::jtx::required
require_t required(Args const &... args)
Compose many condition functors into one.
Definition: require.h:47
ripple::test::jtx::Env::client
AbstractClient & client()
Returns the connected client.
Definition: Env.h:272
beast::severities::kError
@ kError
Definition: Journal.h:38
ripple::Logs::threshold
beast::severities::Severity threshold() const
Definition: Log.cpp:150
ripple::test::jtx::VersionedTestCallable
concept VersionedTestCallable
The VersionedTestCallable concept checks if a set of callables all satisfy the SingleVersionedTestCal...
Definition: Env.h:780
ripple::RPC::apiMinimumSupportedVersion
constexpr unsigned int apiMinimumSupportedVersion
Definition: RPCHelpers.h:236
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::Env::operator=
Env & operator=(Env const &)=delete
ripple::Application::journal
virtual beast::Journal journal(std::string const &name)=0
ripple::test::jtx::noripple
std::array< Account, 1+sizeof...(Args)> noripple(Account const &account, Args const &... args)
Designate accounts as no-ripple in Env::fund.
Definition: Env.h:65
ripple::test::jtx::Env::autofill
virtual void autofill(JTx &jt)
Definition: Env.cpp:411
ripple::test::jtx::Env::now
NetClock::time_point now()
Returns the current network time.
Definition: Env.h:265
ripple::RPC::apiMaximumValidVersion
constexpr unsigned int apiMaximumValidVersion
Definition: RPCHelpers.h:240
ripple::test::jtx::Env::close
bool close()
Close and advance the ledger.
Definition: Env.h:374
beast::severities::Severity
Severity
Severity level / threshold of a Journal message.
Definition: Journal.h:31
ripple::test::jtx::SingleVersionedTestCallable
concept SingleVersionedTestCallable
The SingleVersionedTestCallable concept checks for a callable that takes an unsigned integer as its a...
Definition: Env.h:763
std
STL namespace.
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:228
ripple::test::jtx::Env::le
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition: Env.cpp:216
ripple::test::jtx::Env::AppBundle::owned
std::unique_ptr< Application > owned
Definition: Env.h:128
ripple::test::jtx::Env::master
Account const & master
Definition: Env.h:122
Json::nullValue
@ nullValue
'null' value
Definition: json_value.h:36
ripple::FeatureBitset
Definition: Feature.h:113
ripple::test::jtx::Env::Env
Env(beast::unit_test::suite &suite_)
Create Env with only the current test suite.
Definition: Env.h:235
std::optional< std::chrono::milliseconds >
ripple::test::jtx::Env::disableFeature
void disableFeature(uint256 const feature)
Definition: Env.cpp:480
ripple::test::jtx::Env::~Env
virtual ~Env()=default
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::test::jtx::Env::fund_arg
void fund_arg(STAmount const &amount, Account const &account)
Definition: Env.h:578
beast::manual_clock< std::chrono::steady_clock >
ripple::getRegisteredFeature
std::optional< uint256 > getRegisteredFeature(std::string const &name)
Definition: Feature.cpp:342
ripple::test::jtx::Env::memoize
void memoize(Account const &account)
Associate AccountID with account.
Definition: Env.cpp:156
ripple::test::jtx::Env::Env
Env()=delete
std::unique_ptr< beast::Journal::Sink >
unordered_map
ripple::test::jtx::Env::jtnofill
JTx jtnofill(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Definition: Env.h:463
ripple::test::jtx::SuiteLogs::makeSink
std::unique_ptr< beast::Journal::Sink > makeSink(std::string const &partition, beast::severities::Severity threshold) override
Definition: Env.h:106
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:236
type_traits
ripple::detail::supportedAmendments
std::map< std::string, VoteBehavior > const & supportedAmendments()
Amendments that this server supports and the default voting behavior.
Definition: Feature.cpp:320
ripple::test::jtx::Env::current
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition: Env.h:312
ripple::test::jtx::Env::json
Json::Value json(JsonValue &&jv, FN const &... fN)
Create JSON from parameters.
Definition: Env.h:477
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &to0, Account const &to1, Accounts const &... toN)
Definition: Env.h:650
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:117
ripple::test::jtx::Env::do_rpc
Json::Value do_rpc(unsigned apiVersion, std::vector< std::string > const &args, std::unordered_map< std::string, std::string > const &headers={})
Definition: Env.cpp:462
ripple::test::jtx::Env::AppBundle
Definition: Env.h:125
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:662
ripple::test::jtx::Env::Env
Env(beast::unit_test::suite &suite_, std::unique_ptr< Config > config, std::unique_ptr< Logs > logs=nullptr, beast::severities::Severity thresh=beast::severities::kError)
Create Env using suite and Config pointer.
Definition: Env.h:214
beast
Definition: base_uint.h:641
string