Skip to content

Commit

Permalink
trie: clean up reth-primitives imports (#10757)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Sep 6, 2024
1 parent d1d544e commit 423e022
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/trie/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ revm.workspace = true

# alloy
alloy-rlp.workspace = true
alloy-primitives.workspace = true

# tracing
tracing.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/benches/hash_post_state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(missing_docs, unreachable_pub)]
use alloy_primitives::{keccak256, Address, B256, U256};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner};
use reth_primitives::{keccak256, Address, B256, U256};
use reth_trie::{HashedPostState, HashedStorage};
use revm::db::{states::BundleBuilder, BundleAccount};
use std::collections::HashMap;
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/benches/trie_root.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![allow(missing_docs, unreachable_pub)]
use alloy_primitives::B256;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner};
use proptest_arbitrary_interop::arb;
use reth_primitives::{ReceiptWithBloom, B256};
use reth_primitives::ReceiptWithBloom;
use reth_trie::triehash::KeccakHasher;

/// Benchmarks different implementations of the root calculation.
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/hashed_cursor/mod.rs
Original file line number Diff line number Diff line change
@@ -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;

/// Implementation of hashed state cursor traits for the post state.
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/hashed_cursor/post_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use crate::{
forward_cursor::ForwardInMemoryCursor, HashedAccountsSorted, HashedPostStateSorted,
HashedStorageSorted,
};
use reth_primitives::{Account, B256, U256};
use alloy_primitives::{B256, U256};
use reth_primitives::Account;
use reth_storage_errors::db::DatabaseError;
use std::collections::HashSet;

Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/node_iter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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;

/// Represents a branch node in the trie.
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/prefix_set.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Nibbles;
use reth_primitives::B256;
use alloy_primitives::B256;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/progress.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{hash_builder::HashBuilder, trie_cursor::CursorSubNode, updates::TrieUpdates};
use reth_primitives::B256;
use alloy_primitives::B256;
use reth_stages_types::MerkleCheckpoint;

/// The progress of the state root computation.
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::{
walker::TrieWalker,
HashBuilder, Nibbles,
};
use alloy_primitives::{keccak256, Address, B256};
use alloy_rlp::{BufMut, Encodable};
use reth_execution_errors::trie::StateProofError;
use reth_primitives::{keccak256, Address, B256};
use reth_trie_common::{
proof::ProofRetainer, AccountProof, MultiProof, StorageMultiProof, TrieAccount,
};
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use crate::{
prefix_set::{PrefixSetMut, TriePrefixSetsMut},
Nibbles,
};
use alloy_primitives::{keccak256, Address, B256, U256};
use itertools::Itertools;
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 std::{
borrow::Cow,
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::encode_fixed_size;
use reth_primitives::{Account, Address, B256, U256};
use reth_primitives::Account;
use reth_trie_common::{triehash::KeccakHasher, TrieAccount};

/// Re-export of [triehash].
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ use crate::{
walker::TrieWalker,
HashBuilder, Nibbles, TrieAccount,
};
use alloy_primitives::{keccak256, Address, B256};
use alloy_rlp::{BufMut, Encodable};
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;

#[cfg(feature = "metrics")]
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/trie_cursor/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
forward_cursor::ForwardInMemoryCursor,
updates::{StorageTrieUpdatesSorted, TrieUpdatesSorted},
};
use reth_primitives::B256;
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;
use reth_trie_common::{BranchNodeCompact, Nibbles};
use std::collections::HashSet;
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/trie_cursor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{BranchNodeCompact, Nibbles};
use reth_primitives::B256;
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;

/// In-memory implementations of trie cursors.
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/trie_cursor/noop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{TrieCursor, TrieCursorFactory};
use crate::{BranchNodeCompact, Nibbles};
use reth_primitives::B256;
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;

/// Noop trie cursor factory.
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/trie_cursor/subnode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{BranchNodeCompact, Nibbles, StoredSubNode, CHILD_INDEX_RANGE};
use reth_primitives::B256;
use alloy_primitives::B256;

/// Cursor for iterating over a subtrie.
#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/updates.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{walker::TrieWalker, BranchNodeCompact, HashBuilder, Nibbles};
use reth_primitives::B256;
use alloy_primitives::B256;
use std::collections::{HashMap, HashSet};

/// The aggregation of trie updates.
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
trie_cursor::{CursorSubNode, TrieCursor},
BranchNodeCompact, Nibbles,
};
use reth_primitives::B256;
use alloy_primitives::B256;
use reth_storage_errors::db::DatabaseError;
use std::collections::HashSet;

Expand Down
3 changes: 2 additions & 1 deletion crates/trie/trie/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use crate::{
hashed_cursor::HashedCursorFactory, prefix_set::TriePrefixSetsMut, proof::Proof,
trie_cursor::TrieCursorFactory, HashedPostState,
};
use alloy_primitives::{keccak256, Bytes, B256};
use alloy_rlp::{BufMut, Decodable, Encodable};
use itertools::Either;
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::{
BranchNode, HashBuilder, Nibbles, TrieAccount, TrieNode, CHILD_INDEX_RANGE,
};
Expand Down

0 comments on commit 423e022

Please sign in to comment.