Skip to content

feat: add 10 advanced scenarios from mainnet gas analysis#476

Open
vbuilder69420 wants to merge 2 commits intoflashbots:mainfrom
vbuilder69420:feat/advanced-scenarios
Open

feat: add 10 advanced scenarios from mainnet gas analysis#476
vbuilder69420 wants to merge 2 commits intoflashbots:mainfrom
vbuilder69420:feat/advanced-scenarios

Conversation

@vbuilder69420
Copy link

Summary

Wave 2 of scenario expansion, informed by analyzing Ethereum mainnet block composition, top gas consumers (Etherscan/Dune), and emerging EVM patterns.

Builds on top of #475 (14 basic scenarios + campaign).

New scenarios

Scenario Category Unique Gas Pattern Mainnet Relevance
erc4337.toml Account Abstraction Two-loop validate→execute, deposit accounting ~2% gas, fastest growing
flashLoan.toml Flash Loans 5-level deep atomic callback (lender→borrower→pool→pool→repay) Core MEV primitive
bondingCurve.toml Token Launch Math-heavy pricing + CREATE2 factory deployment as spam Pump.fun pattern
merkleAirdrop.toml Airdrops keccak256-heavy proof verification + packed claimed bitmap Causes gas spikes
create2Factory.toml Contract Creation CREATE2 + ERC-1167 minimal proxy clones Wallet/protocol factories
multicall3.toml Batching 5-50 heterogeneous calls per tx, memory expansion Used by every major protocol
weth.toml WETH payable + msg.value + ERC20 mint Top 5 mainnet contract
stableSwap.toml Curve AMM Newton's method iteration (up to 255 rounds/swap) ~1.5% mainnet gas
mevSandwich.toml MEV [[spam.bundle.tx]] frontrun→victim→backrun >1 per block on mainnet
diamondProxy.toml Proxy Pattern delegatecall dispatch + facet selector routing Used by major protocols

What's different from wave 1

These scenarios exercise fundamentally different EVM codepaths:

  • Iterative computation (StableSwap Newton's method) vs simple arithmetic
  • Deep call stacks (flash loan 5-level callbacks) vs single-contract calls
  • Contract creation as spam (CREATE2 factory) vs function calls on existing contracts
  • Atomic MEV bundles (sandwich) vs independent transactions
  • Two-pass execution (ERC-4337 validate then execute) vs single-pass

Test plan

  • Each scenario parses correctly (contender setup scenario:<name>.toml)
  • Each scenario deploys + spams against local Anvil at low TPS
  • Bundle scenarios (mevSandwich) test bundle submission path
  • No regressions in existing scenarios or wave 1 scenarios

🤖 Generated with Claude Code

vbuilder69420 and others added 2 commits March 21, 2026 22:33
Add scenario TOML files covering a broad range of EVM gas patterns
and real-world DeFi/infrastructure interactions:

- erc721: NFT mint and transfer
- erc1155: multi-token mint, transfer, and batch transfer
- erc4626vault: vault deposit/withdraw with share accounting
- governance: proposal creation and voting
- lending: collateral deposit, borrow, and repay
- simpleAMM: constant-product swaps with 0.3% fee
- stablecoin: ETH-backed mint/burn/flash mint
- nameRegistry: ENS-like name registration and renewal
- multisig: multi-sig submit/confirm/execute
- staking: stake/unstake/claim/compound rewards
- precompiles/hashPrecompiles: SHA256, RIPEMD160, Identity stress
- bridge: L1→L2 deposit simulation (ETH + ERC20)
- dutchAuction: time-based pricing with ETH refunds
- orderBook: on-chain limit orders with partial fills

Also adds campaigns/full-spectrum.toml: a 4-stage campaign
(warmup → DeFi ramp → full load → cooldown) that mixes all
new scenarios for comprehensive chain stress testing.

All contracts are self-contained Solidity 0.8.26, compiled with
solc --optimize --optimize-runs 200. Each scenario includes
deploy, setup (liquidity/approvals/funding), and fuzzed spam.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Research-driven wave 2: analyzed top gas consumers, block composition,
and novel EVM patterns on Ethereum mainnet to identify the highest-
impact scenarios missing from contender.

New scenarios:

- erc4337: Account Abstraction EntryPoint with two-loop
  validate→execute pattern, deposit accounting, UserOp helper
- flashLoan: ERC-3156 flash loan with 5-level deep arbitrage
  callback (lender→borrower→poolA→poolB→repay)
- bondingCurve: Pump.fun-style token launchpad with linear
  bonding curve math + CREATE2 factory deployment as spam
- merkleAirdrop: keccak256-heavy proof verification with
  packed claimed bitmap (256 claims per storage slot)
- create2Factory: ERC-1167 minimal proxy clones via CREATE2
  (contract creation as the hot path, not function calls)
- multicall3: Batched heterogeneous calls (5-50 per tx),
  testing memory expansion and loop overhead
- weth: WETH9 wrap/unwrap — one of highest-volume mainnet
  contracts, covers payable+msg.value+ERC20 mint pattern
- stableSwap: Curve-style StableSwap AMM with Newton's method
  iteration (up to 255 rounds per swap) — fundamentally
  different gas profile from constant-product AMMs
- mevSandwich: MEV sandwich bundles using [[spam.bundle.tx]]
  with frontrun→victim→backrun atomic ordering
- diamondProxy: EIP-2535 Diamond with delegatecall dispatch
  routing through CounterFacet, TokenFacet, StorageFacet

All contracts self-contained Solidity 0.8.26, compiled with
solc --optimize --optimize-runs 200.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant