JournaledAccountTr

Trait JournaledAccountTr 

Source
pub trait JournaledAccountTr {
Show 19 methods // Required methods fn account(&self) -> &Account; fn sload( &mut self, key: StorageKey, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>; fn sstore( &mut self, key: StorageKey, new: StorageValue, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadErasedError>; fn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>; fn balance(&self) -> &U256; fn nonce(&self) -> u64; fn code_hash(&self) -> &B256; fn code(&self) -> Option<&Bytecode>; fn touch(&mut self); fn unsafe_mark_cold(&mut self); fn set_balance(&mut self, balance: U256); fn incr_balance(&mut self, balance: U256) -> bool; fn decr_balance(&mut self, balance: U256) -> bool; fn bump_nonce(&mut self) -> bool; fn set_nonce(&mut self, nonce: u64); fn unsafe_set_nonce(&mut self, nonce: u64); fn set_code(&mut self, code_hash: B256, code: Bytecode); fn set_code_and_hash_slow(&mut self, code: Bytecode); fn delegate(&mut self, address: Address);
}
Expand description

Trait that contains database and journal of all changes that were made to the account.

Required Methods§

Source

fn account(&self) -> &Account

Returns the account.

Source

fn sload( &mut self, key: StorageKey, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>

Sloads the storage slot and returns its mutable reference

Source

fn sstore( &mut self, key: StorageKey, new: StorageValue, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadErasedError>

Loads the storage slot and stores the new value

Source

fn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>

Loads the code of the account. and returns it as reference.

Source

fn balance(&self) -> &U256

Returns the balance of the account.

Source

fn nonce(&self) -> u64

Returns the nonce of the account.

Source

fn code_hash(&self) -> &B256

Returns the code hash of the account.

Source

fn code(&self) -> Option<&Bytecode>

Returns the code of the account.

Source

fn touch(&mut self)

Touches the account.

Source

fn unsafe_mark_cold(&mut self)

Marks the account as cold without making a journal entry.

Changing account without journal entry can be a footgun as reverting of the state change would not happen without entry. It is the reason why this function has an unsafe prefix.

If account is in access list, it would still be marked as warm if account get accessed again.

Source

fn set_balance(&mut self, balance: U256)

Sets the balance of the account.

If balance is the same, we don’t add a journal entry.

Touches the account in all cases.

Source

fn incr_balance(&mut self, balance: U256) -> bool

Increments the balance of the account.

Touches the account in all cases.

Source

fn decr_balance(&mut self, balance: U256) -> bool

Decrements the balance of the account.

Touches the account in all cases.

Source

fn bump_nonce(&mut self) -> bool

Bumps the nonce of the account.

Touches the account in all cases.

Returns true if nonce was bumped, false if nonce is at the max value.

Source

fn set_nonce(&mut self, nonce: u64)

Set the nonce of the account and create a journal entry.

Touches the account in all cases.

Source

fn unsafe_set_nonce(&mut self, nonce: u64)

Set the nonce of the account without creating a journal entry.

Changing account without journal entry can be a footgun as reverting of the state change would not happen without entry. It is the reason why this function has an unsafe prefix.

Source

fn set_code(&mut self, code_hash: B256, code: Bytecode)

Sets the code of the account.

Touches the account in all cases.

Source

fn set_code_and_hash_slow(&mut self, code: Bytecode)

Sets the code of the account. Calculates hash of the code.

Touches the account in all cases.

Source

fn delegate(&mut self, address: Address)

Delegates the account to another address (EIP-7702).

This touches the account, sets the code to the delegation designation, and bumps the nonce.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + JournaledAccountTr + ?Sized> JournaledAccountTr for &'a mut T

Source§

fn account(&self) -> &Account

Source§

fn sload( &mut self, key: StorageKey, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>

Source§

fn sstore( &mut self, key: StorageKey, new: StorageValue, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadErasedError>

Source§

fn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>

Source§

fn balance(&self) -> &U256

Source§

fn nonce(&self) -> u64

Source§

fn code_hash(&self) -> &B256

Source§

fn code(&self) -> Option<&Bytecode>

Source§

fn touch(&mut self)

Source§

fn unsafe_mark_cold(&mut self)

Source§

fn set_balance(&mut self, balance: U256)

Source§

fn incr_balance(&mut self, balance: U256) -> bool

Source§

fn decr_balance(&mut self, balance: U256) -> bool

Source§

fn bump_nonce(&mut self) -> bool

Source§

fn set_nonce(&mut self, nonce: u64)

Source§

fn unsafe_set_nonce(&mut self, nonce: u64)

Source§

fn set_code(&mut self, code_hash: B256, code: Bytecode)

Source§

fn set_code_and_hash_slow(&mut self, code: Bytecode)

Source§

fn delegate(&mut self, address: Address)

Source§

impl<T: JournaledAccountTr + ?Sized> JournaledAccountTr for Box<T>

Source§

fn account(&self) -> &Account

Source§

fn sload( &mut self, key: StorageKey, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>

Source§

fn sstore( &mut self, key: StorageKey, new: StorageValue, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadErasedError>

Source§

fn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>

Source§

fn balance(&self) -> &U256

Source§

fn nonce(&self) -> u64

Source§

fn code_hash(&self) -> &B256

Source§

fn code(&self) -> Option<&Bytecode>

Source§

fn touch(&mut self)

Source§

fn unsafe_mark_cold(&mut self)

Source§

fn set_balance(&mut self, balance: U256)

Source§

fn incr_balance(&mut self, balance: U256) -> bool

Source§

fn decr_balance(&mut self, balance: U256) -> bool

Source§

fn bump_nonce(&mut self) -> bool

Source§

fn set_nonce(&mut self, nonce: u64)

Source§

fn unsafe_set_nonce(&mut self, nonce: u64)

Source§

fn set_code(&mut self, code_hash: B256, code: Bytecode)

Source§

fn set_code_and_hash_slow(&mut self, code: Bytecode)

Source§

fn delegate(&mut self, address: Address)

Implementors§

Source§

impl<'a, DB: Database, ENTRY: JournalEntryTr> JournaledAccountTr for JournaledAccount<'a, DB, ENTRY>