mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
test(trie): use proof nodes helper (#12848)
This commit is contained in:
@ -219,7 +219,6 @@ mod tests {
|
|||||||
use alloy_rlp::EMPTY_STRING_CODE;
|
use alloy_rlp::EMPTY_STRING_CODE;
|
||||||
use arbitrary::Arbitrary;
|
use arbitrary::Arbitrary;
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
use itertools::Itertools;
|
|
||||||
use rand::{rngs::StdRng, Rng, SeedableRng};
|
use rand::{rngs::StdRng, Rng, SeedableRng};
|
||||||
use reth_primitives_traits::Account;
|
use reth_primitives_traits::Account;
|
||||||
use reth_trie::{
|
use reth_trie::{
|
||||||
@ -314,18 +313,8 @@ mod tests {
|
|||||||
|
|
||||||
let storage_root = storage_hash_builder.root();
|
let storage_root = storage_hash_builder.root();
|
||||||
let proof_nodes = storage_hash_builder.take_proof_nodes();
|
let proof_nodes = storage_hash_builder.take_proof_nodes();
|
||||||
let storage_proof_1 = proof_nodes
|
let storage_proof_1 = proof_nodes.matching_nodes_sorted(&slot_path_1);
|
||||||
.iter()
|
let storage_proof_2 = proof_nodes.matching_nodes_sorted(&slot_path_2);
|
||||||
.filter(|(path, _)| path.is_empty() || slot_path_1.common_prefix_length(path) > 0)
|
|
||||||
.map(|(path, proof)| (path.clone(), proof.clone()))
|
|
||||||
.sorted_by_key(|(path, _)| path.clone())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let storage_proof_2 = proof_nodes
|
|
||||||
.iter()
|
|
||||||
.filter(|(path, _)| path.is_empty() || slot_path_2.common_prefix_length(path) > 0)
|
|
||||||
.map(|(path, proof)| (path.clone(), proof.clone()))
|
|
||||||
.sorted_by_key(|(path, _)| path.clone())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
let address_1 = b256!("1000000000000000000000000000000000000000000000000000000000000000");
|
let address_1 = b256!("1000000000000000000000000000000000000000000000000000000000000000");
|
||||||
let address_path_1 = Nibbles::unpack(address_1);
|
let address_path_1 = Nibbles::unpack(address_1);
|
||||||
@ -346,18 +335,8 @@ mod tests {
|
|||||||
|
|
||||||
let root = hash_builder.root();
|
let root = hash_builder.root();
|
||||||
let proof_nodes = hash_builder.take_proof_nodes();
|
let proof_nodes = hash_builder.take_proof_nodes();
|
||||||
let proof_1 = proof_nodes
|
let proof_1 = proof_nodes.matching_nodes_sorted(&address_path_1);
|
||||||
.iter()
|
let proof_2 = proof_nodes.matching_nodes_sorted(&address_path_2);
|
||||||
.filter(|(path, _)| path.is_empty() || address_path_1.common_prefix_length(path) > 0)
|
|
||||||
.map(|(path, proof)| (path.clone(), proof.clone()))
|
|
||||||
.sorted_by_key(|(path, _)| path.clone())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let proof_2 = proof_nodes
|
|
||||||
.iter()
|
|
||||||
.filter(|(path, _)| path.is_empty() || address_path_2.common_prefix_length(path) > 0)
|
|
||||||
.map(|(path, proof)| (path.clone(), proof.clone()))
|
|
||||||
.sorted_by_key(|(path, _)| path.clone())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
let mut sparse = SparseStateTrie::default().with_updates(true);
|
let mut sparse = SparseStateTrie::default().with_updates(true);
|
||||||
sparse.reveal_account(address_1, proof_1).unwrap();
|
sparse.reveal_account(address_1, proof_1).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user