Struct JournaledAccount
pub struct JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,{ /* private fields */ }Expand description
Journaled account contains both mutable account and journal entries.
Useful to encapsulate account and journal entries together. So when account gets changed, we can add a journal entry for it.
Implementations§
§impl<'a, ENTRY> JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,
impl<'a, ENTRY> JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,
pub fn into_account_ref(self) -> &'a Account
pub fn into_account_ref(self) -> &'a Account
Consumes the journaled account and returns the mutable account.
pub fn new(
address: Address,
account: &'a mut Account,
journal_entries: &'a mut Vec<ENTRY>,
) -> JournaledAccount<'a, ENTRY>
pub fn new( address: Address, account: &'a mut Account, journal_entries: &'a mut Vec<ENTRY>, ) -> JournaledAccount<'a, ENTRY>
Creates a new journaled account.
pub fn balance(&self) -> &Uint<256, 4>
pub fn balance(&self) -> &Uint<256, 4>
Returns the balance of the account.
pub fn code_hash(&self) -> &FixedBytes<32>
pub fn code_hash(&self) -> &FixedBytes<32>
Returns the code hash of the account.
pub fn touch(&mut self)
pub fn touch(&mut self)
Touches the account.
pub fn set_balance(&mut self, balance: Uint<256, 4>)
pub 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.
pub fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool
pub fn incr_balance(&mut self, balance: Uint<256, 4>) -> bool
Increments the balance of the account.
Touches the account in all cases.
pub fn decr_balance(&mut self, balance: Uint<256, 4>) -> bool
pub fn decr_balance(&mut self, balance: Uint<256, 4>) -> bool
Decrements the balance of the account.
Touches the account in all cases.
pub fn bump_nonce(&mut self) -> bool
pub 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.
pub fn set_code(&mut self, code_hash: FixedBytes<32>, code: Bytecode)
pub fn set_code(&mut self, code_hash: FixedBytes<32>, code: Bytecode)
Sets the code of the account.
Touches the account in all cases.
pub fn set_code_and_hash_slow(&mut self, code: Bytecode)
pub 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.
pub fn delegate(&mut self, address: Address)
pub 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.
Methods from Deref<Target = Account>§
pub fn state_clear_aware_is_empty(&self, spec: SpecId) -> bool
pub fn state_clear_aware_is_empty(&self, spec: SpecId) -> bool
Checks if account is empty and check if empty state before spurious dragon hardfork.
pub fn is_selfdestructed(&self) -> bool
pub fn is_selfdestructed(&self) -> bool
Is account marked for self destruct.
pub fn is_touched(&self) -> bool
pub fn is_touched(&self) -> bool
If account status is marked as touched.
pub fn is_cold_transaction_id(&self, transaction_id: usize) -> bool
pub fn is_cold_transaction_id(&self, transaction_id: usize) -> bool
Is account warm for given transaction id.
pub fn is_created_locally(&self) -> bool
pub fn is_created_locally(&self) -> bool
Is account locally created
pub fn is_selfdestructed_locally(&self) -> bool
pub fn is_selfdestructed_locally(&self) -> bool
Is account locally selfdestructed
pub fn is_loaded_as_not_existing(&self) -> bool
pub fn is_loaded_as_not_existing(&self) -> bool
Is account loaded as not existing from database.
This is needed for pre spurious dragon hardforks where existing and empty were two separate states.
pub fn is_loaded_as_not_existing_not_touched(&self) -> bool
pub fn is_loaded_as_not_existing_not_touched(&self) -> bool
Is account loaded as not existing from database and not touched.
pub fn is_created(&self) -> bool
pub fn is_created(&self) -> bool
Is account newly created in this transaction.
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Is account empty, check if nonce and balance are zero and code is empty.
pub fn changed_storage_slots(
&self,
) -> impl Iterator<Item = (&Uint<256, 4>, &EvmStorageSlot)>
pub fn changed_storage_slots( &self, ) -> impl Iterator<Item = (&Uint<256, 4>, &EvmStorageSlot)>
Returns an iterator over the storage slots that have been changed.
See also [EvmStorageSlot::is_changed].
Trait Implementations§
§impl<'a, ENTRY> Debug for JournaledAccount<'a, ENTRY>where
ENTRY: Debug + JournalEntryTr,
impl<'a, ENTRY> Debug for JournaledAccount<'a, ENTRY>where
ENTRY: Debug + JournalEntryTr,
§impl<'a, ENTRY> Deref for JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,
impl<'a, ENTRY> Deref for JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,
§impl<'a, ENTRY> PartialEq for JournaledAccount<'a, ENTRY>where
ENTRY: PartialEq + JournalEntryTr,
impl<'a, ENTRY> PartialEq for JournaledAccount<'a, ENTRY>where
ENTRY: PartialEq + JournalEntryTr,
impl<'a, ENTRY> Eq for JournaledAccount<'a, ENTRY>where
ENTRY: Eq + JournalEntryTr,
impl<'a, ENTRY> StructuralPartialEq for JournaledAccount<'a, ENTRY>where
ENTRY: JournalEntryTr,
Auto Trait Implementations§
impl<'a, ENTRY> Freeze for JournaledAccount<'a, ENTRY>
impl<'a, ENTRY> RefUnwindSafe for JournaledAccount<'a, ENTRY>where
ENTRY: RefUnwindSafe,
impl<'a, ENTRY> Send for JournaledAccount<'a, ENTRY>where
ENTRY: Send,
impl<'a, ENTRY> Sync for JournaledAccount<'a, ENTRY>where
ENTRY: Sync,
impl<'a, ENTRY> Unpin for JournaledAccount<'a, ENTRY>
impl<'a, ENTRY> !UnwindSafe for JournaledAccount<'a, ENTRY>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.