diff --git a/Cargo.lock b/Cargo.lock index aa1ce40de9c5..cc11957bf7ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7266,6 +7266,7 @@ dependencies = [ "reth-stages-api", "reth-static-file", "reth-tasks", + "reth-testing-utils", "reth-tracing", "reth-trie", "reth-trie-db", diff --git a/crates/engine/tree/Cargo.toml b/crates/engine/tree/Cargo.toml index 73fd3efe54fd..2c80fbe5287d 100644 --- a/crates/engine/tree/Cargo.toml +++ b/crates/engine/tree/Cargo.toml @@ -78,6 +78,7 @@ reth-prune-types.workspace = true reth-rpc-types-compat.workspace = true reth-stages = { workspace = true, features = ["test-utils"] } reth-static-file.workspace = true +reth-testing-utils.workspace = true reth-tracing.workspace = true reth-chainspec.workspace = true diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index d6b386e5310e..35ef6fee2bda 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -442,11 +442,11 @@ where #[cfg(test)] mod tests { use super::*; - use rand::{prelude::SliceRandom, Rng}; use reth_primitives::{Account as RethAccount, StorageEntry}; use reth_provider::{ 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 revm_primitives::{ Account as RevmAccount, AccountInfo, AccountStatus, Address, EvmState, EvmStorageSlot, @@ -467,16 +467,14 @@ mod tests { } fn create_mock_state_updates(num_accounts: usize, updates_per_account: usize) -> Vec { - let mut rng = rand::thread_rng(); - let mut all_addresses: Vec
= - (0..num_accounts).map(|_| Address::random()).collect(); + let mut rng = generators::rng(); + let all_addresses: Vec
= (0..num_accounts).map(|_| rng.gen()).collect(); let mut updates = Vec::new(); for _ in 0..updates_per_account { let num_accounts_in_update = rng.gen_range(1..=num_accounts); let mut state_update = EvmState::default(); - all_addresses.shuffle(&mut rng); let selected_addresses = &all_addresses[0..num_accounts_in_update]; for &address in selected_addresses {