Trait forest_runtime::Runtime[][src]

pub trait Runtime<BS: BlockStore>: Syscalls {
Show methods fn network_version(&self) -> NetworkVersion;
fn message(&self) -> &dyn MessageInfo;
fn curr_epoch(&self) -> ChainEpoch;
fn validate_immediate_caller_accept_any(&mut self) -> Result<(), ActorError>;
fn validate_immediate_caller_is<'a, I>(
        &mut self,
        addresses: I
    ) -> Result<(), ActorError>
    where
        I: IntoIterator<Item = &'a Address>
;
fn validate_immediate_caller_type<'a, I>(
        &mut self,
        types: I
    ) -> Result<(), ActorError>
    where
        I: IntoIterator<Item = &'a Cid>
;
fn current_balance(&self) -> Result<TokenAmount, ActorError>;
fn resolve_address(
        &self,
        address: &Address
    ) -> Result<Option<Address>, ActorError>;
fn get_actor_code_cid(
        &self,
        addr: &Address
    ) -> Result<Option<Cid>, ActorError>;
fn get_randomness_from_tickets(
        &self,
        personalization: DomainSeparationTag,
        rand_epoch: ChainEpoch,
        entropy: &[u8]
    ) -> Result<Randomness, ActorError>;
fn get_randomness_from_beacon(
        &self,
        personalization: DomainSeparationTag,
        rand_epoch: ChainEpoch,
        entropy: &[u8]
    ) -> Result<Randomness, ActorError>;
fn create<C: Cbor>(&mut self, obj: &C) -> Result<(), ActorError>;
fn state<C: Cbor>(&self) -> Result<C, ActorError>;
fn transaction<C, RT, F>(&mut self, f: F) -> Result<RT, ActorError>
    where
        C: Cbor,
        F: FnOnce(&mut C, &mut Self) -> Result<RT, ActorError>
;
fn store(&self) -> &BS;
fn send(
        &mut self,
        to: Address,
        method: MethodNum,
        params: Serialized,
        value: TokenAmount
    ) -> Result<Serialized, ActorError>;
fn new_actor_address(&mut self) -> Result<Address, ActorError>;
fn create_actor(
        &mut self,
        code_id: Cid,
        address: &Address
    ) -> Result<(), ActorError>;
fn delete_actor(&mut self, beneficiary: &Address) -> Result<(), ActorError>;
fn total_fil_circ_supply(&self) -> Result<TokenAmount, ActorError>;
fn charge_gas(
        &mut self,
        name: &'static str,
        compute: i64
    ) -> Result<(), ActorError>; fn deserialize_params<O: DeserializeOwned>(
        &self,
        params: &Serialized
    ) -> Result<O, ActorError> { ... }
}

Runtime is the VM’s internal runtime object. this is everything that is accessible to actors, beyond parameters.

Required methods

fn network_version(&self) -> NetworkVersion[src]

The network protocol version number at the current epoch.

fn message(&self) -> &dyn MessageInfo[src]

Information related to the current message being executed.

fn curr_epoch(&self) -> ChainEpoch[src]

The current chain epoch number. The genesis block has epoch zero.

fn validate_immediate_caller_accept_any(&mut self) -> Result<(), ActorError>[src]

Validates the caller against some predicate. Exported actor methods must invoke at least one caller validation before returning.

fn validate_immediate_caller_is<'a, I>(
    &mut self,
    addresses: I
) -> Result<(), ActorError> where
    I: IntoIterator<Item = &'a Address>, 
[src]

fn validate_immediate_caller_type<'a, I>(
    &mut self,
    types: I
) -> Result<(), ActorError> where
    I: IntoIterator<Item = &'a Cid>, 
[src]

fn current_balance(&self) -> Result<TokenAmount, ActorError>[src]

The balance of the receiver.

fn resolve_address(
    &self,
    address: &Address
) -> Result<Option<Address>, ActorError>
[src]

