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§
Sourcefn sload(
&mut self,
key: StorageKey,
skip_cold_load: bool,
) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>
fn sload( &mut self, key: StorageKey, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadErasedError>
Sloads the storage slot and returns its mutable reference
Sourcefn sstore(
&mut self,
key: StorageKey,
new: StorageValue,
skip_cold_load: bool,
) -> Result<StateLoad<SStoreResult>, JournalLoadErasedError>
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
Sourcefn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadErasedError>
Loads the code of the account. and returns it as reference.
Sourcefn unsafe_mark_cold(&mut self)
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.
Sourcefn set_balance(&mut self, balance: U256)
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.
Sourcefn incr_balance(&mut self, balance: U256) -> bool
fn incr_balance(&mut self, balance: U256) -> bool
Increments the balance of the account.
Touches the account in all cases.
Sourcefn decr_balance(&mut self, balance: U256) -> bool
fn decr_balance(&mut self, balance: U256) -> bool
Decrements the balance of the account.
Touches the account in all cases.
Sourcefn bump_nonce(&mut self) -> bool
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.
Sourcefn set_nonce(&mut self, nonce: u64)
fn set_nonce(&mut self, nonce: u64)
Set the nonce of the account and create a journal entry.
Touches the account in all cases.
Sourcefn unsafe_set_nonce(&mut self, nonce: u64)
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.
Sourcefn set_code(&mut self, code_hash: B256, code: Bytecode)
fn set_code(&mut self, code_hash: B256, code: Bytecode)
Sets the code of the account.
Touches the account in all cases.
Sourcefn set_code_and_hash_slow(&mut self, code: Bytecode)
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.