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

§error: Error

Error causing this Failure variant.

§transfers: Vec<TransferAddr>

List of transfers that happened during execution up to the point of the failure.

§cost: Gas

Gas consumed 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.

§cost: Gas

Gas cost.

§execution_journal: ExecutionJournal

Journal of execution.

Execution was finished successfully

Implementations§

source§

impl ExecutionResult

source

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.

source

pub fn is_success(&self) -> bool

Returns true if this is a successful variant.

source

pub fn is_failure(&self) -> bool

Returns true if this is a failure variant.

source

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.

source

pub fn cost(&self) -> Gas

Returns gas cost of execution regardless of variant.

source

pub fn transfers(&self) -> &Vec<TransferAddr>

Returns list of transfers regardless of variant.

source

pub fn execution_journal(&self) -> &ExecutionJournal

The journal of transforms regardless of variant.

source

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.

source

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.

source

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.

source

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.

source

pub fn take_error(self) -> Option<Error>

Consumes ExecutionResult instance and optionally returns error::Error instance for ExecutionResult::Failure variant.

source

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.

source

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

source§

fn clone(&self) -> ExecutionResult

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ExecutionResult

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ExecutionResult

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&ExecutionResult> for ExecutionResult

source§

fn from(ee_execution_result: &ExecutionResult) -> Self

Converts to this type from the input type.
source§

impl From<ExecutionResult> for ExecutionResult

source§

fn from(ee_execution_result: ExecutionResult) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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 Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more