Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

fix: sync gas_params when changing spec in all EVM paths#400

Open
decofe wants to merge 1 commit into
tempofrom
dani/fix-tempo-gas-params-sync
Open

fix: sync gas_params when changing spec in all EVM paths#400
decofe wants to merge 1 commit into
tempofrom
dani/fix-tempo-gas-params-sync

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 9, 2026

Port of foundry-rs/foundry#14210. CfgEnv::set_spec() only updates the spec discriminant without updating the gas_params table, causing incorrect gas pricing when executing with a non-default hardfork.

For Tempo this is worse than upstream because we have custom gas overrides via tempo_gas_params() (TIP-1000 sstore/create costs). Using set_spec_and_mainnet_gas_params() would set mainnet gas params, not Tempo's.

Adds TempoCfgEnvExt trait with set_tempo_spec() and sync_tempo_gas_params() that atomically update both spec and gas_params. Replaces all bare .spec = X assignments in:

  • Env::default_with_spec_id / new_with_spec_id
  • ExecutorBuilder::build
  • Executor::set_spec_id / set_hardfork / clone_with_backend / build_test_env
  • Cheatcode inspector execution_evm_version (call + create)
  • CowBackend::backend_mut
  • EitherEvm Tempo variant (finish / into_env — was using with_spec_and_mainnet_gas_params which dropped Tempo gas overrides)
  • Anvil config setup + Tempo EVM construction

Prompted by: DaniPopes

Port of foundry-rs/foundry#14210. CfgEnv::set_spec() only updates the
spec discriminant without updating the gas_params table. For Tempo, we
also need to apply custom gas overrides via tempo_gas_params().

Adds TempoCfgEnvExt trait with set_tempo_spec() that updates both spec
and gas_params atomically. Fixes all bare .spec = X assignments in
executor builder, cheatcodes, CowBackend, EitherEvm, and Anvil config.

Co-Authored-By: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d7086-5292-723a-802b-584496baa54e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants