trie: clean up reth-primitives imports (#10757)

This commit is contained in:
Thomas Coratger
2024-09-06 13:19:50 -07:00
committed by GitHub
parent d1d544e23c
commit 423e0221f7
20 changed files with 27 additions and 18 deletions

1
Cargo.lock generated
View File

@ -8772,6 +8772,7 @@ dependencies = [
name = "reth-trie" name = "reth-trie"
version = "1.0.6" version = "1.0.6"
dependencies = [ dependencies = [
"alloy-primitives",
"alloy-rlp", "alloy-rlp",
"auto_impl", "auto_impl",
"criterion", "criterion",

View File

@ -23,6 +23,7 @@ revm.workspace = true
# alloy # alloy
alloy-rlp.workspace = true alloy-rlp.workspace = true
alloy-primitives.workspace = true
# tracing # tracing
tracing.workspace = true tracing.workspace = true

View File

@ -1,7 +1,7 @@
#![allow(missing_docs, unreachable_pub)] #![allow(missing_docs, unreachable_pub)]
use alloy_primitives::{keccak256, Address, B256, U256};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner};
use reth_primitives::{keccak256, Address, B256, U256};
use reth_trie::{HashedPostState, HashedStorage}; use reth_trie::{HashedPostState, HashedStorage};
use revm::db::{states::BundleBuilder, BundleAccount}; use revm::db::{states::BundleBuilder, BundleAccount};
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -1,8 +1,9 @@
#![allow(missing_docs, unreachable_pub)] #![allow(missing_docs, unreachable_pub)]
use alloy_primitives::B256;
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner};
use proptest_arbitrary_interop::arb; use proptest_arbitrary_interop::arb;
use reth_primitives::{ReceiptWithBloom, B256}; use reth_primitives::ReceiptWithBloom;
use reth_trie::triehash::KeccakHasher; use reth_trie::triehash::KeccakHasher;
/// Benchmarks different implementations of the root calculation. /// Benchmarks different implementations of the root calculation.

View File

@ -1,4 +1,5 @@
use reth_primitives::{Account, B256, U256}; use alloy_primitives::{B256, U256};
use reth_primitives::Account;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
/// Implementation of hashed state cursor traits for the post state. /// Implementation of hashed state cursor traits for the post state.

View File

@ -3,7 +3,8 @@ use crate::{
forward_cursor::ForwardInMemoryCursor, HashedAccountsSorted, HashedPostStateSorted, forward_cursor::ForwardInMemoryCursor, HashedAccountsSorted, HashedPostStateSorted,
HashedStorageSorted, HashedStorageSorted,
}; };
use reth_primitives::{Account, B256, U256}; use alloy_primitives::{B256, U256};
use reth_primitives::Account;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
use std::collections::HashSet; use std::collections::HashSet;

View File

@ -1,5 +1,5 @@
use crate::{hashed_cursor::HashedCursor, trie_cursor::TrieCursor, walker::TrieWalker, Nibbles}; use crate::{hashed_cursor::HashedCursor, trie_cursor::TrieCursor, walker::TrieWalker, Nibbles};
use reth_primitives::B256; use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
/// Represents a branch node in the trie. /// Represents a branch node in the trie.

View File

@ -1,5 +1,5 @@
use crate::Nibbles; use crate::Nibbles;
use reth_primitives::B256; use alloy_primitives::B256;
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
sync::Arc, sync::Arc,

View File

@ -1,5 +1,5 @@
use crate::{hash_builder::HashBuilder, trie_cursor::CursorSubNode, updates::TrieUpdates}; use crate::{hash_builder::HashBuilder, trie_cursor::CursorSubNode, updates::TrieUpdates};
use reth_primitives::B256; use alloy_primitives::B256;
use reth_stages_types::MerkleCheckpoint; use reth_stages_types::MerkleCheckpoint;
/// The progress of the state root computation. /// The progress of the state root computation.

View File

@ -6,9 +6,9 @@ use crate::{
walker::TrieWalker, walker::TrieWalker,
HashBuilder, Nibbles, HashBuilder, Nibbles,
}; };
use alloy_primitives::{keccak256, Address, B256};
use alloy_rlp::{BufMut, Encodable}; use alloy_rlp::{BufMut, Encodable};
use reth_execution_errors::trie::StateProofError; use reth_execution_errors::trie::StateProofError;
use reth_primitives::{keccak256, Address, B256};
use reth_trie_common::{ use reth_trie_common::{
proof::ProofRetainer, AccountProof, MultiProof, StorageMultiProof, TrieAccount, proof::ProofRetainer, AccountProof, MultiProof, StorageMultiProof, TrieAccount,
}; };

View File

