Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way to generate random balances in MockTransactionSimulator #6279

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading