Skip to content

refactor(contracts): remove OPCMv1 from all Solidity code#19795

Open
smartcontracts wants to merge 24 commits intodevelopfrom
chore/remove-opcmv1-solidity
Open

refactor(contracts): remove OPCMv1 from all Solidity code#19795
smartcontracts wants to merge 24 commits intodevelopfrom
chore/remove-opcmv1-solidity

Conversation

@smartcontracts
Copy link
Copy Markdown
Contributor

Summary

Remove OPContractsManager v1 from all Solidity code, making OPContractsManagerV2 the sole OPCM.

  • Delete v1 contract: OPContractsManager.sol (2203 lines, 7 inner contracts) and gut IOPContractsManager.sol interface
  • Remove v1 gating: DevFeatures.OPCM_V2 flag, Constants.OPCM_V2_MIN_VERSION, Config.devFeatureOpcmV2()
  • Delete v1-only files: AddGameType.s.sol, opcm-upgrade-checks/ directory, 3 test files, 12 snapshot files
  • Update deploy scripts: All 10 deploy scripts now unconditionally use V2 types (no more v1/v2 branching)
  • Update test infrastructure: ~17 test/setup files cleaned of v1 branches, assertions, and imports

V2 contracts in src/L1/opcm/ are completely untouched — they have zero V1 dependencies.

56 files changed, +212 / -13,404 lines (net deletion of ~13,200 lines)

This is PR 1 of the OPCMv1 removal series. Breaks out the Solidity-side changes from #19385. Go code (op-deployer) and CI matrix changes follow in subsequent PRs.

Test plan

  • mise exec -- just build-dev passes (zero compilation errors)
  • mise exec -- just pr passes (17/17 checks: lint, semgrep, snapshots, semver-diff, interfaces, size-check, etc.)
  • Zero remaining imports of IOPContractsManager or OPContractsManager (non-V2)
  • Zero remaining references to DevFeatures.OPCM_V2 or Constants.OPCM_V2_MIN_VERSION
  • Zero remaining isOPCMv2 / isOPCMV2 variables
  • V2 contracts in src/L1/opcm/ verified untouched
  • CI passes (pending)
  • mise exec -- just test-dev passes (not yet run — long-running)

🤖 Generated with Claude Code

@smartcontracts smartcontracts marked this pull request as ready for review March 27, 2026 17:10
@smartcontracts smartcontracts requested review from a team and digorithm March 27, 2026 17:10
@smartcontracts smartcontracts marked this pull request as draft March 27, 2026 17:11
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.8%. Comparing base (f5cd6b3) to head (28f23d2).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #19795     +/-   ##
==========================================
- Coverage     75.9%    75.8%   -0.1%     
==========================================
  Files          684      628     -56     
  Lines        73143    68612   -4531     
==========================================
- Hits         55532    52067   -3465     
+ Misses       17467    16545    -922     
+ Partials       144        0    -144     
Flag Coverage Δ
cannon-go-tests-64 ?
contracts-bedrock-tests 75.1% <ø> (-5.7%) ⬇️
unit 75.9% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ages/contracts-bedrock/src/libraries/Constants.sol 0.0% <ø> (-100.0%) ⬇️
...es/contracts-bedrock/src/libraries/DevFeatures.sol 100.0% <ø> (ø)

... and 73 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@smartcontracts smartcontracts force-pushed the chore/remove-opcmv1-solidity branch from c038e35 to 72d2dea Compare March 31, 2026 14:41
@smartcontracts
Copy link
Copy Markdown
Contributor Author

/retest memory-all-opn-op-geth

@wiz-inc-a178a98b5d
Copy link
Copy Markdown

wiz-inc-a178a98b5d bot commented Mar 31, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@smartcontracts smartcontracts force-pushed the chore/remove-opcmv1-solidity branch from 5459530 to c478f58 Compare April 1, 2026 03:38
smartcontracts and others added 20 commits April 2, 2026 11:39
Delete OPContractsManager v1 contract, interface, tests, snapshots,
and all v1/v2 branching logic. OPContractsManagerV2 is now the sole
OPCM — all deploy scripts and test infrastructure use V2 exclusively.

