pub trait CallExecutor<B>: RuntimeVersionOfwhere
    B: Block,{
    type Error: Error;
    type Backend: Backend<B>;

    // Required methods
    fn execution_extensions(&self) -> &ExecutionExtensions<B>;
    fn call(
        &self,
        at_hash: <B as Block>::Hash,
        method: &str,
        call_data: &[u8],
        context: CallContext
    ) -> Result<Vec<u8, Global>, Error>;
    fn contextual_call(
        &self,
        at_hash: <B as Block>::Hash,
        method: &str,
        call_data: &[u8],
        changes: &RefCell<OverlayedChanges<<<B as Block>::Header as Header>::Hashing>>,
        proof_recorder: &Option<Recorder<<<B as Block>::Header as Header>::Hashing>>,
        call_context: CallContext,
        extensions: &RefCell<Extensions>
    ) -> Result<Vec<u8, Global>, Error>;
    fn runtime_version(
        &self,
        at_hash: <B as Block>::Hash
    ) -> Result<RuntimeVersion, Error>;
    fn prove_execution(
        &self,
        at_hash: <B as Block>::Hash,
        method: &str,
        call_data: &[u8]
    ) -> Result<(Vec<u8, Global>, StorageProof), Error>;
}
Expand description

Method call executor.

Required Associated Types§

source

type Error: Error

Externalities error type.

source

type Backend: Backend<B>

The backend used by the node.

Required Methods§

source

fn execution_extensions(&self) -> &ExecutionExtensions<B>

Returns the ExecutionExtensions.

source

fn call( &self, at_hash: <B as Block>::Hash, method: &str, call_data: &[u8], context: CallContext ) -> Result<Vec<u8, Global>, Error>

Execute a call to a contract on top of state in a block of given hash.

No changes are made.

source

fn contextual_call( &self, at_hash: <B as Block>::Hash, method: &str, call_data: &[u8], changes: &RefCell<OverlayedChanges<<<B as Block>::Header as Header>::Hashing>>, proof_recorder: &Option<Recorder<<<B as Block>::Header as Header>::Hashing>>, call_context: CallContext, extensions: &RefCell<Extensions> ) -> Result<Vec<u8, Global>, Error>

Execute a contextual call on top of state in a block of a given hash.

No changes are made. Before executing the method, passed header is installed as the current header of the execution context.

source

fn runtime_version( &self, at_hash: <B as Block>::Hash ) -> Result<RuntimeVersion, Error>

Extract RuntimeVersion of given block

No changes are made.

source

fn prove_execution( &self, at_hash: <B as Block>::Hash, method: &str, call_data: &[u8] ) -> Result<(Vec<u8, Global>, StorageProof), Error>

Prove the execution of the given method.

No changes are made.

Implementations on Foreign Types§

source§

impl<B, E, Block> CallExecutor<Block> for LocalCallExecutor<Block, B, E>where B: Backend<Block>, E: CodeExecutor + RuntimeVersionOf + Clone + 'static, Block: Block,

§

type Error = <E as CodeExecutor>::Error

§

type Backend = B

source§

fn execution_extensions(&self) -> &ExecutionExtensions<Block>

source§

fn call( &self, at_hash: <Block as Block>::Hash, method: &str, call_data: &[u8], context: CallContext ) -> Result<Vec<u8, Global>, Error>

source§

fn contextual_call( &self, at_hash: <Block as Block>::Hash, method: &str, call_data: &[u8], changes: &RefCell<OverlayedChanges<<<Block as Block>::Header as Header>::Hashing>>, recorder: &Option<Recorder<<<Block as Block>::Header as Header>::Hashing>>, call_context: CallContext, extensions: &RefCell<Extensions> ) -> Result<Vec<u8, Global>, Error>

source§

fn runtime_version( &self, at_hash: <Block as Block>::Hash ) -> Result<RuntimeVersion, Error>

source§

fn prove_execution( &self, at_hash: <Block as Block>::Hash, method: &str, call_data: &[u8] ) -> Result<(Vec<u8, Global>, StorageProof), Error>

Implementors§