Skip to content

Restore CeloSuperchainConfig scripts & tests#441

Open
Mc01 wants to merge 14 commits into
op-deployer/v5.0.0from
mc01/celo-contracts/v5.0.0
Open

Restore CeloSuperchainConfig scripts & tests#441
Mc01 wants to merge 14 commits into
op-deployer/v5.0.0from
mc01/celo-contracts/v5.0.0

Conversation

@Mc01
Copy link
Copy Markdown

@Mc01 Mc01 commented Apr 30, 2026

No description provided.

Restores the deploy-side scaffolding for CeloSuperchainConfig (CSC) lost during
the v2.0.0 rebase. Pure plumbing — no changes to OPContractsManager or its
upgrade flow. CSC management remains a v4.1 one-time concern; v5's OPCM keeps
its existing two-arg upgrade(OpChainConfig[], bool) signature unchanged.

- DeployImplementations.s.sol:
    + ICeloSuperchainConfig import
    + Output.celoSuperchainConfigImpl field
    + deployCeloSuperchainConfigImpl() helper (createDeterministic)
    + run() now invokes deployCeloSuperchainConfigImpl
    + assertValidOutput includes the new impl in its address-array check
- ChainAssertions.sol: dioToContractSet maps celoSuperchainConfigImpl
- Deploy.s.sol: _proxies() ContractSet entry sourced from artifact
- DeployOPChain.s.sol: _assertValidDeploy ContractSet entry (address(0))
- Types.sol: ContractSet gets address CeloSuperchainConfig
- op-deployer Go DeployImplementationsOutput: CeloSuperchainConfigImpl field

Note: IOPContractsManager.Implementations struct is INTENTIONALLY unchanged.
The OPCM-level CSC upgrade was a one-time v4.1 migration helper and does NOT
belong on v5's recurring OPCM upgrade path.
@Mc01 Mc01 force-pushed the mc01/celo-contracts/v5.0.0 branch 2 times, most recently from dcef6ae to b0cfe68 Compare May 4, 2026 14:25
@Mc01
Copy link
Copy Markdown
Author

Mc01 commented May 4, 2026

@copilot review

@Mc01 Mc01 marked this pull request as ready for review May 4, 2026 14:26
Copilot AI review requested due to automatic review settings May 4, 2026 14:26

This comment was marked as resolved.

Copilot finished work on behalf of Mc01 May 4, 2026 14:32
chatgpt-codex-connector[bot]

This comment was marked as resolved.

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Mc01 added 5 commits May 5, 2026 14:29
Restores the in-memory deploy path that was present at tag
celo-contracts.L1/v1.8.0--1 but lost during the v2.0.0 rebase. Adapts the v1.8
helpers to v5 APIs (artifacts.mustGetAddress, superchainProxyAdmin.upgradeAndCall,
_proxies()) without touching OPContractsManager.

Deploy.s.sol
  - setupCeloSuperchainConfig(): deploys ERC1967 proxy under SuperchainProxyAdmin
    and invokes initializeCeloSuperchainConfig
  - initializeCeloSuperchainConfig(): upgrades + initializes the CSC proxy with
    guardian + external SuperchainConfig reference, then runs ChainAssertions
  - _run(): calls setupCeloSuperchainConfig between deployImplementations and
    deployOpChain so ContractSet resolution works
  - deployImplementations: artifacts.save('CeloSuperchainConfigImpl', ...)

ChainAssertions.sol
  - checkCeloSuperchainConfig(): validates guardian, paused flag, and the
    superchainConfig() pointer on the initialized CSC proxy (CHECK-CSC-{10..40})

test/setup/Setup.sol
  - ICeloSuperchainConfig celoSuperchainConfig state var + artifact resolution
  - vm.label for the proxy to improve test traces
Ports packages/contracts-bedrock/test/L1/CeloSuperchainConfig.t.sol as it
existed at tag celo-contracts.L1/v1.8.0--1. Was dropped during the v2.0.0
fresh-rebase along with the rest of the CSC scaffolding and never restored
across v3.0.0, v4.1.0, or v5.0.0.

Drift required for v5 (minimal):
  - Import paths rebased from src/{L1,universal}/interfaces/ to
    interfaces/{L1,universal}/ per v5 layout.
  - Upstream SuperchainConfig API changed: pause(string) -> pause(address),
    unpause() -> unpause(address). Celo-side CSC keeps original signatures.
    Replaced the 3 upstream-facing calls with pause/unpause(address(0)).
  - Event-name collision: upstream SuperchainConfig Paused(address)/Unpaused(address)
    events (brought in via CommonTest -> Events.sol) shadow CSC's
    Paused(string)/Unpaused() interface events. Added a local
    CeloSuperchainConfigEvents helper contract declaring CSC's signatures
    so vm.expectEmit matches correctly.

