Skip to main content

World

Trait World 

Source
pub trait World<T: Tracer>: StorageInterface + Sized {
    // Required methods
    fn decommit(&mut self, hash: U256) -> Program<T, Self>;
    fn decommit_code(&mut self, hash: U256) -> Vec<u8> ;

    // Provided method
    fn precompiles(&self) -> &impl Precompiles { ... }
}
Expand description

Encapsulates VM interaction with the external world. This includes VM storage and decomitting (loading) bytecodes for execution.

Required Methods§

Source

fn decommit(&mut self, hash: U256) -> Program<T, Self>

Loads a bytecode with the specified hash.

This method will be called every time a contract is called. Caching and decoding is the world implementor’s job.

Source

fn decommit_code(&mut self, hash: U256) -> Vec<u8>

Loads bytecode bytes for the decommit opcode.

Provided Methods§

Source

fn precompiles(&self) -> &impl Precompiles

Returns precompiles to be used.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: Tracer> World<T> for TestWorld<T>