From 0ce1a0495f9dd691fa395d25e744421764866e02 Mon Sep 17 00:00:00 2001 From: Joe Howarth Date: Mon, 6 Oct 2025 18:39:50 -0400 Subject: [PATCH] Txgen: HighCallData GenMode uses erc20 call with 2^32 bytes calldata Previously high call data txs with too low gas limit were not rejected until getting to execution, but now they are rejected at rpc. This means that we cannot fill blocks to stress proposal creation and raptor cast. This pr fixes this --- monad-eth-testutil/examples/txgen/cli.rs | 2 - monad-eth-testutil/examples/txgen/config.rs | 7 +-- .../txgen/generators/high_call_data.rs | 44 +++++++++++++++---- .../examples/txgen/generators/mod.rs | 7 +-- .../examples/txgen/shared/erc20.rs | 2 +- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/monad-eth-testutil/examples/txgen/cli.rs b/monad-eth-testutil/examples/txgen/cli.rs index d5ca2b85d4..ed50143d22 100644 --- a/monad-eth-testutil/examples/txgen/cli.rs +++ b/monad-eth-testutil/examples/txgen/cli.rs @@ -192,7 +192,6 @@ pub enum CliGenMode { tx_type: TxType, }, HighCallData, - HighCallDataLowGasLimit, SelfDestructs, NonDeterministicStorage, StorageDeletes, @@ -218,7 +217,6 @@ impl From 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, diff --git a/monad-eth-testutil/examples/txgen/config.rs b/monad-eth-testutil/examples/txgen/config.rs index 876ebf26f7..2e526f4be8 100644 --- a/monad-eth-testutil/examples/txgen/config.rs +++ b/monad-eth-testutil/examples/txgen/config.rs @@ -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, @@ -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, @@ -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, @@ -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, @@ -423,7 +419,6 @@ pub enum GenMode { EIP7702Create(EIP7702CreateConfig), RandomPriorityFee(RandomPriorityFeeConfig), HighCallData, - HighCallDataLowGasLimit, SelfDestructs, NonDeterministicStorage, StorageDeletes, diff --git a/monad-eth-testutil/examples/txgen/generators/high_call_data.rs b/monad-eth-testutil/examples/txgen/generators/high_call_data.rs index d61b665ca0..0c6f71675f 100644 --- a/monad-eth-testutil/examples/txgen/generators/high_call_data.rs +++ b/monad-eth-testutil/examples/txgen/generators/high_call_data.rs @@ -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, } impl Generator for HighCallDataTxGenerator { @@ -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)); } @@ -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)) + .unwrap_or(U256::ZERO); // todo: wire gas correctly, see above comment + tx +} diff --git a/monad-eth-testutil/examples/txgen/generators/mod.rs b/monad-eth-testutil/examples/txgen/generators/mod.rs index c9f77bc5c8..ccfc8fe3e7 100644 --- a/monad-eth-testutil/examples/txgen/generators/mod.rs +++ b/monad-eth-testutil/examples/txgen/generators/mod.rs @@ -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, diff --git a/monad-eth-testutil/examples/txgen/shared/erc20.rs b/monad-eth-testutil/examples/txgen/shared/erc20.rs index c5437132b2..7207297550 100644 --- a/monad-eth-testutil/examples/txgen/shared/erc20.rs +++ b/monad-eth-testutil/examples/txgen/shared/erc20.rs @@ -267,7 +267,7 @@ impl ERC20 { } } -fn make_tx( +pub fn make_tx( nonce: u64, signer: &PrivateKey, contract_or_to: Address,