rippled
InvariantCheck.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2016 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/tx/impl/InvariantCheck.h>
21 
22 #include <ripple/app/tx/impl/details/NFTokenUtils.h>
23 #include <ripple/basics/FeeUnits.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/ledger/ReadView.h>
26 #include <ripple/ledger/View.h>
27 #include <ripple/protocol/Feature.h>
28 #include <ripple/protocol/STArray.h>
29 #include <ripple/protocol/SystemParameters.h>
30 #include <ripple/protocol/nftPageMask.h>
31 
32 namespace ripple {
33 
34 void
36  bool,
39 {
40  // nothing to do
41 }
42 
43 bool
45  STTx const& tx,
46  TER const,
47  XRPAmount const fee,
48  ReadView const&,
49  beast::Journal const& j)
50 {
51  // We should never charge a negative fee
52  if (fee.drops() < 0)
53  {
54  JLOG(j.fatal()) << "Invariant failed: fee paid was negative: "
55  << fee.drops();
56  return false;
57  }
58 
59  // We should never charge a fee that's greater than or equal to the
60  // entire XRP supply.
61  if (fee >= INITIAL_XRP)
62  {
63  JLOG(j.fatal()) << "Invariant failed: fee paid exceeds system limit: "
64  << fee.drops();
65  return false;
66  }
67 
68  // We should never charge more for a transaction than the transaction
69  // authorizes. It's possible to charge less in some circumstances.
70  if (fee > tx.getFieldAmount(sfFee).xrp())
71  {
72  JLOG(j.fatal()) << "Invariant failed: fee paid is " << fee.drops()
73  << " exceeds fee specified in transaction.";
74  return false;
75  }
76 
77  return true;
78 }
79 
80 //------------------------------------------------------------------------------
81 
82 void
84  bool isDelete,
85  std::shared_ptr<SLE const> const& before,
87 {
88  /* We go through all modified ledger entries, looking only at account roots,
89  * escrow payments, and payment channels. We remove from the total any
90  * previous XRP values and add to the total any new XRP values. The net
91  * balance of a payment channel is computed from two fields (amount and
92  * balance) and deletions are ignored for paychan and escrow because the
93  * amount fields have not been adjusted for those in the case of deletion.
94  */
95  if (before)
96  {
97  switch (before->getType())
98  {
99  case ltACCOUNT_ROOT:
100  drops_ -= (*before)[sfBalance].xrp().drops();
101  break;
102  case ltPAYCHAN:
103  drops_ -=
104  ((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
105  break;
106  case ltESCROW:
107  drops_ -= (*before)[sfAmount].xrp().drops();
108  break;
109  default:
110  break;
111  }
112  }
113 
114  if (after)
115  {
116  switch (after->getType())
117  {
118  case ltACCOUNT_ROOT:
119  drops_ += (*after)[sfBalance].xrp().drops();
120  break;
121  case ltPAYCHAN:
122  if (!isDelete)
123  drops_ += ((*after)[sfAmount] - (*after)[sfBalance])
124  .xrp()
125  .drops();
126  break;
127  case ltESCROW:
128  if (!isDelete)
129  drops_ += (*after)[sfAmount].xrp().drops();
130  break;
131  default:
132  break;
133  }
134  }
135 }
136 
137 bool
139  STTx const& tx,
140  TER const,
141  XRPAmount const fee,
142  ReadView const&,
143  beast::Journal const& j)
144 {
145  // The net change should never be positive, as this would mean that the
146  // transaction created XRP out of thin air. That's not possible.
147  if (drops_ > 0)
148  {
149  JLOG(j.fatal()) << "Invariant failed: XRP net change was positive: "
150  << drops_;
151  return false;
152  }
153 
154  // The negative of the net change should be equal to actual fee charged.
155  if (-drops_ != fee.drops())
156  {
157  JLOG(j.fatal()) << "Invariant failed: XRP net change of " << drops_
158  << " doesn't match fee " << fee.drops();
159  return false;
160  }
161 
162  return true;
163 }
164 
165 //------------------------------------------------------------------------------
166 
167 void
169  bool,
170  std::shared_ptr<SLE const> const& before,
172 {
173  auto isBad = [](STAmount const& balance) {
174  if (!balance.native())
175  return true;
176 
177  auto const drops = balance.xrp();
178 
179  // Can't have more than the number of drops instantiated
180  // in the genesis ledger.
181  if (drops > INITIAL_XRP)
182  return true;
183 
184  // Can't have a negative balance (0 is OK)
185  if (drops < XRPAmount{0})
186  return true;
187 
188  return false;
189  };
190 
191  if (before && before->getType() == ltACCOUNT_ROOT)
192  bad_ |= isBad((*before)[sfBalance]);
193 
194  if (after && after->getType() == ltACCOUNT_ROOT)
195  bad_ |= isBad((*after)[sfBalance]);
196 }
197 
198 bool
200  STTx const&,
201  TER const,
202  XRPAmount const,
203  ReadView const&,
204  beast::Journal const& j)
205 {
206  if (bad_)
207  {
208  JLOG(j.fatal()) << "Invariant failed: incorrect account XRP balance";
209  return false;
210  }
211 
212  return true;
213 }
214 
215 //------------------------------------------------------------------------------
216 
217 void
219  bool isDelete,
220  std::shared_ptr<SLE const> const& before,
222 {
223  auto isBad = [](STAmount const& pays, STAmount const& gets) {
224  // An offer should never be negative
225  if (pays < beast::zero)
226  return true;
227 
228  if (gets < beast::zero)
229  return true;
230 
231  // Can't have an XRP to XRP offer:
232  return pays.native() && gets.native();
233  };
234 
235  if (before && before->getType() == ltOFFER)
236  bad_ |= isBad((*before)[sfTakerPays], (*before)[sfTakerGets]);
237 
238  if (after && after->getType() == ltOFFER)
239  bad_ |= isBad((*after)[sfTakerPays], (*after)[sfTakerGets]);
240 }
241 
242 bool
244  STTx const&,
245  TER const,
246  XRPAmount const,
247  ReadView const&,
248  beast::Journal const& j)
249 {
250  if (bad_)
251  {
252  JLOG(j.fatal()) << "Invariant failed: offer with a bad amount";
253  return false;
254  }
255 
256  return true;
257 }
258 
259 //------------------------------------------------------------------------------
260 
261 void
263  bool isDelete,
264  std::shared_ptr<SLE const> const& before,
266 {
267  auto isBad = [](STAmount const& amount) {
268  if (!amount.native())
269  return true;
270 
271  if (amount.xrp() <= XRPAmount{0})
272  return true;
273 
274  if (amount.xrp() >= INITIAL_XRP)
275  return true;
276 
277  return false;
278  };
279 
280  if (before && before->getType() == ltESCROW)
281  bad_ |= isBad((*before)[sfAmount]);
282 
283  if (after && after->getType() == ltESCROW)
284  bad_ |= isBad((*after)[sfAmount]);
285 }
286 
287 bool
289  STTx const&,
290  TER const,
291  XRPAmount const,
292  ReadView const&,
293  beast::Journal const& j)
294 {
295  if (bad_)
296  {
297  JLOG(j.fatal()) << "Invariant failed: escrow specifies invalid amount";
298  return false;
299  }
300 
301  return true;
302 }
303 
304 //------------------------------------------------------------------------------
305 
306 void
308  bool isDelete,
309  std::shared_ptr<SLE const> const& before,
311 {
312  if (isDelete && before && before->getType() == ltACCOUNT_ROOT)
314 }
315 
316 bool
318  STTx const& tx,
319  TER const result,
320  XRPAmount const,
321  ReadView const&,
322  beast::Journal const& j)
323 {
324  // AMM account root can be deleted as the result of AMM withdraw
325  // transaction when the total AMM LP Tokens balance goes to 0.
326  // Not every AMM withdraw deletes the AMM account, accountsDeleted_
327  // is set if it is deleted.
328  if ((tx.getTxnType() == ttACCOUNT_DELETE ||
329  (tx.getTxnType() == ttAMM_WITHDRAW && accountsDeleted_ == 1)) &&
330  result == tesSUCCESS)
331  {
332  if (accountsDeleted_ == 1)
333  return true;
334 
335  if (accountsDeleted_ == 0)
336  JLOG(j.fatal()) << "Invariant failed: account deletion "
337  "succeeded without deleting an account";
338  else
339  JLOG(j.fatal()) << "Invariant failed: account deletion "
340  "succeeded but deleted multiple accounts!";
341  return false;
342  }
343 
344  if (accountsDeleted_ == 0)
345  return true;
346 
347  JLOG(j.fatal()) << "Invariant failed: an account root was deleted";
348  return false;
349 }
350 
351 //------------------------------------------------------------------------------
352 
353 void
355  bool,
356  std::shared_ptr<SLE const> const& before,
358 {
359  if (before && after && before->getType() != after->getType())
360  typeMismatch_ = true;
361 
362  if (after)
363  {
364  switch (after->getType())
365  {
366  case ltACCOUNT_ROOT:
367  case ltDIR_NODE:
368  case ltRIPPLE_STATE:
369  case ltTICKET:
370  case ltSIGNER_LIST:
371  case ltOFFER:
372  case ltLEDGER_HASHES:
373  case ltAMENDMENTS:
374  case ltFEE_SETTINGS:
375  case ltESCROW:
376  case ltPAYCHAN:
377  case ltCHECK:
378  case ltDEPOSIT_PREAUTH:
379  case ltNEGATIVE_UNL:
380  case ltNFTOKEN_PAGE:
381  case ltNFTOKEN_OFFER:
382  case ltAMM:
383  break;
384  default:
385  invalidTypeAdded_ = true;
386  break;
387  }
388  }
389 }
390 
391 bool
393  STTx const&,
394  TER const,
395  XRPAmount const,
396  ReadView const&,
397  beast::Journal const& j)
398 {
399  if ((!typeMismatch_) && (!invalidTypeAdded_))
400  return true;
401 
402  if (typeMismatch_)
403  {
404  JLOG(j.fatal()) << "Invariant failed: ledger entry type mismatch";
405  }
406 
407  if (invalidTypeAdded_)
408  {
409  JLOG(j.fatal()) << "Invariant failed: invalid ledger entry type added";
410  }
411 
412  return false;
413 }
414 
415 //------------------------------------------------------------------------------
416 
417 void
419  bool,
422 {
423  if (after && after->getType() == ltRIPPLE_STATE)
424  {
425  // checking the issue directly here instead of
426  // relying on .native() just in case native somehow
427  // were systematically incorrect
428  xrpTrustLine_ =
429  after->getFieldAmount(sfLowLimit).issue() == xrpIssue() ||
430  after->getFieldAmount(sfHighLimit).issue() == xrpIssue();
431  }
432 }
433 
434 bool
436  STTx const&,
437  TER const,
438  XRPAmount const,
439  ReadView const&,
440  beast::Journal const& j)
441 {
442  if (!xrpTrustLine_)
443  return true;
444 
445  JLOG(j.fatal()) << "Invariant failed: an XRP trust line was created";
446  return false;
447 }
448 
449 //------------------------------------------------------------------------------
450 
451 void
453  bool,
454  std::shared_ptr<SLE const> const& before,
456 {
457  if (!before && after->getType() == ltACCOUNT_ROOT)
458  {
460  accountSeq_ = (*after)[sfSequence];
461  }
462 }
463 
464 bool
466  STTx const& tx,
467  TER const result,
468  XRPAmount const,
469  ReadView const& view,
470  beast::Journal const& j)
471 {
472  if (accountsCreated_ == 0)
473  return true;
474 
475  if (accountsCreated_ > 1)
476  {
477  JLOG(j.fatal()) << "Invariant failed: multiple accounts "
478  "created in a single transaction";
479  return false;
480  }
481 
482  // From this point on we know exactly one account was created.
483  if ((tx.getTxnType() == ttPAYMENT || tx.getTxnType() == ttAMM_CREATE) &&
484  result == tesSUCCESS)
485  {
486  std::uint32_t const startingSeq{
487  view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
488 
489  if (accountSeq_ != startingSeq)
490  {
491  JLOG(j.fatal()) << "Invariant failed: account created with "
492  "wrong starting sequence number";
493  return false;
494  }
495  return true;
496  }
497 
498  JLOG(j.fatal()) << "Invariant failed: account root created "
499  "by a non-Payment, by an unsuccessful transaction, "
500  "or by AMM";
501  return false;
502 }
503 
504 //------------------------------------------------------------------------------
505 
506 void
508  bool isDelete,
509  std::shared_ptr<SLE const> const& before,
511 {
512  static constexpr uint256 const& pageBits = nft::pageMask;
513  static constexpr uint256 const accountBits = ~pageBits;
514 
515  auto check = [this, isDelete](std::shared_ptr<SLE const> const& sle) {
516  uint256 const account = sle->key() & accountBits;
517  uint256 const hiLimit = sle->key() & pageBits;
518  std::optional<uint256> const prev = (*sle)[~sfPreviousPageMin];
519 
520  // Make sure that any page links...
521  // 1. Are properly associated with the owning account and
522  // 2. The page is correctly ordered between links.
523  if (prev)
524  {
525  if (account != (*prev & accountBits))
526  badLink_ = true;
527 
528  if (hiLimit <= (*prev & pageBits))
529  badLink_ = true;
530  }
531 
532  if (auto const next = (*sle)[~sfNextPageMin])
533  {
534  if (account != (*next & accountBits))
535  badLink_ = true;
536 
537  if (hiLimit >= (*next & pageBits))
538  badLink_ = true;
539  }
540 
541  {
542  auto const& nftokens = sle->getFieldArray(sfNFTokens);
543 
544  // An NFTokenPage should never contain too many tokens or be empty.
545  if (std::size_t const nftokenCount = nftokens.size();
546  (!isDelete && nftokenCount == 0) ||
547  nftokenCount > dirMaxTokensPerPage)
548  invalidSize_ = true;
549 
550  // If prev is valid, use it to establish a lower bound for
551  // page entries. If prev is not valid the lower bound is zero.
552  uint256 const loLimit =
553  prev ? *prev & pageBits : uint256(beast::zero);
554 
555  // Also verify that all NFTokenIDs in the page are sorted.
556  uint256 loCmp = loLimit;
557  for (auto const& obj : nftokens)
558  {
559  uint256 const tokenID = obj[sfNFTokenID];
560  if (!nft::compareTokens(loCmp, tokenID))
561  badSort_ = true;
562  loCmp = tokenID;
563 
564  // None of the NFTs on this page should belong on lower or
565  // higher pages.
566  if (uint256 const tokenPageBits = tokenID & pageBits;
567  tokenPageBits < loLimit || tokenPageBits >= hiLimit)
568  badEntry_ = true;
569 
570  if (auto uri = obj[~sfURI]; uri && uri->empty())
571  badURI_ = true;
572  }
573  }
574  };
575 
576  if (before && before->getType() == ltNFTOKEN_PAGE)
577  check(before);
578 
579  if (after && after->getType() == ltNFTOKEN_PAGE)
580  check(after);
581 }
582 
583 bool
585  STTx const& tx,
586  TER const result,
587  XRPAmount const,
588  ReadView const& view,
589  beast::Journal const& j)
590 {
591  if (badLink_)
592  {
593  JLOG(j.fatal()) << "Invariant failed: NFT page is improperly linked.";
594  return false;
595  }
596 
597  if (badEntry_)
598  {
599  JLOG(j.fatal()) << "Invariant failed: NFT found in incorrect page.";
600  return false;
601  }
602 
603  if (badSort_)
604  {
605  JLOG(j.fatal()) << "Invariant failed: NFTs on page are not sorted.";
606  return false;
607  }
608 
609  if (badURI_)
610  {
611  JLOG(j.fatal()) << "Invariant failed: NFT contains empty URI.";
612  return false;
613  }
614 
615  if (invalidSize_)
616  {
617  JLOG(j.fatal()) << "Invariant failed: NFT page has invalid size.";
618  return false;
619  }
620 
621  return true;
622 }
623 
624 //------------------------------------------------------------------------------
625 void
627  bool,
628  std::shared_ptr<SLE const> const& before,
630 {
631  if (before && before->getType() == ltACCOUNT_ROOT)
632  {
633  beforeMintedTotal += (*before)[~sfMintedNFTokens].value_or(0);
634  beforeBurnedTotal += (*before)[~sfBurnedNFTokens].value_or(0);
635  }
636 
637  if (after && after->getType() == ltACCOUNT_ROOT)
638  {
639  afterMintedTotal += (*after)[~sfMintedNFTokens].value_or(0);
640  afterBurnedTotal += (*after)[~sfBurnedNFTokens].value_or(0);
641  }
642 }
643 
644 bool
646  STTx const& tx,
647  TER const result,
648  XRPAmount const,
649  ReadView const& view,
650  beast::Journal const& j)
651 {
652  if (TxType const txType = tx.getTxnType();
653  txType != ttNFTOKEN_MINT && txType != ttNFTOKEN_BURN)
654  {
656  {
657  JLOG(j.fatal()) << "Invariant failed: the number of minted tokens "
658  "changed without a mint transaction!";
659  return false;
660  }
661 
663  {
664  JLOG(j.fatal()) << "Invariant failed: the number of burned tokens "
665  "changed without a burn transaction!";
666  return false;
667  }
668 
669  return true;
670  }
671 
672  if (tx.getTxnType() == ttNFTOKEN_MINT)
673  {
674  if (result == tesSUCCESS && beforeMintedTotal >= afterMintedTotal)
675  {
676  JLOG(j.fatal())
677  << "Invariant failed: successful minting didn't increase "
678  "the number of minted tokens.";
679  return false;
680  }
681 
682  if (result != tesSUCCESS && beforeMintedTotal != afterMintedTotal)
683  {
684  JLOG(j.fatal()) << "Invariant failed: failed minting changed the "
685  "number of minted tokens.";
686  return false;
687  }
688 
690  {
691  JLOG(j.fatal())
692  << "Invariant failed: minting changed the number of "
693  "burned tokens.";
694  return false;
695  }
696  }
697 
698  if (tx.getTxnType() == ttNFTOKEN_BURN)
699  {
700  if (result == tesSUCCESS)
701  {
703  {
704  JLOG(j.fatal())
705  << "Invariant failed: successful burning didn't increase "
706  "the number of burned tokens.";
707  return false;
708  }
709  }
710 
711  if (result != tesSUCCESS && beforeBurnedTotal != afterBurnedTotal)
712  {
713  JLOG(j.fatal()) << "Invariant failed: failed burning changed the "
714  "number of burned tokens.";
715  return false;
716  }
717 
719  {
720  JLOG(j.fatal())
721  << "Invariant failed: burning changed the number of "
722  "minted tokens.";
723  return false;
724  }
725  }
726 
727  return true;
728 }
729 
730 //------------------------------------------------------------------------------
731 
732 void
734  bool,
735  std::shared_ptr<SLE const> const& before,
737 {
738  if (before && before->getType() == ltRIPPLE_STATE)
740 }
741 
742 bool
744  STTx const& tx,
745  TER const result,
746  XRPAmount const,
747  ReadView const& view,
748  beast::Journal const& j)
749 {
750  if (tx.getTxnType() != ttCLAWBACK)
751  return true;
752 
753  if (result == tesSUCCESS)
754  {
755  if (trustlinesChanged > 1)
756  {
757  JLOG(j.fatal())
758  << "Invariant failed: more than one trustline changed.";
759  return false;
760  }
761 
762  AccountID const issuer = tx.getAccountID(sfAccount);
763  STAmount const amount = tx.getFieldAmount(sfAmount);
764  AccountID const& holder = amount.getIssuer();
765  STAmount const holderBalance = accountHolds(
766  view, holder, amount.getCurrency(), issuer, fhIGNORE_FREEZE, j);
767 
768  if (holderBalance.signum() < 0)
769  {
770  JLOG(j.fatal())
771  << "Invariant failed: trustline balance is negative";
772  return false;
773  }
774  }
775  else
776  {
777  if (trustlinesChanged != 0)
778  {
779  JLOG(j.fatal()) << "Invariant failed: some trustlines were changed "
780  "despite failure of the transaction.";
781  return false;
782  }
783  }
784 
785  return true;
786 }
787 
788 } // namespace ripple
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:339
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:179
ripple::ValidNFTokenPage::badURI_
bool badURI_
Definition: InvariantCheck.h:337
ripple::LedgerEntryTypesMatch::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:354
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
Definition: TxFormats.h:122
ripple::ltTICKET
@ ltTICKET
A ledger object which describes a ticket.
Definition: LedgerFormats.h:80
ripple::NoZeroEscrow::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:262
ripple::Rules::enabled
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Definition: Rules.cpp:94
std::shared_ptr
STL class.
ripple::TransactionFeeCheck::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:44
ripple::sfAmount
const SF_AMOUNT sfAmount
ripple::ttCLAWBACK
@ ttCLAWBACK
This transaction claws back issued tokens.
Definition: TxFormats.h:143
ripple::sfNFTokenID
const SF_UINT256 sfNFTokenID
ripple::ltLEDGER_HASHES
@ ltLEDGER_HASHES
A ledger object that contains a list of ledger hashes.
Definition: LedgerFormats.h:102
ripple::XRPBalanceChecks::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:199
ripple::XRPAmount::drops
constexpr value_type drops() const
Returns the number of drops.
Definition: XRPAmount.h:172
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::NoXRPTrustLines::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:418
ripple::accountHolds
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:243
ripple::ValidNFTokenPage::badSort_
bool badSort_
Definition: InvariantCheck.h:336
ripple::ltSIGNER_LIST
@ ltSIGNER_LIST
A ledger object which contains a signer list for an account.
Definition: LedgerFormats.h:86
ripple::sfMintedNFTokens
const SF_UINT32 sfMintedNFTokens
ripple::NoBadOffers::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:218
ripple::NoZeroEscrow::bad_
bool bad_
Definition: InvariantCheck.h:277
ripple::ValidNFTokenPage::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:507
ripple::dirMaxTokensPerPage
constexpr std::size_t dirMaxTokensPerPage
The maximum number of items in an NFT page.
Definition: Protocol.h:61
ripple::STAmount::signum
int signum() const noexcept
Definition: STAmount.h:365
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:56
ripple::NoBadOffers::bad_
bool bad_
Definition: InvariantCheck.h:253
ripple::NFTokenCountTracking::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:645
ripple::ValidNFTokenPage::invalidSize_
bool invalidSize_
Definition: InvariantCheck.h:338
ripple::NFTokenCountTracking::beforeMintedTotal
std::uint32_t beforeMintedTotal
Definition: InvariantCheck.h:371
ripple::ltCHECK
@ ltCHECK
A ledger object which describes a check.
Definition: LedgerFormats.h:136
ripple::ltFEE_SETTINGS
@ ltFEE_SETTINGS
The ledger object which lists the network's fee settings.
Definition: LedgerFormats.h:118
ripple::NFTokenCountTracking::afterMintedTotal
std::uint32_t afterMintedTotal
Definition: InvariantCheck.h:373
ripple::nft::compareTokens
bool compareTokens(uint256 const &a, uint256 const &b)
Definition: NFTokenUtils.cpp:227
ripple::STAmount::xrp
XRPAmount xrp() const
Definition: STAmount.cpp:334
ripple::INITIAL_XRP
constexpr XRPAmount INITIAL_XRP
Configure the native currency.
Definition: SystemParameters.h:43
ripple::ValidNewAccountRoot::accountSeq_
std::uint32_t accountSeq_
Definition: InvariantCheck.h:303
ripple::ltDIR_NODE
@ ltDIR_NODE
A ledger object which contains a list of object identifiers.
Definition: LedgerFormats.h:66
ripple::STAmount::getIssuer
AccountID const & getIssuer() const
Definition: STAmount.h:359
ripple::ValidNewAccountRoot::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:465
ripple::nft::pageMask
constexpr uint256 pageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
ripple::featureDeletableAccounts
const uint256 featureDeletableAccounts
ripple::ttPAYMENT
@ ttPAYMENT
This transaction type executes a payment.
Definition: TxFormats.h:59
ripple::NoXRPTrustLines::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:435
ripple::base_uint< 256 >
ripple::sfTakerPays
const SF_AMOUNT sfTakerPays
ripple::ltAMENDMENTS
@ ltAMENDMENTS
The ledger object which lists details about amendments on the network.
Definition: LedgerFormats.h:110
ripple::sfLowLimit
const SF_AMOUNT sfLowLimit
ripple::LedgerEntryTypesMatch::typeMismatch_
bool typeMismatch_
Definition: InvariantCheck.h:199
ripple::ValidNFTokenPage::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:584
ripple::ltOFFER
@ ltOFFER
A ledger object which describes an offer on the DEX.
Definition: LedgerFormats.h:92
ripple::NoBadOffers::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:243
ripple::LedgerEntryTypesMatch::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:392
ripple::NFTokenCountTracking::afterBurnedTotal
std::uint32_t afterBurnedTotal
Definition: InvariantCheck.h:374
ripple::ttAMM_CREATE
@ ttAMM_CREATE
This transaction type creates an AMM instance.
Definition: TxFormats.h:146
ripple::ltESCROW
@ ltESCROW
A ledger object describing a single escrow.
Definition: LedgerFormats.h:124
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::ltNFTOKEN_OFFER
@ ltNFTOKEN_OFFER
A ledger object which identifies an offer to buy or sell an NFT.
Definition: LedgerFormats.h:162
ripple::ValidNFTokenPage::badEntry_
bool badEntry_
Definition: InvariantCheck.h:334
ripple::TERSubset< CanCvtToTER >
ripple::ttNFTOKEN_MINT
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
Definition: TxFormats.h:128
ripple::ValidNewAccountRoot::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:452
ripple::ValidClawback::trustlinesChanged
std::uint32_t trustlinesChanged
Definition: InvariantCheck.h:402
ripple::ValidClawback::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:743
ripple::ltDEPOSIT_PREAUTH
@ ltDEPOSIT_PREAUTH
A ledger object which describes a deposit preauthorization.
Definition: LedgerFormats.h:142
ripple::STAmount
Definition: STAmount.h:45
ripple::XRPNotCreated::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:83
ripple::ttAMM_WITHDRAW
@ ttAMM_WITHDRAW
This transaction type withdraws from an AMM instance.
Definition: TxFormats.h:152
ripple::sfTakerGets
const SF_AMOUNT sfTakerGets
ripple::XRPNotCreated::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:138
ripple::STTx
Definition: STTx.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::sfHighLimit
const SF_AMOUNT sfHighLimit
ripple::NoZeroEscrow::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:288
ripple::AccountRootsNotDeleted::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:317
ripple::NFTokenCountTracking::beforeBurnedTotal
std::uint32_t beforeBurnedTotal
Definition: InvariantCheck.h:372
ripple::sfNFTokens
const SField sfNFTokens
ripple::sfURI
const SF_VL sfURI
ripple::STAmount::native
bool native() const noexcept
Definition: STAmount.h:329
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:125
ripple::ltNFTOKEN_PAGE
@ ltNFTOKEN_PAGE
A ledger object which contains a list of NFTs.
Definition: LedgerFormats.h:156
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::ltNEGATIVE_UNL
@ ltNEGATIVE_UNL
The ledger object which tracks the current negative UNL state.
Definition: LedgerFormats.h:150
ripple::NoXRPTrustLines::xrpTrustLine_
bool xrpTrustLine_
Definition: InvariantCheck.h:226
ripple::ReadView::seq
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition: ReadView.h:193
ripple::ValidNewAccountRoot::accountsCreated_
std::uint32_t accountsCreated_
Definition: InvariantCheck.h:302
ripple::ReadView::rules
virtual Rules const & rules() const =0
Returns the tx processing rules.
ripple::ltACCOUNT_ROOT
@ ltACCOUNT_ROOT
A ledger object which describes an account.
Definition: LedgerFormats.h:59
ripple::TransactionFeeCheck::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:35
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::AccountRootsNotDeleted::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:307
ripple::sfNextPageMin
const SF_UINT256 sfNextPageMin
ripple::xrpIssue
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
Definition: Issue.h:105
ripple::fhIGNORE_FREEZE
@ fhIGNORE_FREEZE
Definition: View.h:78
std::optional
ripple::sfPreviousPageMin
const SF_UINT256 sfPreviousPageMin
ripple::ttNFTOKEN_BURN
@ ttNFTOKEN_BURN
This transaction burns (i.e.
Definition: TxFormats.h:131
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:88
std::size_t
ripple::ValidClawback::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:733
ripple::AccountRootsNotDeleted::accountsDeleted_
std::uint32_t accountsDeleted_
Definition: InvariantCheck.h:148
ripple::sfFee
const SF_AMOUNT sfFee
ripple::XRPBalanceChecks::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:168
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::ltRIPPLE_STATE
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
Definition: LedgerFormats.h:74
ripple::NFTokenCountTracking::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:626
ripple::XRPBalanceChecks::bad_
bool bad_
Definition: InvariantCheck.h:175
ripple::sfBurnedNFTokens
const SF_UINT32 sfBurnedNFTokens
ripple::LedgerEntryTypesMatch::invalidTypeAdded_
bool invalidTypeAdded_
Definition: InvariantCheck.h:200
ripple::STAmount::getCurrency
Currency const & getCurrency() const
Definition: STAmount.h:353
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:225
ripple::XRPNotCreated::drops_
std::int64_t drops_
Definition: InvariantCheck.h:120
ripple::STObject::getFieldAmount
STAmount const & getFieldAmount(SField const &field) const
Definition: STObject.cpp:603
ripple::ltAMM
@ ltAMM
The ledger object which tracks the AMM.
Definition: LedgerFormats.h:168
ripple::ltPAYCHAN
@ ltPAYCHAN
A ledger object describing a single unidirectional XRP payment channel.
Definition: LedgerFormats.h:130
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::ValidNFTokenPage::badLink_
bool badLink_
Definition: InvariantCheck.h:335