@ -2,9 +2,10 @@ use crate::{
prefix_set::{PrefixSetMut, TriePrefixSetsMut}, prefix_set::{PrefixSetMut, TriePrefixSetsMut},
Nibbles, Nibbles,
}; };
use alloy_primitives::{keccak256, Address, B256, U256};
use itertools::Itertools; use itertools::Itertools;
use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use rayon::prelude::{IntoParallelIterator, ParallelIterator};
use reth_primitives::{keccak256, Account, Address, B256, U256}; use reth_primitives::Account;
use revm::db::{states::CacheAccount, AccountStatus, BundleAccount}; use revm::db::{states::CacheAccount, AccountStatus, BundleAccount};
use std::{ use std::{
borrow::Cow, borrow::Cow,

View File

@ -1,5 +1,6 @@
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::encode_fixed_size; use alloy_rlp::encode_fixed_size;
use reth_primitives::{Account, Address, B256, U256}; use reth_primitives::Account;
use reth_trie_common::{triehash::KeccakHasher, TrieAccount}; use reth_trie_common::{triehash::KeccakHasher, TrieAccount};
/// Re-export of [triehash]. /// Re-export of [triehash].

View File

@ -9,9 +9,10 @@ use crate::{
walker::TrieWalker, walker::TrieWalker,
HashBuilder, Nibbles, TrieAccount, HashBuilder, Nibbles, TrieAccount,
}; };
use alloy_primitives::{keccak256, Address, B256};
use alloy_rlp::{BufMut, Encodable}; use alloy_rlp::{BufMut, Encodable};
use reth_execution_errors::{StateRootError, StorageRootError}; use reth_execution_errors::{StateRootError, StorageRootError};
use reth_primitives::{constants::EMPTY_ROOT_HASH, keccak256, Address, B256}; use reth_primitives::constants::EMPTY_ROOT_HASH;
use tracing::trace; use tracing::trace;
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]

View File

@ -3,7 +3,7 @@ use crate::{
forward_cursor::ForwardInMemoryCursor, forward_cursor::ForwardInMemoryCursor,
updates::{StorageTrieUpdatesSorted, TrieUpdatesSorted}, updates::{StorageTrieUpdatesSorted, TrieUpdatesSorted},
}; };
use reth_primitives::B256; use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
use reth_trie_common::{BranchNodeCompact, Nibbles}; use reth_trie_common::{BranchNodeCompact, Nibbles};
use std::collections::HashSet; use std::collections::HashSet;

View File

@ -1,5 +1,5 @@
use crate::{BranchNodeCompact, Nibbles}; use crate::{BranchNodeCompact, Nibbles};
use reth_primitives::B256; use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
/// In-memory implementations of trie cursors. /// In-memory implementations of trie cursors.

View File

@ -1,6 +1,6 @@
use super::{TrieCursor, TrieCursorFactory}; use super::{TrieCursor, TrieCursorFactory};
use crate::{BranchNodeCompact, Nibbles}; use crate::{BranchNodeCompact, Nibbles};
use reth_primitives::B256; use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
/// Noop trie cursor factory. /// Noop trie cursor factory.

View File

@ -1,5 +1,5 @@
use crate::{BranchNodeCompact, Nibbles, StoredSubNode, CHILD_INDEX_RANGE}; use crate::{BranchNodeCompact, Nibbles, StoredSubNode, CHILD_INDEX_RANGE};
use reth_primitives::B256; use alloy_primitives::B256;
/// Cursor for iterating over a subtrie. /// Cursor for iterating over a subtrie.
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,5 +1,5 @@
use crate::{walker::TrieWalker, BranchNodeCompact, HashBuilder, Nibbles}; use crate::{walker::TrieWalker, BranchNodeCompact, HashBuilder, Nibbles};
use reth_primitives::B256; use alloy_primitives::B256;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
/// The aggregation of trie updates. /// The aggregation of trie updates.

View File

@ -3,7 +3,7 @@ use crate::{
trie_cursor::{CursorSubNode, TrieCursor}, trie_cursor::{CursorSubNode, TrieCursor},
BranchNodeCompact, Nibbles, BranchNodeCompact, Nibbles,
}; };
use reth_primitives::B256; use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError; use reth_storage_errors::db::DatabaseError;
use std::collections::HashSet; use std::collections::HashSet;

View File

@ -2,10 +2,11 @@ use crate::{
hashed_cursor::HashedCursorFactory, prefix_set::TriePrefixSetsMut, proof::Proof, hashed_cursor::HashedCursorFactory, prefix_set::TriePrefixSetsMut, proof::Proof,
trie_cursor::TrieCursorFactory, HashedPostState, trie_cursor::TrieCursorFactory, HashedPostState,
}; };
use alloy_primitives::{keccak256, Bytes, B256};
use alloy_rlp::{BufMut, Decodable, Encodable}; use alloy_rlp::{BufMut, Decodable, Encodable};
use itertools::Either; use itertools::Either;
use reth_execution_errors::{StateProofError, TrieWitnessError}; use reth_execution_errors::{StateProofError, TrieWitnessError};
use reth_primitives::{constants::EMPTY_ROOT_HASH, keccak256, Bytes, B256}; use reth_primitives::constants::EMPTY_ROOT_HASH;
use reth_trie_common::{ use reth_trie_common::{
BranchNode, HashBuilder, Nibbles, TrieAccount, TrieNode, CHILD_INDEX_RANGE, BranchNode, HashBuilder, Nibbles, TrieAccount, TrieNode, CHILD_INDEX_RANGE,
}; };