rippled
compression_test.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright 2020 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/Ledger.h>
21 #include <ripple/app/ledger/LedgerMaster.h>
22 #include <ripple/app/misc/Manifest.h>
23 #include <ripple/beast/unit_test.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/core/TimeKeeper.h>
26 #include <ripple/overlay/Compression.h>
27 #include <ripple/overlay/Message.h>
28 #include <ripple/overlay/impl/Handshake.h>
29 #include <ripple/overlay/impl/ProtocolMessage.h>
30 #include <ripple/overlay/impl/ZeroCopyStream.h>
31 #include <ripple/protocol/HashPrefix.h>
32 #include <ripple/protocol/PublicKey.h>
33 #include <ripple/protocol/SecretKey.h>
34 #include <ripple/protocol/Sign.h>
35 #include <ripple/protocol/digest.h>
36 #include <ripple/protocol/jss.h>
37 #include <ripple/shamap/SHAMapNodeID.h>
38 #include <boost/asio/ip/address_v4.hpp>
39 #include <boost/beast/core/multi_buffer.hpp>
40 #include <boost/endian/conversion.hpp>
41 #include <algorithm>
42 #include <ripple.pb.h>
43 #include <test/jtx/Account.h>
44 #include <test/jtx/Env.h>
45 #include <test/jtx/WSClient.h>
46 #include <test/jtx/amount.h>
47 #include <test/jtx/pay.h>
48 
49 namespace ripple {
50 
51 namespace test {
52 
53 using namespace ripple::test;
54 using namespace ripple::test::jtx;
55 
56 static uint256
57 ledgerHash(LedgerInfo const& info)
58 {
59  return ripple::sha512Half(
61  std::uint32_t(info.seq),
62  std::uint64_t(info.drops.drops()),
63  info.parentHash,
64  info.txHash,
65  info.accountHash,
69  std::uint8_t(info.closeFlags));
70 }
71 
72 class compression_test : public beast::unit_test::suite
73 {
76 
77 public:
79  {
80  }
81 
82  template <typename T>
83  void
85  std::shared_ptr<T> proto,
86  protocol::MessageType mt,
87  uint16_t nbuffers,
88  std::string msg)
89  {
90  testcase("Compress/Decompress: " + msg);
91 
92  Message m(*proto, mt);
93 
94  auto& buffer = m.getBuffer(Compressed::On);
95 
96  boost::beast::multi_buffer buffers;
97 
98  // simulate multi-buffer
99  auto sz = buffer.size() / nbuffers;
100  for (int i = 0; i < nbuffers; i++)
101  {
102  auto start = buffer.begin() + sz * i;
103  auto end = i < nbuffers - 1 ? (buffer.begin() + sz * (i + 1))
104  : buffer.end();
105  std::vector<std::uint8_t> slice(start, end);
106  buffers.commit(boost::asio::buffer_copy(
107  buffers.prepare(slice.size()), boost::asio::buffer(slice)));
108  }
109 
110  boost::system::error_code ec;
112  ec, buffers.data(), buffer.size());
113 
114  BEAST_EXPECT(header);
115 
116  if (!header || header->algorithm == Algorithm::None)
117  return;
118 
119  std::vector<std::uint8_t> decompressed;
120  decompressed.resize(header->uncompressed_size);
121 
122  BEAST_EXPECT(
123  header->payload_wire_size == buffer.size() - header->header_size);
124 
125  ZeroCopyInputStream stream(buffers.data());
126  stream.Skip(header->header_size);
127 
128  auto decompressedSize = ripple::compression::decompress(
129  stream,
130  header->payload_wire_size,
131  decompressed.data(),
132  header->uncompressed_size);
133  BEAST_EXPECT(decompressedSize == header->uncompressed_size);
134  auto const proto1 = std::make_shared<T>();
135 
136  BEAST_EXPECT(
137  proto1->ParseFromArray(decompressed.data(), decompressedSize));
138  auto uncompressed = m.getBuffer(Compressed::Off);
139  BEAST_EXPECT(std::equal(
140  uncompressed.begin() + ripple::compression::headerBytes,
141  uncompressed.end(),
142  decompressed.begin()));
143  }
144 
147  {
148  auto manifests = std::make_shared<protocol::TMManifests>();
149  manifests->mutable_list()->Reserve(n);
150  for (int i = 0; i < n; i++)
151  {
152  auto master = randomKeyPair(KeyType::ed25519);
153  auto signing = randomKeyPair(KeyType::ed25519);
154  STObject st(sfGeneric);
155  st[sfSequence] = i;
156  st[sfPublicKey] = std::get<0>(master);
157  st[sfSigningPubKey] = std::get<0>(signing);
158  st[sfDomain] = makeSlice(
159  std::string("example") + std::to_string(i) +
160  std::string(".com"));
161  sign(
162  st,
165  std::get<1>(master),
167  sign(
168  st,
171  std::get<1>(signing));
172  Serializer s;
173  st.add(s);
174  auto* manifest = manifests->add_list();
175  manifest->set_stobject(s.data(), s.size());
176  }
177  return manifests;
178  }
179 
182  {
183  auto endpoints = std::make_shared<protocol::TMEndpoints>();
184  endpoints->mutable_endpoints_v2()->Reserve(n);
185  for (int i = 0; i < n; i++)
186  {
187  auto ep = endpoints->add_endpoints_v2();
188  ep->set_endpoint(std::string("10.0.1.") + std::to_string(i));
189  ep->set_hops(i);
190  }
191  endpoints->set_version(2);
192 
193  return endpoints;
194  }
195 
198  {
199  Env env(*this, envconfig());
200  int fund = 10000;
201  auto const alice = Account("alice");
202  auto const bob = Account("bob");
203  env.fund(XRP(fund), "alice", "bob");
204  env.trust(bob["USD"](fund), alice);
205  env.close();
206 
207  auto toBinary = [this](std::string const& text) {
208  auto blob = strUnHex(text);
209  BEAST_EXPECT(blob);
210  return std::string{
211  reinterpret_cast<char const*>(blob->data()), blob->size()};
212  };
213 
214  std::string usdTxBlob = "";
215  auto wsc = makeWSClient(env.app().config());
216  {
217  Json::Value jrequestUsd;
218  jrequestUsd[jss::secret] = toBase58(generateSeed("bob"));
219  jrequestUsd[jss::tx_json] =
220  pay("bob", "alice", bob["USD"](fund / 2));
221  Json::Value jreply_usd = wsc->invoke("sign", jrequestUsd);
222 
223  usdTxBlob =
224  toBinary(jreply_usd[jss::result][jss::tx_blob].asString());
225  }
226 
227  auto transaction = std::make_shared<protocol::TMTransaction>();
228  transaction->set_rawtransaction(usdTxBlob);
229  transaction->set_status(protocol::tsNEW);
230  auto tk = make_TimeKeeper(logs.journal("TimeKeeper"));
231  transaction->set_receivetimestamp(tk->now().time_since_epoch().count());
232  transaction->set_deferred(true);
233 
234  return transaction;
235  }
236 
239  {
240  auto getLedger = std::make_shared<protocol::TMGetLedger>();
241  getLedger->set_itype(protocol::liTS_CANDIDATE);
242  getLedger->set_ltype(protocol::TMLedgerType::ltACCEPTED);
243  uint256 const hash(ripple::sha512Half(123456789));
244  getLedger->set_ledgerhash(hash.begin(), hash.size());
245  getLedger->set_ledgerseq(123456789);
246  ripple::SHAMapNodeID sha(64, hash);
247  getLedger->add_nodeids(sha.getRawString());
248  getLedger->set_requestcookie(123456789);
249  getLedger->set_querytype(protocol::qtINDIRECT);
250  getLedger->set_querydepth(3);
251  return getLedger;
252  }
253 
255  buildLedgerData(uint32_t n, Logs& logs)
256  {
257  auto ledgerData = std::make_shared<protocol::TMLedgerData>();
258  uint256 const hash(ripple::sha512Half(12356789));
259  ledgerData->set_ledgerhash(hash.data(), hash.size());
260  ledgerData->set_ledgerseq(123456789);
261  ledgerData->set_type(protocol::TMLedgerInfoType::liAS_NODE);
262  ledgerData->set_requestcookie(123456789);
263  ledgerData->set_error(protocol::TMReplyError::reNO_LEDGER);
264  ledgerData->mutable_nodes()->Reserve(n);
265  uint256 parentHash(0);
266  for (int i = 0; i < n; i++)
267  {
268  LedgerInfo info;
269  auto tk = make_TimeKeeper(logs.journal("TimeKeeper"));
270  info.seq = i;
271  info.parentCloseTime = tk->now();
272  info.hash = ripple::sha512Half(i);
273  info.txHash = ripple::sha512Half(i + 1);
274  info.accountHash = ripple::sha512Half(i + 2);
275  info.parentHash = parentHash;
276  info.drops = XRPAmount(10);
277  info.closeTimeResolution = tk->now().time_since_epoch();
278  info.closeTime = tk->now();
279  parentHash = ledgerHash(info);
280  Serializer nData;
281  ripple::addRaw(info, nData);
282  ledgerData->add_nodes()->set_nodedata(
283  nData.getDataPtr(), nData.getLength());
284  }
285 
286  return ledgerData;
287  }
288 
291  {
292  auto getObject = std::make_shared<protocol::TMGetObjectByHash>();
293 
294  getObject->set_type(protocol::TMGetObjectByHash_ObjectType::
295  TMGetObjectByHash_ObjectType_otTRANSACTION);
296  getObject->set_query(true);
297  getObject->set_seq(123456789);
298  uint256 hash(ripple::sha512Half(123456789));
299  getObject->set_ledgerhash(hash.data(), hash.size());
300  getObject->set_fat(true);
301  for (int i = 0; i < 100; i++)
302  {
303  uint256 hash(ripple::sha512Half(i));
304  auto object = getObject->add_objects();
305  object->set_hash(hash.data(), hash.size());
306  ripple::SHAMapNodeID sha(64, hash);
307  object->set_nodeid(sha.getRawString());
308  object->set_index("");
309  object->set_data("");
310  object->set_ledgerseq(i);
311  }
312  return getObject;
313  }
314 
317  {
318  auto list = std::make_shared<protocol::TMValidatorList>();
319 
320  auto master = randomKeyPair(KeyType::ed25519);
321  auto signing = randomKeyPair(KeyType::ed25519);
322  STObject st(sfGeneric);
323  st[sfSequence] = 0;
324  st[sfPublicKey] = std::get<0>(master);
325  st[sfSigningPubKey] = std::get<0>(signing);
326  st[sfDomain] = makeSlice(std::string("example.com"));
327  sign(
328  st,
331  std::get<1>(master),
333  sign(st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing));
334  Serializer s;
335  st.add(s);
336  list->set_manifest(s.data(), s.size());
337  list->set_version(3);
338  STObject signature(sfSignature);
339  ripple::sign(
340  st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing));
341  Serializer s1;
342  st.add(s1);
343  list->set_signature(s1.data(), s1.size());
344  list->set_blob(strHex(s.getString()));
345  return list;
346  }
347 
350  {
351  auto list = std::make_shared<protocol::TMValidatorListCollection>();
352 
353  auto master = randomKeyPair(KeyType::ed25519);
354  auto signing = randomKeyPair(KeyType::ed25519);
355  STObject st(sfGeneric);
356  st[sfSequence] = 0;
357  st[sfPublicKey] = std::get<0>(master);
358  st[sfSigningPubKey] = std::get<0>(signing);
359  st[sfDomain] = makeSlice(std::string("example.com"));
360  sign(
361  st,
364  std::get<1>(master),
366  sign(st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing));
367  Serializer s;
368  st.add(s);
369  list->set_manifest(s.data(), s.size());
370  list->set_version(4);
371  STObject signature(sfSignature);
372  ripple::sign(
373  st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing));
374  Serializer s1;
375  st.add(s1);
376  auto& blob = *list->add_blobs();
377  blob.set_signature(s1.data(), s1.size());
378  blob.set_blob(strHex(s.getString()));
379  return list;
380  }
381 
382  void
384  {
385  auto thresh = beast::severities::Severity::kInfo;
386  auto logs = std::make_unique<Logs>(thresh);
387 
388  protocol::TMManifests manifests;
389  protocol::TMEndpoints endpoints;
390  protocol::TMTransaction transaction;
391  protocol::TMGetLedger get_ledger;
392  protocol::TMLedgerData ledger_data;
393  protocol::TMGetObjectByHash get_object;
394  protocol::TMValidatorList validator_list;
395  protocol::TMValidatorListCollection validator_list_collection;
396 
397  // 4.5KB
398  doTest(buildManifests(20), protocol::mtMANIFESTS, 4, "TMManifests20");
399  // 22KB
400  doTest(buildManifests(100), protocol::mtMANIFESTS, 4, "TMManifests100");
401  // 131B
402  doTest(buildEndpoints(10), protocol::mtENDPOINTS, 4, "TMEndpoints10");
403  // 1.3KB
404  doTest(buildEndpoints(100), protocol::mtENDPOINTS, 4, "TMEndpoints100");
405  // 242B
406  doTest(
407  buildTransaction(*logs),
408  protocol::mtTRANSACTION,
409  1,
410  "TMTransaction");
411  // 87B
412  doTest(buildGetLedger(), protocol::mtGET_LEDGER, 1, "TMGetLedger");
413  // 61KB
414  doTest(
415  buildLedgerData(500, *logs),
416  protocol::mtLEDGER_DATA,
417  10,
418  "TMLedgerData500");
419  // 122 KB
420  doTest(
421  buildLedgerData(1000, *logs),
422  protocol::mtLEDGER_DATA,
423  20,
424  "TMLedgerData1000");
425  // 1.2MB
426  doTest(
427  buildLedgerData(10000, *logs),
428  protocol::mtLEDGER_DATA,
429  50,
430  "TMLedgerData10000");
431  // 12MB
432  doTest(
433  buildLedgerData(100000, *logs),
434  protocol::mtLEDGER_DATA,
435  100,
436  "TMLedgerData100000");
437  // 61MB
438  doTest(
439  buildLedgerData(500000, *logs),
440  protocol::mtLEDGER_DATA,
441  100,
442  "TMLedgerData500000");
443  // 7.7KB
444  doTest(
445  buildGetObjectByHash(),
446  protocol::mtGET_OBJECTS,
447  4,
448  "TMGetObjectByHash");
449  // 895B
450  doTest(
451  buildValidatorList(),
452  protocol::mtVALIDATORLIST,
453  4,
454  "TMValidatorList");
455  doTest(
456  buildValidatorListCollection(),
457  protocol::mtVALIDATORLISTCOLLECTION,
458  4,
459  "TMValidatorListCollection");
460  }
461 
462  void
464  {
465  testcase("Handshake");
466  auto getEnv = [&](bool enable) {
467  Config c;
468  std::stringstream str;
469  str << "[reduce_relay]\n"
470  << "vp_enable=1\n"
471  << "vp_squelch=1\n"
472  << "[compression]\n"
473  << enable << "\n";
474  c.loadFromString(str.str());
475  auto env = std::make_shared<jtx::Env>(*this);
476  env->app().config().COMPRESSION = c.COMPRESSION;
477  env->app().config().VP_REDUCE_RELAY_ENABLE =
479  env->app().config().VP_REDUCE_RELAY_SQUELCH =
481  return env;
482  };
483  auto handshake = [&](int outboundEnable, int inboundEnable) {
484  beast::IP::Address addr =
485  boost::asio::ip::address::from_string("172.1.1.100");
486 
487  auto env = getEnv(outboundEnable);
488  auto request = ripple::makeRequest(
489  true,
490  env->app().config().COMPRESSION,
491  false,
492  env->app().config().TX_REDUCE_RELAY_ENABLE,
493  env->app().config().VP_REDUCE_RELAY_ENABLE);
494  http_request_type http_request;
495  http_request.version(request.version());
496  http_request.base() = request.base();
497  // feature enabled on the peer's connection only if both sides are
498  // enabled
499  auto const peerEnabled = inboundEnable && outboundEnable;
500  // inbound is enabled if the request's header has the feature
501  // enabled and the peer's configuration is enabled
502  auto const inboundEnabled = peerFeatureEnabled(
503  http_request, FEATURE_COMPR, "lz4", inboundEnable);
504  BEAST_EXPECT(!(peerEnabled ^ inboundEnabled));
505 
506  env.reset();
507  env = getEnv(inboundEnable);
508  auto http_resp = ripple::makeResponse(
509  true,
510  http_request,
511  addr,
512  addr,
513  uint256{1},
514  1,
515  {1, 0},
516  env->app());
517  // outbound is enabled if the response's header has the feature
518  // enabled and the peer's configuration is enabled
519  auto const outboundEnabled = peerFeatureEnabled(
520  http_resp, FEATURE_COMPR, "lz4", outboundEnable);
521  BEAST_EXPECT(!(peerEnabled ^ outboundEnabled));
522  };
523  handshake(1, 1);
524  handshake(1, 0);
525  handshake(0, 1);
526  handshake(0, 0);
527  }
528 
529  void
530  run() override
531  {
532  testProtocol();
533  testHandshake();
534  }
535 };
536 
537 BEAST_DEFINE_TESTSUITE_MANUAL(compression, ripple_data, ripple);
538 
539 } // namespace test
540 } // namespace ripple
ripple::test::ledgerHash
static uint256 ledgerHash(LedgerInfo const &info)
Definition: compression_test.cpp:57
std::vector::resize
T resize(T... args)
ripple::HashPrefix::ledgerMaster
@ ledgerMaster
ledger master data for signing
ripple::test::jtx::XRP
const XRP_t XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:105
ripple::Message::getBuffer
std::vector< uint8_t > const & getBuffer(Compressed tryCompressed)
Retrieve the packed message data.
Definition: Message.cpp:210
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:241
std::string
STL class.
std::equal
T equal(T... args)
std::shared_ptr
STL class.
ripple::LedgerInfo::parentHash
uint256 parentHash
Definition: ReadView.h:94
ripple::test::compression_test::doTest
void doTest(std::shared_ptr< T > proto, protocol::MessageType mt, uint16_t nbuffers, std::string msg)
Definition: compression_test.cpp:84
ripple::Logs
Manages partitions for logging.
Definition: Log.h:48
ripple::test::compression_test::buildEndpoints
std::shared_ptr< protocol::TMEndpoints > buildEndpoints(int n)
Definition: compression_test.cpp:181
ripple::sfGeneric
const SField sfGeneric(access, 0)
Definition: SField.h:327
ripple::test::compression_test::testProtocol
void testProtocol()
Definition: compression_test.cpp:383
ripple::test::compression_test::buildLedgerData
std::shared_ptr< protocol::TMLedgerData > buildLedgerData(uint32_t n, Logs &logs)
Definition: compression_test.cpp:255
ripple::LedgerInfo::hash
uint256 hash
Definition: ReadView.h:91
ripple::XRPAmount::drops
constexpr value_type drops() const
Returns the number of drops.
Definition: XRPAmount.h:172
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::HashPrefix::manifest
@ manifest
Manifest.
ripple::addRaw
void addRaw(LedgerInfo const &info, Serializer &s, bool includeHash)
Definition: View.cpp:162
std::vector
STL class.
std::vector::size
T size(T... args)
ripple::Serializer::getString
std::string getString() const
Definition: Serializer.h:204
ripple::compression::headerBytes
constexpr std::size_t headerBytes
Definition: Compression.h:31
ripple::sfSigningPubKey
const SF_VL sfSigningPubKey
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:104
std::stringstream
STL class.
ripple::test::compression_test::buildValidatorList
std::shared_ptr< protocol::TMValidatorList > buildValidatorList()
Definition: compression_test.cpp:316
ripple::test::compression_test::compression_test
compression_test()
Definition: compression_test.cpp:78
ripple::ZeroCopyInputStream
Implements ZeroCopyInputStream around a buffer sequence.
Definition: ZeroCopyStream.h:35
ripple::test::jtx::Env::app
Application & app()
Definition: Env.h:241
ripple::LedgerInfo::seq
LedgerIndex seq
Definition: ReadView.h:83
ripple::test::compression_test::buildGetObjectByHash
std::shared_ptr< protocol::TMGetObjectByHash > buildGetObjectByHash()
Definition: compression_test.cpp:290
ripple::SHAMapNodeID
Identifies a node inside a SHAMap.
Definition: SHAMapNodeID.h:33
ripple::test::jtx::envconfig
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition: envconfig.h:49
ripple::test::jtx::sign
void sign(Json::Value &jv, Account const &account)
Sign automatically.
Definition: utility.cpp:44
ripple::test::compression_test
Definition: compression_test.cpp:72
ripple::LedgerInfo::txHash
uint256 txHash
Definition: ReadView.h:92
ripple::base_uint::data
pointer data()
Definition: base_uint.h:122
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:259
algorithm
ripple::base_uint::size
constexpr static std::size_t size()
Definition: base_uint.h:519
ripple::Config::VP_REDUCE_RELAY_SQUELCH
bool VP_REDUCE_RELAY_SQUELCH
Definition: Config.h:262
ripple::Serializer::data
void const * data() const noexcept
Definition: Serializer.h:75
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
ripple::LedgerInfo::closeTime
NetClock::time_point closeTime
Definition: ReadView.h:114
ripple::KeyType::ed25519
@ ed25519
ripple::base_uint< 256 >
ripple::test::compression_test::run
void run() override
Definition: compression_test.cpp:530
std::chrono::time_point::time_since_epoch
T time_since_epoch(T... args)
ripple::test::compression_test::buildValidatorListCollection
std::shared_ptr< protocol::TMValidatorListCollection > buildValidatorListCollection()
Definition: compression_test.cpp:349
ripple::Config::loadFromString
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Definition: Config.cpp:457
beast::IP::Address
boost::asio::ip::address Address
Definition: IPAddress.h:41
ripple::Config
Definition: Config.h:89
ripple::Serializer::getDataPtr
const void * getDataPtr() const
Definition: Serializer.h:189
ripple::sfMasterSignature
const SF_VL sfMasterSignature
ripple::Application::config
virtual Config & config()=0
ripple::SHAMapNodeID::getRawString
std::string getRawString() const
Definition: SHAMapNodeID.cpp:65
ripple::LedgerInfo::closeFlags
int closeFlags
Definition: ReadView.h:105
std::to_string
T to_string(T... args)
ripple::test::jtx::Env::close
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Definition: Env.cpp:121
ripple::FEATURE_COMPR
static constexpr char FEATURE_COMPR[]
Definition: Handshake.h:142
ripple::compression::Compressed
Compressed
Definition: Compression.h:38
ripple::peerFeatureEnabled
bool peerFeatureEnabled(headers const &request, std::string const &feature, std::string value, bool config)
Check if a feature should be enabled for a peer.
Definition: Handshake.h:199
std::uint32_t
ripple::compression::Algorithm
Algorithm
Definition: Compression.h:36
ripple::test::compression_test::buildTransaction
std::shared_ptr< protocol::TMTransaction > buildTransaction(Logs &logs)
Definition: compression_test.cpp:197
ripple::LedgerInfo::drops
XRPAmount drops
Definition: ReadView.h:96
ripple::Config::VP_REDUCE_RELAY_ENABLE
bool VP_REDUCE_RELAY_ENABLE
Definition: Config.h:253
ripple::Serializer
Definition: Serializer.h:39
ripple::Message
Definition: overlay/Message.h:53
ripple::randomKeyPair
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Definition: SecretKey.cpp:368
ripple::generateSeed
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.
Definition: Seed.cpp:69
ripple::test::compression_test::buildGetLedger
std::shared_ptr< protocol::TMGetLedger > buildGetLedger()
Definition: compression_test.cpp:238
ripple::STObject::add
void add(Serializer &s) const override
Definition: STObject.cpp:85
ripple::STObject
Definition: STObject.h:51
ripple::compression::decompress
std::size_t decompress(InputStream &in, std::size_t inSize, std::uint8_t *decompressed, std::size_t decompressedSize, Algorithm algorithm=Algorithm::LZ4)
Decompress input stream.
Definition: Compression.h:50
ripple::test::jtx
Definition: Check_test.cpp:26
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test
Definition: LedgerDeltaAcquire.h:35
ripple::Serializer::size
std::size_t size() const noexcept
Definition: Serializer.h:69
ripple::Logs::journal
beast::Journal journal(std::string const &name)
Definition: Log.cpp:144
ripple::base_uint::begin
iterator begin()
Definition: base_uint.h:133
ripple::test::jtx::pay
Json::Value pay(Account const &account, Account const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &m)
Generate a signature for a message.
Definition: SecretKey.cpp:238
std::vector::begin
T begin(T... args)
ripple::LedgerInfo::closeTimeResolution
NetClock::duration closeTimeResolution
Definition: ReadView.h:108
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:216
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:228
ripple::make_TimeKeeper
std::unique_ptr< TimeKeeper > make_TimeKeeper(beast::Journal j)
Definition: TimeKeeper.cpp:119
ripple::sfSignature
const SF_VL sfSignature
ripple::Config::COMPRESSION
bool COMPRESSION
Definition: Config.h:225
std::chrono::duration::count
T count(T... args)
ripple::test::compression_test::buildManifests
std::shared_ptr< protocol::TMManifests > buildManifests(int n)
Definition: compression_test.cpp:146
ripple::test::makeWSClient
std::unique_ptr< WSClient > makeWSClient(Config const &cfg, bool v2, unsigned rpc_version, std::unordered_map< std::string, std::string > const &headers)
Returns a client operating through WebSockets/S.
Definition: WSClient.cpp:300
std::stringstream::str
T str(T... args)
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::LedgerInfo
Information about the notional ledger backing the view.
Definition: ReadView.h:75
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::test::compression_test::testHandshake
void testHandshake()
Definition: compression_test.cpp:463
ripple::Serializer::getLength
int getLength() const
Definition: Serializer.h:199
ripple::sfDomain
const SF_VL sfDomain
ripple::makeRequest
auto makeRequest(bool crawlPublic, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled) -> request_type
Make outbound http request.
Definition: Handshake.cpp:365
ripple::makeResponse
http_response_type makeResponse(bool crawlPublic, http_request_type const &req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
Definition: Handshake.cpp:392
ripple::http_request_type
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition: Handshake.h:47
ripple::strUnHex
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:50
std::vector::data
T data(T... args)
ripple::sfPublicKey
const SF_VL sfPublicKey
ripple::detail::parseMessageHeader
std::optional< MessageHeader > parseMessageHeader(boost::system::error_code &ec, BufferSequence const &bufs, std::size_t size)
Parse a message header.
Definition: ProtocolMessage.h:178
ripple::LedgerInfo::accountHash
uint256 accountHash
Definition: ReadView.h:93
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
ripple::test::BEAST_DEFINE_TESTSUITE_MANUAL
BEAST_DEFINE_TESTSUITE_MANUAL(LedgerReplayerLong, app, ripple)
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::LedgerInfo::parentCloseTime
NetClock::time_point parentCloseTime
Definition: ReadView.h:84