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/ApplyContext.h>
22 #include <ripple/app/tx/impl/CancelCheck.h>
23 #include <ripple/app/tx/impl/CancelOffer.h>
24 #include <ripple/app/tx/impl/CashCheck.h>
25 #include <ripple/app/tx/impl/Change.h>
26 #include <ripple/app/tx/impl/CreateCheck.h>
27 #include <ripple/app/tx/impl/CreateOffer.h>
28 #include <ripple/app/tx/impl/CreateTicket.h>
29 #include <ripple/app/tx/impl/DeleteAccount.h>
30 #include <ripple/app/tx/impl/DepositPreauth.h>
31 #include <ripple/app/tx/impl/Escrow.h>
32 #include <ripple/app/tx/impl/PayChan.h>
33 #include <ripple/app/tx/impl/Payment.h>
34 #include <ripple/app/tx/impl/SetAccount.h>
35 #include <ripple/app/tx/impl/SetRegularKey.h>
36 #include <ripple/app/tx/impl/SetSignerList.h>
37 #include <ripple/app/tx/impl/SetTrust.h>
38 
39 namespace ripple {
40 
41 // Templates so preflight does the right thing with T::ConsequencesFactory.
42 //
43 // This could be done more easily using if constexpr, but Visual Studio
44 // 2017 doesn't handle if constexpr correctly. So once we're no longer
45 // building with Visual Studio 2017 we can consider replacing the four
46 // templates with a single template function that uses if constexpr.
47 //
48 // For Transactor::Normal
49 template <
50  class T,
52 TxConsequences
54 {
55  return TxConsequences(ctx.tx);
56 };
57 
58 // For Transactor::Blocker
59 template <
60  class T,
62 TxConsequences
63 consequences_helper(PreflightContext const& ctx)
64 {
65  return TxConsequences(ctx.tx, TxConsequences::blocker);
66 };
67 
68 // For Transactor::Custom
69 template <
70  class T,
72 TxConsequences
73 consequences_helper(PreflightContext const& ctx)
74 {
75  return T::makeTxConsequences(ctx);
76 };
77 
78 template <class T>
81 {
82  auto const tec = T::preflight(ctx);
83  return {
84  tec,
85  isTesSuccess(tec) ? consequences_helper<T>(ctx) : TxConsequences{tec}};
86 }
87 
90 {
91  switch (ctx.tx.getTxnType())
92  {
93  case ttACCOUNT_DELETE:
94  return invoke_preflight_helper<DeleteAccount>(ctx);
95  case ttACCOUNT_SET:
96  return invoke_preflight_helper<SetAccount>(ctx);
97  case ttCHECK_CANCEL:
98  return invoke_preflight_helper<CancelCheck>(ctx);
99  case ttCHECK_CASH:
100  return invoke_preflight_helper<CashCheck>(ctx);
101  case ttCHECK_CREATE:
102  return invoke_preflight_helper<CreateCheck>(ctx);
103  case ttDEPOSIT_PREAUTH:
104  return invoke_preflight_helper<DepositPreauth>(ctx);
105  case ttOFFER_CANCEL:
106  return invoke_preflight_helper<CancelOffer>(ctx);
107  case ttOFFER_CREATE:
108  return invoke_preflight_helper<CreateOffer>(ctx);
109  case ttESCROW_CREATE:
110  return invoke_preflight_helper<EscrowCreate>(ctx);
111  case ttESCROW_FINISH:
112  return invoke_preflight_helper<EscrowFinish>(ctx);
113  case ttESCROW_CANCEL:
114  return invoke_preflight_helper<EscrowCancel>(ctx);
115  case ttPAYCHAN_CLAIM:
116  return invoke_preflight_helper<PayChanClaim>(ctx);
117  case ttPAYCHAN_CREATE:
118  return invoke_preflight_helper<PayChanCreate>(ctx);
119  case ttPAYCHAN_FUND:
120  return invoke_preflight_helper<PayChanFund>(ctx);
121  case ttPAYMENT:
122  return invoke_preflight_helper<Payment>(ctx);
123  case ttREGULAR_KEY_SET:
124  return invoke_preflight_helper<SetRegularKey>(ctx);
125  case ttSIGNER_LIST_SET:
126  return invoke_preflight_helper<SetSignerList>(ctx);
127  case ttTICKET_CREATE:
128  return invoke_preflight_helper<CreateTicket>(ctx);
129  case ttTRUST_SET:
130  return invoke_preflight_helper<SetTrust>(ctx);
131  case ttAMENDMENT:
132  case ttFEE:
133  case ttUNL_MODIFY:
134  return invoke_preflight_helper<Change>(ctx);
135  default:
136  assert(false);
138  }
139 }
140 
141 // The TxQ needs to be able to bypass checking the Sequence or Ticket
142 // The enum provides a self-documenting way to do that
143 enum class SeqCheck : bool {
144  no = false,
145  yes = true,
146 };
147 
148 /* invoke_preclaim<T> uses name hiding to accomplish
149  compile-time polymorphism of (presumably) static
150  class functions for Transactor and derived classes.
151 */
152 template <class T>
153 static TER
155 {
156  // If the transactor requires a valid account and the transaction doesn't
157  // list one, preflight will have already a flagged a failure.
158  auto const id = ctx.tx.getAccountID(sfAccount);
159 
160  if (id != beast::zero)
161  {
162  TER result{tesSUCCESS};
163  if (seqChk == SeqCheck::yes)
164  {
165  result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
166 
167  if (result != tesSUCCESS)
168  return result;
169  }
170 
171  result = T::checkPriorTxAndLastLedger(ctx);
172 
173  if (result != tesSUCCESS)
174  return result;
175 
176  result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
177 
178  if (result != tesSUCCESS)
179  return result;
180 
181  result = T::checkSign(ctx);
182 
183  if (result != tesSUCCESS)
184  return result;
185  }
186 
187  return T::preclaim(ctx);
188 }
189 
190 static TER
191 invoke_preclaim(PreclaimContext const& ctx, SeqCheck seqChk)
192 {
193  switch (ctx.tx.getTxnType())
194  {
195  case ttACCOUNT_DELETE:
196  return invoke_preclaim<DeleteAccount>(ctx, seqChk);
197  case ttACCOUNT_SET:
198  return invoke_preclaim<SetAccount>(ctx, seqChk);
199  case ttCHECK_CANCEL:
200  return invoke_preclaim<CancelCheck>(ctx, seqChk);
201  case ttCHECK_CASH:
202  return invoke_preclaim<CashCheck>(ctx, seqChk);
203  case ttCHECK_CREATE:
204  return invoke_preclaim<CreateCheck>(ctx, seqChk);
205  case ttDEPOSIT_PREAUTH:
206  return invoke_preclaim<DepositPreauth>(ctx, seqChk);
207  case ttOFFER_CANCEL:
208  return invoke_preclaim<CancelOffer>(ctx, seqChk);
209  case ttOFFER_CREATE:
210  return invoke_preclaim<CreateOffer>(ctx, seqChk);
211  case ttESCROW_CREATE:
212  return invoke_preclaim<EscrowCreate>(ctx, seqChk);
213  case ttESCROW_FINISH:
214  return invoke_preclaim<EscrowFinish>(ctx, seqChk);
215  case ttESCROW_CANCEL:
216  return invoke_preclaim<EscrowCancel>(ctx, seqChk);
217  case ttPAYCHAN_CLAIM:
218  return invoke_preclaim<PayChanClaim>(ctx, seqChk);
219  case ttPAYCHAN_CREATE:
220  return invoke_preclaim<PayChanCreate>(ctx, seqChk);
221  case ttPAYCHAN_FUND:
222  return invoke_preclaim<PayChanFund>(ctx, seqChk);
223  case ttPAYMENT:
224  return invoke_preclaim<Payment>(ctx, seqChk);
225  case ttREGULAR_KEY_SET:
226  return invoke_preclaim<SetRegularKey>(ctx, seqChk);
227  case ttSIGNER_LIST_SET:
228  return invoke_preclaim<SetSignerList>(ctx, seqChk);
229  case ttTICKET_CREATE:
230  return invoke_preclaim<CreateTicket>(ctx, seqChk);
231  case ttTRUST_SET:
232  return invoke_preclaim<SetTrust>(ctx, seqChk);
233  case ttAMENDMENT:
234  case ttFEE:
235  case ttUNL_MODIFY:
236  return invoke_preclaim<Change>(ctx, seqChk);
237  default:
238  assert(false);
239  return temUNKNOWN;
240  }
241 }
242 
243 template <class T>
244 static TER
245 invoke_seqCheck(ReadView const& view, STTx const& tx, beast::Journal j)
246 {
247  return T::checkSeqProxy(view, tx, j);
248 }
249 
250 TER
252 {
253  switch (tx.getTxnType())
254  {
255  case ttACCOUNT_DELETE:
256  return invoke_seqCheck<DeleteAccount>(view, tx, j);
257  case ttACCOUNT_SET:
258  return invoke_seqCheck<SetAccount>(view, tx, j);
259  case ttCHECK_CANCEL:
260  return invoke_seqCheck<CancelCheck>(view, tx, j);
261  case ttCHECK_CASH:
262  return invoke_seqCheck<CashCheck>(view, tx, j);
263  case ttCHECK_CREATE:
264  return invoke_seqCheck<CreateCheck>(view, tx, j);
265  case ttDEPOSIT_PREAUTH:
266  return invoke_seqCheck<DepositPreauth>(view, tx, j);
267  case ttOFFER_CANCEL:
268  return invoke_seqCheck<CancelOffer>(view, tx, j);
269  case ttOFFER_CREATE:
270  return invoke_seqCheck<CreateOffer>(view, tx, j);
271  case ttESCROW_CREATE:
272  return invoke_seqCheck<EscrowCreate>(view, tx, j);
273  case ttESCROW_FINISH:
274  return invoke_seqCheck<EscrowFinish>(view, tx, j);
275  case ttESCROW_CANCEL:
276  return invoke_seqCheck<EscrowCancel>(view, tx, j);
277  case ttPAYCHAN_CLAIM:
278  return invoke_seqCheck<PayChanClaim>(view, tx, j);
279  case ttPAYCHAN_CREATE:
280  return invoke_seqCheck<PayChanCreate>(view, tx, j);
281  case ttPAYCHAN_FUND:
282  return invoke_seqCheck<PayChanFund>(view, tx, j);
283  case ttPAYMENT:
284  return invoke_seqCheck<Payment>(view, tx, j);
285  case ttREGULAR_KEY_SET:
286  return invoke_seqCheck<SetRegularKey>(view, tx, j);
287  case ttSIGNER_LIST_SET:
288  return invoke_seqCheck<SetSignerList>(view, tx, j);
289  case ttTICKET_CREATE:
290  return invoke_seqCheck<CreateTicket>(view, tx, j);
291  case ttTRUST_SET:
292  return invoke_seqCheck<SetTrust>(view, tx, j);
293  case ttAMENDMENT:
294  case ttFEE:
295  case ttUNL_MODIFY:
296  return invoke_seqCheck<Change>(view, tx, j);
297  default:
298  assert(false);
299  return temUNKNOWN;
300  }
301 }
302 
303 static FeeUnit64
304 invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
305 {
306  switch (tx.getTxnType())
307  {
308  case ttACCOUNT_DELETE:
309  return DeleteAccount::calculateBaseFee(view, tx);
310  case ttACCOUNT_SET:
311  return SetAccount::calculateBaseFee(view, tx);
312  case ttCHECK_CANCEL:
313  return CancelCheck::calculateBaseFee(view, tx);
314  case ttCHECK_CASH:
315  return CashCheck::calculateBaseFee(view, tx);
316  case ttCHECK_CREATE:
317  return CreateCheck::calculateBaseFee(view, tx);
318  case ttDEPOSIT_PREAUTH:
319  return DepositPreauth::calculateBaseFee(view, tx);
320  case ttOFFER_CANCEL:
321  return CancelOffer::calculateBaseFee(view, tx);
322  case ttOFFER_CREATE:
323  return CreateOffer::calculateBaseFee(view, tx);
324  case ttESCROW_CREATE:
325  return EscrowCreate::calculateBaseFee(view, tx);
326  case ttESCROW_FINISH:
327  return EscrowFinish::calculateBaseFee(view, tx);
328  case ttESCROW_CANCEL:
329  return EscrowCancel::calculateBaseFee(view, tx);
330  case ttPAYCHAN_CLAIM:
331  return PayChanClaim::calculateBaseFee(view, tx);
332  case ttPAYCHAN_CREATE:
333  return PayChanCreate::calculateBaseFee(view, tx);
334  case ttPAYCHAN_FUND:
335  return PayChanFund::calculateBaseFee(view, tx);
336  case ttPAYMENT:
337  return Payment::calculateBaseFee(view, tx);
338  case ttREGULAR_KEY_SET:
339  return SetRegularKey::calculateBaseFee(view, tx);
340  case ttSIGNER_LIST_SET:
341  return SetSignerList::calculateBaseFee(view, tx);
342  case ttTICKET_CREATE:
343  return CreateTicket::calculateBaseFee(view, tx);
344  case ttTRUST_SET:
345  return SetTrust::calculateBaseFee(view, tx);
346  case ttAMENDMENT:
347  case ttFEE:
348  case ttUNL_MODIFY:
349  return Change::calculateBaseFee(view, tx);
350  default:
351  assert(false);
352  return FeeUnit64{0};
353  }
354 }
355 
357  : isBlocker_(false)
358  , fee_(beast::zero)
359  , potentialSpend_(beast::zero)
360  , seqProx_(SeqProxy::sequence(0))
361  , sequencesConsumed_(0)
362 {
363  assert(!isTesSuccess(pfresult));
364 }
365 
367  : isBlocker_(false)
368  , fee_(
369  tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
370  : beast::zero)
371  , potentialSpend_(beast::zero)
372  , seqProx_(tx.getSeqProxy())
373  , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
374 {
375 }
376 
378  : TxConsequences(tx)
379 {
380  isBlocker_ = (category == blocker);
381 }
382 
384  : TxConsequences(tx)
385 {
387 }
388 
389 TxConsequences::TxConsequences(STTx const& tx, std::uint32_t sequencesConsumed)
390  : TxConsequences(tx)
391 {
393 }
394 
397 {
398  switch (ctx.tx.getTxnType())
399  {
400  case ttACCOUNT_DELETE: {
401  DeleteAccount p(ctx);
402  return p();
403  }
404  case ttACCOUNT_SET: {
405  SetAccount p(ctx);
406  return p();
407  }
408  case ttCHECK_CANCEL: {
409  CancelCheck p(ctx);
410  return p();
411  }
412  case ttCHECK_CASH: {
413  CashCheck p(ctx);
414  return p();
415  }
416  case ttCHECK_CREATE: {
417  CreateCheck p(ctx);
418  return p();
419  }
420  case ttDEPOSIT_PREAUTH: {
421  DepositPreauth p(ctx);
422  return p();
423  }
424  case ttOFFER_CANCEL: {
425  CancelOffer p(ctx);
426  return p();
427  }
428  case ttOFFER_CREATE: {
429  CreateOffer p(ctx);
430  return p();
431  }
432  case ttESCROW_CREATE: {
433  EscrowCreate p(ctx);
434  return p();
435  }
436  case ttESCROW_FINISH: {
437  EscrowFinish p(ctx);
438  return p();
439  }
440  case ttESCROW_CANCEL: {
441  EscrowCancel p(ctx);
442  return p();
443  }
444  case ttPAYCHAN_CLAIM: {
445  PayChanClaim p(ctx);
446  return p();
447  }
448  case ttPAYCHAN_CREATE: {
449  PayChanCreate p(ctx);
450  return p();
451  }
452  case ttPAYCHAN_FUND: {
453  PayChanFund p(ctx);
454  return p();
455  }
456  case ttPAYMENT: {
457  Payment p(ctx);
458  return p();
459  }
460  case ttREGULAR_KEY_SET: {
461  SetRegularKey p(ctx);
462  return p();
463  }
464  case ttSIGNER_LIST_SET: {
465  SetSignerList p(ctx);
466  return p();
467  }
468  case ttTICKET_CREATE: {
469  CreateTicket p(ctx);
470  return p();
471  }
472  case ttTRUST_SET: {
473  SetTrust p(ctx);
474  return p();
475  }
476  case ttAMENDMENT:
477  case ttFEE:
478  case ttUNL_MODIFY: {
479  Change p(ctx);
480  return p();
481  }
482  default:
483  assert(false);
484  return {temUNKNOWN, false};
485  }
486 }
487 
488 PreflightResult
490  Application& app,
491  Rules const& rules,
492  STTx const& tx,
493  ApplyFlags flags,
494  beast::Journal j)
495 {
496  PreflightContext const pfctx(app, tx, rules, flags, j);
497  try
498  {
499  return {pfctx, invoke_preflight(pfctx)};
500  }
501  catch (std::exception const& e)
502  {
503  JLOG(j.fatal()) << "apply: " << e.what();
504  return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
505  }
506 }
507 
509  PreflightResult const& preflightResult,
510  Application& app,
511  OpenView const& view,
512  SeqCheck seqChk)
513 {
514  boost::optional<PreclaimContext const> ctx;
515  if (preflightResult.rules != view.rules())
516  {
517  auto secondFlight = preflight(
518  app,
519  view.rules(),
520  preflightResult.tx,
521  preflightResult.flags,
522  preflightResult.j);
523  ctx.emplace(
524  app,
525  view,
526  secondFlight.ter,
527  secondFlight.tx,
528  secondFlight.flags,
529  secondFlight.j);
530  }
531  else
532  {
533  ctx.emplace(
534  app,
535  view,
536  preflightResult.ter,
537  preflightResult.tx,
538  preflightResult.flags,
539  preflightResult.j);
540  }
541  try
542  {
543  if (ctx->preflightResult != tesSUCCESS)
544  return {*ctx, ctx->preflightResult};
545  return {*ctx, invoke_preclaim(*ctx, seqChk)};
546  }
547  catch (std::exception const& e)
548  {
549  JLOG(ctx->j.fatal()) << "apply: " << e.what();
550  return {*ctx, tefEXCEPTION};
551  }
552 }
553 
554 PreclaimResult
556  PreflightResult const& preflightResult,
557  Application& app,
558  OpenView const& view)
559 {
560  return preclaim(preflightResult, app, view, SeqCheck::yes);
561 }
562 
563 PreclaimResult
565  PreflightResult const& preflightResult,
566  Application& app,
567  OpenView const& view)
568 {
569  return preclaim(preflightResult, app, view, SeqCheck::no);
570 }
571 
572 FeeUnit64
573 calculateBaseFee(ReadView const& view, STTx const& tx)
574 {
575  return invoke_calculateBaseFee(view, tx);
576 }
577 
578 XRPAmount
579 calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
580 {
581  return view.fees().toDrops(Transactor::calculateBaseFee(view, tx));
582 }
583 
585 doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
586 {
587  if (preclaimResult.view.seq() != view.seq())
588  {
589  // Logic error from the caller. Don't have enough
590  // info to recover.
591  return {tefEXCEPTION, false};
592  }
593  try
594  {
595  if (!preclaimResult.likelyToClaimFee)
596  return {preclaimResult.ter, false};
597  ApplyContext ctx(
598  app,
599  view,
600  preclaimResult.tx,
601  preclaimResult.ter,
602  calculateBaseFee(view, preclaimResult.tx),
603  preclaimResult.flags,
604  preclaimResult.j);
605  return invoke_apply(ctx);
606  }
607  catch (std::exception const& e)
608  {
609  JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
610  return {tefEXCEPTION, false};
611  }
612 }
613 
614 } // namespace ripple
ripple::ttPAYCHAN_CLAIM
@ ttPAYCHAN_CLAIM
Definition: TxFormats.h:51
ripple::ttCHECK_CANCEL
@ ttCHECK_CANCEL
Definition: TxFormats.h:54
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:339
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:105
ripple::PayChanClaim
Definition: app/tx/impl/PayChan.h:72
ripple::consequences_helper
TxConsequences consequences_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:53
ripple::Application
Definition: Application.h:97
ripple::SetRegularKey::calculateBaseFee
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: SetRegularKey.cpp:28
ripple::PreclaimResult::view
ReadView const & view
From the input - the ledger view.
Definition: applySteps.h:197
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
Definition: TxFormats.h:57
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:356
ripple::PreclaimContext::view
ReadView const & view
Definition: Transactor.h:57
ripple::calculateBaseFee
FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
Definition: applySteps.cpp:573
std::exception
STL class.
ripple::PreclaimContext::j
const beast::Journal j
Definition: Transactor.h:61
ripple::EscrowFinish::calculateBaseFee
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Escrow.cpp:355
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:580
std::pair
ripple::ttOFFER_CREATE
@ ttOFFER_CREATE
Definition: TxFormats.h:43
ripple::Payment
Definition: Payment.h:32
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:52
ripple::CreateCheck
Definition: CreateCheck.h:27
ripple::CancelOffer
Definition: CancelOffer.h:30
ripple::ReadView::fees
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
ripple::invoke_seqCheck
static TER invoke_seqCheck(ReadView const &view, STTx const &tx, beast::Journal j)
Definition: applySteps.cpp:245
ripple::sfAccount
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
Definition: SField.h:481
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:30
ripple::invoke_calculateBaseFee
static FeeUnit64 invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: applySteps.cpp:304
ripple::TxConsequences::Category
Category
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:50
ripple::SetAccount
Definition: SetAccount.h:32
ripple::DepositPreauth
Definition: DepositPreauth.h:27
ripple::EscrowCreate
Definition: Escrow.h:27
ripple::ForTxQ::seqCheck
static TER seqCheck(OpenView &view, STTx const &tx, beast::Journal j)
Definition: applySteps.cpp:251
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:489
ripple::DeleteAccount
Definition: DeleteAccount.h:29
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::SetSignerList
See the README.md for an overview of the SetSignerList transaction that this class implements.
Definition: SetSignerList.h:41
ripple::ttESCROW_FINISH
@ ttESCROW_FINISH
Definition: TxFormats.h:38
ripple::ttPAYMENT
@ ttPAYMENT
Definition: TxFormats.h:36
ripple::DeleteAccount::calculateBaseFee
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: DeleteAccount.cpp:56
ripple::ttFEE
@ ttFEE
Definition: TxFormats.h:62
ripple::SeqCheck::yes
@ yes
ripple::doApply
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Definition: applySteps.cpp:585
ripple::PreflightResult
Describes the results of the preflight check.
Definition: applySteps.h:150
std::enable_if_t
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
Definition: TxFormats.h:56
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:562
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< CanCvtToTER >
ripple::Change
Definition: Change.h:32
ripple::SetTrust
Definition: SetTrust.h:31
ripple::TER
TERSubset< CanCvtToTER > TER
Definition: TER.h:551
ripple::invoke_preflight_helper
std::pair< NotTEC, TxConsequences > invoke_preflight_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:80
ripple::STTx
Definition: STTx.h:42
ripple::Transactor::calculateBaseFee
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Transactor.cpp:140
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::CreateOffer
Transactor specialized for creating offers in the ledger.
Definition: CreateOffer.h:34
ripple::ttCHECK_CASH
@ ttCHECK_CASH
Definition: TxFormats.h:53
std::uint32_t
ripple::temUNKNOWN
@ temUNKNOWN
Definition: TER.h:120
ripple::ttTICKET_CREATE
@ ttTICKET_CREATE
Definition: TxFormats.h:46
ripple::ttAMENDMENT
@ ttAMENDMENT
Definition: TxFormats.h:61
ripple::feeunit::TaggedFee
Definition: FeeUnits.h:70
ripple::TxConsequences::isBlocker_
bool isBlocker_
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:61
ripple::sfFee
const SF_Amount sfFee(access, STI_AMOUNT, 8, "Fee")
Definition: SField.h:448
ripple::ttPAYCHAN_CREATE
@ ttPAYCHAN_CREATE
Definition: TxFormats.h:49
ripple::ForTxQ::preclaimWithoutSeqCheck
static PreclaimResult preclaimWithoutSeqCheck(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Definition: applySteps.cpp:564
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:59
ripple::Fees::toDrops
XRPAmount toDrops(FeeUnit64 const &fee) const
Definition: ReadView.h:72
ripple::invoke_apply
static std::pair< TER, bool > invoke_apply(ApplyContext &ctx)
Definition: applySteps.cpp:396
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:53
ripple::calculateDefaultBaseFee
XRPAmount calculateDefaultBaseFee(ReadView const &view, STTx const &tx)
Return the minimum fee that an "ordinary" transaction would pay.
Definition: applySteps.cpp:579
ripple::ttESCROW_CREATE
@ ttESCROW_CREATE
Definition: TxFormats.h:37
ripple::preclaim
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
Definition: applySteps.cpp:555
ripple::ttCHECK_CREATE
@ ttCHECK_CREATE
Definition: TxFormats.h:52
ripple::CancelCheck
Definition: CancelCheck.h:27
ripple::EscrowCancel
Definition: Escrow.h:69
ripple::TxConsequences::sequencesConsumed
std::uint32_t sequencesConsumed() const
Sequences consumed.
Definition: applySteps.h:122
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:192
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SeqCheck
SeqCheck
Definition: applySteps.cpp:143
ripple::SetRegularKey
Definition: SetRegularKey.h:30
ripple::PayChanFund
Definition: app/tx/impl/PayChan.h:51
ripple::ttESCROW_CANCEL
@ ttESCROW_CANCEL
Definition: TxFormats.h:40
ripple::ttACCOUNT_SET
@ ttACCOUNT_SET
Definition: TxFormats.h:39
ripple::ReadView::seq
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition: ReadView.h:260
ripple::ttOFFER_CANCEL
@ ttOFFER_CANCEL
Definition: TxFormats.h:44
ripple::Change::calculateBaseFee
static FeeUnit64 calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Change.h:50
ripple::PreclaimResult
Describes the results of the preclaim check.
Definition: applySteps.h:193
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::Rules
Rules controlling protocol behavior.
Definition: ReadView.h:131
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
Definition: TxFormats.h:63
ripple::PreclaimResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:201
ripple::PreflightResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:160
ripple::CreateTicket
Definition: CreateTicket.h:30
ripple::TxConsequences::sequencesConsumed_
std::uint32_t sequencesConsumed_
Number of sequences consumed.
Definition: applySteps.h:69
ripple::tefEXCEPTION
@ tefEXCEPTION
Definition: TER.h:149
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:36
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:32
ripple::SeqCheck::no
@ no
ripple::CashCheck
Definition: CashCheck.h:27
ripple::PayChanCreate
Definition: app/tx/impl/PayChan.h:27
ripple::ttPAYCHAN_FUND
@ ttPAYCHAN_FUND
Definition: TxFormats.h:50
ripple::invoke_preclaim
static TER invoke_preclaim(PreclaimContext const &ctx, SeqCheck seqChk)
Definition: applySteps.cpp:154
ripple::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition: applySteps.h:45
ripple::EscrowFinish
Definition: Escrow.h:48
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:216
ripple::OpenView::rules
Rules const & rules() const override
Returns the tx processing rules.
Definition: OpenView.cpp:129
ripple::invoke_preflight
static std::pair< NotTEC, TxConsequences > invoke_preflight(PreflightContext const &ctx)
Definition: applySteps.cpp:89
ripple::ttREGULAR_KEY_SET
@ ttREGULAR_KEY_SET
Definition: TxFormats.h:41
ripple::ttDEPOSIT_PREAUTH
@ ttDEPOSIT_PREAUTH
Definition: TxFormats.h:55
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
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::ttSIGNER_LIST_SET
@ ttSIGNER_LIST_SET
Definition: TxFormats.h:48
ripple::PreflightResult::j
const beast::Journal j
From the input - the journal.
Definition: applySteps.h:162
beast
Definition: base_uint.h:646