Skip to main content

ExecutorState

Struct ExecutorState 

Source
pub struct ExecutorState<'a> {
Show 17 fields pub params: &'a ExecutorParams, pub config: &'a ParsedConfig, pub is_special: bool, pub is_marks_authority: bool, pub is_suspended_by_marks: bool, pub address: StdAddr, pub storage_stat: StorageInfo, pub balance: CurrencyCollection, pub state: AccountState, pub orig_status: AccountStatus, pub end_status: AccountStatus, pub start_lt: u64, pub end_lt: u64, pub out_msgs: Vec<Lazy<OwnedMessage>>, pub total_fees: Tokens, pub burned: Tokens, pub cached_storage_stat: Option<OwnedExtStorageStat>,
}
Expand description

Shared state for executor phases.

Fields§

§params: &'a ExecutorParams§config: &'a ParsedConfig§is_special: bool§is_marks_authority: bool§is_suspended_by_marks: bool§address: StdAddr§storage_stat: StorageInfo§balance: CurrencyCollection§state: AccountState§orig_status: AccountStatus§end_status: AccountStatus§start_lt: u64§end_lt: u64§out_msgs: Vec<Lazy<OwnedMessage>>§total_fees: Tokens§burned: Tokens§cached_storage_stat: Option<OwnedExtStorageStat>

Implementations§

Source§

impl ExecutorState<'_>

Source

pub fn action_phase( &mut self, ctx: ActionPhaseContext<'_, '_>, ) -> Result<ActionPhaseFull>

Source§

impl ExecutorState<'_>

Source

pub fn bounce_phase( &mut self, ctx: BouncePhaseContext<'_>, ) -> Result<BouncePhase>

Bounce phase of ordinary transactions.

  • Tries to send an inbound message back to the sender;
  • Defined only for internal inbound messages;
  • Remaining message balance is substracted from the account balance;
  • Fees are paid using the remaining inbound message balance;

Returns an executed BouncePhase.

Fails if the origin workchain of the message doesn’t exist or disabled. Can also fail on total_fees overflow, but this should not happen on networks with valid value flow.

Source§

impl ExecutorState<'_>

Source

pub fn compute_phase( &mut self, ctx: ComputePhaseContext<'_, '_>, ) -> Result<ComputePhaseFull>

Compute phase of ordinary or ticktock transactions.

  • Tries to deploy or unfreeze account if it was Uninit or Frozen;
  • Executes contract code and produces a new account state;
  • Produces an action list on successful execution;
  • External messages can be ignored if they were not accepted;
  • Necessary for all types of messages or even without them;

Returns an executed ComputePhase with extra data.

Fails only on account balance overflow. This should not happen on networks with valid value flow.

Source§

impl ExecutorState<'_>

Source

pub fn credit_phase( &mut self, received: &ReceivedMessage, ) -> Result<CreditPhase>

Credit phase of ordinary transactions.

  • Adds the remainder of the message balance to the account balance;
  • Requires calling the receive_in_msg first;
  • Only makes sense for internal messages;
  • Follows the storage phase when bounce_enabled, otherwise must be called before it.

Returns an executed CreditPhase.

Fails only on account balance overflow. This should not happen on networks with valid value flow.

Source§

impl ExecutorState<'_>

Source

pub fn receive_in_msg(&mut self, msg_root: Cell) -> Result<ReceivedMessage>

“Pre” phase of ordinary transactions.

  • Validates the inbound message cell;
  • For internal messages updates an LT range;
  • For external messages charges a fwd fee (updates self.balance and self.total_fees).

Returns a parsed received message (ReceivedMessage).

Fails if the message is invalid or can’t be imported.

Source§

impl ExecutorState<'_>

Source

pub fn storage_phase( &mut self, ctx: StoragePhaseContext<'_>, ) -> Result<StoragePhase>

Storage phase of ordinary or ticktock transactions.

  • Precedes the credit phase when bounce_enabled, otherwise must be called after it;
  • Necessary for all types of messages or even without them;
  • Computes storage fee and due payment;
  • Tries to charge the account balance for the storage fees;
  • Freezes or deletes the account if its balance is not enough (doesn’t change the state itself, but rather tells other phases to do so).

Returns an executed StoragePhase.

Fails if called in an older context than account’s last_paid. Can also fail on total_fees overflow, but this should not happen on networks with valid value flow.

Source§

impl ExecutorState<'_>

Source

pub fn run_ordinary_transaction( &mut self, is_external: bool, msg_root: Cell, inspector: Option<&mut ExecutorInspector<'_>>, ) -> TxResult<OrdinaryTxInfo>

Source§

impl ExecutorState<'_>

Source

pub fn run_tick_tock_transaction( &mut self, kind: TickTock, inspector: Option<&mut ExecutorInspector<'_>>, ) -> TxResult<TickTockTxInfo>

Auto Trait Implementations§

§

impl<'a> Freeze for ExecutorState<'a>

§

impl<'a> !RefUnwindSafe for ExecutorState<'a>

§

impl<'a> !Send for ExecutorState<'a>

§

impl<'a> !Sync for ExecutorState<'a>

§

impl<'a> Unpin for ExecutorState<'a>

§

impl<'a> !UnwindSafe for ExecutorState<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> SafeDelete for T
where T: 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> EquivalentRepr<T> for T