Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Dec 11, 2024
1 parent dfe6e16 commit 146e86d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
33 changes: 27 additions & 6 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl StateRootHandle {
pub struct StateRootConfig<Factory> {
/// View over the state in the database.
pub consistent_view: ConsistentDbView<Factory>,
/// Latest trie input
/// Latest trie input.
pub input: Arc<TrieInput>,
}

Expand Down Expand Up @@ -250,9 +250,12 @@ where
+ Send
+ Sync
+ 'static,
ABP: BlindedProvider<Error = SparseTrieError>,
SBP: BlindedProvider<Error = SparseTrieError>,
BPF: BlindedProviderFactory<AccountNodeProvider = ABP, StorageNodeProvider = SBP>,
ABP: BlindedProvider<Error = SparseTrieError> + Send + Sync + 'static,
SBP: BlindedProvider<Error = SparseTrieError> + Send + Sync + 'static,
BPF: BlindedProviderFactory<AccountNodeProvider = ABP, StorageNodeProvider = SBP>
+ Send
+ Sync
+ 'static,
{
/// Creates a new state root task with the unified message channel
pub fn new(config: StateRootConfig<Factory>, blinded_provider: BPF) -> Self {
Expand Down Expand Up @@ -635,7 +638,11 @@ mod tests {
providers::ConsistentDbView, test_utils::create_test_provider_factory, HashingWriter,
};
use reth_testing_utils::generators::{self, Rng};
use reth_trie::{test_utils::state_root, TrieInput};
use reth_trie::{
hashed_cursor::HashedPostStateCursorFactory, proof::ProofBlindedProviderFactory,
test_utils::state_root, trie_cursor::InMemoryTrieCursorFactory, TrieInput,
};
use reth_trie_db::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory};
use revm_primitives::{
Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState, EvmStorageSlot,
HashMap, B256, KECCAK_EMPTY, U256,
Expand Down Expand Up @@ -752,7 +759,21 @@ mod tests {
consistent_view: ConsistentDbView::new(factory, None),
input: Arc::new(TrieInput::from_state(hashed_state)),
};
let task = StateRootTask::new(config);
let provider = config.consistent_view.provider_ro().unwrap();
let nodes_sorted = config.input.nodes.clone().into_sorted();
let state_sorted = config.input.state.clone().into_sorted();
let blinded_provider_factory = ProofBlindedProviderFactory::new(
InMemoryTrieCursorFactory::new(
DatabaseTrieCursorFactory::new(provider.tx_ref()),
&nodes_sorted,
),
HashedPostStateCursorFactory::new(
DatabaseHashedCursorFactory::new(provider.tx_ref()),
&state_sorted,
),
Arc::new(config.input.prefix_sets.clone()),
);
let task = StateRootTask::new(config, blinded_provider_factory);
let mut state_hook = task.state_hook();
let handle = task.spawn();

Expand Down
4 changes: 2 additions & 2 deletions crates/trie/sparse/src/blinded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use reth_execution_errors::SparseTrieError;
use reth_trie_common::Nibbles;

/// Factory for instantiating blinded node providers.
pub trait BlindedProviderFactory: Send + Sync {
pub trait BlindedProviderFactory {
/// Type capable of fetching blinded account nodes.
type AccountNodeProvider: BlindedProvider;
/// Type capable of fetching blinded storage nodes.
Expand All @@ -19,7 +19,7 @@ pub trait BlindedProviderFactory: Send + Sync {
}

/// Trie node provider for retrieving blinded nodes.
pub trait BlindedProvider: Send + Sync {
pub trait BlindedProvider {
/// The error type for the provider.
type Error: Into<SparseTrieError>;

Expand Down

0 comments on commit 146e86d

Please sign in to comment.