Trait tetsy_vm::Ext [−][src]
Externalities interface for VVMs
Required methods
fn initial_storage_at(&self, key: &H256) -> Result<H256>
[src]
Returns the storage value for a given key if reversion happens on the current transaction.
fn storage_at(&self, key: &H256) -> Result<H256>
[src]
Returns a value for given key.
fn set_storage(&mut self, key: H256, value: H256) -> Result<()>
[src]
Stores a value for given key.
fn exists(&self, address: &Address) -> Result<bool>
[src]
Determine whether an account exists.
fn exists_and_not_null(&self, address: &Address) -> Result<bool>
[src]
Determine whether an account exists and is not null (zero balance/nonce, no code).
fn origin_balance(&self) -> Result<U256>
[src]
Balance of the origin account.
fn balance(&self, address: &Address) -> Result<U256>
[src]
Returns address balance.
fn blockhash(&mut self, number: &U256) -> H256
[src]
Returns the hash of one of the 256 most recent complete blocks.
fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
parent_version: &U256,
address: CreateContractAddress,
trap: bool
) -> Result<ContractCreateResult, TrapKind>
[src]
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
parent_version: &U256,
address: CreateContractAddress,
trap: bool
) -> Result<ContractCreateResult, TrapKind>
Creates new contract.
Returns gas_left and contract address if contract creation was successful.
fn call(
&mut self,
gas: &U256,
sender_address: &Address,
receive_address: &Address,
value: Option<U256>,
data: &[u8],
code_address: &Address,
call_type: ActionType,
trap: bool
) -> Result<MessageCallResult, TrapKind>
[src]
&mut self,
gas: &U256,
sender_address: &Address,
receive_address: &Address,
value: Option<U256>,
data: &[u8],
code_address: &Address,
call_type: ActionType,
trap: bool
) -> Result<MessageCallResult, TrapKind>
Message call.
Returns Err, if we run out of gas. Otherwise returns call_result which contains gas left and true if subcall was successfull.
fn extcode(&self, address: &Address) -> Result<Option<Arc<Bytes>>>
[src]
Returns code at given address
fn extcodehash(&self, address: &Address) -> Result<Option<H256>>
[src]
Returns code hash at given address
fn extcodesize(&self, address: &Address) -> Result<Option<usize>>
[src]
Returns code size at given address
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<()>
[src]
Creates log entry with given topics and data
fn ret(self, gas: &U256, data: &ReturnData, apply_state: bool) -> Result<U256>
[src]
Should be called when transaction calls RETURN
opcode.
Returns gas_left if cost of returning the data is not too high.
fn suicide(&mut self, refund_address: &Address) -> Result<()>
[src]
Should be called when contract commits suicide. Address to which funds should be refunded.
fn schedule(&self) -> &Schedule
[src]
Returns schedule.
fn env_info(&self) -> &EnvInfo
[src]
Returns environment info.
fn chain_id(&self) -> u64
[src]
Returns the chain ID of the blockchain
fn depth(&self) -> usize
[src]
Returns current depth of execution.
If contract A calls contract B, and contract B calls C, then A depth is 0, B is 1, C is 2 and so on.
fn add_sstore_refund(&mut self, value: usize)
[src]
Increments sstore refunds counter.
fn sub_sstore_refund(&mut self, value: usize)
[src]
Decrements sstore refunds counter.
fn is_static(&self) -> bool
[src]
Check if running in static context.
Provided methods
fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_current_gas: U256
) -> bool
[src]
&mut self,
_pc: usize,
_instruction: u8,
_current_gas: U256
) -> bool
Decide if any more operations should be traced. Passthrough for the VM trace.
fn trace_prepare_execute(
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256,
_mem_written: Option<(usize, usize)>,
_store_written: Option<(U256, U256)>
)
[src]
&mut self,
_pc: usize,
_instruction: u8,
_gas_cost: U256,
_mem_written: Option<(usize, usize)>,
_store_written: Option<(U256, U256)>
)
Prepare to trace an operation. Passthrough for the VM trace.
For each call of trace_prepare_execute
either trace_failed
or trace_executed
MUST be called.
fn trace_failed(&mut self)
[src]
Trace the execution failure of a single instruction.
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem: &[u8])
[src]
Trace the finalised execution of a single instruction.
Implementors
impl Ext for FakeExt
[src]
fn initial_storage_at(&self, _key: &H256) -> Result<H256>
[src]
fn storage_at(&self, key: &H256) -> Result<H256>
[src]
fn set_storage(&mut self, key: H256, value: H256) -> Result<()>
[src]
fn exists(&self, address: &Address) -> Result<bool>
[src]
fn exists_and_not_null(&self, address: &Address) -> Result<bool>
[src]
fn origin_balance(&self) -> Result<U256>
[src]
fn balance(&self, address: &Address) -> Result<U256>
[src]
fn blockhash(&mut self, number: &U256) -> H256
[src]
fn create(
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
_parent_version: &U256,
address: CreateContractAddress,
_trap: bool
) -> Result<ContractCreateResult, TrapKind>
[src]
&mut self,
gas: &U256,
value: &U256,
code: &[u8],
_parent_version: &U256,
address: CreateContractAddress,
_trap: bool
) -> Result<ContractCreateResult, TrapKind>
fn call(
&mut self,
gas: &U256,
sender_address: &Address,
receive_address: &Address,
value: Option<U256>,
data: &[u8],
code_address: &Address,
_call_type: ActionType,
_trap: bool
) -> Result<MessageCallResult, TrapKind>
[src]
&mut self,
gas: &U256,
sender_address: &Address,
receive_address: &Address,
value: Option<U256>,
data: &[u8],
code_address: &Address,
_call_type: ActionType,
_trap: bool
) -> Result<MessageCallResult, TrapKind>
fn extcode(&self, address: &Address) -> Result<Option<Arc<Bytes>>>
[src]
fn extcodesize(&self, address: &Address) -> Result<Option<usize>>
[src]
fn extcodehash(&self, address: &Address) -> Result<Option<H256>>
[src]
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<()>
[src]
fn ret(
self,
_gas: &U256,
_data: &ReturnData,
_apply_state: bool
) -> Result<U256>
[src]
self,
_gas: &U256,
_data: &ReturnData,
_apply_state: bool
) -> Result<U256>
fn suicide(&mut self, refund_address: &Address) -> Result<()>
[src]
fn schedule(&self) -> &Schedule
[src]
fn env_info(&self) -> &EnvInfo
[src]
fn chain_id(&self) -> u64
[src]
fn depth(&self) -> usize
[src]
fn is_static(&self) -> bool
[src]
fn add_sstore_refund(&mut self, value: usize)
[src]
fn sub_sstore_refund(&mut self, value: usize)
[src]
fn trace_next_instruction(
&mut self,
_pc: usize,
_instruction: u8,
_gas: U256
) -> bool
[src]
&mut self,
_pc: usize,
_instruction: u8,
_gas: U256
) -> bool