Trait JournalEntryTr
pub trait JournalEntryTr {
// Required methods
fn account_warmed(address: Address) -> Self;
fn account_destroyed(
address: Address,
target: Address,
was_destroyed: bool,
had_balance: Uint<256, 4>,
) -> Self;
fn account_touched(address: Address) -> Self;
fn balance_transfer(
from: Address,
to: Address,
balance: Uint<256, 4>,
) -> Self;
fn nonce_changed(address: Address) -> Self;
fn account_created(address: Address) -> Self;
fn storage_changed(
address: Address,
key: Uint<256, 4>,
had_value: Uint<256, 4>,
) -> Self;
fn storage_warmed(address: Address, key: Uint<256, 4>) -> Self;
fn transient_storage_changed(
address: Address,
key: Uint<256, 4>,
had_value: Uint<256, 4>,
) -> Self;
fn code_changed(address: Address) -> Self;
fn revert(
self,
state: &mut HashMap<Address, Account, RandomState>,
transient_storage: &mut HashMap<(Address, Uint<256, 4>), Uint<256, 4>, RandomState>,
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§
fn account_warmed(address: Address) -> Self
fn account_warmed(address: Address) -> Self
Creates a journal entry for when an account is accessed and marked as “warm” for gas metering
fn account_destroyed(
address: Address,
target: Address,
was_destroyed: bool,
had_balance: Uint<256, 4>,
) -> Self
fn account_destroyed( address: Address, target: Address, was_destroyed: bool, had_balance: Uint<256, 4>, ) -> 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
fn account_touched(address: Address) -> Self
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)
fn balance_transfer(from: Address, to: Address, balance: Uint<256, 4>) -> Self
fn balance_transfer(from: Address, to: Address, balance: Uint<256, 4>) -> Self
Creates a journal entry for a balance transfer between accounts
fn nonce_changed(address: Address) -> Self
fn nonce_changed(address: Address) -> Self
Creates a journal entry for when an account’s nonce is incremented.
fn account_created(address: Address) -> Self
fn account_created(address: Address) -> Self
Creates a journal entry for when a new account is created
fn storage_changed(
address: Address,
key: Uint<256, 4>,
had_value: Uint<256, 4>,
) -> Self
fn storage_changed( address: Address, key: Uint<256, 4>, had_value: Uint<256, 4>, ) -> Self
Creates a journal entry for when a storage slot is modified Records the previous value for reverting
fn storage_warmed(address: Address, key: Uint<256, 4>) -> Self
fn storage_warmed(address: Address, key: Uint<256, 4>) -> 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.
fn transient_storage_changed(
address: Address,
key: Uint<256, 4>,
had_value: Uint<256, 4>,
) -> Self
fn transient_storage_changed( address: Address, key: Uint<256, 4>, had_value: Uint<256, 4>, ) -> Self
Creates a journal entry for when a transient storage slot is modified (EIP-1153) Records the previous value for reverting
fn code_changed(address: Address) -> Self
fn code_changed(address: Address) -> Self
Creates a journal entry for when an account’s code is modified
fn revert(
self,
state: &mut HashMap<Address, Account, RandomState>,
transient_storage: &mut HashMap<(Address, Uint<256, 4>), Uint<256, 4>, RandomState>,
is_spurious_dragon_enabled: bool,
)
fn revert( self, state: &mut HashMap<Address, Account, RandomState>, transient_storage: &mut HashMap<(Address, Uint<256, 4>), Uint<256, 4>, RandomState>, 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.