Skip to main content

CallExecutor

Trait CallExecutor 

Source
pub trait CallExecutor<B: BlockT>: RuntimeVersionOf {
    type Error: Error;
    type Backend: Backend<B>;

    // Required methods
    fn execution_extensions(&self) -> &ExecutionExtensions<B>;
    fn call(
        &self,
        at_hash: B::Hash,
        method: &str,
        call_data: &[u8],
        context: CallContext,
    ) -> Result<Vec<u8>, Error>;
    fn contextual_call(
        &self,
        at_hash: B::Hash,
        method: &str,
        call_data: &[u8],
        changes: &RefCell<OverlayedChanges<HashingFor<B>>>,
        proof_recorder: &Option<ProofRecorder<B>>,
        call_context: CallContext,
        extensions: &RefCell<Extensions>,
    ) -> Result<Vec<u8>>;
    fn runtime_version(
        &self,
        at_hash: B::Hash,
        call_context: CallContext,
    ) -> Result<RuntimeVersion, Error>;
    fn prove_execution(
        &self,
        at_hash: B::Hash,
        method: &str,
        call_data: &[u8],
        timeout: Option<Duration>,
    ) -> Result<(Vec<u8>, 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::Hash, method: &str, call_data: &[u8], context: CallContext, ) -> Result<Vec<u8>, 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::Hash, method: &str, call_data: &[u8], changes: &RefCell<OverlayedChanges<HashingFor<B>>>, proof_recorder: &Option<ProofRecorder<B>>, call_context: CallContext, extensions: &RefCell<Extensions>, ) -> Result<Vec<u8>>

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::Hash, call_context: CallContext, ) -> Result<RuntimeVersion, Error>

Extract RuntimeVersion of given block

No changes are made.

Source

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

Prove the execution of the given method.

timeout bounds the wall-clock execution time of the runtime call if Some.

No changes are made.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§