Skip to content

feat: OPCM v2 support on for op-deployer#701

Merged
0xOneTony merged 6 commits intosc-feat/opcm2-revert-opcmfrom
feat/opcmv2-add-feature-flag
Nov 27, 2025
Merged

feat: OPCM v2 support on for op-deployer#701
0xOneTony merged 6 commits intosc-feat/opcm2-revert-opcmfrom
feat/opcmv2-add-feature-flag

Conversation

@0xiamflux
Copy link
Copy Markdown

@0xiamflux 0xiamflux commented Nov 27, 2025

Note

Adds OPCM v2 support and conditionally routes OP Chain deployment through v1 or v2 based on a dev feature flag, updating implementations capture and validation accordingly.

  • Deployer (Go):
    • Add OPCMV2DevFlag in deployer/devfeatures.go.
    • Record OpcmV2Impl and OpcmContainerImpl in addresses.ImplementationsContracts.
    • In pipeline/opchain.go, select Opcm address (v1 vs v2) via devFeatureBitmap; add local isDevFeatureEnabled helper.
  • Contracts Script (Solidity):
    • Extend DeployOPChain.s.sol to support OPCM v2:
      • Runtime switch between IOPContractsManager (v1) and IOPContractsManagerV2 (v2).
      • Build IOPContractsManagerV2.FullConfig, including dispute game configs for CANNON, PERMISSIONED_CANNON, and CANNON_KONA.
      • Map v1/v2 deploy outputs to a common Output and update labels.
      • Adjust validations to derive expected PDG impl and superchain config from v1/v2 accordingly.

Written by Cursor Bugbot for commit 6d98af2. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 16

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread packages/contracts-bedrock/scripts/deploy/DeployOPChainV2.s.sol Outdated

