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