rippled
applySteps.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/app/tx/applySteps.h>
21 #include <ripple/app/tx/impl/AMMBid.h>
22 #include <ripple/app/tx/impl/AMMCreate.h>
23 #include <ripple/app/tx/impl/AMMDelete.h>
24 #include <ripple/app/tx/impl/AMMDeposit.h>
25 #include <ripple/app/tx/impl/AMMVote.h>
26 #include <ripple/app/tx/impl/AMMWithdraw.h>
27 #include <ripple/app/tx/impl/ApplyContext.h>
28 #include <ripple/app/tx/impl/CancelCheck.h>
29 #include <ripple/app/tx/impl/CancelOffer.h>
30 #include <ripple/app/tx/impl/CashCheck.h>
31 #include <ripple/app/tx/impl/Change.h>
32 #include <ripple/app/tx/impl/Clawback.h>
33 #include <ripple/app/tx/impl/CreateCheck.h>
34 #include <ripple/app/tx/impl/CreateOffer.h>
35 #include <ripple/app/tx/impl/CreateTicket.h>
36 #include <ripple/app/tx/impl/DID.h>
37 #include <ripple/app/tx/impl/DeleteAccount.h>
38 #include <ripple/app/tx/impl/DeleteOracle.h>
39 #include <ripple/app/tx/impl/DepositPreauth.h>
40 #include <ripple/app/tx/impl/Escrow.h>
41 #include <ripple/app/tx/impl/NFTokenAcceptOffer.h>
42 #include <ripple/app/tx/impl/NFTokenBurn.h>
43 #include <ripple/app/tx/impl/NFTokenCancelOffer.h>
44 #include <ripple/app/tx/impl/NFTokenCreateOffer.h>
45 #include <ripple/app/tx/impl/NFTokenMint.h>
46 #include <ripple/app/tx/impl/PayChan.h>
47 #include <ripple/app/tx/impl/Payment.h>
48 #include <ripple/app/tx/impl/SetAccount.h>
49 #include <ripple/app/tx/impl/SetOracle.h>
50 #include <ripple/app/tx/impl/SetRegularKey.h>
51 #include <ripple/app/tx/impl/SetSignerList.h>
52 #include <ripple/app/tx/impl/SetTrust.h>
53 #include <ripple/app/tx/impl/XChainBridge.h>
54 #include <ripple/protocol/TxFormats.h>
55 
56 #include <stdexcept>
57 
58 namespace ripple {
59 
60 namespace {
61 
62 struct UnknownTxnType : std::exception
63 {
64  TxType txnType;
65  UnknownTxnType(TxType t) : txnType{t}
66  {
67  }
68 };
69 
70 // Call a lambda with the concrete transaction type as a template parameter
71 // throw an "UnknownTxnType" exception on error
72 template <class F>
73 auto
74 with_txn_type(TxType txnType, F&& f)
75 {
76  switch (txnType)
77  {
78  case ttACCOUNT_DELETE:
79  return f.template operator()<DeleteAccount>();
80  case ttACCOUNT_SET:
81  return f.template operator()<SetAccount>();
82  case ttCHECK_CANCEL:
83  return f.template operator()<CancelCheck>();
84  case ttCHECK_CASH:
85  return f.template operator()<CashCheck>();
86  case ttCHECK_CREATE:
87  return f.template operator()<CreateCheck>();
88  case ttDEPOSIT_PREAUTH:
89  return f.template operator()<DepositPreauth>();
90  case ttOFFER_CANCEL:
91  return f.template operator()<CancelOffer>();
92  case ttOFFER_CREATE:
93  return f.template operator()<CreateOffer>();
94  case ttESCROW_CREATE:
95  return f.template operator()<EscrowCreate>();
96  case ttESCROW_FINISH:
97  return f.template operator()<EscrowFinish>();
98  case ttESCROW_CANCEL:
99  return f.template operator()<EscrowCancel>();
100  case ttPAYCHAN_CLAIM:
101  return f.template operator()<PayChanClaim>();
102  case ttPAYCHAN_CREATE:
103  return f.template operator()<PayChanCreate>();
104  case ttPAYCHAN_FUND:
105  return f.template operator()<PayChanFund>();
106  case ttPAYMENT:
107  return f.template operator()<Payment>();
108  case ttREGULAR_KEY_SET:
109  return f.template operator()<SetRegularKey>();
110  case ttSIGNER_LIST_SET:
111  return f.template operator()<SetSignerList>();
112  case ttTICKET_CREATE:
113  return f.template operator()<CreateTicket>();
114  case ttTRUST_SET:
115  return f.template operator()<SetTrust>();
116  case ttAMENDMENT:
117  case ttFEE:
118  case ttUNL_MODIFY:
119  return f.template operator()<Change>();
120  case ttNFTOKEN_MINT:
121  return f.template operator()<NFTokenMint>();
122  case ttNFTOKEN_BURN:
123  return f.template operator()<NFTokenBurn>();
125  return f.template operator()<NFTokenCreateOffer>();
127  return f.template operator()<NFTokenCancelOffer>();
129  return f.template operator()<NFTokenAcceptOffer>();
130  case ttCLAWBACK:
131  return f.template operator()<Clawback>();
132  case ttAMM_CREATE:
133  return f.template operator()<AMMCreate>();
134  case ttAMM_DEPOSIT:
135  return f.template operator()<AMMDeposit>();
136  case ttAMM_WITHDRAW:
137  return f.template operator()<AMMWithdraw>();
138  case ttAMM_VOTE:
139  return f.template operator()<AMMVote>();
140  case ttAMM_BID:
141  return f.template operator()<AMMBid>();
142  case ttAMM_DELETE:
143  return f.template operator()<AMMDelete>();
145  return f.template operator()<XChainCreateBridge>();
147  return f.template operator()<BridgeModify>();
149  return f.template operator()<XChainCreateClaimID>();
150  case ttXCHAIN_COMMIT:
151  return f.template operator()<XChainCommit>();
152  case ttXCHAIN_CLAIM:
153  return f.template operator()<XChainClaim>();
155  return f.template operator()<XChainAddClaimAttestation>();
157  return f.template operator()<XChainAddAccountCreateAttestation>();
159  return f.template operator()<XChainCreateAccountCommit>();
160  case ttDID_SET:
161  return f.template operator()<DIDSet>();
162  case ttDID_DELETE:
163  return f.template operator()<DIDDelete>();
164  case ttORACLE_SET:
165  return f.template operator()<SetOracle>();
166  case ttORACLE_DELETE:
167  return f.template operator()<DeleteOracle>();
168  default:
169  throw UnknownTxnType(txnType);
170  }
171 }
172 } // namespace
173 
174 // Templates so preflight does the right thing with T::ConsequencesFactory.
175 //
176 // This could be done more easily using if constexpr, but Visual Studio
177 // 2017 doesn't handle if constexpr correctly. So once we're no longer
178 // building with Visual Studio 2017 we can consider replacing the four
179 // templates with a single template function that uses if constexpr.
180 //
181 // For Transactor::Normal
182 //
183 
184 // clang-format off
185 // Current formatter for rippled is based on clang-10, which does not handle `requires` clauses
186 template <class T>
187 requires(T::ConsequencesFactory == Transactor::Normal)
189  consequences_helper(PreflightContext const& ctx)
190 {
191  return TxConsequences(ctx.tx);
192 };
193 
194 // For Transactor::Blocker
195 template <class T>
196 requires(T::ConsequencesFactory == Transactor::Blocker)
197 TxConsequences
198  consequences_helper(PreflightContext const& ctx)
199 {
200  return TxConsequences(ctx.tx, TxConsequences::blocker);
201 };
202 
203 // For Transactor::Custom
204 template <class T>
205 requires(T::ConsequencesFactory == Transactor::Custom)
206 TxConsequences
207  consequences_helper(PreflightContext const& ctx)
208 {
209  return T::makeTxConsequences(ctx);
210 };
211 // clang-format on
212 
215 {
216  try
217  {
218  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
219  auto const tec = T::preflight(ctx);
220  return std::make_pair(
221  tec,
222  isTesSuccess(tec) ? consequences_helper<T>(ctx)
223  : TxConsequences{tec});
224  });
225  }
226  catch (UnknownTxnType const& e)
227  {
228  // Should never happen
229  JLOG(ctx.j.fatal())
230  << "Unknown transaction type in preflight: " << e.txnType;
231  assert(false);
232  return {temUNKNOWN, TxConsequences{temUNKNOWN}};
233  }
234 }
235 
236 static TER
238 {
239  try
240  {
241  // use name hiding to accomplish compile-time polymorphism of static
242  // class functions for Transactor and derived classes.
243  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
244  // If the transactor requires a valid account and the transaction
245  // doesn't list one, preflight will have already a flagged a
246  // failure.
247  auto const id = ctx.tx.getAccountID(sfAccount);
248 
249  if (id != beast::zero)
250  {
251  TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
252 
253  if (result != tesSUCCESS)
254  return result;
255 
256  result = T::checkPriorTxAndLastLedger(ctx);
257 
258  if (result != tesSUCCESS)
259  return result;
260 
261  result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
262 
263  if (result != tesSUCCESS)
264  return result;
265 
266  result = T::checkSign(ctx);
267 
268  if (result != tesSUCCESS)
269  return result;
270  }
271 
272  return T::preclaim(ctx);
273  });
274  }
275  catch (UnknownTxnType const& e)
276  {
277  // Should never happen
278  JLOG(ctx.j.fatal())
279  << "Unknown transaction type in preclaim: " << e.txnType;
280  assert(false);
281  return temUNKNOWN;
282  }
283 }
284 
285 static XRPAmount
286 invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
287 {
288  try
289  {
290  return with_txn_type(tx.getTxnType(), [&]<typename T>() {
291  return T::calculateBaseFee(view, tx);
292  });
293  }
294  catch (UnknownTxnType const& e)
295  {
296  assert(false);
297  return XRPAmount{0};
298  }
299 }
300 
301 TxConsequences::TxConsequences(NotTEC pfresult)
302  : isBlocker_(false)
303  , fee_(beast::zero)
304  , potentialSpend_(beast::zero)
305  , seqProx_(SeqProxy::sequence(0))
306  , sequencesConsumed_(0)
307 {
308  assert(!isTesSuccess(pfresult));
309 }
310 
312  : isBlocker_(false)
313  , fee_(
314  tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
315  : beast::zero)
316  , potentialSpend_(beast::zero)
317  , seqProx_(tx.getSeqProxy())
318  , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
319 {
320 }
321 
323  : TxConsequences(tx)
324 {
325  isBlocker_ = (category == blocker);
326 }
327 
329  : TxConsequences(tx)
330 {
332 }
333 
334 TxConsequences::TxConsequences(STTx const& tx, std::uint32_t sequencesConsumed)
335  : TxConsequences(tx)
336 {
338 }
339 
342 {
343  try
344  {
345  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
346  T p(ctx);
347  return p();
348  });
349  }
350  catch (UnknownTxnType const& e)
351  {
352  // Should never happen
353  JLOG(ctx.journal.fatal())
354  << "Unknown transaction type in apply: " << e.txnType;
355  assert(false);
356  return {temUNKNOWN, false};
357  }
358 }
359 
360 PreflightResult
362  Application& app,
363  Rules const& rules,
364  STTx const& tx,
365  ApplyFlags flags,
366  beast::Journal j)
367 {
368  PreflightContext const pfctx(app, tx, rules, flags, j);
369  try
370  {
371  return {pfctx, invoke_preflight(pfctx)};
372  }
373  catch (std::exception const& e)
374  {
375  JLOG(j.fatal()) << "apply: " << e.what();
376  return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
377  }
378 }
379 
380 PreclaimResult
382  PreflightResult const& preflightResult,
383  Application& app,
384  OpenView const& view)
385 {
387  if (preflightResult.rules != view.rules())
388  {
389  auto secondFlight = preflight(
390  app,
391  view.rules(),
392  preflightResult.tx,
393  preflightResult.flags,
394  preflightResult.j);
395  ctx.emplace(
396  app,
397  view,
398  secondFlight.ter,
399  secondFlight.tx,
400  secondFlight.flags,
401  secondFlight.j);
402  }
403  else
404  {
405  ctx.emplace(
406  app,
407  view,
408  preflightResult.ter,
409  preflightResult.tx,
410  preflightResult.flags,
411  preflightResult.j);
412  }
413  try
414  {
415  if (ctx->preflightResult != tesSUCCESS)
416  return {*ctx, ctx->preflightResult};
417  return {*ctx, invoke_preclaim(*ctx)};
418  }
419  catch (std::exception const& e)
420  {
421  JLOG(ctx->j.fatal()) << "apply: " << e.what();
422  return {*ctx, tefEXCEPTION};
423  }
424 }
425 
426 XRPAmount
427 calculateBaseFee(ReadView const& view, STTx const& tx)
428 {
429  return invoke_calculateBaseFee(view, tx);
430 }
431 
432 XRPAmount
433 calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
434 {
435  return Transactor::calculateBaseFee(view, tx);
436 }
437 
439 doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
440 {
441  if (preclaimResult.view.seq() != view.seq())
442  {
443  // Logic error from the caller. Don't have enough
444  // info to recover.
445  return {tefEXCEPTION, false};
446  }
447  try
448  {
449  if (!preclaimResult.likelyToClaimFee)
450  return {preclaimResult.ter, false};
451  ApplyContext ctx(
452  app,
453  view,
454  preclaimResult.tx,
455  preclaimResult.ter,
456  calculateBaseFee(view, preclaimResult.tx),
457  preclaimResult.flags,
458  preclaimResult.j);
459  return invoke_apply(ctx);
460  }
461  catch (std::exception const& e)
462  {
463  JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
464  return {tefEXCEPTION, false};
465  }
466 }
467 
468 } // namespace ripple
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:338
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:181
ripple::ttNFTOKEN_CREATE_OFFER
@ ttNFTOKEN_CREATE_OFFER
This transaction creates a new offer to buy or sell an NFT.
Definition: TxFormats.h:134
ripple::Application
Definition: Application.h:116
ripple::PreclaimResult::view
ReadView const & view
From the input - the ledger view.
Definition: applySteps.h:197
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
Definition: TxFormats.h:122
ripple::Transactor::Blocker
@ Blocker
Definition: Transactor.h:101
ripple::ttAMM_DELETE
@ ttAMM_DELETE
This transaction type deletes AMM in the empty state.
Definition: TxFormats.h:161
ripple::PreclaimResult::j
const beast::Journal j
From the input - the journal.
Definition: applySteps.h:203
ripple::ttORACLE_DELETE
@ ttORACLE_DELETE
This transaction type deletes an Oracle instance.
Definition: TxFormats.h:198
ripple::TxConsequences::TxConsequences
TxConsequences(NotTEC pfresult)
Definition: applySteps.cpp:301
std::exception
STL class.
ripple::ttREGULAR_KEY_SET
@ ttREGULAR_KEY_SET
This transaction type sets or clears an account's "regular key".
Definition: TxFormats.h:74
ripple::ttCLAWBACK
@ ttCLAWBACK
This transaction claws back issued tokens.
Definition: TxFormats.h:143
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:643
ripple::ttSIGNER_LIST_SET
@ ttSIGNER_LIST_SET
This transaction type modifies the signer list associated with an account.
Definition: TxFormats.h:95
ripple::ttXCHAIN_CLAIM
@ ttXCHAIN_CLAIM
This transaction completes a crosschain transaction.
Definition: TxFormats.h:170
std::pair
ripple::ttESCROW_CANCEL
@ ttESCROW_CANCEL
This transaction type cancels an existing escrow.
Definition: TxFormats.h:71
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
ripple::ttXCHAIN_CREATE_BRIDGE
@ ttXCHAIN_CREATE_BRIDGE
This transactions creates a sidechain.
Definition: TxFormats.h:185
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:210
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
ripple::ttAMM_DEPOSIT
@ ttAMM_DEPOSIT
This transaction type deposits into an AMM instance.
Definition: TxFormats.h:149
ripple::TxConsequences::Category
Category
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:50
ripple::ttOFFER_CANCEL
@ ttOFFER_CANCEL
This transaction type cancels existing offers to trade one asset for another.
Definition: TxFormats.h:83
ripple::ttPAYCHAN_CREATE
@ ttPAYCHAN_CREATE
This transaction type creates a new unidirectional XRP payment channel.
Definition: TxFormats.h:98
std::optional::emplace
T emplace(T... args)
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:56
ripple::invoke_calculateBaseFee
static XRPAmount invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: applySteps.cpp:286
ripple::ApplyContext::journal
const beast::Journal journal
Definition: ApplyContext.h:51
ripple::ttXCHAIN_CREATE_CLAIM_ID
@ ttXCHAIN_CREATE_CLAIM_ID
This transactions creates a crosschain sequence number.
Definition: TxFormats.h:164
ripple::PreflightResult::tx
STTx const & tx
From the input - the transaction.
Definition: applySteps.h:154
ripple::preflight
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
Definition: applySteps.cpp:361
ripple::ttDID_SET
@ ttDID_SET
This transaction type creates or updates a DID.
Definition: TxFormats.h:188
ripple::ttNFTOKEN_ACCEPT_OFFER
@ ttNFTOKEN_ACCEPT_OFFER
This transaction accepts an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:140
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:204
ripple::PreclaimResult::likelyToClaimFee
const bool likelyToClaimFee
Success flag - whether the transaction is likely to claim a fee.
Definition: applySteps.h:209
ripple::PreclaimResult::ter
const TER ter
Intermediate transaction result.
Definition: applySteps.h:206
ripple::requires
requires(T::ConsequencesFactory==Transactor::Normal) TxConsequences consequences_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:187
ripple::invoke_preclaim
static TER invoke_preclaim(PreclaimContext const &ctx)
Definition: applySteps.cpp:237
ripple::ttCHECK_CANCEL
@ ttCHECK_CANCEL
This transaction type cancels an existing check.
Definition: TxFormats.h:113
ripple::ttPAYMENT
@ ttPAYMENT
This transaction type executes a payment.
Definition: TxFormats.h:59
stdexcept
ripple::Transactor::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Transactor.cpp:165
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:216
ripple::doApply
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Definition: applySteps.cpp:439
ripple::ttCHECK_CREATE
@ ttCHECK_CREATE
This transaction type creates a new check.
Definition: TxFormats.h:107
ripple::PreflightResult
Describes the results of the preflight check.
Definition: applySteps.h:150
ripple::ttXCHAIN_COMMIT
@ ttXCHAIN_COMMIT
This transactions initiates a crosschain transaction.
Definition: TxFormats.h:167
ripple::ttAMM_CREATE
@ ttAMM_CREATE
This transaction type creates an AMM instance.
Definition: TxFormats.h:146
ripple::TxConsequences::potentialSpend
XRPAmount const & potentialSpend() const
Potential Spend.
Definition: applySteps.h:108
ripple::PreflightResult::rules
const Rules rules
From the input - the rules.
Definition: applySteps.h:156
ripple::ttTRUST_SET
@ ttTRUST_SET
This transaction type modifies a trustline between two accounts.
Definition: TxFormats.h:119
ripple::TxConsequences::blocker
@ blocker
Affects the ability of subsequent transactions to claim a fee.
Definition: applySteps.h:55
ripple::PreflightResult::ter
const NotTEC ter
Intermediate transaction result.
Definition: applySteps.h:165
ripple::TERSubset
Definition: TER.h:386
ripple::ttNFTOKEN_MINT
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
Definition: TxFormats.h:128
ripple::ttESCROW_CREATE
@ ttESCROW_CREATE
This transaction type creates an escrow object.
Definition: TxFormats.h:62
ripple::TER
TERSubset< CanCvtToTER > TER
Definition: TER.h:614
ripple::ttXCHAIN_MODIFY_BRIDGE
@ ttXCHAIN_MODIFY_BRIDGE
This transaction modifies a sidechain.
Definition: TxFormats.h:182
ripple::ttAMM_WITHDRAW
@ ttAMM_WITHDRAW
This transaction type withdraws from an AMM instance.
Definition: TxFormats.h:152
ripple::ttESCROW_FINISH
@ ttESCROW_FINISH
This transaction type completes an existing escrow.
Definition: TxFormats.h:65
ripple::STTx
Definition: STTx.h:46
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::temUNKNOWN
@ temUNKNOWN
Definition: TER.h:123
ripple::ttXCHAIN_ACCOUNT_CREATE_COMMIT
@ ttXCHAIN_ACCOUNT_CREATE_COMMIT
This transaction initiates a crosschain account create transaction.
Definition: TxFormats.h:173
ripple::ttDID_DELETE
@ ttDID_DELETE
This transaction type deletes a DID.
Definition: TxFormats.h:191
ripple::TxConsequences::isBlocker_
bool isBlocker_
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:61
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:58
ripple::ttNFTOKEN_CANCEL_OFFER
@ ttNFTOKEN_CANCEL_OFFER
This transaction cancels an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:137
ripple::ttOFFER_CREATE
@ ttOFFER_CREATE
This transaction type creates an offer to trade one asset for another.
Definition: TxFormats.h:80
ripple::invoke_apply
static std::pair< TER, bool > invoke_apply(ApplyContext &ctx)
Definition: applySteps.cpp:341
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
ripple::calculateDefaultBaseFee
XRPAmount calculateDefaultBaseFee(ReadView const &view, STTx const &tx)
Return the minimum fee that an "ordinary" transaction would pay.
Definition: applySteps.cpp:433
ripple::ttACCOUNT_SET
@ ttACCOUNT_SET
This transaction type adjusts various account settings.
Definition: TxFormats.h:68
ripple::Transactor::Custom
@ Custom
Definition: Transactor.h:101
ripple::preclaim
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
Definition: applySteps.cpp:381
ripple::TxConsequences::sequencesConsumed
std::uint32_t sequencesConsumed() const
Sequences consumed.
Definition: applySteps.h:122
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:54
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::ttORACLE_SET
@ ttORACLE_SET
This transaction type creates an Oracle instance.
Definition: TxFormats.h:195
ripple::ReadView::seq
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition: ReadView.h:122
ripple::ttDEPOSIT_PREAUTH
@ ttDEPOSIT_PREAUTH
This transaction type grants or revokes authorization to transfer funds.
Definition: TxFormats.h:116
ripple::Transactor::Normal
@ Normal
Definition: Transactor.h:101
ripple::ttCHECK_CASH
@ ttCHECK_CASH
This transaction type cashes an existing check.
Definition: TxFormats.h:110
ripple::PreclaimResult
Describes the results of the preclaim check.
Definition: applySteps.h:193
ripple::ttPAYCHAN_FUND
@ ttPAYCHAN_FUND
This transaction type funds an existing unidirectional XRP payment channel.
Definition: TxFormats.h:101
ripple::SeqProxy
A type that represents either a sequence value or a ticket value.
Definition: SeqProxy.h:55
ripple::TxConsequences::potentialSpend_
XRPAmount potentialSpend_
Does NOT include the fee.
Definition: applySteps.h:65
ripple::ttAMM_VOTE
@ ttAMM_VOTE
This transaction type votes for the trading fee.
Definition: TxFormats.h:155
ripple::ttPAYCHAN_CLAIM
@ ttPAYCHAN_CLAIM
This transaction type submits a claim against an existing unidirectional payment channel.
Definition: TxFormats.h:104
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::calculateBaseFee
XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
Definition: applySteps.cpp:427
std::optional
ripple::ttNFTOKEN_BURN
@ ttNFTOKEN_BURN
This transaction burns (i.e.
Definition: TxFormats.h:131
ripple::PreclaimResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:201
ripple::sfFee
const SF_AMOUNT sfFee
ripple::PreflightResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:160
ripple::TxConsequences::sequencesConsumed_
std::uint32_t sequencesConsumed_
Number of sequences consumed.
Definition: applySteps.h:69
ripple::tefEXCEPTION
@ tefEXCEPTION
Definition: TER.h:169
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:35
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
ripple::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition: applySteps.h:45
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:238
ripple::OpenView::rules
Rules const & rules() const override
Returns the tx processing rules.
Definition: OpenView.cpp:152
ripple::invoke_preflight
static std::pair< NotTEC, TxConsequences > invoke_preflight(PreflightContext const &ctx)
Definition: applySteps.cpp:214
ripple::ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION
@ ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION
This transaction adds an attestation to a claimid.
Definition: TxFormats.h:179
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
ripple::ttTICKET_CREATE
@ ttTICKET_CREATE
This transaction type creates a new set of tickets.
Definition: TxFormats.h:89
std::exception::what
T what(T... args)
ripple::PreclaimResult::tx
STTx const & tx
From the input - the transaction.
Definition: applySteps.h:199
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::ttAMM_BID
@ ttAMM_BID
This transaction type bids for the auction slot.
Definition: TxFormats.h:158
ripple::PreflightResult::j
const beast::Journal j
From the input - the journal.
Definition: applySteps.h:162
ripple::ttXCHAIN_ADD_CLAIM_ATTESTATION
@ ttXCHAIN_ADD_CLAIM_ATTESTATION
This transaction adds an attestation to a claimid.
Definition: TxFormats.h:176
beast
Definition: base_uint.h:641