Struct HashedPostState
pub struct HashedPostState {
pub accounts: HashMap<FixedBytes<32>, Option<Account>, FbBuildHasher<32>>,
pub storages: HashMap<FixedBytes<32>, HashedStorage, FbBuildHasher<32>>,
}Expand description
In-memory hashed state that stores account and storage changes with keccak256-hashed keys in hash maps.
Fields§
§accounts: HashMap<FixedBytes<32>, Option<Account>, FbBuildHasher<32>>Mapping of hashed address to account info, None if destroyed.
storages: HashMap<FixedBytes<32>, HashedStorage, FbBuildHasher<32>>Mapping of hashed address to hashed storage.
Implementations§
§impl HashedPostState
impl HashedPostState
pub fn with_capacity(capacity: usize) -> HashedPostState
pub fn with_capacity(capacity: usize) -> HashedPostState
Create new instance of HashedPostState.
pub fn from_bundle_state<'a, KH>(
state: impl IntoIterator<Item = (&'a Address, &'a BundleAccount)>,
) -> HashedPostStatewhere
KH: KeyHasher,
pub fn from_bundle_state<'a, KH>(
state: impl IntoIterator<Item = (&'a Address, &'a BundleAccount)>,
) -> HashedPostStatewhere
KH: KeyHasher,
Initialize HashedPostState from bundle state.
Hashes all changed accounts and storage entries that are currently stored in the bundle
state.
pub fn from_hashed_storage(
hashed_address: FixedBytes<32>,
storage: HashedStorage,
) -> HashedPostState
pub fn from_hashed_storage( hashed_address: FixedBytes<32>, storage: HashedStorage, ) -> HashedPostState
Construct HashedPostState from a single HashedStorage.
pub fn with_accounts(
self,
accounts: impl IntoIterator<Item = (FixedBytes<32>, Option<Account>)>,
) -> HashedPostState
pub fn with_accounts( self, accounts: impl IntoIterator<Item = (FixedBytes<32>, Option<Account>)>, ) -> HashedPostState
Set account entries on hashed state.
pub fn with_storages(
self,
storages: impl IntoIterator<Item = (FixedBytes<32>, HashedStorage)>,
) -> HashedPostState
pub fn with_storages( self, storages: impl IntoIterator<Item = (FixedBytes<32>, HashedStorage)>, ) -> HashedPostState
Set storage entries on hashed state.
pub fn construct_prefix_sets(&self) -> TriePrefixSetsMut
pub fn construct_prefix_sets(&self) -> TriePrefixSetsMut
Construct TriePrefixSetsMut from hashed post state.
The prefix sets contain the hashed account and storage keys that have been changed in the
post state.
pub fn multi_proof_targets(&self) -> MultiProofTargets
pub fn multi_proof_targets(&self) -> MultiProofTargets
Create multiproof targets for this state.
pub fn multi_proof_targets_difference(
&self,
excluded: &MultiProofTargets,
) -> MultiProofTargets
pub fn multi_proof_targets_difference( &self, excluded: &MultiProofTargets, ) -> MultiProofTargets
Create multiproof targets difference for this state,
i.e., the targets that are in targets create from self but not in excluded.
This method is preferred to first calling Self::multi_proof_targets and the calling
MultiProofTargets::retain_difference, because it does not over allocate the targets map.
pub fn chunks(self, size: usize) -> ChunkedHashedPostState ⓘ
pub fn chunks(self, size: usize) -> ChunkedHashedPostState ⓘ
Returns an iterator that yields chunks of the specified size.
See ChunkedHashedPostState for more information.
§Panics
Panics if the chunk size is zero.
pub fn chunking_length(&self) -> usize
pub fn chunking_length(&self) -> usize
Returns the number of items that will be considered during chunking in [Self::chunks].
pub fn extend(&mut self, other: HashedPostState)
pub fn extend(&mut self, other: HashedPostState)
Extend this hashed post state with contents of another. Entries in the second hashed post state take precedence.
pub fn extend_ref(&mut self, other: &HashedPostState)
pub fn extend_ref(&mut self, other: &HashedPostState)
Extend this hashed post state with contents of another. Entries in the second hashed post state take precedence.
Slightly less efficient than Self::extend, but preferred to extend(other.clone()).
pub fn extend_from_sorted(&mut self, sorted: &HashedPostStateSorted)
pub fn extend_from_sorted(&mut self, sorted: &HashedPostStateSorted)
Extend this hashed post state with sorted data, converting directly into the unsorted
HashMap representation. This is more efficient than first converting to HashedPostState
and then extending, as it avoids creating intermediate HashMap allocations.
pub fn into_sorted(self) -> HashedPostStateSorted
pub fn into_sorted(self) -> HashedPostStateSorted
Converts hashed post state into HashedPostStateSorted.
pub fn clone_into_sorted(&self) -> HashedPostStateSorted
pub fn clone_into_sorted(&self) -> HashedPostStateSorted
Creates a sorted copy without consuming self.
More efficient than .clone().into_sorted() as it avoids cloning HashMap metadata.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clears the account and storage maps of this HashedPostState.
Trait Implementations§
§impl Clone for HashedPostState
impl Clone for HashedPostState
§fn clone(&self) -> HashedPostState
fn clone(&self) -> HashedPostState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HashedPostState
impl Debug for HashedPostState
§impl Default for HashedPostState
impl Default for HashedPostState
§fn default() -> HashedPostState
fn default() -> HashedPostState
§impl<'de> Deserialize<'de> for HashedPostState
impl<'de> Deserialize<'de> for HashedPostState
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HashedPostState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HashedPostState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<'de> DeserializeAs<'de, HashedPostState> for HashedPostState<'de>
impl<'de> DeserializeAs<'de, HashedPostState> for HashedPostState<'de>
§fn deserialize_as<D>(
deserializer: D,
) -> Result<HashedPostState, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(
deserializer: D,
) -> Result<HashedPostState, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for HashedPostState
§impl<'a> From<&'a HashedPostState> for HashedPostState<'a>
impl<'a> From<&'a HashedPostState> for HashedPostState<'a>
§fn from(value: &'a HashedPostState) -> HashedPostState<'a>
fn from(value: &'a HashedPostState) -> HashedPostState<'a>
§impl<'a> From<HashedPostState<'a>> for HashedPostState
impl<'a> From<HashedPostState<'a>> for HashedPostState
§fn from(value: HashedPostState<'a>) -> HashedPostState
fn from(value: HashedPostState<'a>) -> HashedPostState
§impl From<HashedPostStateSorted> for HashedPostState
impl From<HashedPostStateSorted> for HashedPostState
§fn from(sorted: HashedPostStateSorted) -> HashedPostState
fn from(sorted: HashedPostStateSorted) -> HashedPostState
§impl FromIterator<(FixedBytes<32>, Option<Account>, Option<HashedStorage>)> for HashedPostState
impl FromIterator<(FixedBytes<32>, Option<Account>, Option<HashedStorage>)> for HashedPostState
§fn from_iter<T>(iter: T) -> HashedPostState
fn from_iter<T>(iter: T) -> HashedPostState
Constructs a HashedPostState from an iterator of tuples containing:
- Hashed address (B256)
- Optional account info (
Noneindicates destroyed account) - Optional hashed storage
§Important
- The iterator assumes unique hashed addresses (B256). If duplicate addresses are present, later entries will overwrite earlier ones for accounts, and storage will be merged.
- The
HashedStoragemust not be empty (as determined byHashedStorage::is_empty). Empty storage should be represented asNonerather thanSome(empty_storage). This ensures the storage map only contains meaningful entries.
Use (!storage.is_empty()).then_some(storage) to convert empty storage to None.
§impl FromParallelIterator<(FixedBytes<32>, Option<Account>, Option<HashedStorage>)> for HashedPostState
Available on crate feature rayon only.
impl FromParallelIterator<(FixedBytes<32>, Option<Account>, Option<HashedStorage>)> for HashedPostState
rayon only.§fn from_par_iter<I>(par_iter: I) -> HashedPostState
fn from_par_iter<I>(par_iter: I) -> HashedPostState
Parallel version of FromIterator for constructing HashedPostState from a parallel
iterator.
See FromIterator::from_iter for details on the expected input format.
§Important
- The iterator assumes unique hashed addresses (B256). If duplicate addresses are present, later entries will overwrite earlier ones for accounts, and storage will be merged.
- The
HashedStoragemust not be empty. Empty storage should beNone.
§impl PartialEq for HashedPostState
impl PartialEq for HashedPostState
§impl Serialize for HashedPostState
impl Serialize for HashedPostState
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl SerializeAs<HashedPostState> for HashedPostState<'_>
impl SerializeAs<HashedPostState> for HashedPostState<'_>
§fn serialize_as<S>(
source: &HashedPostState,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize_as<S>(
source: &HashedPostState,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for HashedPostState
Auto Trait Implementations§
impl Freeze for HashedPostState
impl RefUnwindSafe for HashedPostState
impl Send for HashedPostState
impl Sync for HashedPostState
impl Unpin for HashedPostState
impl UnsafeUnpin for HashedPostState
impl UnwindSafe for HashedPostState
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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<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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreimpl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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: 80 bytes