Suite: 15 tests pass, 0 fail, 1 skipped (superchainGuardian variant).
Forward-port of #352 (commit 12ee711) onto v5.0.0.
Allows CeloSuperchainConfig to wrap an externally-provided SuperchainConfig
(e.g. the upstream Optimism Superchain Registry's SC for Celo Mainnet)
instead of always deploying a fresh local one.

DeployConfig.s.sol
  - new `address public externalSuperchainConfig` field, read from JSON key
    `externalSuperchainConfig` (defaults to address(0))
  - new `setExternalSuperchainConfig` setter for test-time overrides

Deploy.s.sol
  - new `runCelo(address payable _protocolVersionsProxy)` entrypoint:
    deploys a fresh OP Stack wrapping cfg.externalSuperchainConfig() as the
    SuperchainConfig (Mainnet flow). ProtocolVersions is passed in as a
    parameter, mirroring runWithSuperchain.
  - new `run(bool _needsSuperchain)` testing entrypoint
  - _run else-branch: when _needsSuperchain=false AND no SuperchainConfigProxy
    artifact has been pre-populated, fall back to cfg.externalSuperchainConfig()

test/setup/Setup.sol
  - `bool needsSuperchain = true` flag toggled via withoutSuperchain()
  - deploy.run is now invoked as deploy.run(needsSuperchain)
  - new virtual hook `applyCfgOverrides()` runs AFTER deploy is etched but
    BEFORE deploy.run, so subclasses can push cfg fields the deploy reads

test/setup/CommonTest.sol
  - new `enableExternalSuperchainConfig(address)` helper mirrors
    enableInterop / enableCustomGasToken
  - applyCfgOverrides override pushes externalSuperchainConfig into cfg
    BEFORE the deploy script reads it

test/setup/ExternalSuperchainConfig.t.sol (new file)
  - verifies the JSON read-or-default path defaults to address(0)
  - verifies setExternalSuperchainConfig overrides the cfg field
  - end-to-end deploy flow remains exercised by integration deployments
    using runCelo(<protocolVersionsProxy>)

Note: the v1.8 baseline also added an ExternalSuperchainConfig field to
op-chain-ops/genesis/config.go. On v5 op-deployer no longer drives Celo
deploys via that Go config — DeployConfig.s.sol reads the JSON directly
via stdJson — so the Go field is unnecessary.

Tests: 163 pass, 0 fail (CSC 15, OPCM 24, Container 3, StandardValidator 108,
DeployImpl 11, ExternalSuperchainConfig 2).
Restores the ABI + storage-layout snapshots and semver-lock entry that were
present at tag celo-contracts.L1/v1.8.0--1 but lost during the v2.0.0 rebase.

- snapshots/abi/CeloSuperchainConfig.json (regenerated)
    Captures the v5 CSC ABI including the forward-compat `paused(address)`
    overload that was added on top of the v1.8 baseline.

- snapshots/storageLayout/CeloSuperchainConfig.json (regenerated)
    Slot map for the OpenZeppelin Initializable parent. CSC's own state lives
    in unstructured slots (keccak256-derived) and is therefore correctly
    invisible to forge inspect — matching the v1.8 layout.

- snapshots/semver-lock.json
    Adds the new `src/celo/CeloSuperchainConfig.sol:CeloSuperchainConfig`
    entry. Other entries that drifted during `just snapshots-no-build`
    (OPCM, SystemConfig, etc.) are NOT included here — those are pre-existing
    snapshot drift on the v5 base, unrelated to this hot-fix, and belong in
    a separate housekeeping PR.

Files were generated via `just snapshots-no-build` against the v5 build of
src/celo/CeloSuperchainConfig.sol (version 1.0.0-celo). Auxiliary Celo-specific
contract snapshots that the same command would have generated (CeloRegistry,
FeeCurrency, GoldToken, etc.) are also left out of this commit for the same
reason — they are pre-existing un-snapshotted contracts, not CSC scope.
Documents the L1-side deltas between Celo's fork and upstream OP at v5.0.0
(dual-guardian, SystemConfig indirection, external SuperchainConfig, OPCM
upgrade exclusion, CGT, L2 fee currency).

The v1.8.0 Celo.README.md was lost during the v2.0.0 rebase; this rewrites
it for v5's architecture instead of porting verbatim. File renamed to
CELO.md to match the all-caps top-level README convention.
@Mc01 Mc01 force-pushed the mc01/celo-contracts/v5.0.0 branch from e31ee05 to 0544e31 Compare May 5, 2026 12:35
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Mc01 added 3 commits May 5, 2026 15:09
Fork-mode runs revealed two issues:

ForkLive.s.sol — the previous unconditional 'save SystemConfig.superchainConfig()
as CeloSuperchainConfigProxy' wrongly seeded the upstream SuperchainConfig
address on non-Celo forks (e.g. OP Mainnet). Tests would then call CSC methods
on what's actually upstream's SuperchainConfig and revert.

Now probe with SUPERCHAIN_CONFIG_SLOT() — a method only CSC exposes — and
only seed the artifact when the probe succeeds.

CeloSuperchainConfig.t.sol — the unit suite assumes a Celo deploy environment
and can't run against a non-Celo fork (no CSC exists there). Add
skipIfForkTest in the shared setUp; same pattern SuperchainConfig.t.sol uses.

Tested against:
- Mainnet fork (https://mainnet.gateway.tenderly.co/...) — CSC suite skipped
  cleanly; the 7 remaining failures (6 OPContractsManager_Upgrade, 1
  OptimismPortal2 UnexpectedRootClaim) are pre-existing on op-deployer/v5.0.0
  base, unrelated to this PR.
- Sepolia fork — pre-existing UnsupportedChainId() in ForkLive (only
  Mainnet is supported for upgrade tests). Unrelated to this PR.
- Non-fork: 163 tests still pass across CSC + OPCM + StandardValidator +
  DeployImpl + ExternalSuperchainConfig suites.
@Mc01
Copy link
Copy Markdown
Author

Mc01 commented May 6, 2026

@copilot review

This comment was marked as resolved.

Copilot finished work on behalf of Mc01 May 6, 2026 12:52
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b9d69bf38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as off-topic.

Copy link
Copy Markdown

@m-chrzan m-chrzan left a comment

Choose a reason for hiding this comment

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

One general comment: previously, CeloSuperchainConfig.sol lived under src/L1/, as it is a change to our version of the OP Stack contracts, while src/celo remained as solely for "importing" the monorepo contracts. I'm following the same convention for the CeloSequencerFeeVault in #444.

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.

5 participants