feat: Add L2CM implementation#19111
Merged
maurelian merged 16 commits intoethereum-optimism:developfrom Feb 25, 2026
Merged
Conversation
* feat: add initial iteration of L2ContractsManager * feat: add network configuration structs * feat: load full config for L2ContractsManager * feat: implement L2CM::_apply * feat: add gas price oracle * refactor: move L2CM types to library * fix: upgrade ProxyAdmin predeploy * chore: enforce delegatecall for L2CM::upgrade * feat: add conditional upgrade for CGT * refactor: remove non-proxied predeploys * chore: renamed l2cm
maurelian
reviewed
Feb 6, 2026
* refactor: rename _fullConfig to _loadFullConfig to match OPCM v2 * chore: remove non-proxied weth from implementations struct * test: add config preservation test * test: add CGT specific tests * refactor: avoid casting network config values to address * test: add test cases
* chore: remove unnecesary casting on L2CM * feat: add interface for XForkL2ContractsManager * chore: add natspec to XForkL2ContractsManager * chore: pr ready
0xniha
reviewed
Feb 9, 2026
0xOneTony
reviewed
Feb 10, 2026
packages/contracts-bedrock/interfaces/L2/IXForkL2ContractsManager.sol
Outdated
Show resolved
Hide resolved
* chore: add comment clarifying use `useCustomGasToken` * chore: upgrade both native native asset liquidity and liquidity controller predeploys together * feat: prohibit downgrading predeploy implementations * refactor: make isCustomGasToken part of the network full config * fix: add missing import * fix: use FeeVault legacy getters for backward compat * chore: update name XForkL2ContractsManager to L2ContractsManager
…d in a given chain (#857)
maurelian
reviewed
Feb 12, 2026
0xniha
reviewed
Feb 12, 2026
0xniha
reviewed
Feb 12, 2026
* chore: add todo tracking removal of L2ProxyAdmin skips * chore: add natspec comment for isPredeployNamespace * chore: use vm.prank(address,bool) to prank a delegatecall * chore: add todo for dev flags for CrossL2Inbox and L2ToL2CrossDomainMessenger * feat: allow immutables for L2CM in semgrep rules * chore: pr ready
* test: add coverage test for predeploy upgrades * chore: update test natspec
0xniha
reviewed
Feb 18, 2026
0xniha
reviewed
Feb 18, 2026
0xniha
reviewed
Feb 18, 2026
packages/contracts-bedrock/src/libraries/L2ContractsManagerTypes.sol
Outdated
Show resolved
Hide resolved
0xniha
reviewed
Feb 18, 2026
maurelian
reviewed
Feb 18, 2026
maurelian
reviewed
Feb 18, 2026
* refactor: move helper function into Predeploys.s.sol * fix: add conditional deployer to L2CM * chore: update to l1block and l1blockCGT * test: fixes issue where OptimismSuperchainERC20 tests fail due to profile ambiguity * chore: just pr ready
maurelian
reviewed
Feb 19, 2026
packages/contracts-bedrock/test/L2/OptimismSuperchainERC20.t.sol
Outdated
Show resolved
Hide resolved
maurelian
reviewed
Feb 19, 2026
packages/contracts-bedrock/src/libraries/L2ContractsManagerUtils.sol
Outdated
Show resolved
Hide resolved
maurelian
reviewed
Feb 20, 2026
maurelian
reviewed
Feb 20, 2026
maurelian
reviewed
Feb 20, 2026
* fix: move code length check out of isUpgradeable * chore: inline fullCofig_.isCustomGasToken initialization * chore: add public getters for the implementations on the L2CM * chore: remove XForkL2ContractsManager sol rule exclusion * test: add downgrade prevention test suite * chore: just pr ready * refactor: check for address 0 instead code length * Revert "refactor: check for address 0 instead code length" This reverts commit 1fa8694. * chore: remove non-needed check
2 tasks
maurelian
reviewed
Feb 20, 2026
* refactor: remove individual getters in favor of a unified one * test: add test for getImplementations
maurelian
approved these changes
Feb 24, 2026
JosepBove
approved these changes
Feb 25, 2026
Contributor
|
/ci authorize ed617ef |
Merged
via the queue into
ethereum-optimism:develop
with commit Feb 25, 2026
a7369cf
225 of 226 checks passed
This was referenced Feb 25, 2026
Inphi
added a commit
that referenced
this pull request
Feb 25, 2026
The L2CM PR (#19111) added new functions to Predeploys.sol which changed the init code hashes of all L2 contracts that import it, but only added the new L2ContractsManager entry without regenerating the existing hashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inphi
added a commit
that referenced
this pull request
Feb 25, 2026
The L2CM PR (#19111) added new functions to Predeploys.sol which changed the init code hashes of all L2 contracts that import it, but only added the new L2ContractsManager entry without regenerating the existing hashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mds1
added a commit
that referenced
this pull request
Feb 26, 2026
…piler profile ambiguity When `additional_compiler_profiles` is configured in foundry.toml, contracts pulled into the dispute profile's compilation graph get compiled with both default (999999 optimizer runs) and dispute (5000 runs) profiles. PR #19111 added L2ProxyAdmin extending ProxyAdmin, which pulled ProxyAdmin (and transitively OptimismMintableERC20Factory) into the dispute profile graph. On CI (Linux), `vm.getCode("ProxyAdmin")` non-deterministically resolves to the dispute profile artifact (6149 bytes creation code), while VerifyOPCM reads the default profile artifact from disk (6751 bytes). This mismatch causes VerifyOPCM_Failed() across all chains and feature flags on CI, while passing locally on macOS where the resolution order differs. The fix adds `DeployUtils.getCode()` which constructs explicit artifact file paths (`forge-artifacts/<Name>.sol/<Name>.json`) to always resolve the default profile. All `vm.getCode()` callsites in scripts and tests are migrated to use this helper. A semgrep rule enforces this going forward. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mds1
added a commit
that referenced
this pull request
Feb 26, 2026
…piler profile ambiguity When `additional_compiler_profiles` is configured in foundry.toml, contracts pulled into the dispute profile's compilation graph get compiled with both default (999999 optimizer runs) and dispute (5000 runs) profiles. PR #19111 added L2ProxyAdmin extending ProxyAdmin, which pulled ProxyAdmin (and transitively OptimismMintableERC20Factory) into the dispute profile graph. On CI (Linux), `vm.getCode("ProxyAdmin")` non-deterministically resolves to the dispute profile artifact (6149 bytes creation code), while VerifyOPCM reads the default profile artifact from disk (6751 bytes). This mismatch causes VerifyOPCM_Failed() across all chains and feature flags on CI, while passing locally on macOS where the resolution order differs. The fix adds `DeployUtils.getCode()` which constructs explicit artifact file paths (`forge-artifacts/<Name>.sol/<Name>.json`) to always resolve the default profile. All `vm.getCode()` callsites in scripts and tests are migrated to use this helper. A semgrep rule enforces this going forward. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 27, 2026
* fix(contracts-bedrock): resolve VerifyOPCM bytecode mismatch from compiler profile ambiguity When `additional_compiler_profiles` is configured in foundry.toml, contracts pulled into the dispute profile's compilation graph get compiled with both default (999999 optimizer runs) and dispute (5000 runs) profiles. PR #19111 added L2ProxyAdmin extending ProxyAdmin, which pulled ProxyAdmin (and transitively OptimismMintableERC20Factory) into the dispute profile graph. On CI (Linux), `vm.getCode("ProxyAdmin")` non-deterministically resolves to the dispute profile artifact (6149 bytes creation code), while VerifyOPCM reads the default profile artifact from disk (6751 bytes). This mismatch causes VerifyOPCM_Failed() across all chains and feature flags on CI, while passing locally on macOS where the resolution order differs. The fix adds `DeployUtils.getCode()` which constructs explicit artifact file paths (`forge-artifacts/<Name>.sol/<Name>.json`) to always resolve the default profile. All `vm.getCode()` callsites in scripts and tests are migrated to use this helper. A semgrep rule enforces this going forward. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(contracts-bedrock): add try/catch fallback and cicoverage gas test fix Add try/catch fallback to DeployUtils.getCode() so the Go script host (which doesn't support explicit artifact paths) gracefully falls back to vm.getCode(_name). Also add "/" passthrough for callers passing explicit paths. Fix L1ChugSplashProxy OOG gas test: under cicoverage, the now-correct default-profile proxy bytecode is larger, leaving insufficient retained gas (1/64 rule) for the require message. Use generic vm.expectRevert() for unoptimized profiles — the test still verifies the revert occurs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(contracts-bedrock): fix semgrep findings in DeployUtils and L1ChugSplashProxy Rename try/catch return variable to `code_` (trailing underscore convention) and add L1ChugSplashProxy.t.sol to expectrevert-no-args exclusion list since the bare vm.expectRevert() is intentional (OOG produces no revert data). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(contracts-bedrock): skip explicit artifact path under coverage Under coverage profiles, forge-artifacts/ contains the default profile's (optimized) artifacts, not the coverage profile's. Since coverage profiles have no additional_compiler_profiles, there is no profile ambiguity, so plain vm.getCode() resolves correctly. Skip the explicit artifact path under vm.isContext(Coverage) to avoid bytecode mismatches between artifact- loaded code and fresh compilation in tests (DeployFeesDepositor, DeployMIPS). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(contracts-bedrock): wrap isContext in try/catch for Go host compat The Go script host doesn't implement vm.isContext(), causing a revert that propagates up as an unrecognized selector error. Wrap the coverage detection in try/catch so the Go host silently falls through to the artifact-path resolution (which itself falls back to vm.getCode). Also adds a comment explaining why the catch block is intentionally empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Adds the L2ContractsManager contract that handles upgrades of L2 predeploys via DELEGATECALL from ProxyAdmin. It's based on the L2ContractsManager specs here.
Note: Feature flag handling beyond Custom Gas Token is deferred to future work.
Reference Issue: #18830