Key changes:
- Delete OPContractsManager.sol (2203 lines, 7 inner contracts)
- Gut IOPContractsManager.sol interface to empty
- Remove DevFeatures.OPCM_V2 flag and Constants.OPCM_V2_MIN_VERSION
- Remove AddGameType.s.sol (v1-only script)
- Remove opcm-upgrade-checks (v1-only CI check)
- Update all deploy scripts to unconditionally use V2 types
- Update all test files to remove v1 branches and assertions
- Delete 12 v1 snapshot files (ABI + storage layout)

V2 contracts in src/L1/opcm/ are untouched (zero V1 dependencies).

This is PR 1 of the OPCMv1 removal series. Go code and CI matrix
changes follow in subsequent PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add back v1 OPCM fields as address/bytes32 placeholders in Solidity
script structs to maintain ABI compatibility with Go op-deployer.

- DeployImplementations.Output: 6 deprecated address fields (always zero)
- ReadSuperchainDeployment.Input: opcmAddress field (ignored)
- ReadSuperchainDeployment.Output: 5 ProtocolVersions fields (always zero)

These fields are never populated — they exist solely so Go's ABI
encoding matches the Solidity struct layout. They will be removed
atomically with the Go struct fields in a follow-up PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update Go op-deployer to unconditionally use OPCMv2 instead of
branching on the OPCM_V2 dev feature flag, matching the Solidity
contract deletion.

- opchain.go: unconditionally use OpcmV2Impl instead of defaulting
  to v1 OpcmImpl
- init.go: update ReadSuperchainDeployment call for new struct layout
- artifacts.go: point Opcm mapping to V2 artifact, remove 5 deleted
  v1 sub-contract artifact mappings
- Tests updated to match new behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mpat

Since v1 OPContractsManager is deleted, dio.Opcm is always zero.
Populate OpcmImpl with dio.OpcmV2 so downstream consumers
(op-devstack, e2e tests) get a valid OPCM address.

The OpcmImpl field will be renamed/removed in the follow-up Go PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The v1 OPCM Go bindings are stale (v1 contract deleted), so
superroot.go can no longer use OPContractsManagerMetaData to ABI-encode
migrate calls. Remove the v1 path entirely and use an inline v2
migrator ABI for the migrate call.

- Remove isOPCMV2 version check (always v2 now)
- Remove v1 MigrateInput path with UsePermissionlessGame/GameParameters
- Add OPContractsManagerMigratorABI() helper with inline v2 ABI JSON
- Remove unused deployer import and versionFn var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- apply_test: OpcmImpl now equals OpcmV2Impl (not zero)
- implementations_test: check OpcmV2 instead of Opcm (deprecated zero field)
- migrate_test: remove opcm-v1 test case from table-driven test
- migrate_test (CLI): skip TestCLIMigrateV1 (v1 contract deleted)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dead code left behind when v1 migration path was removed.
Caught by go-lint CI check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add vm.assume to exclude OPCM address from fuzz inputs in migrate test
  (triggers _onlyDelegateCall instead of expected ProxyAdminOwnerMismatch)
- Change implsOutput.Opcm → implsOutput.OpcmV2 in bootstrap test assertions
  (Opcm field is always zero now that v1 is deleted)
- Add OpcmV2Impl to manual state population in migrate tests so opchain.go
  can find the OPCM address
- Remove v6.0.0-rc.2 upgrade test case (v1 OPCM on Sepolia, embedded
  artifacts no longer support v1 upgrades)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The AddGameType.s.sol script was deleted as part of OPCMv1 removal.
Rewrite addGameTypeForRuntime to use the V2 upgrade path
(UpgradeOPChain.s.sol with UpgradeInputV2/DisputeGameConfig) instead
of the deleted V1 AddGameType script.

Also skip TestAddGameType in manage package since it depends on the
deleted script. The V2 equivalent is TestManageAddGameTypeV2_CLI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OPCMv2.upgrade() requires exactly 3 dispute game configs in order
(CANNON, PERMISSIONED_CANNON, CANNON_KONA). The previous commit
only sent 1 config per game type, causing InvalidGameConfigs revert.

