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
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of foundry-rs/foundry#14210.
CfgEnv::set_spec()only updates the spec discriminant without updating thegas_paramstable, 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). Usingset_spec_and_mainnet_gas_params()would set mainnet gas params, not Tempo's.Adds
TempoCfgEnvExttrait withset_tempo_spec()andsync_tempo_gas_params()that atomically update bothspecandgas_params. Replaces all bare.spec = Xassignments in:Env::default_with_spec_id/new_with_spec_idExecutorBuilder::buildExecutor::set_spec_id/set_hardfork/clone_with_backend/build_test_envexecution_evm_version(call + create)CowBackend::backend_mutEitherEvmTempo variant (finish/into_env— was usingwith_spec_and_mainnet_gas_paramswhich dropped Tempo gas overrides)Prompted by: DaniPopes