Skip to content

Geth migrations, rebased#11593

Open
martinvol wants to merge 172 commits intorelease/core-contracts/17from
martinvol/gethMigrations
Open

Geth migrations, rebased#11593
martinvol wants to merge 172 commits intorelease/core-contracts/17from
martinvol/gethMigrations

Conversation

@martinvol
Copy link
Copy Markdown
Collaborator

@martinvol martinvol commented Jan 5, 2026

Forked from mc01/cr14/geth-migrations-fix-tests

Commit 6ea49d059846e2c96b2b4d375f0c319fbf1fdf08

Closes #11709

Mc01 and others added 30 commits August 28, 2025 15:56
* WIP.

* Consitution test that fail with anvil.

* Identify part of migration script that causes tests to fail.

* Wip: fixing migration script.

* Do not rely on ffi mode.

* Fix constitution values in anvil migration.

* Port old governance tests from Truffle.

* Finish porting old governance integration tests to Foundry.

* Fix unit tests.

* Fix CI.

* Fix remappings for CI.

* Fix TS deps.

* Update comment.

Co-authored-by: pahor167 <47992132+pahor167@users.noreply.github.com>

* CR.

* Combine proxy selectors with contract selectors.

* CR.

* Isolate common part.

* Enabled detailed anvil logging in CI by default.

* Fix tests.

* CR fixes.

* Cleanup merging.

---------

Co-authored-by: pahor167 <47992132+pahor167@users.noreply.github.com>
…ns on top of CR14 (#11485)

* Update caching version and add Foundry release scripts

* prettify

* Refactor argument names in make-release scripts for consistency

* Refactor getDefaultValueForSolidityType to handle fixed arrays and improve readability

* prettify
…1488)

* Update README and Foundry configuration for contract verification

- Added Foundry verification instructions alongside Truffle in README.md
- Updated foundry.toml to include a profile for Truffle compatibility with Solidity 0.5.13
- Clarified parameter descriptions in SortedOracles contract

* revert of foundry.toml

* API key

* Update .gitignore and foundry.toml for improved build configuration and compatibility

* Update openzeppelin-contracts8 submodule to v4.9.0

* Refactor foundry.toml: reorganize profiles and update no_match_path and fs_permissions for clarity
Remove duplicate LIBRARIES_FILE assignment that was overwriting the
correctly renamed previous-version libraries filename with the current
version name, causing validate_libraries_filename to reject it.
@palango palango changed the title Get migrations, rebased Geth migrations, rebased Apr 9, 2026
- Add signersMnemonic to migrationsConfig.json for generating validator
  signer keys separate from account keys
- Derive signer keys via vm.deriveKey in electValidators and authorize
  them via authorizeValidatorSigner before registration
- Read elected signers from Accounts contract in initializeEpochManager
  instead of using account addresses
- Add anvil mnemonic to truffle-config-parent.js
… typo

- Move hardcoded 390M CELO treasury balance to migrationsConfig.json
- Remove unused console2 import, use console instead
- Fix missing $ in github.workspace reference in CI workflow
@martinvol
Copy link
Copy Markdown
Collaborator Author

@codex review this PR

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: 559a34ea9b

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


mv foundry.toml.bak foundry.toml

BUILD_DIR="./out-${BRANCH}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Derive build directory from sanitized branch name

build_tag_foundry writes artifacts to out-<branch-with-/-replaced-by-_>-<profile>, but this line now rebuilds BUILD_DIR from the raw BRANCH. For supported inputs like release/core-contracts/X (documented at the top of this script), make-release.ts will look for out-release/core-contracts/X-truffle-compat* and fail with "directory not found" even though the build succeeded in out-release_core-contracts_X-*.

Useful? React with 👍 / 👎.

- name: Generate migrations on local devchain
if: success() || failure()
run: |
LOAD_STATE=${{ github.workspace }}/celo-optimism/packages/contracts-bedrock/anvil-state.json ./scripts/foundry/create_and_migrate_anvil_devchain.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Publish generated devchain state file into artifact

This workflow now runs migrations via LOAD_STATE=... create_and_migrate_anvil_devchain.sh, but that script no longer exports a final snapshot into packages/protocol/.tmp (the previous devchain.json/l2-devchain.json writeout path was removed). Since the publish job uploads .tmp directly, the npm artifact can be published without a usable chain state file, breaking consumers that expect to start anvil from the package contents.

