Trait Host

Source
pub trait Host {
Show 24 methods // Required methods fn basefee(&self) -> U256; fn blob_gasprice(&self) -> U256; fn gas_limit(&self) -> U256; fn difficulty(&self) -> U256; fn prevrandao(&self) -> Option<U256>; fn block_number(&self) -> u64; fn timestamp(&self) -> U256; fn beneficiary(&self) -> Address; fn chain_id(&self) -> U256; fn effective_gas_price(&self) -> U256; fn caller(&self) -> Address; fn blob_hash(&self, number: usize) -> Option<U256>; fn max_initcode_size(&self) -> usize; fn block_hash(&mut self, number: u64) -> Option<B256>; fn selfdestruct( &mut self, address: Address, target: Address, ) -> Option<StateLoad<SelfDestructResult>>; fn log(&mut self, log: Log); fn sstore( &mut self, address: Address, key: U256, value: U256, ) -> Option<StateLoad<SStoreResult>>; fn sload(&mut self, address: Address, key: U256) -> Option<StateLoad<U256>>; fn tstore(&mut self, address: Address, key: U256, value: U256); fn tload(&mut self, address: Address, key: U256) -> U256; fn balance(&mut self, address: Address) -> Option<StateLoad<U256>>; fn load_account_delegated( &mut self, address: Address, ) -> Option<StateLoad<AccountLoad>>; fn load_account_code( &mut self, address: Address, ) -> Option<StateLoad<Bytes>>; fn load_account_code_hash( &mut self, address: Address, ) -> Option<StateLoad<B256>>;
}
Expand description

Host trait with all methods that are needed by the Interpreter.

This trait is implemented for all types that have ContextTr trait.

There are few groups of functions which are Block, Transaction, Config, Database and Journal functions.

Required Methods§

Source

fn basefee(&self) -> U256

Block basefee, calls ContextTr::block().basefee()

Source

fn blob_gasprice(&self) -> U256

Block blob gasprice, calls ContextTr::block().blob_gasprice()

Source

fn gas_limit(&self) -> U256

Block gas limit, calls ContextTr::block().gas_limit()

Source

fn difficulty(&self) -> U256

Block difficulty, calls ContextTr::block().difficulty()

Source

fn prevrandao(&self) -> Option<U256>

Block prevrandao, calls ContextTr::block().prevrandao()

Source

fn block_number(&self) -> u64

Block number, calls ContextTr::block().number()

Source

fn timestamp(&self) -> U256

Block timestamp, calls ContextTr::block().timestamp()

Source

fn beneficiary(&self) -> Address

Block beneficiary, calls ContextTr::block().beneficiary()

Source

fn chain_id(&self) -> U256

Chain id, calls ContextTr::cfg().chain_id()

Source

fn effective_gas_price(&self) -> U256

Transaction effective gas price, calls ContextTr::tx().effective_gas_price(basefee as u128)

Source

fn caller(&self) -> Address

Transaction caller, calls ContextTr::tx().caller()

Source

fn blob_hash(&self, number: usize) -> Option<U256>

Transaction blob hash, calls ContextTr::tx().blob_hash(number)

Source

fn max_initcode_size(&self) -> usize

Max initcode size, calls ContextTr::cfg().max_code_size().saturating_mul(2)

Source

fn block_hash(&mut self, number: u64) -> Option<B256>

Block hash, calls ContextTr::journal().db().block_hash(number)

Source

fn selfdestruct( &mut self, address: Address, target: Address, ) -> Option<StateLoad<SelfDestructResult>>

Selfdestruct account, calls ContextTr::journal().selfdestruct(address, target)

Source

fn log(&mut self, log: Log)

Log, calls ContextTr::journal().log(log)

Source

fn sstore( &mut self, address: Address, key: U256, value: U256, ) -> Option<StateLoad<SStoreResult>>

Sstore, calls ContextTr::journal().sstore(address, key, value)

Source

fn sload(&mut self, address: Address, key: U256) -> Option<StateLoad<U256>>

Sload, calls ContextTr::journal().sload(address, key)

Source

fn tstore(&mut self, address: Address, key: U256, value: U256)

Tstore, calls ContextTr::journal().tstore(address, key, value)

Source

fn tload(&mut self, address: Address, key: U256) -> U256

Tload, calls ContextTr::journal().tload(address, key)

Source

fn balance(&mut self, address: Address) -> Option<StateLoad<U256>>

Balance, calls ContextTr::journal().load_account(address)

Source

fn load_account_delegated( &mut self, address: Address, ) -> Option<StateLoad<AccountLoad>>

Load account delegated, calls ContextTr::journal().load_account_delegated(address)

Source

fn load_account_code(&mut self, address: Address) -> Option<StateLoad<Bytes>>

Load account code, calls ContextTr::journal().load_account_code(address)

Source

fn load_account_code_hash( &mut self, address: Address, ) -> Option<StateLoad<B256>>

Load account code hash, calls ContextTr::journal().code_hash(address)

Implementors§

Source§

impl Host for DummyHost

Source§

impl<CTX: ContextTr> Host for CTX