Skip to main content

JournaledState

Type Alias JournaledState 

Source
pub type JournaledState = JournalInner<JournalEntry>;

Aliased Type§

pub struct JournaledState {
    pub state: HashMap<Address, Account, RandomState>,
    pub transient_storage: HashMap<(Address, Uint<256, 4>), Uint<256, 4>, RandomState>,
    pub logs: Vec<Log>,
    pub depth: usize,
    pub journal: Vec<JournalEntry>,
    pub transaction_id: usize,
    pub spec: SpecId,
    pub warm_preloaded_addresses: HashSet<Address, RandomState>,
    pub warm_coinbase_address: Option<Address>,
    pub precompiles: HashSet<Address, RandomState>,
}

Fields§

§state: HashMap<Address, Account, RandomState>

The current state

§transient_storage: HashMap<(Address, Uint<256, 4>), Uint<256, 4>, RandomState>

Transient storage that is discarded after every transaction.

See EIP-1153.

§logs: Vec<Log>

Emitted logs

§depth: usize

The current call stack depth

§journal: Vec<JournalEntry>

The journal of state changes, one for each transaction

§transaction_id: usize

Global transaction id that represent number of transactions executed (Including reverted ones). It can be different from number of journal_history as some transaction could be reverted or had a error on execution.

This ID is used in Self::state to determine if account/storage is touched/warm/cold.

§spec: SpecId

The spec ID for the EVM. Spec is required for some journal entries and needs to be set for JournalInner to be functional.

If spec is set it assumed that precompile addresses are set as well for this particular spec.

This spec is used for two things:

  • EIP-161: Prior to this EIP, Ethereum had separate definitions for empty and non-existing accounts.
  • EIP-6780: SELFDESTRUCT only in same transaction
§warm_preloaded_addresses: HashSet<Address, RandomState>

Warm loaded addresses are used to check if loaded address should be considered cold or warm loaded when the account is first accessed.

Note that this not include newly loaded accounts, account and storage is considered warm if it is found in the State.

§warm_coinbase_address: Option<Address>

Warm coinbase address, stored separately to avoid cloning preloaded addresses.

§precompiles: HashSet<Address, RandomState>

Precompile addresses

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 248 bytes