Restructure addGameTypesForRuntime to build all 3 configs in a single
upgrade call: requested game types are enabled, others are disabled.
Also add the required PermittedProxyDeployment extra instruction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- interopgen/deploy.go: use superDeployment.OpcmV2 instead of .Opcm
  (v1 field is always zero now). Fixes all interop/devstack tests.
- apply_test.go: TestEndToEndBootstrapApply now uses OPCMV2DevFlag
  and impls.OpcmV2 (v1 path no longer exists).
- apply_test.go: remove "default" (non-V2) test case from
  TestEndToEndBootstrapApplyWithUpgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- interopgen/deploy.go: convert MigrateInputV1 to MigrateInputV2 since
  InteropMigration.s.sol no longer supports V1 format. V2 uses
  ChainSystemConfigs + DisputeGameConfigs instead of OpChainConfigs.
- apply_test.go: revert DevFeatureBitmap back to empty (V2 is default
  now, no flag needed). Set SuperchainConfigProxy in intent so the
  pipeline doesn't try to resolve it from OPCM (V2 OPCM doesn't
  expose superchainConfig() directly).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When an OPCM address is provided via intent.OPCMAddress (pre-deployed),
the init stage only populated OpcmImpl. The opchain stage reads
OpcmV2Impl, which was left as zero, causing "OPCM implementation is
not deployed" error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DevFeatures and GameType/GameTypes imports were dropped when removing
v1 IOPContractsManager imports during rebase conflict resolution.
Regenerate semver-lock.json. Includes linter auto-fixes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After rebase, the V2 contract now requires 6 game types (including
super root types) instead of 3. Add SUPER_CANNON,
SUPER_PERMISSIONED_CANNON, SUPER_CANNON_KONA as disabled configs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
V2 OPCM sets initBonds[PERMISSIONED_CANNON] = 0.08 ether via
DEFAULT_INIT_BOND. DisputeGameFactory.create() requires msg.value
to match the init bond. The test's sendTx was dropping the Value
field from the TxCandidate, sending msg.value=0 which reverts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The interop migration only configured game type 0 (CANNON) but the
proposer uses game type 4 (SUPER_CANNON) as the respected game type.
DisputeGameFactory.create(4, ...) reverted with NoImplementation
because no implementation was registered for type 4.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The V1 migrate path registered SUPER_CANNON, SUPER_PERMISSIONED_CANNON,
and SUPER_CANNON_KONA from OpChainConfigs. The V2 path only registered
SUPER_CANNON, causing:
- TestPreinteropSingleChainFaultProofs: challenger can't find
  SUPER_CANNON_KONA implementation for split depth query
- TestProposals: factory has no SUPER_CANNON implementation
  (interopgen path)

Register all 3 super game types in both superroot.go and interopgen
deploy.go migrate paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add version guards to UpgradeOPChain.s.sol and InteropMigration.s.sol:
  require OPCM >= v7.0.0 with descriptive error instead of silent revert
- Replace inline ABI JSON in superroot.go with forge artifact loading
- Remove bindings.Proposal dependency, define Proposal struct locally
- Remove stale op-e2e/bindings/opcontractsmanager.go (v1 dead code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@smartcontracts smartcontracts force-pushed the chore/remove-opcmv1-solidity branch from c478f58 to d0a920f Compare April 2, 2026 15:42
The V1→V2 migration conversion only registered game types 0 (Cannon)
and 4 (Super Cannon), missing type 9 (Super Cannon Kona). The proposer
creates games of type 9, so TestProposals timed out waiting for a game
that could never be created.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@smartcontracts
Copy link
Copy Markdown
Contributor Author

#wiz_ignore False positive — the file path in OPContractsManagerMigratorABI() is constructed entirely from hardcoded constants, not user input. findMonorepoRoot walks up from the working directory looking for a known marker, and the artifact path is a fixed join of string literals.

@smartcontracts smartcontracts marked this pull request as ready for review April 2, 2026 19:35
@smartcontracts smartcontracts requested review from a team as code owners April 2, 2026 19:35
)

