Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions monad-eth-testutil/examples/txgen/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ pub enum CliGenMode {
tx_type: TxType,
},
HighCallData,
HighCallDataLowGasLimit,
SelfDestructs,
NonDeterministicStorage,
StorageDeletes,
Expand All @@ -218,7 +217,6 @@ impl From<CliGenMode> for GenMode {
GenMode::RandomPriorityFee(RandomPriorityFeeConfig { tx_type })
}
CliGenMode::HighCallData => GenMode::HighCallData,
CliGenMode::HighCallDataLowGasLimit => GenMode::HighCallDataLowGasLimit,
CliGenMode::SelfDestructs => GenMode::SelfDestructs,
CliGenMode::NonDeterministicStorage => GenMode::NonDeterministicStorage,
CliGenMode::StorageDeletes => GenMode::StorageDeletes,
Expand Down
7 changes: 1 addition & 6 deletions monad-eth-testutil/examples/txgen/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ impl TrafficGen {
GenMode::NullGen => 0,
GenMode::ECMul => 10,
GenMode::Uniswap => 10,
GenMode::HighCallDataLowGasLimit => 30,
GenMode::ReserveBalance => 1,
GenMode::ReserveBalanceFail(..) => 1,
GenMode::SystemSpam(..) => 500,
Expand All @@ -181,7 +180,6 @@ impl TrafficGen {
GenMode::SelfDestructs => 10,
GenMode::HighCallData => 10,
GenMode::ECMul => 10,
GenMode::HighCallDataLowGasLimit => 3,
GenMode::Uniswap => 20,
GenMode::ReserveBalance => 100,
GenMode::ReserveBalanceFail(..) => 100,
Expand All @@ -208,7 +206,6 @@ impl TrafficGen {
GenMode::NullGen => 100,
GenMode::SelfDestructs => 100,
GenMode::HighCallData => 100,
GenMode::HighCallDataLowGasLimit => 100,
GenMode::ECMul => 100,
GenMode::Uniswap => 200,
GenMode::ReserveBalance => 2500,
Expand Down Expand Up @@ -238,8 +235,7 @@ impl TrafficGen {
TxType::ERC20 => ERC20,
TxType::Native => None,
},
GenMode::HighCallData => None,
GenMode::HighCallDataLowGasLimit => None,
GenMode::HighCallData => ERC20,
GenMode::SelfDestructs => None,
GenMode::NonDeterministicStorage => ERC20,
GenMode::StorageDeletes => ERC20,
Expand Down Expand Up @@ -423,7 +419,6 @@ pub enum GenMode {
EIP7702Create(EIP7702CreateConfig),
RandomPriorityFee(RandomPriorityFeeConfig),
HighCallData,
HighCallDataLowGasLimit,
SelfDestructs,
NonDeterministicStorage,
StorageDeletes,
Expand Down
44 changes: 35 additions & 9 deletions monad-eth-testutil/examples/txgen/generators/high_call_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{prelude::*, shared::erc20::ERC20};
pub struct HighCallDataTxGenerator {
pub(crate) recipient_keys: KeyPool,
pub(crate) tx_per_sender: usize,
pub(crate) gas_limit: u64,
pub erc20: Option<ERC20>,
}

impl Generator for HighCallDataTxGenerator {
Expand All @@ -33,15 +33,13 @@ impl Generator for HighCallDataTxGenerator {
for _ in 0..self.tx_per_sender {
let to = self.recipient_keys.next_addr();

let tx = ERC20::deploy_tx_with_gas_limit_and_priority(
sender.nonce,
&sender.key,
ctx.base_fee * 2,
ctx.chain_id,
ctx.set_tx_gas_limit.unwrap_or(self.gas_limit), // use CLI override or generator default
ctx.priority_fee.unwrap_or(10), // 10 default, override with --priority-fee
let tx = high_calldata_erc20_call(
sender,
self.erc20
.as_ref()
.expect("No ERC20 contract found, but tx_type is erc20"),
ctx,
);
sender.nonce += 1;

txs.push((tx, to));
}
Expand All @@ -50,3 +48,31 @@ impl Generator for HighCallDataTxGenerator {
txs
}
}

pub fn high_calldata_erc20_call(
from: &mut SimpleAccount,
erc20: &ERC20,
ctx: &GenCtx,
) -> TxEnvelope {
let max_fee_per_gas = ctx.base_fee * 2;
let input = vec![0u8; 1 << 15];
let tx = crate::shared::erc20::make_tx(
from.nonce,
&from.key,
erc20.addr,
U256::ZERO,
input,
max_fee_per_gas,
ctx.chain_id,
ctx.set_tx_gas_limit,
ctx.priority_fee,
);

// update from
from.nonce += 1;
from.native_bal = from
.native_bal
.checked_sub(U256::from(400_000 * max_fee_per_gas))
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 400_000 for gas estimation is hardcoded. Consider defining this as a named constant (e.g., ESTIMATED_GAS_USAGE) to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.
.unwrap_or(U256::ZERO); // todo: wire gas correctly, see above comment
tx
}
7 changes: 1 addition & 6 deletions monad-eth-testutil/examples/txgen/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ pub fn make_generator(
GenMode::HighCallData => Box::new(HighCallDataTxGenerator {
recipient_keys,
tx_per_sender,
gas_limit: 800_000,
}),
GenMode::HighCallDataLowGasLimit => Box::new(HighCallDataTxGenerator {
recipient_keys,
tx_per_sender,
gas_limit: 100_000,
erc20: deployed_contract.erc20().ok(),
}),
GenMode::NonDeterministicStorage => Box::new(NonDeterministicStorageTxGenerator {
recipient_keys,
Expand Down
2 changes: 1 addition & 1 deletion monad-eth-testutil/examples/txgen/shared/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl ERC20 {
}
}

fn make_tx(
pub fn make_tx(
nonce: u64,
signer: &PrivateKey,
contract_or_to: Address,
Expand Down
Loading