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§
Sourcefn blob_gasprice(&self) -> U256
fn blob_gasprice(&self) -> U256
Block blob gasprice, calls ContextTr::block().blob_gasprice()
Sourcefn difficulty(&self) -> U256
fn difficulty(&self) -> U256
Block difficulty, calls ContextTr::block().difficulty()
Sourcefn prevrandao(&self) -> Option<U256>
fn prevrandao(&self) -> Option<U256>
Block prevrandao, calls ContextTr::block().prevrandao()
Sourcefn block_number(&self) -> u64
fn block_number(&self) -> u64
Block number, calls ContextTr::block().number()
Sourcefn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
Block beneficiary, calls ContextTr::block().beneficiary()
Sourcefn effective_gas_price(&self) -> U256
fn effective_gas_price(&self) -> U256
Transaction effective gas price, calls ContextTr::tx().effective_gas_price(basefee as u128)
Sourcefn blob_hash(&self, number: usize) -> Option<U256>
fn blob_hash(&self, number: usize) -> Option<U256>
Transaction blob hash, calls ContextTr::tx().blob_hash(number)
Sourcefn max_initcode_size(&self) -> usize
fn max_initcode_size(&self) -> usize
Max initcode size, calls ContextTr::cfg().max_code_size().saturating_mul(2)
Sourcefn block_hash(&mut self, number: u64) -> Option<B256>
fn block_hash(&mut self, number: u64) -> Option<B256>
Block hash, calls ContextTr::journal().db().block_hash(number)
Sourcefn selfdestruct(
&mut self,
address: Address,
target: Address,
) -> Option<StateLoad<SelfDestructResult>>
fn selfdestruct( &mut self, address: Address, target: Address, ) -> Option<StateLoad<SelfDestructResult>>
Selfdestruct account, calls ContextTr::journal().selfdestruct(address, target)
Sourcefn sstore(
&mut self,
address: Address,
key: U256,
value: U256,
) -> Option<StateLoad<SStoreResult>>
fn sstore( &mut self, address: Address, key: U256, value: U256, ) -> Option<StateLoad<SStoreResult>>
Sstore, calls ContextTr::journal().sstore(address, key, value)
Sourcefn sload(&mut self, address: Address, key: U256) -> Option<StateLoad<U256>>
fn sload(&mut self, address: Address, key: U256) -> Option<StateLoad<U256>>
Sload, calls ContextTr::journal().sload(address, key)
Sourcefn tstore(&mut self, address: Address, key: U256, value: U256)
fn tstore(&mut self, address: Address, key: U256, value: U256)
Tstore, calls ContextTr::journal().tstore(address, key, value)
Sourcefn tload(&mut self, address: Address, key: U256) -> U256
fn tload(&mut self, address: Address, key: U256) -> U256
Tload, calls ContextTr::journal().tload(address, key)
Sourcefn balance(&mut self, address: Address) -> Option<StateLoad<U256>>
fn balance(&mut self, address: Address) -> Option<StateLoad<U256>>
Balance, calls ContextTr::journal().load_account(address)
Sourcefn load_account_delegated(
&mut self,
address: Address,
) -> Option<StateLoad<AccountLoad>>
fn load_account_delegated( &mut self, address: Address, ) -> Option<StateLoad<AccountLoad>>
Load account delegated, calls ContextTr::journal().load_account_delegated(address)
Sourcefn load_account_code(&mut self, address: Address) -> Option<StateLoad<Bytes>>
fn load_account_code(&mut self, address: Address) -> Option<StateLoad<Bytes>>
Load account code, calls ContextTr::journal().load_account_code(address)
Sourcefn load_account_code_hash(
&mut self,
address: Address,
) -> Option<StateLoad<B256>>
fn load_account_code_hash( &mut self, address: Address, ) -> Option<StateLoad<B256>>
Load account code hash, calls ContextTr::journal().code_hash(address)