Skip to content

Commit

Permalink
refactor!: remove Node::new
Browse files Browse the repository at this point in the history
  • Loading branch information
0xaatif committed Jul 16, 2024
1 parent da77bd0 commit 8b1a1b4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion evm_arithmetization/src/generation/mpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ fn load_state_trie(
code_hash,
} = account;

let storage_hash_only = Node::new(Node::Hash(storage_root)).freeze();
let storage_hash_only = Node::Hash(storage_root).freeze();
let merged_key = key.merge_nibbles(nibbles);
let storage_trie: &Node = storage_tries_by_state_key
.get(&merged_key)
Expand Down
4 changes: 0 additions & 4 deletions mpt_trie/src/partial_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ impl Node {
node: self,
}
}
/// Creates a new partial trie from a node.
pub fn new(node: Node) -> Self {
node
}
/// Inserts a node into the trie.
pub fn insert<K, V>(&mut self, k: K, v: V) -> TrieOpResult<()>
where
Expand Down
4 changes: 2 additions & 2 deletions mpt_trie/src/trie_hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ mod tests {
fn get_root_hashes_for_our_trie_after_each_insert(
entries: impl Iterator<Item = TestInsertValEntry>,
) -> impl Iterator<Item = H256> {
let mut trie = Node::new(Node::Empty);
let mut trie = Node::Empty;

entries.map(move |(k, v)| {
trie.insert(k, v).unwrap();
Expand All @@ -250,7 +250,7 @@ mod tests {
fn empty_hash_is_correct() {
common_setup();

let trie = Node::new(Node::Empty);
let trie = Node::Empty;
assert_eq!(keccak_hash::KECCAK_NULL_RLP, trie.get_hash());
}

Expand Down
2 changes: 1 addition & 1 deletion mpt_trie/src/trie_subsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ mod tests {
fn encountering_a_hash_node_returns_err() {
common_setup();

let trie = TrieType::new(Node::Hash(H256::zero()));
let trie = Node::Hash(H256::zero());
let res = create_trie_subset(&trie, once(0x1234));

assert!(res.is_err())
Expand Down
2 changes: 1 addition & 1 deletion trace_decoder/src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl ProcessedBlockTrace {
if !storage_tries.contains_key(h_addr) {
let trie = state_accounts_with_no_accesses_but_storage_tries
.get(h_addr)
.map(|s_root| Node::new(Node::Hash(*s_root)))
.map(|s_root| Node::Hash(*s_root))
.unwrap_or_default();

storage_tries.insert(*h_addr, trie);
Expand Down

0 comments on commit 8b1a1b4

Please sign in to comment.