pub struct HashedPostStateSorted {
pub accounts: Vec<(B256, Option<Account>)>,
pub storages: B256Map<HashedStorageSorted>,
}Expand description
Sorted hashed post state optimized for iterating during state trie calculation.
Fields§
§accounts: Vec<(B256, Option<Account>)>Sorted collection of account updates. None indicates a destroyed account.
storages: B256Map<HashedStorageSorted>Map of hashed addresses to their sorted storage updates.
Implementations§
Source§impl HashedPostStateSorted
impl HashedPostStateSorted
Sourcepub const fn new(
accounts: Vec<(B256, Option<Account>)>,
storages: B256Map<HashedStorageSorted>,
) -> Self
pub const fn new( accounts: Vec<(B256, Option<Account>)>, storages: B256Map<HashedStorageSorted>, ) -> Self
Create new instance of HashedPostStateSorted
Sourcepub const fn accounts(&self) -> &Vec<(B256, Option<Account>)>
pub const fn accounts(&self) -> &Vec<(B256, Option<Account>)>
Returns reference to hashed accounts.
Sourcepub const fn account_storages(&self) -> &B256Map<HashedStorageSorted>
pub const fn account_storages(&self) -> &B256Map<HashedStorageSorted>
Returns reference to hashed account storages.
Sourcepub fn total_len(&self) -> usize
pub fn total_len(&self) -> usize
Returns the total number of updates including all accounts and storage updates.
Sourcepub 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.
Sourcepub fn extend_ref_and_sort(&mut self, other: &Self)
pub fn extend_ref_and_sort(&mut self, other: &Self)
Extends this state with contents of another sorted state.
Entries in other take precedence for duplicate keys.
Sorts the accounts after extending. Sorts the storage after extending, for each account.
Sourcepub fn merge_batch<T: AsRef<Self> + From<Self>>(
iter: impl IntoIterator<Item = T>,
) -> T
pub fn merge_batch<T: AsRef<Self> + From<Self>>( iter: impl IntoIterator<Item = T>, ) -> T
Batch-merge sorted hashed post states. Iterator yields newest to oldest.
For small batches, uses extend_ref_and_sort loop.
For large batches, uses k-way merge for O(n log k) complexity.
Sourcepub fn merge_slice<T: AsRef<Self>>(items: &[T]) -> Self
pub fn merge_slice<T: AsRef<Self>>(items: &[T]) -> Self
Batch-merge sorted hashed post states from a slice. Slice is newest to oldest.
This variant takes a slice reference directly, avoiding iterator collection overhead.
For small batches, uses extend_ref_and_sort loop.
For large batches, uses k-way merge for O(n log k) complexity.
Sourcepub fn disjointed_merge_batch<'a>(batch: &[&'a Self], mask: &[&'a Self]) -> Self
pub fn disjointed_merge_batch<'a>(batch: &[&'a Self], mask: &[&'a Self]) -> Self
Merges the batch and removes overlapping keys whose mask values all differ from the merged batch value.
Account keys are masked at the top level, while storage entries are masked at the slot level. For duplicate keys in the batch, later items take precedence over earlier ones. An overlapping entry is retained if any mask value is equal to the merged batch value. The order of the mask does not matter. An empty mask merges the batch without filtering.
Trait Implementations§
Source§impl Clone for HashedPostStateSorted
impl Clone for HashedPostStateSorted
Source§impl Debug for HashedPostStateSorted
impl Debug for HashedPostStateSorted
Source§impl Default for HashedPostStateSorted
impl Default for HashedPostStateSorted
Source§impl<'de> Deserialize<'de> for HashedPostStateSorted
Available on crate feature serde only.
impl<'de> Deserialize<'de> for HashedPostStateSorted
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'de> DeserializeAs<'de, HashedPostStateSorted> for HashedPostStateSorted<'de>
Available on crate feature serde-bincode-compat only.
impl<'de> DeserializeAs<'de, HashedPostStateSorted> for HashedPostStateSorted<'de>
serde-bincode-compat only.Source§fn deserialize_as<D>(deserializer: D) -> Result<HashedPostStateSorted, D::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(deserializer: D) -> Result<HashedPostStateSorted, D::Error>where
D: Deserializer<'de>,
impl Eq for HashedPostStateSorted
Source§impl<'a> From<&'a HashedPostStateSorted> for HashedPostStateSorted<'a>
Available on crate feature serde-bincode-compat only.
impl<'a> From<&'a HashedPostStateSorted> for HashedPostStateSorted<'a>
serde-bincode-compat only.Source§fn from(value: &'a HashedPostStateSorted) -> Self
fn from(value: &'a HashedPostStateSorted) -> Self
Source§impl<'a> From<HashedPostStateSorted<'a>> for HashedPostStateSorted
Available on crate feature serde-bincode-compat only.
impl<'a> From<HashedPostStateSorted<'a>> for HashedPostStateSorted
serde-bincode-compat only.Source§fn from(value: HashedPostStateSorted<'a>) -> Self
fn from(value: HashedPostStateSorted<'a>) -> Self
Source§impl From<HashedPostStateSorted> for HashedPostState
impl From<HashedPostStateSorted> for HashedPostState
Source§fn from(sorted: HashedPostStateSorted) -> Self
fn from(sorted: HashedPostStateSorted) -> Self
Source§impl PartialEq for HashedPostStateSorted
impl PartialEq for HashedPostStateSorted
Source§impl Serialize for HashedPostStateSorted
Available on crate feature serde only.
impl Serialize for HashedPostStateSorted
serde only.Source§impl SerializeAs<HashedPostStateSorted> for HashedPostStateSorted<'_>
Available on crate feature serde-bincode-compat only.
impl SerializeAs<HashedPostStateSorted> for HashedPostStateSorted<'_>
serde-bincode-compat only.Source§fn serialize_as<S>(
source: &HashedPostStateSorted,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_as<S>(
source: &HashedPostStateSorted,
serializer: S,
) -> Result<S::Ok, S::Error>where
S: Serializer,
impl StructuralPartialEq for HashedPostStateSorted
Auto Trait Implementations§
impl Freeze for HashedPostStateSorted
impl RefUnwindSafe for HashedPostStateSorted
impl Send for HashedPostStateSorted
impl Sync for HashedPostStateSorted
impl Unpin for HashedPostStateSorted
impl UnsafeUnpin for HashedPostStateSorted
impl UnwindSafe for HashedPostStateSorted
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> 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> ⓘ
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: 64 bytes