diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 5218603..6e40854 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -151,7 +151,7 @@ async fn main() -> Result<(), Box> { continue; } - let agent = SignerStore::new_random(signers_per_block, &rand_seed); + let agent = SignerStore::new_random(signers_per_block, &rand_seed, &from_pool); all_signers.extend_from_slice(&agent.signers); agents.add_agent(from_pool, agent); } diff --git a/crates/core/src/agent_controller.rs b/crates/core/src/agent_controller.rs index 82c235e..e5ee981 100644 --- a/crates/core/src/agent_controller.rs +++ b/crates/core/src/agent_controller.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use alloy::{ - primitives::{Address, FixedBytes}, + primitives::{Address, FixedBytes, U256}, signers::local::PrivateKeySigner, }; @@ -50,7 +50,7 @@ impl AgentStore { num_signers: usize, rand_seeder: &RandSeed, ) { - let signers = SignerStore::new_random(num_signers, rand_seeder); + let signers = SignerStore::new_random(num_signers, rand_seeder, name.as_ref()); self.add_agent(name, signers); } @@ -91,7 +91,12 @@ impl SignerStore { } } - pub fn new_random(num_signers: usize, rand_seeder: &RandSeed) -> Self { + pub fn new_random(num_signers: usize, rand_seeder: &RandSeed, acct_seed: &str) -> Self { + // add numerical value of acct_seed to given seed + let new_seed = rand_seeder.as_u256() + U256::from_be_slice(acct_seed.as_bytes()); + let rand_seeder = RandSeed::from_u256(new_seed); + + // generate random private keys with new seed let prv_keys = rand_seeder .seed_values(num_signers, None, None) .map(|sv| sv.as_bytes().to_vec()) diff --git a/crates/core/src/generator/mod.rs b/crates/core/src/generator/mod.rs index f641bcb..2cad532 100644 --- a/crates/core/src/generator/mod.rs +++ b/crates/core/src/generator/mod.rs @@ -271,7 +271,7 @@ where } for i in 0..(num_txs / num_steps) { - for (j, step) in spam_steps.iter().enumerate() { + for step in spam_steps.iter() { // converts a FunctionCallDefinition to a NamedTxRequest (filling in fuzzable args), // returns a callback handle and the processed tx request let process_tx = |req| { @@ -286,7 +286,7 @@ where let tx = NamedTxRequest::new( templater.template_function_call( - &self.make_strict_call(&req, j)?, // 'from' address injected here + &self.make_strict_call(&req, i)?, // 'from' address injected here &placeholder_map, )?, None, diff --git a/crates/core/src/spammer/blockwise.rs b/crates/core/src/spammer/blockwise.rs index 50e3d6f..bdb3385 100644 --- a/crates/core/src/spammer/blockwise.rs +++ b/crates/core/src/spammer/blockwise.rs @@ -26,7 +26,7 @@ use super::tx_actor::TxActorHandle; use super::OnTxSent; /// Defines the number of blocks to target with a single bundle. -const BUNDLE_BLOCK_TOLERANCE: usize = 5; +const BUNDLE_BLOCK_TOLERANCE: usize = 4; pub struct BlockwiseSpammer where @@ -249,6 +249,7 @@ where .await .map_err(|e| ContenderError::with_err(e, "failed to prepare tx"))?; + println!("bundle tx from {:?}", tx_req.from); // sign tx let tx_envelope = tx_req.build(&signer).await.map_err(|e| { ContenderError::with_err(e, "bad request: failed to build tx") diff --git a/scenarios/spamMe.toml b/scenarios/spamMe.toml index d35bb49..53168b2 100644 --- a/scenarios/spamMe.toml +++ b/scenarios/spamMe.toml @@ -16,7 +16,7 @@ signature = "transfer()" [[spam.tx.fuzz]] value = true min = "10000000000000" -max = "1000000000000000" +max = "100000000000000" # spam bundle @@ -33,4 +33,4 @@ fuzz = [{ param = "gasAmount", min = "100000", max = "500000" }] to = "{SpamMe}" from_pool = "bluepool" signature = "tipCoinbase()" -value = "10000000000000000" \ No newline at end of file +value = "10000000000000000"