|
1 | 1 | //! The implementation of the hash builder.
|
2 | 2 |
|
3 | 3 | use super::{
|
| 4 | + BranchNodeCompact, EMPTY_ROOT_HASH, Nibbles, TrieMask, |
4 | 5 | nodes::{BranchNodeRef, ExtensionNodeRef, LeafNodeRef},
|
5 | 6 | proof::ProofRetainer,
|
6 |
| - BranchNodeCompact, Nibbles, TrieMask, EMPTY_ROOT_HASH, |
7 | 7 | };
|
8 |
| -use crate::{nodes::RlpNode, proof::ProofNodes, HashMap}; |
| 8 | +use crate::{HashMap, nodes::RlpNode, proof::ProofNodes}; |
9 | 9 | use alloc::vec::Vec;
|
10 |
| -use alloy_primitives::{keccak256, B256}; |
| 10 | +use alloy_primitives::{B256, keccak256}; |
11 | 11 | use alloy_rlp::EMPTY_STRING_CODE;
|
12 | 12 | use core::cmp;
|
13 | 13 | use tracing::trace;
|
@@ -183,11 +183,7 @@ impl HashBuilder {
|
183 | 183 |
|
184 | 184 | fn current_root(&self) -> B256 {
|
185 | 185 | if let Some(node_ref) = self.stack.last() {
|
186 |
| - if let Some(hash) = node_ref.as_hash() { |
187 |
| - hash |
188 |
| - } else { |
189 |
| - keccak256(node_ref) |
190 |
| - } |
| 186 | + if let Some(hash) = node_ref.as_hash() { hash } else { keccak256(node_ref) } |
191 | 187 | } else {
|
192 | 188 | EMPTY_ROOT_HASH
|
193 | 189 | }
|
@@ -455,7 +451,7 @@ mod tests {
|
455 | 451 | use super::*;
|
456 | 452 | use crate::{nodes::LeafNode, triehash_trie_root};
|
457 | 453 | use alloc::collections::BTreeMap;
|
458 |
| - use alloy_primitives::{b256, hex, U256}; |
| 454 | + use alloy_primitives::{U256, b256, hex}; |
459 | 455 | use alloy_rlp::Encodable;
|
460 | 456 |
|
461 | 457 | // Hashes the keys, RLP encodes the values, compares the trie builder with the upstream root.
|
|
0 commit comments