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  break;
396  default:
397  invalidTypeAdded_ = true;
398  break;
399  }
400  }
401 }
402 
403 bool
405  STTx const&,
406  TER const,
407  XRPAmount const,
408  ReadView const&,
409  beast::Journal const& j)
410 {
411  if ((!typeMismatch_) && (!invalidTypeAdded_))
412  return true;
413 
414  if (typeMismatch_)
415  {
416  JLOG(j.fatal()) << "Invariant failed: ledger entry type mismatch";
417  }
418 
419  if (invalidTypeAdded_)
420  {
421  JLOG(j.fatal()) << "Invariant failed: invalid ledger entry type added";
422  }
423 
424  return false;
425 }
426 
427 //------------------------------------------------------------------------------
428 
429 void
431  bool,
434 {
435  if (after && after->getType() == ltRIPPLE_STATE)
436  {
437  // checking the issue directly here instead of
438  // relying on .native() just in case native somehow
439  // were systematically incorrect
440  xrpTrustLine_ =
441  after->getFieldAmount(sfLowLimit).issue() == xrpIssue() ||
442  after->getFieldAmount(sfHighLimit).issue() == xrpIssue();
443  }
444 }
445 
446 bool
448  STTx const&,
449  TER const,
450  XRPAmount const,
451  ReadView const&,
452  beast::Journal const& j)
453 {
454  if (!xrpTrustLine_)
455  return true;
456 
457  JLOG(j.fatal()) << "Invariant failed: an XRP trust line was created";
458  return false;
459 }
460 
461 //------------------------------------------------------------------------------
462 
463 void
465  bool,
466  std::shared_ptr<SLE const> const& before,
468 {
469  if (!before && after->getType() == ltACCOUNT_ROOT)
470  {
472  accountSeq_ = (*after)[sfSequence];
473  }
474 }
475 
476 bool
478  STTx const& tx,
479  TER const result,
480  XRPAmount const,
481  ReadView const& view,
482  beast::Journal const& j)
483 {
484  if (accountsCreated_ == 0)
485  return true;
486 
487  if (accountsCreated_ > 1)
488  {
489  JLOG(j.fatal()) << "Invariant failed: multiple accounts "
490  "created in a single transaction";
491  return false;
492  }
493 
494  // From this point on we know exactly one account was created.
495  if ((tx.getTxnType() == ttPAYMENT || tx.getTxnType() == ttAMM_CREATE ||
498  result == tesSUCCESS)
499  {
500  std::uint32_t const startingSeq{
501  view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
502 
503  if (accountSeq_ != startingSeq)
504  {
505  JLOG(j.fatal()) << "Invariant failed: account created with "
506  "wrong starting sequence number";
507  return false;
508  }
509  return true;
510  }
511 
512  JLOG(j.fatal()) << "Invariant failed: account root created "
513  "by a non-Payment, by an unsuccessful transaction, "
514  "or by AMM";
515  return false;
516 }
517 
518 //------------------------------------------------------------------------------
519 
520 void
522  bool isDelete,
523  std::shared_ptr<SLE const> const& before,
525 {
526  static constexpr uint256 const& pageBits = nft::pageMask;
527  static constexpr uint256 const accountBits = ~pageBits;
528 
529  auto check = [this, isDelete](std::shared_ptr<SLE const> const& sle) {
530  uint256 const account = sle->key() & accountBits;
531  uint256 const hiLimit = sle->key() & pageBits;
532  std::optional<uint256> const prev = (*sle)[~sfPreviousPageMin];
533 
534  // Make sure that any page links...
535  // 1. Are properly associated with the owning account and
536  // 2. The page is correctly ordered between links.
537  if (prev)
538  {
539  if (account != (*prev & accountBits))
540  badLink_ = true;
541 
542  if (hiLimit <= (*prev & pageBits))
543  badLink_ = true;
544  }
545 
546  if (auto const next = (*sle)[~sfNextPageMin])
547  {
548  if (account != (*next & accountBits))
549  badLink_ = true;
550 
551  if (hiLimit >= (*next & pageBits))
552  badLink_ = true;
553  }
554 
555  {
556  auto const& nftokens = sle->getFieldArray(sfNFTokens);
557 
558  // An NFTokenPage should never contain too many tokens or be empty.
559  if (std::size_t const nftokenCount = nftokens.size();
560  (!isDelete && nftokenCount == 0) ||
561  nftokenCount > dirMaxTokensPerPage)
562  invalidSize_ = true;
563 
564  // If prev is valid, use it to establish a lower bound for
565  // page entries. If prev is not valid the lower bound is zero.
566  uint256 const loLimit =
567  prev ? *prev & pageBits : uint256(beast::zero);
568 
569  // Also verify that all NFTokenIDs in the page are sorted.
570  uint256 loCmp = loLimit;
571  for (auto const& obj : nftokens)
572  {
573  uint256 const tokenID = obj[sfNFTokenID];
574  if (!nft::compareTokens(loCmp, tokenID))
575  badSort_ = true;
576  loCmp = tokenID;
577 
578  // None of the NFTs on this page should belong on lower or
579  // higher pages.
580  if (uint256 const tokenPageBits = tokenID & pageBits;
581  tokenPageBits < loLimit || tokenPageBits >= hiLimit)
582  badEntry_ = true;
583 
584  if (auto uri = obj[~sfURI]; uri && uri->empty())
585  badURI_ = true;
586  }
587  }
588  };
589 
590  if (before && before->getType() == ltNFTOKEN_PAGE)
591  check(before);
592 
593  if (after && after->getType() == ltNFTOKEN_PAGE)
594  check(after);
595 }
596 
597 bool
599  STTx const& tx,
600  TER const result,
601  XRPAmount const,
602  ReadView const& view,
603  beast::Journal const& j)
604 {
605  if (badLink_)
606  {
607  JLOG(j.fatal()) << "Invariant failed: NFT page is improperly linked.";
608  return false;
609  }
610 
611  if (badEntry_)
612  {
613  JLOG(j.fatal()) << "Invariant failed: NFT found in incorrect page.";
614  return false;
615  }
616 
617  if (badSort_)
618  {
619  JLOG(j.fatal()) << "Invariant failed: NFTs on page are not sorted.";
620  return false;
621  }
622 
623  if (badURI_)
624  {
625  JLOG(j.fatal()) << "Invariant failed: NFT contains empty URI.";
626  return false;
627  }
628 
629  if (invalidSize_)
630  {
631  JLOG(j.fatal()) << "Invariant failed: NFT page has invalid size.";
632  return false;
633  }
634 
635  return true;
636 }
637 
638 //------------------------------------------------------------------------------
639 void
641  bool,
642  std::shared_ptr<SLE const> const& before,
644 {
645  if (before && before->getType() == ltACCOUNT_ROOT)
646  {
647  beforeMintedTotal += (*before)[~sfMintedNFTokens].value_or(0);
648  beforeBurnedTotal += (*before)[~sfBurnedNFTokens].value_or(0);
649  }
650 
651  if (after && after->getType() == ltACCOUNT_ROOT)
652  {
653  afterMintedTotal += (*after)[~sfMintedNFTokens].value_or(0);
654  afterBurnedTotal += (*after)[~sfBurnedNFTokens].value_or(0);
655  }
656 }
657 
658 bool
660  STTx const& tx,
661  TER const result,
662  XRPAmount const,
663  ReadView const& view,
664  beast::Journal const& j)
665 {
666  if (TxType const txType = tx.getTxnType();
667  txType != ttNFTOKEN_MINT && txType != ttNFTOKEN_BURN)
668  {
670  {
671  JLOG(j.fatal()) << "Invariant failed: the number of minted tokens "
672  "changed without a mint transaction!";
673  return false;
674  }
675 
677  {
678  JLOG(j.fatal()) << "Invariant failed: the number of burned tokens "
679  "changed without a burn transaction!";
680  return false;
681  }
682 
683  return true;
684  }
685 
686  if (tx.getTxnType() == ttNFTOKEN_MINT)
687  {
688  if (result == tesSUCCESS && beforeMintedTotal >= afterMintedTotal)
689  {
690  JLOG(j.fatal())
691  << "Invariant failed: successful minting didn't increase "
692  "the number of minted tokens.";
693  return false;
694  }
695 
696  if (result != tesSUCCESS && beforeMintedTotal != afterMintedTotal)
697  {
698  JLOG(j.fatal()) << "Invariant failed: failed minting changed the "
699  "number of minted tokens.";
700  return false;
701  }
702 
704  {
705  JLOG(j.fatal())
706  << "Invariant failed: minting changed the number of "
707  "burned tokens.";
708  return false;
709  }
710  }
711 
712  if (tx.getTxnType() == ttNFTOKEN_BURN)
713  {
714  if (result == tesSUCCESS)
715  {
717  {
718  JLOG(j.fatal())
719  << "Invariant failed: successful burning didn't increase "
720  "the number of burned tokens.";
721  return false;
722  }
723  }
724 
725  if (result != tesSUCCESS && beforeBurnedTotal != afterBurnedTotal)
726  {
727  JLOG(j.fatal()) << "Invariant failed: failed burning changed the "
728  "number of burned tokens.";
729  return false;
730  }
731 
733  {
734  JLOG(j.fatal())
735  << "Invariant failed: burning changed the number of "
736  "minted tokens.";
737  return false;
738  }
739  }
740 
741  return true;
742 }
743 
744 //------------------------------------------------------------------------------
745 
746 void
748  bool,
749  std::shared_ptr<SLE const> const& before,
751 {
752  if (before && before->getType() == ltRIPPLE_STATE)
754 }
755 
756 bool
758  STTx const& tx,
759  TER const result,
760  XRPAmount const,
761  ReadView const& view,
762  beast::Journal const& j)
763 {
764  if (tx.getTxnType() != ttCLAWBACK)
765  return true;
766 
767  if (result == tesSUCCESS)
768  {
769  if (trustlinesChanged > 1)
770  {
771  JLOG(j.fatal())
772  << "Invariant failed: more than one trustline changed.";
773  return false;
774  }
775 
776  AccountID const issuer = tx.getAccountID(sfAccount);
777  STAmount const amount = tx.getFieldAmount(sfAmount);
778  AccountID const& holder = amount.getIssuer();
779  STAmount const holderBalance = accountHolds(
780  view, holder, amount.getCurrency(), issuer, fhIGNORE_FREEZE, j);
781 
782  if (holderBalance.signum() < 0)
783  {
784  JLOG(j.fatal())
785  << "Invariant failed: trustline balance is negative";
786  return false;
787  }
788  }
789  else
790  {
791  if (trustlinesChanged != 0)
792  {
793  JLOG(j.fatal()) << "Invariant failed: some trustlines were changed "
794  "despite failure of the transaction.";
795  return false;
796  }
797  }
798 
799  return true;
800 }
801 
802 } // 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::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:430
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:521
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:659
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:477
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:447
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:598
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:404
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:604
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:464
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:757
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:747
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:640
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:235
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:618
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