Skip to content

Commit

Permalink
add a way to generate random balances in MockTransactionSimulator (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Jan 30, 2024
1 parent 677c0a0 commit 11f50f8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crates/transaction-pool/src/test_utils/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<R: Rng> MockTransactionSimulator<R> {
let senders = config.addresses(&mut rng);
Self {
base_fee: config.base_fee,
balances: senders.iter().copied().map(|a| (a, config.balance)).collect(),
balances: senders.iter().copied().map(|a| (a, rng.gen())).collect(),
nonces: senders.iter().copied().map(|a| (a, 0)).collect(),
senders,
scenarios: config.scenarios,
Expand Down Expand Up @@ -151,8 +151,6 @@ impl<R: Rng> MockTransactionSimulator<R> {
pub(crate) struct MockSimulatorConfig {
/// How many senders to generate.
pub(crate) num_senders: usize,
// TODO(mattsse): add a way to generate different balances
pub(crate) balance: U256,
/// Scenarios to test
pub(crate) scenarios: Vec<ScenarioType>,
/// The start base fee
Expand Down Expand Up @@ -214,7 +212,6 @@ pub(crate) struct ExecutedScenarios {
fn test_on_chain_nonce_scenario() {
let config = MockSimulatorConfig {
num_senders: 10,
balance: U256::from(200_000u64),
scenarios: vec![ScenarioType::OnchainNonce],
base_fee: 10,
tx_generator: MockTransactionDistribution::new(30, 10..100),
Expand Down

0 comments on commit 11f50f8

Please sign in to comment.