Trait Host
pub trait Host {
Show 24 methods
// Required methods
fn basefee(&self) -> Uint<256, 4>;
fn blob_gasprice(&self) -> Uint<256, 4>;
fn gas_limit(&self) -> Uint<256, 4>;
fn difficulty(&self) -> Uint<256, 4>;
fn prevrandao(&self) -> Option<Uint<256, 4>>;
fn block_number(&self) -> u64;
fn timestamp(&self) -> Uint<256, 4>;
fn beneficiary(&self) -> Address;
fn chain_id(&self) -> Uint<256, 4>;
fn effective_gas_price(&self) -> Uint<256, 4>;
fn caller(&self) -> Address;
fn blob_hash(&self, number: usize) -> Option<Uint<256, 4>>;
fn max_initcode_size(&self) -> usize;
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>;
fn selfdestruct(
&mut self,
address: Address,
target: Address,
) -> Option<StateLoad<SelfDestructResult>>;
fn log(&mut self, log: Log);
fn sstore(
&mut self,
address: Address,
key: Uint<256, 4>,
value: Uint<256, 4>,
) -> Option<StateLoad<SStoreResult>>;
fn sload(
&mut self,
address: Address,
key: Uint<256, 4>,
) -> Option<StateLoad<Uint<256, 4>>>;
fn tstore(
&mut self,
address: Address,
key: Uint<256, 4>,
value: Uint<256, 4>,
);
fn tload(&mut self, address: Address, key: Uint<256, 4>) -> Uint<256, 4>;
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>;
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<FixedBytes<32>>>;
}
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§
fn blob_gasprice(&self) -> Uint<256, 4>
fn blob_gasprice(&self) -> Uint<256, 4>
Block blob gasprice, calls ContextTr::block().blob_gasprice()
fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
Block difficulty, calls ContextTr::block().difficulty()
fn prevrandao(&self) -> Option<Uint<256, 4>>
fn prevrandao(&self) -> Option<Uint<256, 4>>
Block prevrandao, calls ContextTr::block().prevrandao()
fn block_number(&self) -> u64
fn block_number(&self) -> u64
Block number, calls ContextTr::block().number()
fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
Block beneficiary, calls ContextTr::block().beneficiary()
fn effective_gas_price(&self) -> Uint<256, 4>
fn effective_gas_price(&self) -> Uint<256, 4>
Transaction effective gas price, calls ContextTr::tx().effective_gas_price(basefee as u128)
fn blob_hash(&self, number: usize) -> Option<Uint<256, 4>>
fn blob_hash(&self, number: usize) -> Option<Uint<256, 4>>
Transaction blob hash, calls ContextTr::tx().blob_hash(number)
fn max_initcode_size(&self) -> usize
fn max_initcode_size(&self) -> usize
Max initcode size, calls ContextTr::cfg().max_code_size().saturating_mul(2)
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>
fn block_hash(&mut self, number: u64) -> Option<FixedBytes<32>>
Block hash, calls ContextTr::journal().db().block_hash(number)
fn 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)
fn sstore(
&mut self,
address: Address,
key: Uint<256, 4>,
value: Uint<256, 4>,
) -> Option<StateLoad<SStoreResult>>
fn sstore( &mut self, address: Address, key: Uint<256, 4>, value: Uint<256, 4>, ) -> Option<StateLoad<SStoreResult>>
Sstore, calls ContextTr::journal().sstore(address, key, value)
fn sload(
&mut self,
address: Address,
key: Uint<256, 4>,
) -> Option<StateLoad<Uint<256, 4>>>
fn sload( &mut self, address: Address, key: Uint<256, 4>, ) -> Option<StateLoad<Uint<256, 4>>>
Sload, calls ContextTr::journal().sload(address, key)
fn tstore(&mut self, address: Address, key: Uint<256, 4>, value: Uint<256, 4>)
fn tstore(&mut self, address: Address, key: Uint<256, 4>, value: Uint<256, 4>)
Tstore, calls ContextTr::journal().tstore(address, key, value)
fn tload(&mut self, address: Address, key: Uint<256, 4>) -> Uint<256, 4>
fn tload(&mut self, address: Address, key: Uint<256, 4>) -> Uint<256, 4>
Tload, calls ContextTr::journal().tload(address, key)
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>
fn balance(&mut self, address: Address) -> Option<StateLoad<Uint<256, 4>>>
Balance, calls ContextTr::journal().load_account(address)
fn 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)
fn 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)
fn load_account_code_hash(
&mut self,
address: Address,
) -> Option<StateLoad<FixedBytes<32>>>
fn load_account_code_hash( &mut self, address: Address, ) -> Option<StateLoad<FixedBytes<32>>>
Load account code hash, calls ContextTr::journal().code_hash(address)