Useful? React with 👍 / 👎.

Comment thread packages/protocol/migrations_sol/Migration.s.sol Outdated
- Fix configulationFileRawJSON typo (108 occurrences)
- Remove dead MIGRATION_L2_TARGET_CONTRACT from constants.sh
- Remove stale IBlockchainParametersInitializer import and comment
- Remove commented-out --legacy flag
- Kill anvil by PID instead of lsof in generate-devchain-initial-state.sh
- Add TODO links to #11714 for Foundry version pins
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: d1b6213b71

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

run: chmod +x scripts/foundry/*.sh
- name: Generate migrations and run devchain
run: ./scripts/foundry/create_and_migrate_anvil_l2_devchain.sh
run: ./scripts/foundry/create_and_migrate_anvil_devchain.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Install celocli before running devchain migration script

create_and_migrate_anvil_devchain.sh now calls activate_votes.sh, which executes celocli epochs:switch (packages/protocol/scripts/foundry/activate_votes.sh, line 46), but this job invokes the script directly without installing celocli first. On the ubuntu-latest runner used here, that causes the devchain setup step to fail before tests start; note that .github/workflows/protocol-devchain-anvil.yml added an explicit celocli install step for the same script path.

Useful? React with 👍 / 👎.

run: chmod +x scripts/foundry/*.sh
- name: Generate migrations and run devchain
run: ./scripts/foundry/create_and_migrate_anvil_l2_devchain.sh
run: ./scripts/foundry/create_and_migrate_anvil_devchain.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provide LOAD_STATE when launching the new devchain migration flow

This step now runs the L1/L2-combined migration script without LOAD_STATE, but the new migration code expects predeployed proxy addresses from .proxies.* and immediately interacts with them (for example, migrateFeeCurrencyDirectorysetImplementationOnProxyAndAddToRegistry reads proxy._getOwner()). Without loading a prepared state file, those proxy addresses are not guaranteed to exist and migration can revert before running any devchain tests; the dedicated devchain workflow already mitigates this by generating and passing anvil-state.json.

Useful? React with 👍 / 👎.

@martinvol martinvol changed the base branch from release/core-contracts/16 to release/core-contracts/17 April 14, 2026 14:38
- Use readBool consistently for multisig .required and .internalRequired
  fields in Migration.s.sol (was mixing readUint and readBool)
- Remove duplicate copy_libraries/deploy_libraries definitions in
  deploy_libraries.sh, keeping the $FORGE version
- Replace unsafe kill-by-port with PID-based kill in start_anvil.sh
  and stop_anvil.sh
@martinvol martinvol deployed to production April 15, 2026 14:47 — with GitHub Actions Active
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: 407e4594da

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

run: chmod +x scripts/foundry/*.sh
- name: Generate migrations and run devchain
run: ./scripts/foundry/create_and_migrate_anvil_l2_devchain.sh
run: ./scripts/foundry/create_and_migrate_anvil_devchain.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use a Foundry version that supports anvil --celo

This job now invokes create_and_migrate_anvil_devchain.sh, which starts Anvil with --celo, but the same job still installs Foundry v1.0.0. In Foundry v1.0.0's Anvil CLI (crates/anvil/src/cmd.rs), --celo is not an accepted network flag, so this step fails with an unknown option before migrations/tests execute. Pinning a Foundry release with Celo network support (or avoiding the new script here) is required for this workflow path to run.

Useful? React with 👍 / 👎.

Comment on lines +38 to +41
MS_TO_ADVANCE=$((BLOCKS_TO_ADVANCE * 1000))

# Mock the new time on anvil
cast rpc evm_increaseTime $MS_TO_ADVANCE --rpc-url $ANVIL_RPC_URL --rpc-timeout 30000
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass seconds, not milliseconds, to evm_increaseTime

evm_increaseTime takes a time delta in seconds, but this code multiplies by 1000 and sends milliseconds. With the current config (epochManager.newEpochDuration = 100), the script advances ~101,000 seconds instead of ~101, which can skip many epochs and mutate epoch/reward state far beyond what the migration flow intends before epochs:switch runs.

Useful? React with 👍 / 👎.

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.

Make anvil migrations compatible with op-geth Initialize function of EpochManager should not query the oracle address from the registry

7 participants