Resolves an address of any protocol to an ID address (via the Init actor’s table). This allows resolution of externally-provided SECP, BLS, or actor addresses to the canonical form. If the argument is an ID address it is returned directly.

fn get_actor_code_cid(&self, addr: &Address) -> Result<Option<Cid>, ActorError>[src]

Look up the code ID at an actor address.

fn get_randomness_from_tickets(
    &self,
    personalization: DomainSeparationTag,
    rand_epoch: ChainEpoch,
    entropy: &[u8]
) -> Result<Randomness, ActorError>
[src]

Randomness returns a (pseudo)random byte array drawing from the latest ticket chain from a given epoch and incorporating requisite entropy. This randomness is fork dependant but also biasable because of this.

fn get_randomness_from_beacon(
    &self,
    personalization: DomainSeparationTag,
    rand_epoch: ChainEpoch,
    entropy: &[u8]
) -> Result<Randomness, ActorError>
[src]

Randomness returns a (pseudo)random byte array drawing from the latest beacon from a given epoch and incorporating requisite entropy. This randomness is not tied to any fork of the chain, and is unbiasable.

fn create<C: Cbor>(&mut self, obj: &C) -> Result<(), ActorError>[src]

Initializes the state object. This is only valid in a constructor function and when the state has not yet been initialized.

fn state<C: Cbor>(&self) -> Result<C, ActorError>[src]

Loads a readonly copy of the state of the receiver into the argument.

Any modification to the state is illegal and will result in an abort.

fn transaction<C, RT, F>(&mut self, f: F) -> Result<RT, ActorError> where
    C: Cbor,
    F: FnOnce(&mut C, &mut Self) -> Result<RT, ActorError>, 
[src]

Loads a mutable version of the state into the obj argument and protects the execution from side effects (including message send).

The second argument is a function which allows the caller to mutate the state. The return value from that function will be returned from the call to Transaction().

If the state is modified after this function returns, execution will abort.

The gas cost of this method is that of a Store.Put of the mutated state object.

fn store(&self) -> &BS[src]

Returns reference to blockstore

fn send(
    &mut self,
    to: Address,
    method: MethodNum,
    params: Serialized,
    value: TokenAmount
) -> Result<Serialized, ActorError>
[src]

Sends a message to another actor, returning the exit code and return value envelope. If the invoked method does not return successfully, its state changes (and that of any messages it sent in turn) will be rolled back.

fn new_actor_address(&mut self) -> Result<Address, ActorError>[src]

Computes an address for a new actor. The returned address is intended to uniquely refer to the actor even in the event of a chain re-org (whereas an ID-address might refer to a different actor after messages are re-ordered). Always an ActorExec address.

fn create_actor(
    &mut self,
    code_id: Cid,
    address: &Address
) -> Result<(), ActorError>
[src]

Creates an actor with code codeID and address address, with empty state. May only be called by Init actor.

fn delete_actor(&mut self, beneficiary: &Address) -> Result<(), ActorError>[src]

Deletes the executing actor from the state tree, transferring any balance to beneficiary. Aborts if the beneficiary does not exist. May only be called by the actor itself.

fn total_fil_circ_supply(&self) -> Result<TokenAmount, ActorError>[src]

Returns the total token supply in circulation at the beginning of the current epoch. The circulating supply is the sum of:

  • rewards emitted by the reward actor,
  • funds vested from lock-ups in the genesis state, less the sum of:
  • funds burnt,
  • pledge collateral locked in storage miner actors (recorded in the storage power actor)
  • deal collateral locked by the storage market actor

fn charge_gas(
    &mut self,
    name: &'static str,
    compute: i64
) -> Result<(), ActorError>
[src]

ChargeGas charges specified amount of gas for execution. name provides information about gas charging point

Loading content...

Provided methods

fn deserialize_params<O: DeserializeOwned>(
    &self,
    params: &Serialized
) -> Result<O, ActorError>
[src]

This function is a workaround for go-implementation’s faulty exit code handling of parameters before version 7

Loading content...

Implementors

Loading content...