Skip to content

feat: resolve evm_version per chain and detect PUSH0 support automatically - #21

Merged
SyedAsadKazmi merged 1 commit into
mainfrom
feat/change-evm-version
Jul 31, 2026
Merged

feat: resolve evm_version per chain and detect PUSH0 support automatically#21
SyedAsadKazmi merged 1 commit into
mainfrom
feat/change-evm-version

Conversation

@aelmanaa

Copy link
Copy Markdown
Contributor

This pull request introduces per-chain EVM version support to the deployment and configuration workflow, ensuring that all forge script invocations use the correct EVM version for each chain. This is especially important for chains that do not support newer opcodes (such as PUSH0). The implementation adds a mechanism to detect, declare, and forward the appropriate --evm-version flag for each chain, defaulting to the repository-wide setting when not specified. It also updates documentation to reflect these changes and clarifies the new configuration schema.

Makefile and Deployment Workflow Enhancements:

  • Added evm-version and evm-version-flag macros to the Makefile for per-chain EVM version resolution, using a new shell script to detect the required version and forwarding it to all relevant forge script invocations.
  • Updated all deployment, synchronization, lane management, and token adoption targets in the Makefile to forward the correct --evm-version flag, ensuring compatibility with each chain’s requirements. [1] [2] [3] [4] [5] [6] [7] [8]

Documentation and Schema Updates:

  • Updated README.md, docs/config-architecture.md, and docs/config-schema.md to document the new per-chain evmVersion field, its purpose, and how it is set or detected. This includes schema tables, field descriptions, and example config files. [1] [2] [3] [4] [5] [6]

These changes make the deployment process more robust and future-proof by ensuring that bytecode is always compiled and simulated with the correct EVM version for each target chain.

@aelmanaa
aelmanaa requested review from a team as code owners July 31, 2026 07:26
@github-actions

Copy link
Copy Markdown

👋 aelmanaa, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

…cally

Target shanghai by default and pin an older EVM only where a chain needs it,
instead of holding the whole repo back to paris.

The setting does double duty in Foundry: it is the compile target AND the
version of the local EVM that forge scripts execute in. Pinned to paris, a
script cannot run any contract built with a current toolchain, so operations
against an operator-supplied token fail before a transaction is signed, and the
failure is easy to misread as a fault in that token. Reading decimals() off a
healthy BYO token is the costly case, because the value that gets substituted
when the read fails decides the deployed pool's decimals.

A few chains have not activated PUSH0, and bytecode compiled for shanghai is
undeployable there, so the pin cannot simply be raised. config/chains/<name>.json
gains an optional evmVersion key and every chain-scoped target forwards it as
--evm-version. add-chain probes the chain and records the pin only when the
chain rejects PUSH0, so the value is measured rather than maintained by hand;
detect-evm-version re-checks a chain already in the repo. The probe is eth_call
with initcode, needing no funds or keys.

The probe refuses rather than guesses, because a pin it writes is permanent and
valid enough to pass review. It records one only when the node reports an
invalid opcode: a timeout or a rate limit is not a rejection, and pinning on
absence of success would return a chain to the compile target this mechanism
exists to move it off. It asserts eth_chainId before trusting an endpoint, since
public RPC directories carry chainId collisions, and it refuses when it cannot
identify the endpoint at all. Missing tools and unparseable config are separated
from "this chain needs nothing", so neither can exit as a silent success.

The resolver reads its default from forge config so it cannot drift from
foundry.toml, and validates a declared value: broadcasting targets abort on an
unrecognised one or an unreadable config, while read-only paths fall back and
report it, so a typo can never quietly deploy bytecode built for the wrong EVM.

ignored_error_codes now lists code-size and init-code-size explicitly alongside
too-many-warnings, because setting the key replaces Foundry's defaults rather
than extending them, and shanghai adds enough EIP-3860 warnings to cross solc's
256-warning cap.

Chains that support PUSH0 need no key and their configs are untouched. Contracts
deployed after this change carry PUSH0, so their bytecode differs from before.
@aelmanaa
aelmanaa force-pushed the feat/change-evm-version branch from ceac88c to a31c3da Compare July 31, 2026 12:00
@aelmanaa
aelmanaa requested a review from SyedAsadKazmi July 31, 2026 12:05
@SyedAsadKazmi
SyedAsadKazmi merged commit ae86d3b into main Jul 31, 2026
12 checks passed
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.

2 participants