pub enum ExecutionResult {
Failure {
error: Error,
transfers: Vec<TransferAddr>,
cost: Gas,
execution_journal: ExecutionJournal,
},
Success {
transfers: Vec<TransferAddr>,
cost: Gas,
execution_journal: ExecutionJournal,
},
}
Expand description
Represents the result of an execution specified by
crate::core::engine_state::ExecuteRequest
.
Variants§
Failure
Fields
transfers: Vec<TransferAddr>
List of transfers that happened during execution up to the point of the failure.
execution_journal: ExecutionJournal
Journal of execution.
An error condition that happened during execution
Success
Fields
transfers: Vec<TransferAddr>
List of transfers.
execution_journal: ExecutionJournal
Journal of execution.
Execution was finished successfully
Implementations§
source§impl ExecutionResult
impl ExecutionResult
sourcepub fn precondition_failure(error: Error) -> ExecutionResult
pub fn precondition_failure(error: Error) -> ExecutionResult
Constructs ExecutionResult::Failure that has 0 cost and no effects.
This is the case for failures that we can’t (or don’t want to) charge
for, like PreprocessingError
or InvalidNonce
.
sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true
if this is a successful variant.
sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Returns true
if this is a failure variant.
sourcepub fn has_precondition_failure(&self) -> bool
pub fn has_precondition_failure(&self) -> bool
Returns true
if this is a precondition failure.
Precondition variant is further described as an execution failure which does not have any effects, and has a gas cost of 0.
sourcepub fn transfers(&self) -> &Vec<TransferAddr>
pub fn transfers(&self) -> &Vec<TransferAddr>
Returns list of transfers regardless of variant.
sourcepub fn execution_journal(&self) -> &ExecutionJournal
pub fn execution_journal(&self) -> &ExecutionJournal
The journal of transforms regardless of variant.
sourcepub fn with_cost(self, cost: Gas) -> Self
pub fn with_cost(self, cost: Gas) -> Self
Returns a new execution result with updated gas cost.
This method preserves the ExecutionResult
variant and updates the cost field
only.
sourcepub fn with_transfers(self, transfers: Vec<TransferAddr>) -> Self
pub fn with_transfers(self, transfers: Vec<TransferAddr>) -> Self
Returns a new execution result with updated transfers field.
This method preserves the ExecutionResult
variant and updates the
transfers
field only.
sourcepub fn with_journal(self, execution_journal: ExecutionJournal) -> Self
pub fn with_journal(self, execution_journal: ExecutionJournal) -> Self
Returns a new execution result with an updated execution journal.
This method preserves the ExecutionResult
variant and updates the
execution_journal
field only.
sourcepub fn as_error(&self) -> Option<&Error>
pub fn as_error(&self) -> Option<&Error>
Returns error value, if possible.
Returns a reference to a wrapped error::Error
instance if the object is a failure
variant.
sourcepub fn take_error(self) -> Option<Error>
pub fn take_error(self) -> Option<Error>
Consumes ExecutionResult
instance and optionally returns error::Error
instance for
ExecutionResult::Failure
variant.
sourcepub fn check_forced_transfer(
&self,
payment_purse_balance: Motes,
gas_price: u64
) -> Option<ForcedTransferResult>
pub fn check_forced_transfer( &self, payment_purse_balance: Motes, gas_price: u64 ) -> Option<ForcedTransferResult>
Checks the transfer status of a payment code.
This method converts the gas cost of the execution result into motes using supplied
gas_price
, and then a check is made to ensure that user deposited enough funds in the
payment purse (in motes) to cover the execution of a payment code.
Returns None
if user deposited enough funds in payment purse and the execution result was
a success variant, otherwise a wrapped ForcedTransferResult
that indicates an error
condition.
sourcepub fn new_payment_code_error(
error: Error,
max_payment_cost: Motes,
account_main_purse_balance: Motes,
gas_cost: Gas,
account_main_purse_balance_key: Key,
proposer_main_purse_balance_key: Key
) -> Result<ExecutionResult, Error>
pub fn new_payment_code_error( error: Error, max_payment_cost: Motes, account_main_purse_balance: Motes, gas_cost: Gas, account_main_purse_balance_key: Key, proposer_main_purse_balance_key: Key ) -> Result<ExecutionResult, Error>
Creates a new payment code error.
The method below creates an ExecutionResult
with precomputed effects of a
“finalize_payment”.
The effects that are produced as part of this process would subract max_payment_cost
from
account’s main purse, and add max_payment_cost
to proposer account’s balance.
Trait Implementations§
source§impl Clone for ExecutionResult
impl Clone for ExecutionResult
source§fn clone(&self) -> ExecutionResult
fn clone(&self) -> ExecutionResult
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExecutionResult
impl Debug for ExecutionResult
source§impl Default for ExecutionResult
impl Default for ExecutionResult
source§impl From<&ExecutionResult> for ExecutionResult
impl From<&ExecutionResult> for ExecutionResult
source§fn from(ee_execution_result: &ExecutionResult) -> Self
fn from(ee_execution_result: &ExecutionResult) -> Self
source§impl From<ExecutionResult> for ExecutionResult
impl From<ExecutionResult> for ExecutionResult
source§fn from(ee_execution_result: ExecutionResult) -> Self
fn from(ee_execution_result: ExecutionResult) -> Self
Auto Trait Implementations§
impl RefUnwindSafe for ExecutionResult
impl Send for ExecutionResult
impl Sync for ExecutionResult
impl Unpin for ExecutionResult
impl UnwindSafe for ExecutionResult
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_dbg<F, R>(self, func: F) -> Self
fn tap_dbg<F, R>(self, func: F) -> Self
tap
in debug builds, and does nothing in release builds.§fn tap_mut_dbg<F, R>(self, func: F) -> Self
fn tap_mut_dbg<F, R>(self, func: F) -> Self
tap_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
tap_ref
in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
tap_ref_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
tap_borrow
in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
tap_borrow_mut
in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
tap_deref
in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
self
for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
tap_deref_mut
in debug builds, and does nothing in release
builds.