mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf(trie): use unstable sort when sorting for computing roots (#11301)
This commit is contained in:
@ -75,7 +75,7 @@ pub fn state_root_unhashed<A: Into<TrieAccount>>(
|
||||
pub fn state_root_unsorted<A: Into<TrieAccount>>(
|
||||
state: impl IntoIterator<Item = (B256, A)>,
|
||||
) -> B256 {
|
||||
state_root(state.into_iter().sorted_by_key(|(key, _)| *key))
|
||||
state_root(state.into_iter().sorted_unstable_by_key(|(key, _)| *key))
|
||||
}
|
||||
|
||||
/// Calculates the root hash of the state represented as MPT.
|
||||
@ -105,7 +105,7 @@ pub fn storage_root_unhashed(storage: impl IntoIterator<Item = (B256, U256)>) ->
|
||||
/// Sorts and calculates the root hash of account storage trie.
|
||||
/// See [`storage_root`] for more info.
|
||||
pub fn storage_root_unsorted(storage: impl IntoIterator<Item = (B256, U256)>) -> B256 {
|
||||
storage_root(storage.into_iter().sorted_by_key(|(key, _)| *key))
|
||||
storage_root(storage.into_iter().sorted_unstable_by_key(|(key, _)| *key))
|
||||
}
|
||||
|
||||
/// Calculates the root hash of account storage trie.
|
||||
|
||||
Reference in New Issue
Block a user