config_ = IOPContractsManagerV2.FullConfig({
saltMixer: _input.saltMixer,
superchainConfig: ISuperchainConfig(_opcmV2.implementations().superchainConfigImpl),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Wrong superchainConfig address passed for OPCM v2 deployments

The code passes implementations().superchainConfigImpl (the uninitialized implementation contract) instead of the SuperchainConfig proxy. In contrast, Deploy.s.sol correctly uses artifacts.mustGetAddress("SuperchainConfigProxy"), and the v1 path uses opcm.superchainConfig(). The implementation contract has no initialized state, so when the SystemConfig is configured with this address, the pause mechanism won't function - the system won't detect when the superchain is paused because it will read from the implementation's empty storage rather than the proxy's actual state.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment on lines +107 to +114
// Select which OPCM to use based on dev feature flag
opcmAddr := st.ImplementationsDeployment.OpcmImpl
if devFeatureBitmap, ok := intent.GlobalDeployOverrides["devFeatureBitmap"].(common.Hash); ok {
opcmV2Flag := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000010000")
if isDevFeatureEnabled(devFeatureBitmap, opcmV2Flag) && st.ImplementationsDeployment.OpcmV2Impl != (common.Address{}) {
opcmAddr = st.ImplementationsDeployment.OpcmV2Impl
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this as temporary but it is probably not the way to use the feature bitmap.

config_ = IOPContractsManagerV2.FullConfig({
saltMixer: _input.saltMixer,
// TODO: Add superchain config to OPCM v2.
superchainConfig: ISuperchainConfig(address(0)),
Copy link
Copy Markdown

@0xniha 0xniha Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a DeployOPChainInput argument to populate this value (_input.superchainConfig) .
It would be consumed in the same way the DeployImplementations go script receives it from DeploySuperchain, with st.SuperchainDeployment.SuperchainConfigProxy.

/// @notice Converts IOPContractsManagerV2.ChainContracts to Output.
/// @param _chainContracts The chain contracts.
/// @return output_ The output parameters.
function fromOPCMV2OutputToOutput(IOPContractsManagerV2.ChainContracts memory _chainContracts)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the naming too much but I think it's fine for a PoC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same I agree

Comment thread packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol Outdated
Comment thread packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol Outdated
Copy link
Copy Markdown
Member

@0xOneTony 0xOneTony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@0xOneTony 0xOneTony merged commit 0e060a5 into sc-feat/opcm2-revert-opcm Nov 27, 2025
1 check passed
0xOneTony pushed a commit that referenced this pull request Dec 12, 2025
* feat: add feature flag initial

* feat: add feature flags to deploy chains using OPCM v2

* chore: remove unused function, update helper function names

* chore: remove unused DeployOPChainV2

* chore: add todo for obtaining a superchain config per deployment

* fix: remove unnecessary arg and replace function visibility

---------

Co-authored-by: niha <205694301+0xniha@users.noreply.github.com>
0xiamflux added a commit that referenced this pull request Dec 18, 2025
…ism#18399)

* feat: revert opcm v1 on public interface functions (#699)

* feat: revert opcm v1 on public interface functions

* fix: add dev flag check for OPCM v2

* feat: OPCM v2 support on for op-deployer (#701)

* feat: add feature flag initial

* feat: add feature flags to deploy chains using OPCM v2

* chore: remove unused function, update helper function names

* chore: remove unused DeployOPChainV2

* chore: add todo for obtaining a superchain config per deployment

* fix: remove unnecessary arg and replace function visibility

---------

Co-authored-by: niha <205694301+0xniha@users.noreply.github.com>

* fix: add superchainConfig input & fix tests in deployopchain (#705)

* fix: add superchainConfig input & fix tests in deployopchain

* docs: add TODOs

* feat: add opcmv2 flag to deployImplementations and apply opcmv2 deployment test

* feat: add opcmv2 flag to deployImplementations and add apply opcmv2 deployment test

* fix: hardcode flag to avoid import cycles & refactor createOPCMContractV2

* fix: remove todo comment

* fix: deploy implementations test branching

* refactor: add deployOPCMStandardValidatorV2

* fix: add test and script checks

* fix: remove cgt & fix tests (#736)

* fix: remove cgt

* fix: query chainIdToBatchInboxAddress in chain assertions script

* fix: add skip deploy ocpmv1 when v2 enabled

* refactor: remove unnecesary function

* fix: opcm semver

* chore: add todo comment with issue number (#737)

---------

Co-authored-by: IamFlux <175354924+0xiamflux@users.noreply.github.com>

* refactor: match assert pattern on OPCM v1 (#749)

* refactor: adheres OPCM v1 revert function to assert pattern

* chore: enable deny_warnings on foundry.toml

* chore: pre-pr ready

* fix: add implementations for StandardValidator when using OPCMv2

* chore: pre-pr ready (#758)

* fix: remove cgt checks for opcmv2 (#765)

* chore: opcm revert develop sync (#769)

* feat(ci): mise; cache & retries. (ethereum-optimism#18572)

* op-node: Light CL: Always Follow Source using CL (ethereum-optimism#18571)

* wiring for l2.follow.source

* Follow Safe without handling external safe > local unsafe

* safe follow

* safe follow consider unsafe gap EL Sync

* follow finalized

* Comments

* cleanup

* drop unused interface methods

* sanity check external finalized

* Adjust follow source log level

* op-devstack: Follow Source Support

* op-acceptance-tests: Follow Source

* op-devstack: Follow Source Support

* simplify labeling

* l1 reorg protection: reset

* add reorg tc

* typo

* follow source: check unsafe

* convention

* Add unsafe only reorg test

* devstack/acceptance test : rename FollowSource to FollowL2

* follow upstream source enabled when derivation disabled, reorg detection

* fix unsafe only reorg sync test comments

* rm unused interface method

* dsl

* devstack support for ext sync test + follow l2

* op-acceptance-tests: Follow L2 using Ext + SyncTester

* use blockref

* fix log msg err

* Fix composite interface naming

* op-node: Follow Source: EL / CL support

* devstack: Allow EL or CL to be follow source

* Inject CurrentL1

* logs for injecting CurrentL1

* refactor to less rpc calls

* acceptance-tests: Check CurrentL1 is advancing

* linter

* fix error args

* sanity check external values using L1

* op-node: Follow Source CL and drop unsafeOnly

* op-acceptance-tests: drop EL follow source / Unsafe Only tests

* op-devstack|acceptance-tests: Follow Source CL

* op-node: Follow Client: only allow CL source

* drop unused args

* rm redundant unsafe head reorg logic

* rm unused dsl

* Do not use functions

* chore: Add SafeRename ioutil utility (ethereum-optimism#18610)

* chore: Add SafeRename ioutil utility

* fix: Lint

* proofs: Update pinned kona client version (ethereum-optimism#18611)

* feat: have OPCMv2 check upgrade ordering version (ethereum-optimism#18583)

* feat: have OPCMv2 check upgrade ordering version

This PR introduces a check in OPCM that validates that the
version difference in the previous OPCM and the current OPCM is
acceptable. This PR explicitly disallows skipping OPCM versions
which was previously an implicit requirement.

* fix: properly set version testing flag

* fix: semver lock

* fix: move valid instructions allowance

* fix: semver lock

* fix: better mechanism for checking permitted upgrades

* fix: properly run permitted upgrade sequence tests

* chore: bump opcmv2 to v7 (ethereum-optimism#18631)

* chore: bump opcmv2 to v7

* fix: correct version in upgrade sequence

* fix: broken tests

* op-chain-ops: Add command to calculate an output root from an EL endpoint. (ethereum-optimism#18626)

* verify opcm v2 (ethereum-optimism#18590)

* verify opcm v2

* fixes

* fixes

* some fixes

* some fixes

* some fixes

* fix verifyOPCM v1 tests

* fix verifyOPCM v1 tests

* fix ci checks

* better approach to tests, less diff

* improve test coverage

* fix typo

* fix semver

* Update packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol

Co-authored-by: 0xOneTony <112496816+0xOneTony@users.noreply.github.com>

---------

Co-authored-by: 0xOneTony <112496816+0xOneTony@users.noreply.github.com>

* codeowners(op-deployer): add platforms team as codeowners (ethereum-optimism#18635)

* ci: Fix contracts test-upgrade test junit output (ethereum-optimism#18637)

* ci: Fix contracts test-upgrade test junit output

* fix test-upgrade xml output

* proofs: Add provable output roots to super DGs (ethereum-optimism#18605)

* proofs: Add provable output roots to super DGs

This patch updates the SuperFaultDisputeGame to explicitly prove output
roots contained in the super root. This is accomplished by requiring
proposers to provide the preimage of the super root when creating a
SuperFaultDisputeGame.

The Super DG is then extended with a rootClaim(uint256 _l2ChainId)
method that returns specific output roots contained in the proposal.
This allows withdrawals to be proven using only an output root.

* review comments

* fix nits; update interfaces

* update snapshots

* fix panic in non-l2oo proposals

* op-program: Reduce disk usage of preimage prestate builds in ci (ethereum-optimism#18641)

* all: upgrade op-geth (ethereum-optimism#18646)

Pull in superchain registry changes and a few other minor changes.

No upstream merges.

* refactor+fix(op-node/sequencing): l1 origin selection improvements (ethereum-optimism#18589)

* WIP

* wip

* WIP

* Treat NotFound next L1 origin as chain end

* Use recover mode in sequence window expiry test

* Invoke fault proof earlier and fix typos

Run env.RunFaultProofProgram after computing l2SafeHead
(l2SafeHead.Number.Uint64()/2) and replace the FromGenesis call with
RunFaultProofProgram. Fix minor comment typos and wrap a long log line.

* reduce diff

* Use requireL1OriginAt helper in test

Replace manual error assertions around FindL1Origin with
requireL1OriginAt and remove the now-unused derive import.

* Introduce L2Sequencer.ActMaybeL2StartBlock

* add TestRecoverModeWhenChainHealthy acceptance test

sysgo only

* Add SetSequencerRecoverMode and enable debug logs

* Adjust L1 block time and sequence window test

Set default L1 block time to 12s to match action helper assumptions.
Increase sequencer window size in the test to 50. Compute drift from
UnsafeL2 headers (use UnsafeL2.L1Origin). Simplify L1 mining to always
BatchMineAndSync and remove the extra numL1Blocks > 10 lag guard.

* restore stub

* WIP

* name errs

* refactor

* fix

* add test

* Rename error constant and add L1 origin tests

Rename ErrInvalidL1OriginChild to ErrNextL1OriginOrphaned and adjust the
error text. Add test cases covering L1 reorg and invalid L1 origin, and
refactor the test case construction in the unit test.

* Use drift check for next L1 origin and update tests

Compute driftNext and use it to decide adoption of the next L1 origin
instead of comparing absolute timestamps. Bump MaxSequencerDrift to 1800
and add tests covering max-drift and negative-drift scenarios.

* Refactor L1 origin selection and error handling

Delegate origin decision logic to FindL1OriginOfNextL2Block and handle
synchronous fetch when in recover mode. Remove recover-mode fetching
from CurrentAndNextOrigin and return cached values instead. Update
sequencer error handling to distinguish invalid/orphaned origin (which
triggers a reset) from temporary lookup errors.

* fixes

* fixes

* lint

* don't use pointers

saves some translation code

* handle retries without a "temporary error"

fixes action tests

* use Fjord drift constant

* fix origin_selector_test

mainly just asserting on sentinel errors, and taking account of small
optimization (fewer network calls)

* Simplify FindL1Origin

* move new pure function into a method on los

* Update comment to refer to empty nextL1Origin

* Use errors.Is for L1 origin error checks

* Return L1 origin on validation errors

* Add expectedResult to origin selector tests

Set expectedResult for the test cases with l2Head d1000 and e1000 to
assert the expected L1 origins (c101 and c100 respectively)

* Add assertion message and clarify origin comments

Provide a helpful failure message in sequence_window_expiry_test when
the safe head doesn't advance after the sequencing window expires.
Document that the current L1 origin should always be non-empty and add a
panic guard. Clarify the rationale for requiring the next L1 origin,
include a source link, and note the effect on unsafe block production.

* Store recoverMode and add comment period

* Update op-node/rollup/sequencing/origin_selector.go

Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>

* Update op-node/rollup/sequencing/origin_selector.go

Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>

* feat: add ReadSuperchainDeployment support for opcm v2 (ethereum-optimism#18520)

* feat: add readsuperchaindeployment for opcm v2

* fix: argument in PopulateSuperchainState & add docs  (#734)

* fix: set superchainConfig to zero for populateSuperchainState with opcmV1

* docs: add clarification of opcmv1 deprecation

* fix: remove unused opcmV2Enabled var

* test: opcm2 add read sup chain tests (#754)

* chore: expand comment on ReadSuperchainDeployment.s.sol and init.go

* test: add additional test cases for PopulateSuperchainState and InitLiveStrategy

* fix: adds the right number of hex digits to OPCMV2DevFlag in devfeatures.go (#755)

* fix: remove branching in init.go & link TODO issue (#760)

* docs: link todo issue

* refactor: remove branching in init.go WIP

* fix: remove unused opcmv2 feature flag

* fix: remove console logs

* fix: set original timeout, fix isOpcmV2 version and add populateSuperchainState tests

* fix: set original timeout

* fix: isOpcmV2 version

* feat: add test cases for populateSuperchainState and unify tests

* fix: ocpm version comments

---------

Co-authored-by: Flux <175354924+0xiamflux@users.noreply.github.com>
Co-authored-by: OneTony <onetony@defi.sucks>
Co-authored-by: 0xOneTony <112496816+0xOneTony@users.noreply.github.com>

* fix: opcmv2 view function calls

---------

Co-authored-by: Stefano Charissis <stefano@oplabs.co>
Co-authored-by: Changwan Park <pcw109550@gmail.com>
Co-authored-by: Ján Jakub Naništa <jan.jakub.nanista@gmail.com>
Co-authored-by: Inphi <mlaw2501@gmail.com>
Co-authored-by: smartcontracts <14298799+smartcontracts@users.noreply.github.com>
Co-authored-by: Adrian Sutton <adrian@oplabs.co>
Co-authored-by: Michael Amadi <amadimichaeld@gmail.com>
Co-authored-by: 0xOneTony <112496816+0xOneTony@users.noreply.github.com>
Co-authored-by: serpixel <5087962+serpixel@users.noreply.github.com>
Co-authored-by: Josh Klopfenstein <joshklop@oplabs.co>
Co-authored-by: George Knee <georgeknee@googlemail.com>
Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>
Co-authored-by: Flux <175354924+0xiamflux@users.noreply.github.com>
Co-authored-by: OneTony <onetony@defi.sucks>

* Revert "chore: opcm revert develop sync (#769)"

This reverts commit d84f0b9.

* fix: sync commit

---------

Co-authored-by: IamFlux <175354924+0xiamflux@users.noreply.github.com>
Co-authored-by: OneTony <onetony@defi.sucks>
Co-authored-by: 0xOneTony <112496816+0xOneTony@users.noreply.github.com>
Co-authored-by: Stefano Charissis <stefano@oplabs.co>
Co-authored-by: Changwan Park <pcw109550@gmail.com>
Co-authored-by: Ján Jakub Naništa <jan.jakub.nanista@gmail.com>
Co-authored-by: Inphi <mlaw2501@gmail.com>
Co-authored-by: smartcontracts <14298799+smartcontracts@users.noreply.github.com>
Co-authored-by: Adrian Sutton <adrian@oplabs.co>
Co-authored-by: Michael Amadi <amadimichaeld@gmail.com>
Co-authored-by: serpixel <5087962+serpixel@users.noreply.github.com>
Co-authored-by: Josh Klopfenstein <joshklop@oplabs.co>
Co-authored-by: George Knee <georgeknee@googlemail.com>
Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>
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.

3 participants