Trait JournaledAccountTr
pub trait JournaledAccountTr {
Show 20 methods
// Required methods
fn account(&self) -> &Account;
fn sload(
&mut self,
key: Uint<256, 4>,
skip_cold_load: bool,
) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadError<ErasedError>>;
fn sstore(
&mut self,
key: Uint<256, 4>,
new: Uint<256, 4>,
skip_cold_load: bool,
) -> Result<StateLoad<SStoreResult>, JournalLoadError<ErasedError>>;
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadError<ErasedError>>;
fn balance(&self) -> &Uint<256, 4>;
fn nonce(&self) -> u64;
fn code_hash(&self) -> &FixedBytes<32>;
fn code(&self) -> Option<&Bytecode>;
fn touch(&mut self);
fn unsafe_mark_cold(&mut self);
fn set_balance(&mut self, balance: Uint<256, 4>);
fn set_extension(&mut self, extension: AccountExtension);
fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool;
fn decr_balance(&mut self, balance: Uint<256, 4>) -> 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: FixedBytes<32>, 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§
fn sload(
&mut self,
key: Uint<256, 4>,
skip_cold_load: bool,
) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadError<ErasedError>>
fn sload( &mut self, key: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadError<ErasedError>>
Sloads the storage slot and returns its mutable reference
fn sstore(
&mut self,
key: Uint<256, 4>,
new: Uint<256, 4>,
skip_cold_load: bool,
) -> Result<StateLoad<SStoreResult>, JournalLoadError<ErasedError>>
fn sstore( &mut self, key: Uint<256, 4>, new: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadError<ErasedError>>
Loads the storage slot and stores the new value
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadError<ErasedError>>
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadError<ErasedError>>
Loads the code of the account. and returns it as reference.
fn balance(&self) -> &Uint<256, 4>
fn balance(&self) -> &Uint<256, 4>
Returns the balance of the account.
fn code_hash(&self) -> &FixedBytes<32>
fn code_hash(&self) -> &FixedBytes<32>
Returns the code hash of the account.
fn touch(&mut self)
fn touch(&mut self)
Touches the account.
fn 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.
fn set_balance(&mut self, balance: Uint<256, 4>)
fn set_balance(&mut self, balance: Uint<256, 4>)
Sets the balance of the account.
If balance is the same, we don’t add a journal entry.
Touches the account in all cases.
fn set_extension(&mut self, extension: AccountExtension)
Available on crate feature account-ext only.
fn set_extension(&mut self, extension: AccountExtension)
account-ext only.Sets the chain-specific payload, touching the account and journaling the previous value.
fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool
fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool
Increments the balance of the account.
Touches the account in all cases.
fn decr_balance(&mut self, balance: Uint<256, 4>) -> bool
fn decr_balance(&mut self, balance: Uint<256, 4>) -> bool
Decrements the balance of the account.
Touches the account in all cases.
fn 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.
fn 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.
fn 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.
fn set_code(&mut self, code_hash: FixedBytes<32>, code: Bytecode)
fn set_code(&mut self, code_hash: FixedBytes<32>, code: Bytecode)
Sets the code of the account.
Touches the account in all cases.
fn 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
§impl<'a, T> JournaledAccountTr for &'a mut Twhere
T: 'a + JournaledAccountTr + ?Sized,
impl<'a, T> JournaledAccountTr for &'a mut Twhere
T: 'a + JournaledAccountTr + ?Sized,
fn account(&self) -> &Account
fn sload( &mut self, key: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadError<ErasedError>>
fn sstore( &mut self, key: Uint<256, 4>, new: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadError<ErasedError>>
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadError<ErasedError>>
fn balance(&self) -> &Uint<256, 4>
fn nonce(&self) -> u64
fn code_hash(&self) -> &FixedBytes<32>
fn code(&self) -> Option<&Bytecode>
fn touch(&mut self)
fn unsafe_mark_cold(&mut self)
fn set_balance(&mut self, balance: Uint<256, 4>)
§fn set_extension(&mut self, extension: AccountExtension)
fn set_extension(&mut self, extension: AccountExtension)
account-ext only.fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool
fn decr_balance(&mut self, balance: Uint<256, 4>) -> 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: FixedBytes<32>, code: Bytecode)
fn set_code_and_hash_slow(&mut self, code: Bytecode)
fn delegate(&mut self, address: Address)
§impl<T> JournaledAccountTr for Box<T>where
T: JournaledAccountTr + ?Sized,
impl<T> JournaledAccountTr for Box<T>where
T: JournaledAccountTr + ?Sized,
fn account(&self) -> &Account
fn sload( &mut self, key: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<&mut EvmStorageSlot>, JournalLoadError<ErasedError>>
fn sstore( &mut self, key: Uint<256, 4>, new: Uint<256, 4>, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, JournalLoadError<ErasedError>>
fn load_code(&mut self) -> Result<&Bytecode, JournalLoadError<ErasedError>>
fn balance(&self) -> &Uint<256, 4>
fn nonce(&self) -> u64
fn code_hash(&self) -> &FixedBytes<32>
fn code(&self) -> Option<&Bytecode>
fn touch(&mut self)
fn unsafe_mark_cold(&mut self)
fn set_balance(&mut self, balance: Uint<256, 4>)
§fn set_extension(&mut self, extension: AccountExtension)
fn set_extension(&mut self, extension: AccountExtension)
account-ext only.