Trait JournalEntryTr

Source
pub trait JournalEntryTr {
    // Required methods
    fn account_warmed(address: Address) -> Self;
    fn account_destroyed(
        address: Address,
        target: Address,
        was_destroyed: bool,
        had_balance: U256,
    ) -> Self;
    fn account_touched(address: Address) -> Self;
    fn balance_transfer(from: Address, to: Address, balance: U256) -> Self;
    fn nonce_changed(address: Address) -> Self;
    fn account_created(address: Address) -> Self;
    fn storage_changed(address: Address, key: U256, had_value: U256) -> Self;
    fn storage_warmed(address: Address, key: U256) -> Self;
    fn transient_storage_changed(
        address: Address,
        key: U256,
        had_value: U256,
    ) -> Self;
    fn code_changed(address: Address) -> Self;
    fn revert(
        self,
        state: &mut EvmState,
        transient_storage: &mut TransientStorage,
        is_spurious_dragon_enabled: bool,
    );
}
Expand description

Trait for tracking and reverting state changes in the EVM. Journal entry contains information about state changes that can be reverted.

Required Methods§

Source

fn account_warmed(address: Address) -> Self

Creates a journal entry for when an account is accessed and marked as “warm” for gas metering

Source

fn account_destroyed( address: Address, target: Address, was_destroyed: bool, had_balance: U256, ) -> Self

Creates a journal entry for when an account is destroyed via SELFDESTRUCT Records the target address that received the destroyed account’s balance, whether the account was already destroyed, and its balance before destruction on revert, the balance is transferred back to the original account

Source

fn account_touched(address: Address) -> Self

Creates a journal entry for when an account is “touched” - accessed in a way that may require saving it. If account is empty and touch it will be removed from the state (EIP-161 state clear EIP)

Source

fn balance_transfer(from: Address, to: Address, balance: U256) -> Self

Creates a journal entry for a balance transfer between accounts

Source

fn nonce_changed(address: Address) -> Self

Creates a journal entry for when an account’s nonce is incremented.

Source

fn account_created(address: Address) -> Self

Creates a journal entry for when a new account is created

Source

fn storage_changed(address: Address, key: U256, had_value: U256) -> Self

Creates a journal entry for when a storage slot is modified Records the previous value for reverting

Source

fn storage_warmed(address: Address, key: U256) -> Self

Creates a journal entry for when a storage slot is accessed and marked as “warm” for gas metering This is called with SLOAD opcode.

Source

fn transient_storage_changed( address: Address, key: U256, had_value: U256, ) -> Self

Creates a journal entry for when a transient storage slot is modified (EIP-1153) Records the previous value for reverting

Source

fn code_changed(address: Address) -> Self

Creates a journal entry for when an account’s code is modified

Source

fn revert( self, state: &mut EvmState, transient_storage: &mut TransientStorage, is_spurious_dragon_enabled: bool, )

Reverts the state change recorded by this journal entry

More information on what is reverted can be found in JournalEntry enum.

§Notes

The spurious dragon flag is used to skip revertion 0x000..0003 precompile. This Behaviour is special and it caused by bug in Geth and Parity that is explained in PR#716.

From yellow paper:

K.1. Deletion of an Account Despite Out-of-gas. At block 2675119, in the transaction 0xcf416c536ec1a19ed1fb89e
4ec7ffb3cf73aa413b3aa9b77d60e4fd81a4296ba, an account at address 0x03 was called and an out-of-gas occurred during
the call. Against the equation (209), this added 0x03 in the set of touched addresses, and this transaction turned σ[0x03]
into ∅.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§