Skip to content

Commit

Permalink
use reth_testing_utils::generators
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Nov 20, 2024
1 parent 78e2a0e commit fde920f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 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/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -467,16 +467,14 @@ mod tests {
}

fn create_mock_state_updates(num_accounts: usize, updates_per_account: usize) -> Vec<EvmState> {
let mut rng = rand::thread_rng();
let mut all_addresses: Vec<Address> =
(0..num_accounts).map(|_| Address::random()).collect();
let mut rng = generators::rng();
let all_addresses: Vec<Address> = (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 {
Expand Down

0 comments on commit fde920f

Please sign in to comment.