Skip to content

[sim] Run the environment on a real L2 (cheatcode-free mode) #33

Description

@adachi-440

Motivation

A code audit shows the environment is structurally portable to a real L2 (public testnet or dedicated rollup, running our own deployed venue clones): the deployer, env contracts (PriceFeed / mock oracles / vuln factory), flow bot + relay, GMX keeper (realtime path), default-profile oracle updates, and scoring reconstruction all use standard signed txs / archive reads. What blocks a real-chain run is a small, well-localized set of anvil-only mechanisms.

Work items

(1) Funding without cheatcodesfundWallet uses anvil_setBalance (ETH) and dealErc20 (anvil_setStorageAt, stables/bases); admin/keeper funding and vuln-pool window funding are the same. Replace with real transfers from a treasury EOA — tokens are our own MockERC20s (deployer holds mint rights), so mint+transfer is mechanical.

(2) Block-production and ordering assumptions — drop setIntervalMining / evm_setAutomine (the sequencer produces blocks), but the real design question is the loss of anvil --order fees: the default profile relies on fee-priority ordering to land oracle updates at txIndex 0. On Arbitrum-style FIFO/timeboost sequencing that guarantee disappears. The economicGas profile was designed to remove this assumption but finalizes prices via storage-writes, so it is unusable on a real chain — this needs a tx-based redesign (e.g. commit oracle price for block N in a tx during N−1).

(3) Run lifecycle without resetresetFork (anvil_reset / evm_snapshot+evm_revert) has no real-chain equivalent; a run becomes fresh-deploy-per-run (ERIS_SKIP_RESET semantics).

(4) Mechanical ports — GMX vendor deploy hardcodes hardhat --network localhost + chainId 31337 (edit vendor network config, re-point deployments/<net>); drop the Aave fork-timestamp increaseTime warp (fork-skew workaround, irrelevant on a native chain); scoring requires an archive RPC for historical multicalls.

Notes

  • Target is our own closed-economy venue deployment, not real protocols — the fair-price/oracle-injection design assumes the env owns every contract.
  • economicGas=false (default) already keeps the entire per-block oracle path tx-based; keep it that way for real-chain runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsim-envSimulation environment work (core/sdk/deployer, scoring, events)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions