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/DepositPreauth.h>
39 #include <ripple/app/tx/impl/Escrow.h>
40 #include <ripple/app/tx/impl/NFTokenAcceptOffer.h>
41 #include <ripple/app/tx/impl/NFTokenBurn.h>
42 #include <ripple/app/tx/impl/NFTokenCancelOffer.h>
43 #include <ripple/app/tx/impl/NFTokenCreateOffer.h>
44 #include <ripple/app/tx/impl/NFTokenMint.h>
45 #include <ripple/app/tx/impl/PayChan.h>
46 #include <ripple/app/tx/impl/Payment.h>
47 #include <ripple/app/tx/impl/SetAccount.h>
48 #include <ripple/app/tx/impl/SetRegularKey.h>
49 #include <ripple/app/tx/impl/SetSignerList.h>
50 #include <ripple/app/tx/impl/SetTrust.h>
51 #include <ripple/app/tx/impl/XChainBridge.h>
52 #include <ripple/protocol/TxFormats.h>
53 
54 #include <stdexcept>
55 
56 namespace ripple {
57 
58 namespace {
59 
60 struct UnknownTxnType : std::exception
61 {
62  TxType txnType;
63  UnknownTxnType(TxType t) : txnType{t}
64  {
65  }
66 };
67 
68 // Call a lambda with the concrete transaction type as a template parameter
69 // throw an "UnknownTxnType" exception on error
70 template <class F>
71 auto
72 with_txn_type(TxType txnType, F&& f)
73 {
74  switch (txnType)
75  {
76  case ttACCOUNT_DELETE:
77  return f.template operator()<DeleteAccount>();
78  case ttACCOUNT_SET:
79  return f.template operator()<SetAccount>();
80  case ttCHECK_CANCEL:
81  return f.template operator()<CancelCheck>();
82  case ttCHECK_CASH:
83  return f.template operator()<CashCheck>();
84  case ttCHECK_CREATE:
85  return f.template operator()<CreateCheck>();
86  case ttDEPOSIT_PREAUTH:
87  return f.template operator()<DepositPreauth>();
88  case ttOFFER_CANCEL:
89  return f.template operator()<CancelOffer>();
90  case ttOFFER_CREATE:
91  return f.template operator()<CreateOffer>();
92  case ttESCROW_CREATE:
93  return f.template operator()<EscrowCreate>();
94  case ttESCROW_FINISH:
95  return f.template operator()<EscrowFinish>();
96  case ttESCROW_CANCEL:
97  return f.template operator()<EscrowCancel>();
98  case ttPAYCHAN_CLAIM:
99  return f.template operator()<PayChanClaim>();
100  case ttPAYCHAN_CREATE:
101  return f.template operator()<PayChanCreate>();
102  case ttPAYCHAN_FUND:
103  return f.template operator()<PayChanFund>();
104  case ttPAYMENT:
105  return f.template operator()<Payment>();
106  case ttREGULAR_KEY_SET:
107  return f.template operator()<SetRegularKey>();
108  case ttSIGNER_LIST_SET:
109  return f.template operator()<SetSignerList>();
110  case ttTICKET_CREATE:
111  return f.template operator()<CreateTicket>();
112  case ttTRUST_SET:
113  return f.template operator()<SetTrust>();
114  case ttAMENDMENT:
115  case ttFEE:
116  case ttUNL_MODIFY:
117  return f.template operator()<Change>();
118  case ttNFTOKEN_MINT:
119  return f.template operator()<NFTokenMint>();
120  case ttNFTOKEN_BURN:
121  return f.template operator()<NFTokenBurn>();
123  return f.template operator()<NFTokenCreateOffer>();
125  return f.template operator()<NFTokenCancelOffer>();
127  return f.template operator()<NFTokenAcceptOffer>();
128  case ttCLAWBACK:
129  return f.template operator()<Clawback>();
130  case ttAMM_CREATE:
131  return f.template operator()<AMMCreate>();
132  case ttAMM_DEPOSIT:
133  return f.template operator()<AMMDeposit>();
134  case ttAMM_WITHDRAW:
135  return f.template operator()<AMMWithdraw>();
136  case ttAMM_VOTE:
137  return f.template operator()<AMMVote>();
138  case ttAMM_BID:
139  return f.template operator()<AMMBid>();
140  case ttAMM_DELETE:
141  return f.template operator()<AMMDelete>();
143  return f.template operator()<XChainCreateBridge>();
145  return f.template operator()<BridgeModify>();
147  return f.template operator()<XChainCreateClaimID>();
148  case ttXCHAIN_COMMIT:
149  return f.template operator()<XChainCommit>();
150  case ttXCHAIN_CLAIM:
151  return f.template operator()<XChainClaim>();
153  return f.template operator()<XChainAddClaimAttestation>();
155  return f.template operator()<XChainAddAccountCreateAttestation>();
157  return f.template operator()<XChainCreateAccountCommit>();
158  case ttDID_SET:
159  return f.template operator()<DIDSet>();
160  case ttDID_DELETE:
161  return f.template operator()<DIDDelete>();
162  default:
163  throw UnknownTxnType(txnType);
164  }
165 }
166 } // namespace
167 
168 // Templates so preflight does the right thing with T::ConsequencesFactory.
169 //
170 // This could be done more easily using if constexpr, but Visual Studio
171 // 2017 doesn't handle if constexpr correctly. So once we're no longer
172 // building with Visual Studio 2017 we can consider replacing the four
173 // templates with a single template function that uses if constexpr.
174 //
175 // For Transactor::Normal
176 //
177 
178 // clang-format off
179 // Current formatter for rippled is based on clang-10, which does not handle `requires` clauses
180 template <class T>
181 requires(T::ConsequencesFactory == Transactor::Normal)
183  consequences_helper(PreflightContext const& ctx)
184 {
185  return TxConsequences(ctx.tx);
186 };
187 
188 // For Transactor::Blocker
189 template <class T>
190 requires(T::ConsequencesFactory == Transactor::Blocker)
191 TxConsequences
192  consequences_helper(PreflightContext const& ctx)
193 {
194  return TxConsequences(ctx.tx, TxConsequences::blocker);
195 };
196 
197 // For Transactor::Custom
198 template <class T>
199 requires(T::ConsequencesFactory == Transactor::Custom)
200 TxConsequences
201  consequences_helper(PreflightContext const& ctx)
202 {
203  return T::makeTxConsequences(ctx);
204 };
205 // clang-format on
206 
209 {
210  try
211  {
212  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
213  auto const tec = T::preflight(ctx);
214  return std::make_pair(
215  tec,
216  isTesSuccess(tec) ? consequences_helper<T>(ctx)
217  : TxConsequences{tec});
218  });
219  }
220  catch (UnknownTxnType const& e)
221  {
222  // Should never happen
223  JLOG(ctx.j.fatal())
224  << "Unknown transaction type in preflight: " << e.txnType;
225  assert(false);
226  return {temUNKNOWN, TxConsequences{temUNKNOWN}};
227  }
228 }
229 
230 static TER
232 {
233  try
234  {
235  // use name hiding to accomplish compile-time polymorphism of static
236  // class functions for Transactor and derived classes.
237  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
238  // If the transactor requires a valid account and the transaction
239  // doesn't list one, preflight will have already a flagged a
240  // failure.
241  auto const id = ctx.tx.getAccountID(sfAccount);
242 
243  if (id != beast::zero)
244  {
245  TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
246 
247  if (result != tesSUCCESS)
248  return result;
249 
250  result = T::checkPriorTxAndLastLedger(ctx);
251 
252  if (result != tesSUCCESS)
253  return result;
254 
255  result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
256 
257  if (result != tesSUCCESS)
258  return result;
259 
260  result = T::checkSign(ctx);
261 
262  if (result != tesSUCCESS)
263  return result;
264  }
265 
266  return T::preclaim(ctx);
267  });
268  }
269  catch (UnknownTxnType const& e)
270  {
271  // Should never happen
272  JLOG(ctx.j.fatal())
273  << "Unknown transaction type in preclaim: " << e.txnType;
274  assert(false);
275  return temUNKNOWN;
276  }
277 }
278 
279 static XRPAmount
280 invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
281 {
282  try
283  {
284  return with_txn_type(tx.getTxnType(), [&]<typename T>() {
285  return T::calculateBaseFee(view, tx);
286  });
287  }
288  catch (UnknownTxnType const& e)
289  {
290  assert(false);
291  return XRPAmount{0};
292  }
293 }
294 
295 TxConsequences::TxConsequences(NotTEC pfresult)
296  : isBlocker_(false)
297  , fee_(beast::zero)
298  , potentialSpend_(beast::zero)
299  , seqProx_(SeqProxy::sequence(0))
300  , sequencesConsumed_(0)
301 {
302  assert(!isTesSuccess(pfresult));
303 }
304 
306  : isBlocker_(false)
307  , fee_(
308  tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
309  : beast::zero)
310  , potentialSpend_(beast::zero)
311  , seqProx_(tx.getSeqProxy())
312  , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
313 {
314 }
315 
317  : TxConsequences(tx)
318 {
319  isBlocker_ = (category == blocker);
320 }
321 
323  : TxConsequences(tx)
324 {
326 }
327 
328 TxConsequences::TxConsequences(STTx const& tx, std::uint32_t sequencesConsumed)
329  : TxConsequences(tx)
330 {
332 }
333 
336 {
337  try
338  {
339  return with_txn_type(ctx.tx.getTxnType(), [&]<typename T>() {
340  T p(ctx);
341  return p();
342  });
343  }
344  catch (UnknownTxnType const& e)
345  {
346  // Should never happen
347  JLOG(ctx.journal.fatal())
348  << "Unknown transaction type in apply: " << e.txnType;
349  assert(false);
350  return {temUNKNOWN, false};
351  }
352 }
353 
354 PreflightResult
356  Application& app,
357  Rules const& rules,
358  STTx const& tx,
359  ApplyFlags flags,
360  beast::Journal j)
361 {
362  PreflightContext const pfctx(app, tx, rules, flags, j);
363  try
364  {
365  return {pfctx, invoke_preflight(pfctx)};
366  }
367  catch (std::exception const& e)
368  {
369  JLOG(j.fatal()) << "apply: " << e.what();
370  return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
371  }
372 }
373 
374 PreclaimResult
376  PreflightResult const& preflightResult,
377  Application& app,
378  OpenView const& view)
379 {
381  if (preflightResult.rules != view.rules())
382  {
383  auto secondFlight = preflight(
384  app,
385  view.rules(),
386  preflightResult.tx,
387  preflightResult.flags,
388  preflightResult.j);
389  ctx.emplace(
390  app,
391  view,
392  secondFlight.ter,
393  secondFlight.tx,
394  secondFlight.flags,
395  secondFlight.j);
396  }
397  else
398  {
399  ctx.emplace(
400  app,
401  view,
402  preflightResult.ter,
403  preflightResult.tx,
404  preflightResult.flags,
405  preflightResult.j);
406  }
407  try
408  {
409  if (ctx->preflightResult != tesSUCCESS)
410  return {*ctx, ctx->preflightResult};
411  return {*ctx, invoke_preclaim(*ctx)};
412  }
413  catch (std::exception const& e)
414  {
415  JLOG(ctx->j.fatal()) << "apply: " << e.what();
416  return {*ctx, tefEXCEPTION};
417  }
418 }
419 
420 XRPAmount
421 calculateBaseFee(ReadView const& view, STTx const& tx)
422 {
423  return invoke_calculateBaseFee(view, tx);
424 }
425 
426 XRPAmount
427 calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
428 {
429  return Transactor::calculateBaseFee(view, tx);
430 }
431 
433 doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
434 {
435  if (preclaimResult.view.seq() != view.seq())
436  {
437  // Logic error from the caller. Don't have enough
438  // info to recover.
439  return {tefEXCEPTION, false};
440  }
441  try
442  {
443  if (!preclaimResult.likelyToClaimFee)
444  return {preclaimResult.ter, false};
445  ApplyContext ctx(
446  app,
447  view,
448  preclaimResult.tx,
449  preclaimResult.ter,
450  calculateBaseFee(view, preclaimResult.tx),
451  preclaimResult.flags,
452  preclaimResult.j);
453  return invoke_apply(ctx);
454  }
455  catch (std::exception const& e)
456  {
457  JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
458  return {tefEXCEPTION, false};
459  }
460 }
461 
462 } // namespace ripple
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:338
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:179
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::TxConsequences::TxConsequences
TxConsequences(NotTEC pfresult)
Definition: applySteps.cpp:295
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:637
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:204
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:280
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:355
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:198
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:181
ripple::invoke_preclaim
static TER invoke_preclaim(PreclaimContext const &ctx)
Definition: applySteps.cpp:231
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:210
ripple::doApply
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Definition: applySteps.cpp:433
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:380
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:608
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:45
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:335
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:427
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:375
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::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:421
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:166
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:236
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:208
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