func TestAddGameType(t *testing.T) {
t.Skip("OPCMv1 contract deleted — AddGameType.s.sol no longer exists. Use TestManageAddGameTypeV2_CLI instead.")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can just remove this entirely now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

op-deployer/pkg/deployer/opcm/add_game_type.go:119 also references AddGameType.s.sol

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will handle in follow-up PR

Copy link
Copy Markdown
Contributor

@stevennevins stevennevins left a comment

Choose a reason for hiding this comment

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

Some stale references to deleted files

# File Line Type
1 .semgrep/rules/sol-rules.yaml 247 Stale exclude path
2 .semgrep/rules/sol-rules.yaml 323 Stale exclude path
3 docs/public-docs/notices/op-deployer-upgrade-deprecation.mdx 32 Broken GitHub link to deleted file
4 packages/contracts-bedrock/book/src/policies/versioning.md 82 Broken GitHub link to deleted file
5 packages/contracts-bedrock/book/src/policies/versioning.md 84 Broken GitHub link (with specific line anchor)

Some more stale references

# File Line Type
1 op-deployer/pkg/deployer/manage/migrate.go 50 Stale comment — IOPContractsManagerInteropMigrator deleted
2 op-deployer/pkg/deployer/manage/migrate.go 59 Stale comment — IOPContractsManagerInteropMigrator deleted
3 op-deployer/pkg/deployer/manage/migrate.go 71 Stale comment — IOPContractsManagerInteropMigrator deleted
4 packages/contracts-bedrock/book/src/contributing/opcm.md 18 Stale doc — OPContractsManager (v1 entry point) deleted
5 packages/contracts-bedrock/book/src/contributing/opcm.md 21 Stale doc — OPContractsManagerGameTypeAdder deleted
6 packages/contracts-bedrock/book/src/contributing/opcm.md 22 Stale doc — OPContractsManagerDeployer deleted
7 packages/contracts-bedrock/book/src/contributing/opcm.md 23 Stale doc — OPContractsManagerUpgrader deleted
8 packages/contracts-bedrock/book/src/contributing/opcm.md 24 Stale doc — OPContractsManagerContractsContainer deleted
9 packages/contracts-bedrock/book/src/contributing/opcm.md 80 Stale doc — OPContractsManagerUpgrader deleted
10 packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol 185 Stale override — OPContractsManagerGameTypeAdder deleted
11 packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol 186 Stale override — OPContractsManagerDeployer deleted
12 packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol 188 Stale override — OPContractsManagerUpgrader deleted
13 packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol 189 Stale override — OPContractsManagerInteropMigrator deleted
14 packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol 195 Stale override — OPContractsManagerContractsContainer deleted
15 ops/ai-eng/contracts-test-maintenance/exclusion.toml 15 Stale exclusion — OPContractsManagerContractsContainer.t.sol deleted
16 ops/ai-eng/contracts-test-maintenance/docs/runbook.md 296 Stale example — OPContractsManagerContractsContainer.t.sol deleted

The test suite was deleted as part of the OPCMv1 removal, but it should
have been migrated to V2 types instead. This restores it with:

- Remove IOPContractsManager (v1) imports, use deploy.cfg() for config
- Remove DevFeatures.OPCM_V2 branching, keep V2 path unconditionally
- Remove v1-only addGameType/newGameInputFactory helpers
- Simplify DelayedWETH tests by removing v1/v2 assertion branches
- Remove unused IBigStepper import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
// Since both OPCM V1 and V2 have contractsContainer var and they point to different contract file names,
// in the code logic, we rename any occurrences of it to "contractsContainerV1" or "contractsContainerV2" before
// using it to read the mapping.
fieldNameOverrides["contractsContainerV1"] = "OPContractsManagerContractsContainer";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can delete this too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will handle in follow-up

Strip comments that just explain "this is V2 now" or "OPCMv1 has been
removed" — the code is self-evident after the removal. Kept comments
that explain why deprecated zero-valued struct fields exist (Go ABI
compatibility).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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