Skip to content

CR14 vs CR15#11616

Open
pahor167 wants to merge 82 commits intorelease/core-contracts/14from
release/core-contracts/15
Open

CR14 vs CR15#11616
pahor167 wants to merge 82 commits intorelease/core-contracts/14from
release/core-contracts/15

Conversation

@pahor167
Copy link
Copy Markdown
Collaborator

@pahor167 pahor167 commented Jan 14, 2026

Description

A few sentences describing the overall effects and goals of the pull request's commits.
What is the current behavior, and what is the updated/expected behavior with this PR?

Other changes

Describe any minor or "drive-by" changes here.

Tested

An explanation of how the changes were tested or an explanation as to why they don't need to be.

Related issues

  • Fixes #[issue number here]

Backwards compatibility

Brief explanation of why these changes are/are not backwards compatible.

Documentation

The set of community facing docs that have been added/modified because of this change


Note

Medium Risk
Medium risk because it significantly changes CI runner configuration and test execution paths (Foundry version, devchain generation, removed e2e matrices), which could cause build/test regressions if assumptions differ across environments.

Overview
Refactors the repo toward a core-contracts-only footprint by removing the packages/celotool package, legacy testnet env files/genesis artifacts, and deprecated container build configs (e.g., cloudbuild.yaml, celotool/metadata-crawler Dockerfiles), plus simplifying ignores (.dockerignore, .gitignore, .prettierignore).

Updates CI/CD to match the new focus: bumps NODE_MODULE_CACHE_VERSION, switches runners/containers, pins Foundry to v1.0.0, installs forge deps where needed, updates devchain/release tags to core-contracts.v14.anvil, and trims the test matrix (e.g., removes celotool e2e geth matrix, consolidates protocol tests to test:ts, uses L2 anvil devchain scripts). Container workflow is simplified and reusable workflow version bumped.

Adds AI/editor guidance via .cursor/skills (release + node cache update playbooks), CLAUDE.md, and updates repository metadata/docs (README rewrite, CODEOWNERS default team change, contributing link fixes, minor doc link corrections, disable git submodule detection in VSCode).

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

Danyylka and others added 30 commits May 27, 2025 19:08
Update README-dev.md
* Fix typos in developer_key_publishing.md

* Fix typos in README-dev.md

* Fix typos in packages/protocol/releaseData/README.md

* Fix typos in packages/metadata-crawler/README.md

* Fix typos in packages/helm-charts/testnet/README.md

* Fix typos in packages/helm-charts/celostats/README.md
)

Co-authored-by: pinegreene <alex@greenestreet.xyz>
Co-authored-by: Victoria <4222953+lvpeschke@users.noreply.github.com>
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Victoria <4222953+lvpeschke@users.noreply.github.com>
)

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* update GH WF

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* L2 Staking and Voting (#11034)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* set EpochSize on L2

* allow voting and activating

* move election test contract to vote dir

* updated test to allow testing of L2 with no reward distribution

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* lint: function order

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* initial validators contract review

* Remove block gas limit flag for `governance/voting` CI tests

* bump version

* ++ tests && format

* removed comments

* getValidatorGroupSlashingMultiplier allowed only on L1

* reverting changes to test contract size issue

* minimal changes

* allow slashing multiplier reset on L2

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* COP, KES, USDT Oracle config (#10984)

* Yaml file drafts

* Update COPUSD Config

* Update KESUSD and rename USDKES.yaml to KESUSD.yaml

* Rename USDCOP.yaml to COPUSD.yaml

* Adding KESUSD data source

* CELOKES and KESUSD config

* chore: test USDTUSD config

* fix: remove openexchangerates from kesusd

* chore: add pair constants

* chore: add alfajores & baklava kesusd and usdtusd addresses

* fix: use pnpm instead of yarn

* fix: update min oracles for CELOKES

* chore: add mainnet kes hsms

* USDTUSD config from Nadiem

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* chore: latest deployed images

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* set celo-foundry to 0.5

* force CI test after changing PR base

---------

Co-authored-by: Nadiem Sissouno <53600650+sissnad@users.noreply.github.com>
Co-authored-by: Nadiem Sissouno <nadiem.sissouno@clabs.co>
Co-authored-by: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com>
Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Soloseng/update-celo-L2-distribution-logic (#11045)

* modified L2 CELO distribution logic

* rename functions

* ++ more name changes

* change more variable names

* ∆ gold to celo in contract

* contract rename

* forgotten names

* Celo token totalSupply() update (#11081)

* total supply update

* lint

* lint2

* hardcode L2toL1MessagePasser

* revert increaseSupply

* update goldtoken

* Update npm package versioning script to be compatible with other packages (#11041)

* updated script to allow for versioning devchain-anvil package

* run in PR as well

* reorg workflow to install node

* fixed utils test

* ++ workflow dispatch

* Soloseng/bytecode-tooling-fix (#11092)

* use the existing `build_artifacts` arg to also fetch 0.8 contracts

* git force run tests

* Create a ProxyFactory (#11095)

* Martinvol/fix interfaces migrations (#11084)

* Update README with Foundry version (#11097)

* Add Support for CeloToken Name in Registry (#11080)

* Updated Using registry v2

* using ICeloToken interface in distribution

* updated contracts to use `getCeloToken` instead of `getGoldToken`

* Changed `GOLD_TOKEN_REGISTRY_ID` to `CELO_TOKEN_REGISTRY_ID` throughtout repo

* fix tests

* replaced gold with celo

* updated migrations

* Bump version

* ++ celoToken & lockedCelo to registry during migration

* removed celoToken and LockedCelo from bytecode check

* update interface

* fixed LockedGold migration

* fix test

* ∆ gold name

* Soloseng/revert-celo-total-supply-changes (#11093)

* initial work

* accounting debug

* disable CELO transfers to celoDistribution schedule

* removed debug logs

* ++ celoDistributionSchedule to `usingRegistry` contract.

* Moved setting registry address to initialize function

* ∆ execution order

* updated release data

* updated variable name in test

* test fix

* ++ native transfer test

* refactor: reads supported Foundry version from an environment variable (#11046)

refactor(workflows): reads supported Foundry version from env variable

* Soloseng/publishing-version-fix (#11105)

* set override the default version

* ++ npm tag in workflow trigger

* PR feedback

* feat(foundry): publish L2 state in `@celo/devchain-anvil` (#11107)

* refactor(scripts/foundry): moves `run_e2e_tests...sh` file

Small house-keeping change to keep Foundry-related bash scripts organised in a single directory. This script doesn't seem to be called from anywhere, and doesn't have a yarn command in `package.json` so it was fine to move it without any changes in other files.

* feat(package.json): adds yarn commands for e2e and integration tests

Two helper commands to run two Foundry-related bash scripts during local development.

* refactor(migrations_sol): groups imports for better readability

* feat(scripts/foundry): adds MVP L2 migration script

Successfully deploys bytecode to `proxyAdminAddress`.
Does not yet dump state correctly, or call functions to active L2 correctly.

* feat(package.json): adds two helper yarn commands

1. `anvil-devchain:start-L2`: which creates and migrates an L2 devchain
2. `anvil-devchain:check-is-running`: which can be used to check that an anvil instance is running locally and serving at localhost:8546

* chore(migrations_sol): fix typo in function name

* chore(migrations_sol): nit simplifies code comment for better readability

* feat(scripts/foundry): activates CeloDistributionSchedule

Now successfully activates CeloDistributionSchedule.
Does not yet dump state correctly

* refactor(scripts/foundry): moves variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(scripts/foundry): moves more variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(constants.sh): read bytecode from Foundry instead of Truffle

* chore(scripts/foundry): adds TODO comment

At this point, the migration works as intended and the L2 is activated.
But, I haven't yet saved the devchain state file.
I'll need to refactor the way the L1 and L2 move the state file around.

* refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_devchain.sh`

To keep it consistent with the L1 script

* style(migrations_sol): linting

* chore(scripts/foundry): remove debugging statements

* refactor(constants): adds L1 and L2 state file names

* feat(scripts/foundry): successfully dumps L2 state

* refactor(constants): uses `$ANVIL_RPC_URL` instead of hardcoded URL

* refactor(constants): moves libraries to constants

* fix(constants): adds `$PWD` to prevent errors on CI

On CI it seems like `jq` doesn't find the artifacts without an explicit path

```sh
./scripts/foundry/create_and_migrate_anvil_devchain.sh
  shell: /usr/bin/bash -e {0}
  env:
    FOUNDRY_CACHE_KEY: 2
    SUPPORTED_FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
    ANVIL_PORT: 8546
jq: error: Could not open file build/contracts/Registry.json: No such file or directory
jq: error: Could not open file build/contracts/Proxy.json: No such file or directory
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9808280627/job/27083755032#step:18:9

* chore(workflows): debugging `jq` error on CI

Can't find build artifacts on CI, so trying to work out what might be wrong.

* fix(constants): moves bytecode operation back into scripts

Since the constants are read before any foundry compilation occured, the constants can't read from the Foundry artifacts. Locally, I missed this because I had existing artifacts from previous compilations.

* chore(workflows): debugging `jq` CI error

* fix(scripts/foundry): uses Foundry `out/` directory

Mistakenly read artifacts from Truffle's `build/` directory. Took a while to remember that Foundry write artifacts to `out/`.

Source: https://book.getfoundry.sh/reference/forge/forge-build#build-modes

* chore(scripts/foundry): removes debugging statement

* feat(package.json): updates yarn command names

* docs(CONTRIBUTING): updates yarn command docs

* chore(workflows): add back NPM install step

Not confident enough to remove it in this PR.

* chore(workflows): removes code comment

* feat(workflows): publishes L1 and L2 state

Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.

* fix(scripts/foundry): remove unnecessary `stop_anvil` call

CI doesn't like `lsof` command in `stop_anvil.sh`

```sh
/runner/_work/celo-monorepo/celo-monorepo/packages/protocol/scripts/foundry/stop_anvil.sh: line 10: lsof: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811181588/job/27092901761?pr=11107#step:19:7073

* refactor(workflows): replace CI env with variable from `constants.sh`

Simplifies code and makes it easier to update ports in a single place.

* fix(workflows): adds back `stop_anvil.sh` and installs `lsof` explicitly

CI fails if I don't explicitly kill an existing anvil server, so I decided to install `lsof` which is used by `stop_anvil.sh` to kill processes.

```sh
error binding to 127.0.0.1:8546: error creating server listener: Address already in use (os error 98)
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811346558/job/27093342967?pr=11107#step:20:30

* chore(scripts/foundry): removes code comment

* fix(workflows): install `lsof` in the same step

Not sure if that's the bug, but the last run where the installation and use was in different steps didn't work.

* fix(workflows): hacky fix to run L2 anvil

I'm struggling to terminate the previous anvil server and re-start a new anvil server at the same address (local host 8546).

I tried to work around cumbersome CI environment issues (`lsof` which we use to identify the process is not available on CI).

For now, as a quick fix, I'll start anvil at an arbitrary different port 8547 and run the test against that localhost 8547.

I'll need to refactor this better.

* refactor(scripts/foundry): simplifying `lsof` query to find PID

* fix(workflows): try to terminate anvil server again

* fix(workflows): hacky workaround to prevent Anvil bug when loading state

Starting L1 from scratch instead of JSON state to circumvent this Anvil bug https://github.com/foundry-rs/foundry/issues/7502.

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* feat(constants): set CeloDistributionSchedule initial balance to 700M CELO

Arbitrary amount chosen to be approximately equal to `GoldToken.totalSupply()` on the L1 Mainnet (695,313,643 CELO as of this commit). During the real L2 genesis, the VM will calculate and set an appropriate balance.

```sh
# Get address of GoldToken
$ cast call \
0x000000000000000000000000000000000000ce10 \
"getAddressForStringOrDie(string calldata identifier)(address)" \
"GoldToken" \
--rpc-url https://forno.celo.org
0x471EcE3750Da237f93B8E339c536989b8978a438

# Call `totalSupply()` on `GoldToken.sol`
$ cast call \
0x471EcE3750Da237f93B8E339c536989b8978a438 \
"totalSupply()(uint256)" \
--rpc-url https://forno.celo.org
695313643195035937058427065 [6.953e26]

# Convert units from wei to ether
$ cast to-unit 695313643195035937058427065 ether
695313643.195035937058427065
```

* docs(README): improves README

More context, examples, background, files in the package.

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* chore: update CeloDistributionSchedule initial balance (#11140)

chore(constant): fix CeloDistributionSchedule initial balance

* L2 Governance Hotfix (#11014)

* lint: function ordering

* Deprecate L1 hotfix;
Implement L2 hotfix;

* BUMP version

* prepare hotfix on L2

* cleanup

* ++ setters and checks

* ++ more test cases

* PR feedback

* PR feedback

* PR feedback

* resetHotfix is public

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* fixed inheritance

* added pretest check

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: Leszek Stachowski <leszek.stachowski@clabs.co>

* Added Check to CeloDistributionSchedule `activate` function (#11109)

* added check to activate function

* Updated function name

* changed the check to make sure that the address set in the goldToken contract is actually the celoDistributionSchedule contract address

* Use celoDistributionSchedule address set in registry instead of setting in CeloToken contract manually

* PR feedback

* ++ celo distribution schedule to registry

* updated path and added missing address to registry

* using 0.8 artifacts

* ++ comment

* test: `forge test` should be all green and exclude tests that require anvil (#11148)

* test(devchain/e2e): moves e2e demo test into new `devchain/` directory

This allows us to exclude all tests in the `devchain/` directory when running `forge test`

* test(devchain/migration): renames migration test to Migration.t.sol

Previously this was called Integration.t.sol, but that's not super obvious naming.

* feat(foundry.toml): excludes `/devchain` directory when running `forge test`

* feat(foundry.toml): adds profile for tests that require a devchain

The configs of this profile extend or overwrite the default profile. That means we can customise the `match_path` and `no_match_path` configs in that profile and run `forge test` with that profile by passing an environment variable `FOUNDRY_PROFILE=devchain`.

For example, once a devchain is serving at localhost:

```sh
FOUNDRY_PROFILE=devchain forge test -vvv \
--match-path "test-sol/devchain/e2e/*" \
--fork-url $ANVIL_RPC_URL
[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test-sol/devchain/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.92ms (2.35ms CPU time)

Ran 1 test suite in 164.71ms (12.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
```

* docs(devchain/README): adds documentation for future reference

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* Trigger Build

* docs(README): add note on devchain tests

Co-authored-by: Martín Volpe <volpe@clabs.co>

---------

Co-authored-by: alvarof2 <fernandez.f.alvaro@gmail.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* refactor: use constants across `test-sol/` and `migrations_sol/` (#11143)

* feat(test-sol/constants): adds registryAddress and proxyAdminAddress

* style(test-sol/constants): improves code comment

* refactor(test-sol/e2e/utils): use `REGISTRY_ADDRESS`

* refactor(migrations_sol): rename to `MigrationsConstants`

To avoid import clashes when importing `TestConstants` from `test-sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(test-sol): rename to `TestConstants`

To avoid import clashes when importing `MigrationsConstants` from `migrations_sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(Integration.t.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use constants

* refactor(Accounts.t.sol): use constants

* refactor(CeloDistributionSchedule): use constants in `setUp()`

* refactor(CeloDistributionSchedule): use constants across file

* test(CeloDistributionSchedule): revert to previous variable in broken test

This test fails with this change

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(REGISTRY_ADDRESS);
```

```sh
forge test -vvv \
--match-path "test-sol/unit/*"

Failing tests:
Encountered 1 failing test in test-sol/unit/common/CeloDistributionSchedule.t.sol:CeloDistributionScheduleTest_activate
[FAIL. Reason: call reverted as expected, but without data] test_Reverts_WhenRegistryNotUpdated() (gas: 1877202)

Encountered a total of 1 failing tests, 2202 tests succeeded
```

But, passes with this change:

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(PROXY_ADMIN_ADDRESS);
```

```sh
$ forge test -vvv \
--match-path "test-sol/unit/*"

# ...
Ran 360 test suites in 4.60s (11.71s CPU time): 2203 tests passed, 0 failed, 0 skipped (2203 total tests)
```

I can sort of see why that's the case. In the current `setUp()` function the L2 is activated by arbitrarily deploying `Registry.sol` bytecode to the `proxyAdminAddress`.

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/test-sol/unit/common/CeloDistributionSchedule.t.sol#L68-L75

My hunch is that this _empty_ Registry is then used in this test. Since it's empty these two `UsingRegistry()` getters fails as expected by this test

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/CeloDistributionSchedule.sol#L77-L79

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/UsingRegistry.sol#L82-L85

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts/common/Registry.sol#L49-L53

In my opinion, this is a janky way to test that the contract call reverts.

My reasoning and things I'd change:
1. `proxyAdminAddress` will not necessarily have `Registry` bytecode. _Any_ arbitrary bytecode activates the L2. So using that `proxyAdminAddress` is a valid `Registry` is not a good assumption.
2. I'd create a new purposely empty Registry in this test, so it's obvious to the reader why the test fails.
3. I'd update the test name since it's not obvious which contract the `Registry` is missing. Presumably it's the `CeloToken`, but it's not immediately obvious from the test name.

I'll probably fix this in a separate PR.

* refactor(FeeHandler.t.sol): use `REGISTRY_ADDRESS` constant

* refactor(GasPriceMinimum.t.sol): use constants

* refactor(GoldToken.t.sol): use `PROXY_ADMIN_ADDRESS`

* fix(test-sol): import forgotten `TestConstants`

All unit tests pass

```sh
forge test -vvv \
--match-path "test-sol/unit/*"
```

* refactor(IsL2Check.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(BlockchainParamters.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(EpochRewards.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(GovernanceSlasher.t.sol): use constants

* refactor(DoubleSigningSlasher.t.sol): use constants

* refactor(DowntimeSlasher.t.sol): use constants

* refactor(Validators.t.sol): use constants

* refactor(Election.t.sol): use constants

* refactor(LockedGold.t.sol): use constants

* refactor(ReleaseGold.t.sol): use constants

* refactor(Escrow.t.sol): use constants

* refactor(FederatedAttestations.t.sol): use constants

* refactor(OdisPayments.t.sol): use constants

* style(GasPriceMinimum.t.sol): move import to top

* style(Random.t.sol): use constants

* feat(migrations_sol): import constants

To avoid redefining them and having a variable name clash at compilation:

```sh
Error (9097): Identifier already declared.
  --> test-sol/constants.sol:28:3:
   |
28 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> migrations_sol/constants.sol:33:3:
   |
33 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```

* style(test-sol): linting

* chore(Governance.t.sol): updates to `TestConstants`

* chore(Election.t.sol): uses named import `{ Utils }` for readability

* chore(Governance.t.sol): updates to `TestConstants` in Contract

* refactor(CeloDistributionSchedule.t.sol):  use `REGISTRY_ADDRESS`

* test(CeloDistributionSchedule.t.sol): fix failing test due to merge conflict

I made a mistake when resolving a conflict earlier and committed too much.
This should fix the error, the test is all green now.

* test: migrate `FeeHandlerSeller.t.sol` to foundry (#11155)

* test(FeeHandlerSeller.t.sol): adds MVP contract outline

Test is currently failing

* test(FeeHandlerSeller.t.sol): use `GoldTokenMock` to work around missing transfer precompile

Test passes as expected ✅

* chore(FeeHandlerSeller.t.sol): remove unused code comments

* test(FeeHandlerSeller.t.sol): add test for revert when not owner

Test passes as expected ✅

* style(FeeHandlerSeller.t.sol): improve function naming

More explicit naming in compliance with VS code extension that suggests forge test naming.

* test(FeeHandlerSeller.t.sol): add test for setMinimumReports

Test passes as expected ✅

* test(FeeHandlerSeller.t.sol): refactor constants and simplify tests

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(FeeHandlerSeller.t.sol): remove unused imports

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(feehandlerseller.ts): deletes TS test

Fully migrated to foundry test.

* refactor(FeeHandlerSeller.t.sol): use arbitrary token address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test: migrate `UniswapFeeHandlerSeller.t.sol` to foundry (#11171)

* test(UniswapFeeHandlerSeller.t.sol): adds MVP test outline

First test passes as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for non-owner `setRouter` test

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for setting router to zero address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* chore(UniswapFeeHandlerSeller.t.sol): debugging `expectRevert`

I can't seem to get the contract to revert when the max number of routers are set per token. Although limit is hardcoded to 3, the `setRouter` function seems to accept more tokens than the limit.

```sh
Logs:
  Setting router 0
  Setting router 1
  Setting router 2
  Setting router 3
  Setting router 4
  Setting router 5
  Setting router 6
  Setting router 7
  Setting router 8
  Setting router 9
  Routers for token: 1
  ```

* fix(FeeHandlerSeller.t.sol): use distinct router addressees

Fixes a bug in the test where I couldn't trigger the expected revert.

* style(FeeHandlerSeller.t.sol): linting

* test(FeeHandlerSeller.t.sol): adds test for large list and applies linting

* refactor(FeeHandlerSeller.t.sol): removes setup() to improve readability

* chore(FeeHandlerSeller.t.sol): adds code comment for context

* test(uniswapfeehandlerseller.ts): removes TS test

Fully covered by newly added Foundry test `UniswapFeeHandlerSeller.t.sol`

* refactor: remove unused code comment in `Proxy.sol` (#11174)

* refactor(Proxy.sol): remove unused code comments

This code change makes a test fail:
test-sol/unit/common/ProxyFactory08.t.sol > test_verifyArtifacts

```sh
$ forge test

Failing tests:
Encountered 1 failing test in test-sol/unit/common/ProxyFactory08.t.sol:ProxyFactoryTest
[FAIL. Reason: panic: assertion failed (0x01)] test_verifyArtifacts() (gas: 188341)
```

I'm not 100% certain but it's maybe because the `packages/protocol/artifacts/Proxy/proxyInitCode0.5.17+commit.d19bba13.hex` artifact is derived from the contract with the code comments.

* refactor(ProxyFactory08.t.sol): simplify `getCode` arguments

This is semantically equivalent, see https://book.getfoundry.sh/cheatcodes/get-code

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `bytecode.object.`

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `deployedBytecode.object.`

* docs(artifacts/Proxy/README): adds a note for future reference

* style(artifacts/Proxy/README): fix typo

* style(artifacts/Proxy/README): fix typo

* refactor: uses `L2Migration.s.sol` and simplifies migration script (#11177)

* refactor(constants.sh): renames target contract variable for better readability

* fix(interfaces/ICeloDistributionSchedule): removes 1 argument from `activate` function

As far as I can see, this interface was not defined correctly and had an argument too much.

* refactor(MigrationL2.s.sol): moves `activate` call to script and refactors bash file

Left two TODO comments.

* refactor(constants): uses `DEPLOYER_ACCOUNT`

* refactor(constant.sh): removes anvil private key (not used anymore)

* refactor(Migrations.s.sol): add `setupUsingRegistry()` to improve readability

* style(scripts/foundry): indent lines that don't start a command

* feat(IEpochRewards): adds new interface

* feat(UsingRegistry): adds EpochRewards

* refactor(MigrationL2): gets fractions from EpochRewards.sol

* chore(MigrationL2): delete console.log import

* chore(MigrationL2): deletes `TODO` comment

* style(protocol): linting

* Test celo-monorepo.yml trigger filters

* Remove useless workflow triggers

* Run on repository runners

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>

* Anvil migrations: use stable symbols (#11193)

* L2 devchain fix (#11200)

* L2 devchain fix

* fixes

* artifact fixes

* [DO NOT MERGE] Epoch manager WIP (#11189)

* Fix anvil devchain generation (#11226)

* Get epoch info of specified epoch (#11231)

* EpochManager FinishNextEpochProcessing unit tests (#11233)

* Bring back some functions removed since CR11 (#11239)

* Bring back getHotfixRecord function

* Bring back getMaxGroupSize

* Bring back getRegisteredValidatorSigners

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Epoch Manager "finishNextEpochProcessing"  gas test (#11240)

* Gas usage test

* prettify

* Isolate test run

* removal of struct

* Update gas test

* prettify

* refactor test a bit

* added another gas test

* prettify

* Don't update SortedLinkedList pointers when not necessary (#11241)

* Truffle works with anvil (#11230)

* Score manager gas optimization (#11246)

* Score manager gas optimization

* prettify

* PR comments

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Add score manager setter role (#11244)

* Fix buyback and add fee split (#11234)

* Make Governance slasher able to remove validator and decrease slash m… (#11245)

* Adds backwards compatibility in `UsingPrecompile` contract.  (#11236)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>
Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Finish epoch processing split (#11243)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Finish epoch processing split

* FinishEpochProcessing split e2e test

* setToProcessGroups unit tests

* process group unit tests

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

* prettify

* Pr comments

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* Prevent CELO Transfer to Unreleased Treasury (#11222)

* first compiling draft
no working test.

Co-authored-by: Martín Volpe <martinvol@users.noreply.github.com>

* Compiler fixes + finishNextEpochProcess

* allocateValidatorsRewards compilable

* First few tests

* test fix

* uisng registry instead

* updated registry ID var names

* typo

* ++ mock contracts in 0.8

* ++ passing test using mock

* Removal of using precompiles

* ScoreManager refactor

* Decouple epoch manage…
* Reenable the optimizer

Before Foundry 1.0, the optimizer was turned on by default. So upgrading
from a pre-1.0 nightly build to 1.0 disabled the optimizer. This PR
reenables it in foundry.toml.

* Temporarily disable failing unit tests

* Expect a same-depth reversion from failed transfer

* Expect a same-depth reversion in selfdestruct tests

* Use assertDoesNotEmit instead of testFail

* Use assertDoesNotEmit instead of testFail

* Broadcast library deployments

* Specify the use of Foundry 1.0

* Remove note about deprecated testFail

* Clean up unnecessary newlines

* Use foundry 1.0 in GH workflows

* bump version

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
* Add `getCurrentValidatorSigners` L2 Support (#11317)

* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* update GH WF

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* L2 Staking and Voting (#11034)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* set EpochSize on L2

* allow voting and activating

* move election test contract to vote dir

* updated test to allow testing of L2 with no reward distribution

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* lint: function order

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* initial validators contract review

* Remove block gas limit flag for `governance/voting` CI tests

* bump version

* ++ tests && format

* removed comments

* getValidatorGroupSlashingMultiplier allowed only on L1

* reverting changes to test contract size issue

* minimal changes

* allow slashing multiplier reset on L2

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* COP, KES, USDT Oracle config (#10984)

* Yaml file drafts

* Update COPUSD Config

* Update KESUSD and rename USDKES.yaml to KESUSD.yaml

* Rename USDCOP.yaml to COPUSD.yaml

* Adding KESUSD data source

* CELOKES and KESUSD config

* chore: test USDTUSD config

* fix: remove openexchangerates from kesusd

* chore: add pair constants

* chore: add alfajores & baklava kesusd and usdtusd addresses

* fix: use pnpm instead of yarn

* fix: update min oracles for CELOKES

* chore: add mainnet kes hsms

* USDTUSD config from Nadiem

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* chore: latest deployed images

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* set celo-foundry to 0.5

* force CI test after changing PR base

---------

Co-authored-by: Nadiem Sissouno <53600650+sissnad@users.noreply.github.com>
Co-authored-by: Nadiem Sissouno <nadiem.sissouno@clabs.co>
Co-authored-by: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com>
Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Soloseng/update-celo-L2-distribution-logic (#11045)

* modified L2 CELO distribution logic

* rename functions

* ++ more name changes

* change more variable names

* ∆ gold to celo in contract

* contract rename

* forgotten names

* Celo token totalSupply() update (#11081)

* total supply update

* lint

* lint2

* hardcode L2toL1MessagePasser

* revert increaseSupply

* update goldtoken

* Update npm package versioning script to be compatible with other packages (#11041)

* updated script to allow for versioning devchain-anvil package

* run in PR as well

* reorg workflow to install node

* fixed utils test

* ++ workflow dispatch

* Soloseng/bytecode-tooling-fix (#11092)

* use the existing `build_artifacts` arg to also fetch 0.8 contracts

* git force run tests

* Create a ProxyFactory (#11095)

* Martinvol/fix interfaces migrations (#11084)

* Update README with Foundry version (#11097)

* Add Support for CeloToken Name in Registry (#11080)

* Updated Using registry v2

* using ICeloToken interface in distribution

* updated contracts to use `getCeloToken` instead of `getGoldToken`

* Changed `GOLD_TOKEN_REGISTRY_ID` to `CELO_TOKEN_REGISTRY_ID` throughtout repo

* fix tests

* replaced gold with celo

* updated migrations

* Bump version

* ++ celoToken & lockedCelo to registry during migration

* removed celoToken and LockedCelo from bytecode check

* update interface

* fixed LockedGold migration

* fix test

* ∆ gold name

* Soloseng/revert-celo-total-supply-changes (#11093)

* initial work

* accounting debug

* disable CELO transfers to celoDistribution schedule

* removed debug logs

* ++ celoDistributionSchedule to `usingRegistry` contract.

* Moved setting registry address to initialize function

* ∆ execution order

* updated release data

* updated variable name in test

* test fix

* ++ native transfer test

* refactor: reads supported Foundry version from an environment variable (#11046)

refactor(workflows): reads supported Foundry version from env variable

* Soloseng/publishing-version-fix (#11105)

* set override the default version

* ++ npm tag in workflow trigger

* PR feedback

* feat(foundry): publish L2 state in `@celo/devchain-anvil` (#11107)

* refactor(scripts/foundry): moves `run_e2e_tests...sh` file

Small house-keeping change to keep Foundry-related bash scripts organised in a single directory. This script doesn't seem to be called from anywhere, and doesn't have a yarn command in `package.json` so it was fine to move it without any changes in other files.

* feat(package.json): adds yarn commands for e2e and integration tests

Two helper commands to run two Foundry-related bash scripts during local development.

* refactor(migrations_sol): groups imports for better readability

* feat(scripts/foundry): adds MVP L2 migration script

Successfully deploys bytecode to `proxyAdminAddress`.
Does not yet dump state correctly, or call functions to active L2 correctly.

* feat(package.json): adds two helper yarn commands

1. `anvil-devchain:start-L2`: which creates and migrates an L2 devchain
2. `anvil-devchain:check-is-running`: which can be used to check that an anvil instance is running locally and serving at localhost:8546

* chore(migrations_sol): fix typo in function name

* chore(migrations_sol): nit simplifies code comment for better readability

* feat(scripts/foundry): activates CeloDistributionSchedule

Now successfully activates CeloDistributionSchedule.
Does not yet dump state correctly

* refactor(scripts/foundry): moves variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(scripts/foundry): moves more variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(constants.sh): read bytecode from Foundry instead of Truffle

* chore(scripts/foundry): adds TODO comment

At this point, the migration works as intended and the L2 is activated.
But, I haven't yet saved the devchain state file.
I'll need to refactor the way the L1 and L2 move the state file around.

* refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_devchain.sh`

To keep it consistent with the L1 script

* style(migrations_sol): linting

* chore(scripts/foundry): remove debugging statements

* refactor(constants): adds L1 and L2 state file names

* feat(scripts/foundry): successfully dumps L2 state

* refactor(constants): uses `$ANVIL_RPC_URL` instead of hardcoded URL

* refactor(constants): moves libraries to constants

* fix(constants): adds `$PWD` to prevent errors on CI

On CI it seems like `jq` doesn't find the artifacts without an explicit path

```sh
./scripts/foundry/create_and_migrate_anvil_devchain.sh
  shell: /usr/bin/bash -e {0}
  env:
    FOUNDRY_CACHE_KEY: 2
    SUPPORTED_FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
    ANVIL_PORT: 8546
jq: error: Could not open file build/contracts/Registry.json: No such file or directory
jq: error: Could not open file build/contracts/Proxy.json: No such file or directory
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9808280627/job/27083755032#step:18:9

* chore(workflows): debugging `jq` error on CI

Can't find build artifacts on CI, so trying to work out what might be wrong.

* fix(constants): moves bytecode operation back into scripts

Since the constants are read before any foundry compilation occured, the constants can't read from the Foundry artifacts. Locally, I missed this because I had existing artifacts from previous compilations.

* chore(workflows): debugging `jq` CI error

* fix(scripts/foundry): uses Foundry `out/` directory

Mistakenly read artifacts from Truffle's `build/` directory. Took a while to remember that Foundry write artifacts to `out/`.

Source: https://book.getfoundry.sh/reference/forge/forge-build#build-modes

* chore(scripts/foundry): removes debugging statement

* feat(package.json): updates yarn command names

* docs(CONTRIBUTING): updates yarn command docs

* chore(workflows): add back NPM install step

Not confident enough to remove it in this PR.

* chore(workflows): removes code comment

* feat(workflows): publishes L1 and L2 state

Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.

* fix(scripts/foundry): remove unnecessary `stop_anvil` call

CI doesn't like `lsof` command in `stop_anvil.sh`

```sh
/runner/_work/celo-monorepo/celo-monorepo/packages/protocol/scripts/foundry/stop_anvil.sh: line 10: lsof: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811181588/job/27092901761?pr=11107#step:19:7073

* refactor(workflows): replace CI env with variable from `constants.sh`

Simplifies code and makes it easier to update ports in a single place.

* fix(workflows): adds back `stop_anvil.sh` and installs `lsof` explicitly

CI fails if I don't explicitly kill an existing anvil server, so I decided to install `lsof` which is used by `stop_anvil.sh` to kill processes.

```sh
error binding to 127.0.0.1:8546: error creating server listener: Address already in use (os error 98)
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811346558/job/27093342967?pr=11107#step:20:30

* chore(scripts/foundry): removes code comment

* fix(workflows): install `lsof` in the same step

Not sure if that's the bug, but the last run where the installation and use was in different steps didn't work.

* fix(workflows): hacky fix to run L2 anvil

I'm struggling to terminate the previous anvil server and re-start a new anvil server at the same address (local host 8546).

I tried to work around cumbersome CI environment issues (`lsof` which we use to identify the process is not available on CI).

For now, as a quick fix, I'll start anvil at an arbitrary different port 8547 and run the test against that localhost 8547.

I'll need to refactor this better.

* refactor(scripts/foundry): simplifying `lsof` query to find PID

* fix(workflows): try to terminate anvil server again

* fix(workflows): hacky workaround to prevent Anvil bug when loading state

Starting L1 from scratch instead of JSON state to circumvent this Anvil bug https://github.com/foundry-rs/foundry/issues/7502.

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* feat(constants): set CeloDistributionSchedule initial balance to 700M CELO

Arbitrary amount chosen to be approximately equal to `GoldToken.totalSupply()` on the L1 Mainnet (695,313,643 CELO as of this commit). During the real L2 genesis, the VM will calculate and set an appropriate balance.

```sh
$ cast call \
0x000000000000000000000000000000000000ce10 \
"getAddressForStringOrDie(string calldata identifier)(address)" \
"GoldToken" \
--rpc-url https://forno.celo.org
0x471EcE3750Da237f93B8E339c536989b8978a438

$ cast call \
0x471EcE3750Da237f93B8E339c536989b8978a438 \
"totalSupply()(uint256)" \
--rpc-url https://forno.celo.org
695313643195035937058427065 [6.953e26]

$ cast to-unit 695313643195035937058427065 ether
695313643.195035937058427065
```

* docs(README): improves README

More context, examples, background, files in the package.

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* chore: update CeloDistributionSchedule initial balance (#11140)

chore(constant): fix CeloDistributionSchedule initial balance

* L2 Governance Hotfix (#11014)

* lint: function ordering

* Deprecate L1 hotfix;
Implement L2 hotfix;

* BUMP version

* prepare hotfix on L2

* cleanup

* ++ setters and checks

* ++ more test cases

* PR feedback

* PR feedback

* PR feedback

* resetHotfix is public

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* fixed inheritance

* added pretest check

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: Leszek Stachowski <leszek.stachowski@clabs.co>

* Added Check to CeloDistributionSchedule `activate` function (#11109)

* added check to activate function

* Updated function name

* changed the check to make sure that the address set in the goldToken contract is actually the celoDistributionSchedule contract address

* Use celoDistributionSchedule address set in registry instead of setting in CeloToken contract manually

* PR feedback

* ++ celo distribution schedule to registry

* updated path and added missing address to registry

* using 0.8 artifacts

* ++ comment

* test: `forge test` should be all green and exclude tests that require anvil (#11148)

* test(devchain/e2e): moves e2e demo test into new `devchain/` directory

This allows us to exclude all tests in the `devchain/` directory when running `forge test`

* test(devchain/migration): renames migration test to Migration.t.sol

Previously this was called Integration.t.sol, but that's not super obvious naming.

* feat(foundry.toml): excludes `/devchain` directory when running `forge test`

* feat(foundry.toml): adds profile for tests that require a devchain

The configs of this profile extend or overwrite the default profile. That means we can customise the `match_path` and `no_match_path` configs in that profile and run `forge test` with that profile by passing an environment variable `FOUNDRY_PROFILE=devchain`.

For example, once a devchain is serving at localhost:

```sh
FOUNDRY_PROFILE=devchain forge test -vvv \
--match-path "test-sol/devchain/e2e/*" \
--fork-url $ANVIL_RPC_URL
[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test-sol/devchain/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.92ms (2.35ms CPU time)

Ran 1 test suite in 164.71ms (12.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
```

* docs(devchain/README): adds documentation for future reference

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* Trigger Build

* docs(README): add note on devchain tests

Co-authored-by: Martín Volpe <volpe@clabs.co>

---------

Co-authored-by: alvarof2 <fernandez.f.alvaro@gmail.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* refactor: use constants across `test-sol/` and `migrations_sol/` (#11143)

* feat(test-sol/constants): adds registryAddress and proxyAdminAddress

* style(test-sol/constants): improves code comment

* refactor(test-sol/e2e/utils): use `REGISTRY_ADDRESS`

* refactor(migrations_sol): rename to `MigrationsConstants`

To avoid import clashes when importing `TestConstants` from `test-sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(test-sol): rename to `TestConstants`

To avoid import clashes when importing `MigrationsConstants` from `migrations_sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(Integration.t.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use constants

* refactor(Accounts.t.sol): use constants

* refactor(CeloDistributionSchedule): use constants in `setUp()`

* refactor(CeloDistributionSchedule): use constants across file

* test(CeloDistributionSchedule): revert to previous variable in broken test

This test fails with this change

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(REGISTRY_ADDRESS);
```

```sh
forge test -vvv \
--match-path "test-sol/unit/*"

Failing tests:
Encountered 1 failing test in test-sol/unit/common/CeloDistributionSchedule.t.sol:CeloDistributionScheduleTest_activate
[FAIL. Reason: call reverted as expected, but without data] test_Reverts_WhenRegistryNotUpdated() (gas: 1877202)

Encountered a total of 1 failing tests, 2202 tests succeeded
```

But, passes with this change:

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(PROXY_ADMIN_ADDRESS);
```

```sh
$ forge test -vvv \
--match-path "test-sol/unit/*"

Ran 360 test suites in 4.60s (11.71s CPU time): 2203 tests passed, 0 failed, 0 skipped (2203 total tests)
```

I can sort of see why that's the case. In the current `setUp()` function the L2 is activated by arbitrarily deploying `Registry.sol` bytecode to the `proxyAdminAddress`.

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/test-sol/unit/common/CeloDistributionSchedule.t.sol#L68-L75

My hunch is that this _empty_ Registry is then used in this test. Since it's empty these two `UsingRegistry()` getters fails as expected by this test

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/CeloDistributionSchedule.sol#L77-L79

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/UsingRegistry.sol#L82-L85

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts/common/Registry.sol#L49-L53

In my opinion, this is a janky way to test that the contract call reverts.

My reasoning and things I'd change:
1. `proxyAdminAddress` will not necessarily have `Registry` bytecode. _Any_ arbitrary bytecode activates the L2. So using that `proxyAdminAddress` is a valid `Registry` is not a good assumption.
2. I'd create a new purposely empty Registry in this test, so it's obvious to the reader why the test fails.
3. I'd update the test name since it's not obvious which contract the `Registry` is missing. Presumably it's the `CeloToken`, but it's not immediately obvious from the test name.

I'll probably fix this in a separate PR.

* refactor(FeeHandler.t.sol): use `REGISTRY_ADDRESS` constant

* refactor(GasPriceMinimum.t.sol): use constants

* refactor(GoldToken.t.sol): use `PROXY_ADMIN_ADDRESS`

* fix(test-sol): import forgotten `TestConstants`

All unit tests pass

```sh
forge test -vvv \
--match-path "test-sol/unit/*"
```

* refactor(IsL2Check.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(BlockchainParamters.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(EpochRewards.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(GovernanceSlasher.t.sol): use constants

* refactor(DoubleSigningSlasher.t.sol): use constants

* refactor(DowntimeSlasher.t.sol): use constants

* refactor(Validators.t.sol): use constants

* refactor(Election.t.sol): use constants

* refactor(LockedGold.t.sol): use constants

* refactor(ReleaseGold.t.sol): use constants

* refactor(Escrow.t.sol): use constants

* refactor(FederatedAttestations.t.sol): use constants

* refactor(OdisPayments.t.sol): use constants

* style(GasPriceMinimum.t.sol): move import to top

* style(Random.t.sol): use constants

* feat(migrations_sol): import constants

To avoid redefining them and having a variable name clash at compilation:

```sh
Error (9097): Identifier already declared.
  --> test-sol/constants.sol:28:3:
   |
28 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> migrations_sol/constants.sol:33:3:
   |
33 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```

* style(test-sol): linting

* chore(Governance.t.sol): updates to `TestConstants`

* chore(Election.t.sol): uses named import `{ Utils }` for readability

* chore(Governance.t.sol): updates to `TestConstants` in Contract

* refactor(CeloDistributionSchedule.t.sol):  use `REGISTRY_ADDRESS`

* test(CeloDistributionSchedule.t.sol): fix failing test due to merge conflict

I made a mistake when resolving a conflict earlier and committed too much.
This should fix the error, the test is all green now.

* test: migrate `FeeHandlerSeller.t.sol` to foundry (#11155)

* test(FeeHandlerSeller.t.sol): adds MVP contract outline

Test is currently failing

* test(FeeHandlerSeller.t.sol): use `GoldTokenMock` to work around missing transfer precompile

Test passes as expected ✅

* chore(FeeHandlerSeller.t.sol): remove unused code comments

* test(FeeHandlerSeller.t.sol): add test for revert when not owner

Test passes as expected ✅

* style(FeeHandlerSeller.t.sol): improve function naming

More explicit naming in compliance with VS code extension that suggests forge test naming.

* test(FeeHandlerSeller.t.sol): add test for setMinimumReports

Test passes as expected ✅

* test(FeeHandlerSeller.t.sol): refactor constants and simplify tests

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(FeeHandlerSeller.t.sol): remove unused imports

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(feehandlerseller.ts): deletes TS test

Fully migrated to foundry test.

* refactor(FeeHandlerSeller.t.sol): use arbitrary token address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test: migrate `UniswapFeeHandlerSeller.t.sol` to foundry (#11171)

* test(UniswapFeeHandlerSeller.t.sol): adds MVP test outline

First test passes as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for non-owner `setRouter` test

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for setting router to zero address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* chore(UniswapFeeHandlerSeller.t.sol): debugging `expectRevert`

I can't seem to get the contract to revert when the max number of routers are set per token. Although limit is hardcoded to 3, the `setRouter` function seems to accept more tokens than the limit.

```sh
Logs:
  Setting router 0
  Setting router 1
  Setting router 2
  Setting router 3
  Setting router 4
  Setting router 5
  Setting router 6
  Setting router 7
  Setting router 8
  Setting router 9
  Routers for token: 1
  ```

* fix(FeeHandlerSeller.t.sol): use distinct router addressees

Fixes a bug in the test where I couldn't trigger the expected revert.

* style(FeeHandlerSeller.t.sol): linting

* test(FeeHandlerSeller.t.sol): adds test for large list and applies linting

* refactor(FeeHandlerSeller.t.sol): removes setup() to improve readability

* chore(FeeHandlerSeller.t.sol): adds code comment for context

* test(uniswapfeehandlerseller.ts): removes TS test

Fully covered by newly added Foundry test `UniswapFeeHandlerSeller.t.sol`

* refactor: remove unused code comment in `Proxy.sol` (#11174)

* refactor(Proxy.sol): remove unused code comments

This code change makes a test fail:
test-sol/unit/common/ProxyFactory08.t.sol > test_verifyArtifacts

```sh
$ forge test

Failing tests:
Encountered 1 failing test in test-sol/unit/common/ProxyFactory08.t.sol:ProxyFactoryTest
[FAIL. Reason: panic: assertion failed (0x01)] test_verifyArtifacts() (gas: 188341)
```

I'm not 100% certain but it's maybe because the `packages/protocol/artifacts/Proxy/proxyInitCode0.5.17+commit.d19bba13.hex` artifact is derived from the contract with the code comments.

* refactor(ProxyFactory08.t.sol): simplify `getCode` arguments

This is semantically equivalent, see https://book.getfoundry.sh/cheatcodes/get-code

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `bytecode.object.`

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `deployedBytecode.object.`

* docs(artifacts/Proxy/README): adds a note for future reference

* style(artifacts/Proxy/README): fix typo

* style(artifacts/Proxy/README): fix typo

* refactor: uses `L2Migration.s.sol` and simplifies migration script (#11177)

* refactor(constants.sh): renames target contract variable for better readability

* fix(interfaces/ICeloDistributionSchedule): removes 1 argument from `activate` function

As far as I can see, this interface was not defined correctly and had an argument too much.

* refactor(MigrationL2.s.sol): moves `activate` call to script and refactors bash file

Left two TODO comments.

* refactor(constants): uses `DEPLOYER_ACCOUNT`

* refactor(constant.sh): removes anvil private key (not used anymore)

* refactor(Migrations.s.sol): add `setupUsingRegistry()` to improve readability

* style(scripts/foundry): indent lines that don't start a command

* feat(IEpochRewards): adds new interface

* feat(UsingRegistry): adds EpochRewards

* refactor(MigrationL2): gets fractions from EpochRewards.sol

* chore(MigrationL2): delete console.log import

* chore(MigrationL2): deletes `TODO` comment

* style(protocol): linting

* Test celo-monorepo.yml trigger filters

* Remove useless workflow triggers

* Run on repository runners

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>

* Anvil migrations: use stable symbols (#11193)

* L2 devchain fix (#11200)

* L2 devchain fix

* fixes

* artifact fixes

* [DO NOT MERGE] Epoch manager WIP (#11189)

* Fix anvil devchain generation (#11226)

* Get epoch info of specified epoch (#11231)

* EpochManager FinishNextEpochProcessing unit tests (#11233)

* Bring back some functions removed since CR11 (#11239)

* Bring back getHotfixRecord function

* Bring back getMaxGroupSize

* Bring back getRegisteredValidatorSigners

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Epoch Manager "finishNextEpochProcessing"  gas test (#11240)

* Gas usage test

* prettify

* Isolate test run

* removal of struct

* Update gas test

* prettify

* refactor test a bit

* added another gas test

* prettify

* Don't update SortedLinkedList pointers when not necessary (#11241)

* Truffle works with anvil (#11230)

* Score manager gas optimization (#11246)

* Score manager gas optimization

* prettify

* PR comments

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Add score manager setter role (#11244)

* Fix buyback and add fee split (#11234)

* Make Governance slasher able to remove validator and decrease slash m… (#11245)

* Adds backwards compatibility in `UsingPrecompile` contract.  (#11236)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>
Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Finish epoch processing split (#11243)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Finish epoch processing split

* FinishEpochProcessing split e2e test

* setToProcessGroups unit tests

* process group unit tests

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

* prettify

* Pr comments

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* Prevent CELO Transfer to Unreleased Treasury (#11222)

* first compiling draft
no working test.

Co-authored-by: Martín Volpe <martinvol@users.noreply.github.com>

* Compiler fixes + finishNextEpochProcess

* allocateValidatorsRewards compilable

* First few tests

* test fix

* uisng registry instead

* updated registry ID var names

* typo

* ++ mock contracts in 0.8

* ++ passing test using mock

* Removal of using precompiles

* ScoreManager refactor

* Decouple epoch manager initializer from reg…

* fix version

* Deprecate L1 functions celoToken (#11346)

* deprecate L1 functions for CeloToken

* rename old tests

* BUMP version

* Bump to CR12

* change to using allocated supply

* disable Governance e2e test

* remove isL2Check contract

* -- comments

* consolidate L2 setup contracts

* fix version

* updated test name

* trigger PR on this branch

* BUMP version

* Deprecate-L1-functions-election (#11353)

* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
forge test --match-path "*test-sol/unit/*"

forge test --match-path "*test-sol/e2e/*"

forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
t…
* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* update GH WF

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* L2 Staking and Voting (#11034)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* set EpochSize on L2

* allow voting and activating

* move election test contract to vote dir

* updated test to allow testing of L2 with no reward distribution

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* lint: function order

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* initial validators contract review

* Remove block gas limit flag for `governance/voting` CI tests

* bump version

* ++ tests && format

* removed comments

* getValidatorGroupSlashingMultiplier allowed only on L1

* reverting changes to test contract size issue

* minimal changes

* allow slashing multiplier reset on L2

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* COP, KES, USDT Oracle config (#10984)

* Yaml file drafts

* Update COPUSD Config

* Update KESUSD and rename USDKES.yaml to KESUSD.yaml

* Rename USDCOP.yaml to COPUSD.yaml

* Adding KESUSD data source

* CELOKES and KESUSD config

* chore: test USDTUSD config

* fix: remove openexchangerates from kesusd

* chore: add pair constants

* chore: add alfajores & baklava kesusd and usdtusd addresses

* fix: use pnpm instead of yarn

* fix: update min oracles for CELOKES

* chore: add mainnet kes hsms

* USDTUSD config from Nadiem

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* chore: latest deployed images

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* set celo-foundry to 0.5

* force CI test after changing PR base

---------

Co-authored-by: Nadiem Sissouno <53600650+sissnad@users.noreply.github.com>
Co-authored-by: Nadiem Sissouno <nadiem.sissouno@clabs.co>
Co-authored-by: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com>
Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Soloseng/update-celo-L2-distribution-logic (#11045)

* modified L2 CELO distribution logic

* rename functions

* ++ more name changes

* change more variable names

* ∆ gold to celo in contract

* contract rename

* forgotten names

* Celo token totalSupply() update (#11081)

* total supply update

* lint

* lint2

* hardcode L2toL1MessagePasser

* revert increaseSupply

* update goldtoken

* Update npm package versioning script to be compatible with other packages (#11041)

* updated script to allow for versioning devchain-anvil package

* run in PR as well

* reorg workflow to install node

* fixed utils test

* ++ workflow dispatch

* Soloseng/bytecode-tooling-fix (#11092)

* use the existing `build_artifacts` arg to also fetch 0.8 contracts

* git force run tests

* Create a ProxyFactory (#11095)

* Martinvol/fix interfaces migrations (#11084)

* Update README with Foundry version (#11097)

* Add Support for CeloToken Name in Registry (#11080)

* Updated Using registry v2

* using ICeloToken interface in distribution

* updated contracts to use `getCeloToken` instead of `getGoldToken`

* Changed `GOLD_TOKEN_REGISTRY_ID` to `CELO_TOKEN_REGISTRY_ID` throughtout repo

* fix tests

* replaced gold with celo

* updated migrations

* Bump version

* ++ celoToken & lockedCelo to registry during migration

* removed celoToken and LockedCelo from bytecode check

* update interface

* fixed LockedGold migration

* fix test

* ∆ gold name

* Soloseng/revert-celo-total-supply-changes (#11093)

* initial work

* accounting debug

* disable CELO transfers to celoDistribution schedule

* removed debug logs

* ++ celoDistributionSchedule to `usingRegistry` contract.

* Moved setting registry address to initialize function

* ∆ execution order

* updated release data

* updated variable name in test

* test fix

* ++ native transfer test

* refactor: reads supported Foundry version from an environment variable (#11046)

refactor(workflows): reads supported Foundry version from env variable

* Soloseng/publishing-version-fix (#11105)

* set override the default version

* ++ npm tag in workflow trigger

* PR feedback

* feat(foundry): publish L2 state in `@celo/devchain-anvil` (#11107)

* refactor(scripts/foundry): moves `run_e2e_tests...sh` file

Small house-keeping change to keep Foundry-related bash scripts organised in a single directory. This script doesn't seem to be called from anywhere, and doesn't have a yarn command in `package.json` so it was fine to move it without any changes in other files.

* feat(package.json): adds yarn commands for e2e and integration tests

Two helper commands to run two Foundry-related bash scripts during local development.

* refactor(migrations_sol): groups imports for better readability

* feat(scripts/foundry): adds MVP L2 migration script

Successfully deploys bytecode to `proxyAdminAddress`.
Does not yet dump state correctly, or call functions to active L2 correctly.

* feat(package.json): adds two helper yarn commands

1. `anvil-devchain:start-L2`: which creates and migrates an L2 devchain
2. `anvil-devchain:check-is-running`: which can be used to check that an anvil instance is running locally and serving at localhost:8546

* chore(migrations_sol): fix typo in function name

* chore(migrations_sol): nit simplifies code comment for better readability

* feat(scripts/foundry): activates CeloDistributionSchedule

Now successfully activates CeloDistributionSchedule.
Does not yet dump state correctly

* refactor(scripts/foundry): moves variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(scripts/foundry): moves more variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(constants.sh): read bytecode from Foundry instead of Truffle

* chore(scripts/foundry): adds TODO comment

At this point, the migration works as intended and the L2 is activated.
But, I haven't yet saved the devchain state file.
I'll need to refactor the way the L1 and L2 move the state file around.

* refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_devchain.sh`

To keep it consistent with the L1 script

* style(migrations_sol): linting

* chore(scripts/foundry): remove debugging statements

* refactor(constants): adds L1 and L2 state file names

* feat(scripts/foundry): successfully dumps L2 state

* refactor(constants): uses `$ANVIL_RPC_URL` instead of hardcoded URL

* refactor(constants): moves libraries to constants

* fix(constants): adds `$PWD` to prevent errors on CI

On CI it seems like `jq` doesn't find the artifacts without an explicit path

```sh
./scripts/foundry/create_and_migrate_anvil_devchain.sh
  shell: /usr/bin/bash -e {0}
  env:
    FOUNDRY_CACHE_KEY: 2
    SUPPORTED_FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
    ANVIL_PORT: 8546
jq: error: Could not open file build/contracts/Registry.json: No such file or directory
jq: error: Could not open file build/contracts/Proxy.json: No such file or directory
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9808280627/job/27083755032#step:18:9

* chore(workflows): debugging `jq` error on CI

Can't find build artifacts on CI, so trying to work out what might be wrong.

* fix(constants): moves bytecode operation back into scripts

Since the constants are read before any foundry compilation occured, the constants can't read from the Foundry artifacts. Locally, I missed this because I had existing artifacts from previous compilations.

* chore(workflows): debugging `jq` CI error

* fix(scripts/foundry): uses Foundry `out/` directory

Mistakenly read artifacts from Truffle's `build/` directory. Took a while to remember that Foundry write artifacts to `out/`.

Source: https://book.getfoundry.sh/reference/forge/forge-build#build-modes

* chore(scripts/foundry): removes debugging statement

* feat(package.json): updates yarn command names

* docs(CONTRIBUTING): updates yarn command docs

* chore(workflows): add back NPM install step

Not confident enough to remove it in this PR.

* chore(workflows): removes code comment

* feat(workflows): publishes L1 and L2 state

Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.

* fix(scripts/foundry): remove unnecessary `stop_anvil` call

CI doesn't like `lsof` command in `stop_anvil.sh`

```sh
/runner/_work/celo-monorepo/celo-monorepo/packages/protocol/scripts/foundry/stop_anvil.sh: line 10: lsof: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811181588/job/27092901761?pr=11107#step:19:7073

* refactor(workflows): replace CI env with variable from `constants.sh`

Simplifies code and makes it easier to update ports in a single place.

* fix(workflows): adds back `stop_anvil.sh` and installs `lsof` explicitly

CI fails if I don't explicitly kill an existing anvil server, so I decided to install `lsof` which is used by `stop_anvil.sh` to kill processes.

```sh
error binding to 127.0.0.1:8546: error creating server listener: Address already in use (os error 98)
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811346558/job/27093342967?pr=11107#step:20:30

* chore(scripts/foundry): removes code comment

* fix(workflows): install `lsof` in the same step

Not sure if that's the bug, but the last run where the installation and use was in different steps didn't work.

* fix(workflows): hacky fix to run L2 anvil

I'm struggling to terminate the previous anvil server and re-start a new anvil server at the same address (local host 8546).

I tried to work around cumbersome CI environment issues (`lsof` which we use to identify the process is not available on CI).

For now, as a quick fix, I'll start anvil at an arbitrary different port 8547 and run the test against that localhost 8547.

I'll need to refactor this better.

* refactor(scripts/foundry): simplifying `lsof` query to find PID

* fix(workflows): try to terminate anvil server again

* fix(workflows): hacky workaround to prevent Anvil bug when loading state

Starting L1 from scratch instead of JSON state to circumvent this Anvil bug https://github.com/foundry-rs/foundry/issues/7502.

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* feat(constants): set CeloDistributionSchedule initial balance to 700M CELO

Arbitrary amount chosen to be approximately equal to `GoldToken.totalSupply()` on the L1 Mainnet (695,313,643 CELO as of this commit). During the real L2 genesis, the VM will calculate and set an appropriate balance.

```sh
# Get address of GoldToken
$ cast call \
0x000000000000000000000000000000000000ce10 \
"getAddressForStringOrDie(string calldata identifier)(address)" \
"GoldToken" \
--rpc-url https://forno.celo.org
0x471EcE3750Da237f93B8E339c536989b8978a438

# Call `totalSupply()` on `GoldToken.sol`
$ cast call \
0x471EcE3750Da237f93B8E339c536989b8978a438 \
"totalSupply()(uint256)" \
--rpc-url https://forno.celo.org
695313643195035937058427065 [6.953e26]

# Convert units from wei to ether
$ cast to-unit 695313643195035937058427065 ether
695313643.195035937058427065
```

* docs(README): improves README

More context, examples, background, files in the package.

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* chore: update CeloDistributionSchedule initial balance (#11140)

chore(constant): fix CeloDistributionSchedule initial balance

* L2 Governance Hotfix (#11014)

* lint: function ordering

* Deprecate L1 hotfix;
Implement L2 hotfix;

* BUMP version

* prepare hotfix on L2

* cleanup

* ++ setters and checks

* ++ more test cases

* PR feedback

* PR feedback

* PR feedback

* resetHotfix is public

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* fixed inheritance

* added pretest check

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: Leszek Stachowski <leszek.stachowski@clabs.co>

* Added Check to CeloDistributionSchedule `activate` function (#11109)

* added check to activate function

* Updated function name

* changed the check to make sure that the address set in the goldToken contract is actually the celoDistributionSchedule contract address

* Use celoDistributionSchedule address set in registry instead of setting in CeloToken contract manually

* PR feedback

* ++ celo distribution schedule to registry

* updated path and added missing address to registry

* using 0.8 artifacts

* ++ comment

* test: `forge test` should be all green and exclude tests that require anvil (#11148)

* test(devchain/e2e): moves e2e demo test into new `devchain/` directory

This allows us to exclude all tests in the `devchain/` directory when running `forge test`

* test(devchain/migration): renames migration test to Migration.t.sol

Previously this was called Integration.t.sol, but that's not super obvious naming.

* feat(foundry.toml): excludes `/devchain` directory when running `forge test`

* feat(foundry.toml): adds profile for tests that require a devchain

The configs of this profile extend or overwrite the default profile. That means we can customise the `match_path` and `no_match_path` configs in that profile and run `forge test` with that profile by passing an environment variable `FOUNDRY_PROFILE=devchain`.

For example, once a devchain is serving at localhost:

```sh
FOUNDRY_PROFILE=devchain forge test -vvv \
--match-path "test-sol/devchain/e2e/*" \
--fork-url $ANVIL_RPC_URL
[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test-sol/devchain/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.92ms (2.35ms CPU time)

Ran 1 test suite in 164.71ms (12.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
```

* docs(devchain/README): adds documentation for future reference

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* Trigger Build

* docs(README): add note on devchain tests

Co-authored-by: Martín Volpe <volpe@clabs.co>

---------

Co-authored-by: alvarof2 <fernandez.f.alvaro@gmail.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* refactor: use constants across `test-sol/` and `migrations_sol/` (#11143)

* feat(test-sol/constants): adds registryAddress and proxyAdminAddress

* style(test-sol/constants): improves code comment

* refactor(test-sol/e2e/utils): use `REGISTRY_ADDRESS`

* refactor(migrations_sol): rename to `MigrationsConstants`

To avoid import clashes when importing `TestConstants` from `test-sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(test-sol): rename to `TestConstants`

To avoid import clashes when importing `MigrationsConstants` from `migrations_sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(Integration.t.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use constants

* refactor(Accounts.t.sol): use constants

* refactor(CeloDistributionSchedule): use constants in `setUp()`

* refactor(CeloDistributionSchedule): use constants across file

* test(CeloDistributionSchedule): revert to previous variable in broken test

This test fails with this change

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(REGISTRY_ADDRESS);
```

```sh
forge test -vvv \
--match-path "test-sol/unit/*"

Failing tests:
Encountered 1 failing test in test-sol/unit/common/CeloDistributionSchedule.t.sol:CeloDistributionScheduleTest_activate
[FAIL. Reason: call reverted as expected, but without data] test_Reverts_WhenRegistryNotUpdated() (gas: 1877202)

Encountered a total of 1 failing tests, 2202 tests succeeded
```

But, passes with this change:

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(PROXY_ADMIN_ADDRESS);
```

```sh
$ forge test -vvv \
--match-path "test-sol/unit/*"

# ...
Ran 360 test suites in 4.60s (11.71s CPU time): 2203 tests passed, 0 failed, 0 skipped (2203 total tests)
```

I can sort of see why that's the case. In the current `setUp()` function the L2 is activated by arbitrarily deploying `Registry.sol` bytecode to the `proxyAdminAddress`.

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/test-sol/unit/common/CeloDistributionSchedule.t.sol#L68-L75

My hunch is that this _empty_ Registry is then used in this test. Since it's empty these two `UsingRegistry()` getters fails as expected by this test

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/CeloDistributionSchedule.sol#L77-L79

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/UsingRegistry.sol#L82-L85

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts/common/Registry.sol#L49-L53

In my opinion, this is a janky way to test that the contract call reverts.

My reasoning and things I'd change:
1. `proxyAdminAddress` will not necessarily have `Registry` bytecode. _Any_ arbitrary bytecode activates the L2. So using that `proxyAdminAddress` is a valid `Registry` is not a good assumption.
2. I'd create a new purposely empty Registry in this test, so it's obvious to the reader why the test fails.
3. I'd update the test name since it's not obvious which contract the `Registry` is missing. Presumably it's the `CeloToken`, but it's not immediately obvious from the test name.

I'll probably fix this in a separate PR.

* refactor(FeeHandler.t.sol): use `REGISTRY_ADDRESS` constant

* refactor(GasPriceMinimum.t.sol): use constants

* refactor(GoldToken.t.sol): use `PROXY_ADMIN_ADDRESS`

* fix(test-sol): import forgotten `TestConstants`

All unit tests pass

```sh
forge test -vvv \
--match-path "test-sol/unit/*"
```

* refactor(IsL2Check.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(BlockchainParamters.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(EpochRewards.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(GovernanceSlasher.t.sol): use constants

* refactor(DoubleSigningSlasher.t.sol): use constants

* refactor(DowntimeSlasher.t.sol): use constants

* refactor(Validators.t.sol): use constants

* refactor(Election.t.sol): use constants

* refactor(LockedGold.t.sol): use constants

* refactor(ReleaseGold.t.sol): use constants

* refactor(Escrow.t.sol): use constants

* refactor(FederatedAttestations.t.sol): use constants

* refactor(OdisPayments.t.sol): use constants

* style(GasPriceMinimum.t.sol): move import to top

* style(Random.t.sol): use constants

* feat(migrations_sol): import constants

To avoid redefining them and having a variable name clash at compilation:

```sh
Error (9097): Identifier already declared.
  --> test-sol/constants.sol:28:3:
   |
28 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> migrations_sol/constants.sol:33:3:
   |
33 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```

* style(test-sol): linting

* chore(Governance.t.sol): updates to `TestConstants`

* chore(Election.t.sol): uses named import `{ Utils }` for readability

* chore(Governance.t.sol): updates to `TestConstants` in Contract

* refactor(CeloDistributionSchedule.t.sol):  use `REGISTRY_ADDRESS`

* test(CeloDistributionSchedule.t.sol): fix failing test due to merge conflict

I made a mistake when resolving a conflict earlier and committed too much.
This should fix the error, the test is all green now.

* test: migrate `FeeHandlerSeller.t.sol` to foundry (#11155)

* test(FeeHandlerSeller.t.sol): adds MVP contract outline

Test is currently failing

* test(FeeHandlerSeller.t.sol): use `GoldTokenMock` to work around missing transfer precompile

Test passes as expected ✅

* chore(FeeHandlerSeller.t.sol): remove unused code comments

* test(FeeHandlerSeller.t.sol): add test for revert when not owner

Test passes as expected ✅

* style(FeeHandlerSeller.t.sol): improve function naming

More explicit naming in compliance with VS code extension that suggests forge test naming.

* test(FeeHandlerSeller.t.sol): add test for setMinimumReports

Test passes as expected ✅

* test(FeeHandlerSeller.t.sol): refactor constants and simplify tests

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(FeeHandlerSeller.t.sol): remove unused imports

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(feehandlerseller.ts): deletes TS test

Fully migrated to foundry test.

* refactor(FeeHandlerSeller.t.sol): use arbitrary token address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test: migrate `UniswapFeeHandlerSeller.t.sol` to foundry (#11171)

* test(UniswapFeeHandlerSeller.t.sol): adds MVP test outline

First test passes as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for non-owner `setRouter` test

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for setting router to zero address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* chore(UniswapFeeHandlerSeller.t.sol): debugging `expectRevert`

I can't seem to get the contract to revert when the max number of routers are set per token. Although limit is hardcoded to 3, the `setRouter` function seems to accept more tokens than the limit.

```sh
Logs:
  Setting router 0
  Setting router 1
  Setting router 2
  Setting router 3
  Setting router 4
  Setting router 5
  Setting router 6
  Setting router 7
  Setting router 8
  Setting router 9
  Routers for token: 1
  ```

* fix(FeeHandlerSeller.t.sol): use distinct router addressees

Fixes a bug in the test where I couldn't trigger the expected revert.

* style(FeeHandlerSeller.t.sol): linting

* test(FeeHandlerSeller.t.sol): adds test for large list and applies linting

* refactor(FeeHandlerSeller.t.sol): removes setup() to improve readability

* chore(FeeHandlerSeller.t.sol): adds code comment for context

* test(uniswapfeehandlerseller.ts): removes TS test

Fully covered by newly added Foundry test `UniswapFeeHandlerSeller.t.sol`

* refactor: remove unused code comment in `Proxy.sol` (#11174)

* refactor(Proxy.sol): remove unused code comments

This code change makes a test fail:
test-sol/unit/common/ProxyFactory08.t.sol > test_verifyArtifacts

```sh
$ forge test

Failing tests:
Encountered 1 failing test in test-sol/unit/common/ProxyFactory08.t.sol:ProxyFactoryTest
[FAIL. Reason: panic: assertion failed (0x01)] test_verifyArtifacts() (gas: 188341)
```

I'm not 100% certain but it's maybe because the `packages/protocol/artifacts/Proxy/proxyInitCode0.5.17+commit.d19bba13.hex` artifact is derived from the contract with the code comments.

* refactor(ProxyFactory08.t.sol): simplify `getCode` arguments

This is semantically equivalent, see https://book.getfoundry.sh/cheatcodes/get-code

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `bytecode.object.`

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `deployedBytecode.object.`

* docs(artifacts/Proxy/README): adds a note for future reference

* style(artifacts/Proxy/README): fix typo

* style(artifacts/Proxy/README): fix typo

* refactor: uses `L2Migration.s.sol` and simplifies migration script (#11177)

* refactor(constants.sh): renames target contract variable for better readability

* fix(interfaces/ICeloDistributionSchedule): removes 1 argument from `activate` function

As far as I can see, this interface was not defined correctly and had an argument too much.

* refactor(MigrationL2.s.sol): moves `activate` call to script and refactors bash file

Left two TODO comments.

* refactor(constants): uses `DEPLOYER_ACCOUNT`

* refactor(constant.sh): removes anvil private key (not used anymore)

* refactor(Migrations.s.sol): add `setupUsingRegistry()` to improve readability

* style(scripts/foundry): indent lines that don't start a command

* feat(IEpochRewards): adds new interface

* feat(UsingRegistry): adds EpochRewards

* refactor(MigrationL2): gets fractions from EpochRewards.sol

* chore(MigrationL2): delete console.log import

* chore(MigrationL2): deletes `TODO` comment

* style(protocol): linting

* Test celo-monorepo.yml trigger filters

* Remove useless workflow triggers

* Run on repository runners

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>

* Anvil migrations: use stable symbols (#11193)

* L2 devchain fix (#11200)

* L2 devchain fix

* fixes

* artifact fixes

* [DO NOT MERGE] Epoch manager WIP (#11189)

* Fix anvil devchain generation (#11226)

* Get epoch info of specified epoch (#11231)

* EpochManager FinishNextEpochProcessing unit tests (#11233)

* Bring back some functions removed since CR11 (#11239)

* Bring back getHotfixRecord function

* Bring back getMaxGroupSize

* Bring back getRegisteredValidatorSigners

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Epoch Manager "finishNextEpochProcessing"  gas test (#11240)

* Gas usage test

* prettify

* Isolate test run

* removal of struct

* Update gas test

* prettify

* refactor test a bit

* added another gas test

* prettify

* Don't update SortedLinkedList pointers when not necessary (#11241)

* Truffle works with anvil (#11230)

* Score manager gas optimization (#11246)

* Score manager gas optimization

* prettify

* PR comments

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Add score manager setter role (#11244)

* Fix buyback and add fee split (#11234)

* Make Governance slasher able to remove validator and decrease slash m… (#11245)

* Adds backwards compatibility in `UsingPrecompile` contract.  (#11236)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>
Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Finish epoch processing split (#11243)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Finish epoch processing split

* FinishEpochProcessing split e2e test

* setToProcessGroups unit tests

* process group unit tests

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

* prettify

* Pr comments

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* Prevent CELO Transfer to Unreleased Treasury (#11222)

* first compiling draft
no working test.

Co-authored-by: Martín Volpe <martinvol@users.noreply.github.com>

* Compiler fixes + finishNextEpochProcess

* allocateValidatorsRewards compilable

* First few tests

* test fix

* uisng registry instead

* updated registry ID var names

* typo

* ++ mock contracts in 0.8

* ++ passing test using mock

* Removal of using precompiles

* ScoreManager refactor

* Decouple epoch manager initiali…
* deprecate L1 features

* deprecated unused var

* Add `getCurrentValidatorSigners` L2 Support (#11317)

* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* update GH WF

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* L2 Staking and Voting (#11034)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* set EpochSize on L2

* allow voting and activating

* move election test contract to vote dir

* updated test to allow testing of L2 with no reward distribution

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* lint: function order

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* initial validators contract review

* Remove block gas limit flag for `governance/voting` CI tests

* bump version

* ++ tests && format

* removed comments

* getValidatorGroupSlashingMultiplier allowed only on L1

* reverting changes to test contract size issue

* minimal changes

* allow slashing multiplier reset on L2

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* COP, KES, USDT Oracle config (#10984)

* Yaml file drafts

* Update COPUSD Config

* Update KESUSD and rename USDKES.yaml to KESUSD.yaml

* Rename USDCOP.yaml to COPUSD.yaml

* Adding KESUSD data source

* CELOKES and KESUSD config

* chore: test USDTUSD config

* fix: remove openexchangerates from kesusd

* chore: add pair constants

* chore: add alfajores & baklava kesusd and usdtusd addresses

* fix: use pnpm instead of yarn

* fix: update min oracles for CELOKES

* chore: add mainnet kes hsms

* USDTUSD config from Nadiem

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* chore: latest deployed images

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* set celo-foundry to 0.5

* force CI test after changing PR base

---------

Co-authored-by: Nadiem Sissouno <53600650+sissnad@users.noreply.github.com>
Co-authored-by: Nadiem Sissouno <nadiem.sissouno@clabs.co>
Co-authored-by: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com>
Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Soloseng/update-celo-L2-distribution-logic (#11045)

* modified L2 CELO distribution logic

* rename functions

* ++ more name changes

* change more variable names

* ∆ gold to celo in contract

* contract rename

* forgotten names

* Celo token totalSupply() update (#11081)

* total supply update

* lint

* lint2

* hardcode L2toL1MessagePasser

* revert increaseSupply

* update goldtoken

* Update npm package versioning script to be compatible with other packages (#11041)

* updated script to allow for versioning devchain-anvil package

* run in PR as well

* reorg workflow to install node

* fixed utils test

* ++ workflow dispatch

* Soloseng/bytecode-tooling-fix (#11092)

* use the existing `build_artifacts` arg to also fetch 0.8 contracts

* git force run tests

* Create a ProxyFactory (#11095)

* Martinvol/fix interfaces migrations (#11084)

* Update README with Foundry version (#11097)

* Add Support for CeloToken Name in Registry (#11080)

* Updated Using registry v2

* using ICeloToken interface in distribution

* updated contracts to use `getCeloToken` instead of `getGoldToken`

* Changed `GOLD_TOKEN_REGISTRY_ID` to `CELO_TOKEN_REGISTRY_ID` throughtout repo

* fix tests

* replaced gold with celo

* updated migrations

* Bump version

* ++ celoToken & lockedCelo to registry during migration

* removed celoToken and LockedCelo from bytecode check

* update interface

* fixed LockedGold migration

* fix test

* ∆ gold name

* Soloseng/revert-celo-total-supply-changes (#11093)

* initial work

* accounting debug

* disable CELO transfers to celoDistribution schedule

* removed debug logs

* ++ celoDistributionSchedule to `usingRegistry` contract.

* Moved setting registry address to initialize function

* ∆ execution order

* updated release data

* updated variable name in test

* test fix

* ++ native transfer test

* refactor: reads supported Foundry version from an environment variable (#11046)

refactor(workflows): reads supported Foundry version from env variable

* Soloseng/publishing-version-fix (#11105)

* set override the default version

* ++ npm tag in workflow trigger

* PR feedback

* feat(foundry): publish L2 state in `@celo/devchain-anvil` (#11107)

* refactor(scripts/foundry): moves `run_e2e_tests...sh` file

Small house-keeping change to keep Foundry-related bash scripts organised in a single directory. This script doesn't seem to be called from anywhere, and doesn't have a yarn command in `package.json` so it was fine to move it without any changes in other files.

* feat(package.json): adds yarn commands for e2e and integration tests

Two helper commands to run two Foundry-related bash scripts during local development.

* refactor(migrations_sol): groups imports for better readability

* feat(scripts/foundry): adds MVP L2 migration script

Successfully deploys bytecode to `proxyAdminAddress`.
Does not yet dump state correctly, or call functions to active L2 correctly.

* feat(package.json): adds two helper yarn commands

1. `anvil-devchain:start-L2`: which creates and migrates an L2 devchain
2. `anvil-devchain:check-is-running`: which can be used to check that an anvil instance is running locally and serving at localhost:8546

* chore(migrations_sol): fix typo in function name

* chore(migrations_sol): nit simplifies code comment for better readability

* feat(scripts/foundry): activates CeloDistributionSchedule

Now successfully activates CeloDistributionSchedule.
Does not yet dump state correctly

* refactor(scripts/foundry): moves variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(scripts/foundry): moves more variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(constants.sh): read bytecode from Foundry instead of Truffle

* chore(scripts/foundry): adds TODO comment

At this point, the migration works as intended and the L2 is activated.
But, I haven't yet saved the devchain state file.
I'll need to refactor the way the L1 and L2 move the state file around.

* refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_devchain.sh`

To keep it consistent with the L1 script

* style(migrations_sol): linting

* chore(scripts/foundry): remove debugging statements

* refactor(constants): adds L1 and L2 state file names

* feat(scripts/foundry): successfully dumps L2 state

* refactor(constants): uses `$ANVIL_RPC_URL` instead of hardcoded URL

* refactor(constants): moves libraries to constants

* fix(constants): adds `$PWD` to prevent errors on CI

On CI it seems like `jq` doesn't find the artifacts without an explicit path

```sh
./scripts/foundry/create_and_migrate_anvil_devchain.sh
  shell: /usr/bin/bash -e {0}
  env:
    FOUNDRY_CACHE_KEY: 2
    SUPPORTED_FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
    ANVIL_PORT: 8546
jq: error: Could not open file build/contracts/Registry.json: No such file or directory
jq: error: Could not open file build/contracts/Proxy.json: No such file or directory
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9808280627/job/27083755032#step:18:9

* chore(workflows): debugging `jq` error on CI

Can't find build artifacts on CI, so trying to work out what might be wrong.

* fix(constants): moves bytecode operation back into scripts

Since the constants are read before any foundry compilation occured, the constants can't read from the Foundry artifacts. Locally, I missed this because I had existing artifacts from previous compilations.

* chore(workflows): debugging `jq` CI error

* fix(scripts/foundry): uses Foundry `out/` directory

Mistakenly read artifacts from Truffle's `build/` directory. Took a while to remember that Foundry write artifacts to `out/`.

Source: https://book.getfoundry.sh/reference/forge/forge-build#build-modes

* chore(scripts/foundry): removes debugging statement

* feat(package.json): updates yarn command names

* docs(CONTRIBUTING): updates yarn command docs

* chore(workflows): add back NPM install step

Not confident enough to remove it in this PR.

* chore(workflows): removes code comment

* feat(workflows): publishes L1 and L2 state

Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.

* fix(scripts/foundry): remove unnecessary `stop_anvil` call

CI doesn't like `lsof` command in `stop_anvil.sh`

```sh
/runner/_work/celo-monorepo/celo-monorepo/packages/protocol/scripts/foundry/stop_anvil.sh: line 10: lsof: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811181588/job/27092901761?pr=11107#step:19:7073

* refactor(workflows): replace CI env with variable from `constants.sh`

Simplifies code and makes it easier to update ports in a single place.

* fix(workflows): adds back `stop_anvil.sh` and installs `lsof` explicitly

CI fails if I don't explicitly kill an existing anvil server, so I decided to install `lsof` which is used by `stop_anvil.sh` to kill processes.

```sh
error binding to 127.0.0.1:8546: error creating server listener: Address already in use (os error 98)
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811346558/job/27093342967?pr=11107#step:20:30

* chore(scripts/foundry): removes code comment

* fix(workflows): install `lsof` in the same step

Not sure if that's the bug, but the last run where the installation and use was in different steps didn't work.

* fix(workflows): hacky fix to run L2 anvil

I'm struggling to terminate the previous anvil server and re-start a new anvil server at the same address (local host 8546).

I tried to work around cumbersome CI environment issues (`lsof` which we use to identify the process is not available on CI).

For now, as a quick fix, I'll start anvil at an arbitrary different port 8547 and run the test against that localhost 8547.

I'll need to refactor this better.

* refactor(scripts/foundry): simplifying `lsof` query to find PID

* fix(workflows): try to terminate anvil server again

* fix(workflows): hacky workaround to prevent Anvil bug when loading state

Starting L1 from scratch instead of JSON state to circumvent this Anvil bug https://github.com/foundry-rs/foundry/issues/7502.

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* feat(constants): set CeloDistributionSchedule initial balance to 700M CELO

Arbitrary amount chosen to be approximately equal to `GoldToken.totalSupply()` on the L1 Mainnet (695,313,643 CELO as of this commit). During the real L2 genesis, the VM will calculate and set an appropriate balance.

```sh
# Get address of GoldToken
$ cast call \
0x000000000000000000000000000000000000ce10 \
"getAddressForStringOrDie(string calldata identifier)(address)" \
"GoldToken" \
--rpc-url https://forno.celo.org
0x471EcE3750Da237f93B8E339c536989b8978a438

# Call `totalSupply()` on `GoldToken.sol`
$ cast call \
0x471EcE3750Da237f93B8E339c536989b8978a438 \
"totalSupply()(uint256)" \
--rpc-url https://forno.celo.org
695313643195035937058427065 [6.953e26]

# Convert units from wei to ether
$ cast to-unit 695313643195035937058427065 ether
695313643.195035937058427065
```

* docs(README): improves README

More context, examples, background, files in the package.

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* chore: update CeloDistributionSchedule initial balance (#11140)

chore(constant): fix CeloDistributionSchedule initial balance

* L2 Governance Hotfix (#11014)

* lint: function ordering

* Deprecate L1 hotfix;
Implement L2 hotfix;

* BUMP version

* prepare hotfix on L2

* cleanup

* ++ setters and checks

* ++ more test cases

* PR feedback

* PR feedback

* PR feedback

* resetHotfix is public

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* fixed inheritance

* added pretest check

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: Leszek Stachowski <leszek.stachowski@clabs.co>

* Added Check to CeloDistributionSchedule `activate` function (#11109)

* added check to activate function

* Updated function name

* changed the check to make sure that the address set in the goldToken contract is actually the celoDistributionSchedule contract address

* Use celoDistributionSchedule address set in registry instead of setting in CeloToken contract manually

* PR feedback

* ++ celo distribution schedule to registry

* updated path and added missing address to registry

* using 0.8 artifacts

* ++ comment

* test: `forge test` should be all green and exclude tests that require anvil (#11148)

* test(devchain/e2e): moves e2e demo test into new `devchain/` directory

This allows us to exclude all tests in the `devchain/` directory when running `forge test`

* test(devchain/migration): renames migration test to Migration.t.sol

Previously this was called Integration.t.sol, but that's not super obvious naming.

* feat(foundry.toml): excludes `/devchain` directory when running `forge test`

* feat(foundry.toml): adds profile for tests that require a devchain

The configs of this profile extend or overwrite the default profile. That means we can customise the `match_path` and `no_match_path` configs in that profile and run `forge test` with that profile by passing an environment variable `FOUNDRY_PROFILE=devchain`.

For example, once a devchain is serving at localhost:

```sh
FOUNDRY_PROFILE=devchain forge test -vvv \
--match-path "test-sol/devchain/e2e/*" \
--fork-url $ANVIL_RPC_URL
[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test-sol/devchain/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.92ms (2.35ms CPU time)

Ran 1 test suite in 164.71ms (12.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
```

* docs(devchain/README): adds documentation for future reference

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* Trigger Build

* docs(README): add note on devchain tests

Co-authored-by: Martín Volpe <volpe@clabs.co>

---------

Co-authored-by: alvarof2 <fernandez.f.alvaro@gmail.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* refactor: use constants across `test-sol/` and `migrations_sol/` (#11143)

* feat(test-sol/constants): adds registryAddress and proxyAdminAddress

* style(test-sol/constants): improves code comment

* refactor(test-sol/e2e/utils): use `REGISTRY_ADDRESS`

* refactor(migrations_sol): rename to `MigrationsConstants`

To avoid import clashes when importing `TestConstants` from `test-sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(test-sol): rename to `TestConstants`

To avoid import clashes when importing `MigrationsConstants` from `migrations_sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(Integration.t.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use constants

* refactor(Accounts.t.sol): use constants

* refactor(CeloDistributionSchedule): use constants in `setUp()`

* refactor(CeloDistributionSchedule): use constants across file

* test(CeloDistributionSchedule): revert to previous variable in broken test

This test fails with this change

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(REGISTRY_ADDRESS);
```

```sh
forge test -vvv \
--match-path "test-sol/unit/*"

Failing tests:
Encountered 1 failing test in test-sol/unit/common/CeloDistributionSchedule.t.sol:CeloDistributionScheduleTest_activate
[FAIL. Reason: call reverted as expected, but without data] test_Reverts_WhenRegistryNotUpdated() (gas: 1877202)

Encountered a total of 1 failing tests, 2202 tests succeeded
```

But, passes with this change:

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(PROXY_ADMIN_ADDRESS);
```

```sh
$ forge test -vvv \
--match-path "test-sol/unit/*"

# ...
Ran 360 test suites in 4.60s (11.71s CPU time): 2203 tests passed, 0 failed, 0 skipped (2203 total tests)
```

I can sort of see why that's the case. In the current `setUp()` function the L2 is activated by arbitrarily deploying `Registry.sol` bytecode to the `proxyAdminAddress`.

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/test-sol/unit/common/CeloDistributionSchedule.t.sol#L68-L75

My hunch is that this _empty_ Registry is then used in this test. Since it's empty these two `UsingRegistry()` getters fails as expected by this test

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/CeloDistributionSchedule.sol#L77-L79

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/UsingRegistry.sol#L82-L85

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts/common/Registry.sol#L49-L53

In my opinion, this is a janky way to test that the contract call reverts.

My reasoning and things I'd change:
1. `proxyAdminAddress` will not necessarily have `Registry` bytecode. _Any_ arbitrary bytecode activates the L2. So using that `proxyAdminAddress` is a valid `Registry` is not a good assumption.
2. I'd create a new purposely empty Registry in this test, so it's obvious to the reader why the test fails.
3. I'd update the test name since it's not obvious which contract the `Registry` is missing. Presumably it's the `CeloToken`, but it's not immediately obvious from the test name.

I'll probably fix this in a separate PR.

* refactor(FeeHandler.t.sol): use `REGISTRY_ADDRESS` constant

* refactor(GasPriceMinimum.t.sol): use constants

* refactor(GoldToken.t.sol): use `PROXY_ADMIN_ADDRESS`

* fix(test-sol): import forgotten `TestConstants`

All unit tests pass

```sh
forge test -vvv \
--match-path "test-sol/unit/*"
```

* refactor(IsL2Check.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(BlockchainParamters.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(EpochRewards.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(GovernanceSlasher.t.sol): use constants

* refactor(DoubleSigningSlasher.t.sol): use constants

* refactor(DowntimeSlasher.t.sol): use constants

* refactor(Validators.t.sol): use constants

* refactor(Election.t.sol): use constants

* refactor(LockedGold.t.sol): use constants

* refactor(ReleaseGold.t.sol): use constants

* refactor(Escrow.t.sol): use constants

* refactor(FederatedAttestations.t.sol): use constants

* refactor(OdisPayments.t.sol): use constants

* style(GasPriceMinimum.t.sol): move import to top

* style(Random.t.sol): use constants

* feat(migrations_sol): import constants

To avoid redefining them and having a variable name clash at compilation:

```sh
Error (9097): Identifier already declared.
  --> test-sol/constants.sol:28:3:
   |
28 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> migrations_sol/constants.sol:33:3:
   |
33 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```

* style(test-sol): linting

* chore(Governance.t.sol): updates to `TestConstants`

* chore(Election.t.sol): uses named import `{ Utils }` for readability

* chore(Governance.t.sol): updates to `TestConstants` in Contract

* refactor(CeloDistributionSchedule.t.sol):  use `REGISTRY_ADDRESS`

* test(CeloDistributionSchedule.t.sol): fix failing test due to merge conflict

I made a mistake when resolving a conflict earlier and committed too much.
This should fix the error, the test is all green now.

* test: migrate `FeeHandlerSeller.t.sol` to foundry (#11155)

* test(FeeHandlerSeller.t.sol): adds MVP contract outline

Test is currently failing

* test(FeeHandlerSeller.t.sol): use `GoldTokenMock` to work around missing transfer precompile

Test passes as expected ✅

* chore(FeeHandlerSeller.t.sol): remove unused code comments

* test(FeeHandlerSeller.t.sol): add test for revert when not owner

Test passes as expected ✅

* style(FeeHandlerSeller.t.sol): improve function naming

More explicit naming in compliance with VS code extension that suggests forge test naming.

* test(FeeHandlerSeller.t.sol): add test for setMinimumReports

Test passes as expected ✅

* test(FeeHandlerSeller.t.sol): refactor constants and simplify tests

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(FeeHandlerSeller.t.sol): remove unused imports

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(feehandlerseller.ts): deletes TS test

Fully migrated to foundry test.

* refactor(FeeHandlerSeller.t.sol): use arbitrary token address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test: migrate `UniswapFeeHandlerSeller.t.sol` to foundry (#11171)

* test(UniswapFeeHandlerSeller.t.sol): adds MVP test outline

First test passes as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for non-owner `setRouter` test

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for setting router to zero address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* chore(UniswapFeeHandlerSeller.t.sol): debugging `expectRevert`

I can't seem to get the contract to revert when the max number of routers are set per token. Although limit is hardcoded to 3, the `setRouter` function seems to accept more tokens than the limit.

```sh
Logs:
  Setting router 0
  Setting router 1
  Setting router 2
  Setting router 3
  Setting router 4
  Setting router 5
  Setting router 6
  Setting router 7
  Setting router 8
  Setting router 9
  Routers for token: 1
  ```

* fix(FeeHandlerSeller.t.sol): use distinct router addressees

Fixes a bug in the test where I couldn't trigger the expected revert.

* style(FeeHandlerSeller.t.sol): linting

* test(FeeHandlerSeller.t.sol): adds test for large list and applies linting

* refactor(FeeHandlerSeller.t.sol): removes setup() to improve readability

* chore(FeeHandlerSeller.t.sol): adds code comment for context

* test(uniswapfeehandlerseller.ts): removes TS test

Fully covered by newly added Foundry test `UniswapFeeHandlerSeller.t.sol`

* refactor: remove unused code comment in `Proxy.sol` (#11174)

* refactor(Proxy.sol): remove unused code comments

This code change makes a test fail:
test-sol/unit/common/ProxyFactory08.t.sol > test_verifyArtifacts

```sh
$ forge test

Failing tests:
Encountered 1 failing test in test-sol/unit/common/ProxyFactory08.t.sol:ProxyFactoryTest
[FAIL. Reason: panic: assertion failed (0x01)] test_verifyArtifacts() (gas: 188341)
```

I'm not 100% certain but it's maybe because the `packages/protocol/artifacts/Proxy/proxyInitCode0.5.17+commit.d19bba13.hex` artifact is derived from the contract with the code comments.

* refactor(ProxyFactory08.t.sol): simplify `getCode` arguments

This is semantically equivalent, see https://book.getfoundry.sh/cheatcodes/get-code

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `bytecode.object.`

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `deployedBytecode.object.`

* docs(artifacts/Proxy/README): adds a note for future reference

* style(artifacts/Proxy/README): fix typo

* style(artifacts/Proxy/README): fix typo

* refactor: uses `L2Migration.s.sol` and simplifies migration script (#11177)

* refactor(constants.sh): renames target contract variable for better readability

* fix(interfaces/ICeloDistributionSchedule): removes 1 argument from `activate` function

As far as I can see, this interface was not defined correctly and had an argument too much.

* refactor(MigrationL2.s.sol): moves `activate` call to script and refactors bash file

Left two TODO comments.

* refactor(constants): uses `DEPLOYER_ACCOUNT`

* refactor(constant.sh): removes anvil private key (not used anymore)

* refactor(Migrations.s.sol): add `setupUsingRegistry()` to improve readability

* style(scripts/foundry): indent lines that don't start a command

* feat(IEpochRewards): adds new interface

* feat(UsingRegistry): adds EpochRewards

* refactor(MigrationL2): gets fractions from EpochRewards.sol

* chore(MigrationL2): delete console.log import

* chore(MigrationL2): deletes `TODO` comment

* style(protocol): linting

* Test celo-monorepo.yml trigger filters

* Remove useless workflow triggers

* Run on repository runners

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>

* Anvil migrations: use stable symbols (#11193)

* L2 devchain fix (#11200)

* L2 devchain fix

* fixes

* artifact fixes

* [DO NOT MERGE] Epoch manager WIP (#11189)

* Fix anvil devchain generation (#11226)

* Get epoch info of specified epoch (#11231)

* EpochManager FinishNextEpochProcessing unit tests (#11233)

* Bring back some functions removed since CR11 (#11239)

* Bring back getHotfixRecord function

* Bring back getMaxGroupSize

* Bring back getRegisteredValidatorSigners

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Epoch Manager "finishNextEpochProcessing"  gas test (#11240)

* Gas usage test

* prettify

* Isolate test run

* removal of struct

* Update gas test

* prettify

* refactor test a bit

* added another gas test

* prettify

* Don't update SortedLinkedList pointers when not necessary (#11241)

* Truffle works with anvil (#11230)

* Score manager gas optimization (#11246)

* Score manager gas optimization

* prettify

* PR comments

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Add score manager setter role (#11244)

* Fix buyback and add fee split (#11234)

* Make Governance slasher able to remove validator and decrease slash m… (#11245)

* Adds backwards compatibility in `UsingPrecompile` contract.  (#11236)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>
Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Finish epoch processing split (#11243)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Finish epoch processing split

* FinishEpochProcessing split e2e test

* setToProcessGroups unit tests

* process group unit tests

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

* prettify

* Pr comments

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* Prevent CELO Transfer to Unreleased Treasury (#11222)

* first compiling draft
no working test.

Co-authored-by: Martín Volpe <martinvol@users.noreply.github.com>

* Compiler fixes + finishNextEpochProcess

* allocateValidatorsRewards compilable

* First few tests

* test fix

* uisng registry instead

* updated registry ID var names

* typo

* ++ mock contracts in 0.8

* ++ passing t…
…tching (#11391)

* E2E active/vote revoke in between epoch switching

* PR comments

* PR comments 2

* PR comments 3

* remove tmp anvil files when e2e done

* assertApproxEqAbs

* PR comments 4 :-)

* prettify

* comment fix
updated submodule fetch settings
* Super bridge WETH wrapper

* Cleanup & prettify

* added ability to update the addresses

* added recepient and gas limit as input parameters

* Smart contract is now immutable

* Deployment

* lint

* PR comments

* PR comments 2

* removal of duplicate
Includes following commits:
- Propose cleanup for package.json scripts.
- Rename, group and sort relevant scripts in package.json
- Add note to unused revoke script.
- Add cheatsheet.
- Changes from comments.
- CR.
- Bring back old deploy script with deprecation notice.
- Update script name to make:release.
- Display cheatsheet.
* refactor: remove celotool references and related configurations

* refactor: remove deprecated configuration files and ignore unnecessary packages

* docs: update contributing guide and README links for clarity

* refactor: simplify CODEOWNERS and remove metadata-crawler Dockerfile and workflows

* refactor: remove obsolete environment configuration files for oracle and staging

* refactor: update README for clarity and remove obsolete SETUP.md

* refactor: update CODEOWNERS to correct default owner and improve clarity

* fix: correct typo in "Resources" heading in README.md

* fix: wrap logo section in a div for center alignment
…11483)

* chore: fix typo in function's name

* chore: fix typo in function's name

* chore: fix typo in function's name

* chore: fix typo in function's name
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Update Election.sol

* Update ReleaseGold.sol

* Update Governance.sol
martinvol and others added 14 commits October 27, 2025 14:45
Update .gitmodules with mento fork #11559
* Add scripts for pruning dispute games from storage.

* Rename env + add docs.

* Version.

* Add reset anchor game.

* Add limit to games pruning.

* Cursor CR.
* Add tooling for L2 to L1 withdrawal.

* CR.

* Cursor CR.

* Adapt scripts to perform withdrawal on Baklava/Alfajores.

* Add Chaos V2.

* Add deposit.

* Remove alfajores, baklava & chaos.

* Use custom celo network for successful withdrawal.

* Run prettier.

* Cursor CR.

* CR.
* Add OP tooling.

* CR.

* CR.

* CR. Allow to use generic addresses for mocked signers. Update docs.

* CR. Even more docs...

* Cursor CR.

* Use with arbitrary block number.

* Allow arbitrary RPC for forking.

* Add succinct upgrade.

* Change fork l2 to sepolia.

* Anonymize v2 & v3.

* Cursor CR & refactor.

* Fix relative path.
* Add OP tooling.

* CR.

* CR.

* CR. Allow to use generic addresses for mocked signers. Update docs.

* CR. Even more docs...

* Cursor CR.

* Use with arbitrary block number.

* Allow arbitrary RPC for forking.

* Add succinct upgrade.

* Change fork l2 to sepolia.

* Anonymize v2 & v3.

* Cursor CR & refactor.

* Update succinct.

* Update target & nonces.

* Correct nonce.

* Update calldata.

* Exec on mainnet.

* Anonymize succinct.

* Fix relative path.

* Fix relative path for succinct.
Use the builds generated in master
… (#11610)

* Introduce ValidatorEpochRewardAllocated event in EpochManager for tracking validator rewards.
* Update reward allocation logic to emit the new event when rewards are allocated.
* Add unit test to verify the emission of ValidatorEpochRewardAllocated event during epoch processing.

Co-authored-by: Pavel Hornak <pavel.hornak@clabs.co>
Use new helpers for artifact names
@pahor167 pahor167 requested review from a team as code owners January 14, 2026 13:54
@pahor167 pahor167 requested a review from ezdac January 14, 2026 13:54
mkdir .tmp/devchain
mv .tmp/devchain.json .tmp/devchain
mv .tmp/l2-devchain.json .tmp/devchain
working-directory: packages/protocol
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Release test expects contracts missing from devchain artifact

High Severity

The protocol-devchain.yml workflow now only uploads devchain.json and l2-devchain.json files, removing the compiled contracts that were previously included (mv packages/protocol/build/contracts* devchain/). However, the protocol-test-release job in celo-monorepo.yml still runs ci:test-make-release with -d $BUILD_AND_DEVCHAIN_DIR, which calls check-backward.ts expecting contracts at $BUILD_DIR/contracts. The copy step that populated this directory was removed, and the artifact no longer contains contracts, so the release comparison test will fail.

Additional Locations (1)

Fix in Cursor Fix in Web

* Deprecate `isReserveLow` on L2 (#11290)

* Sync `release/core-contracts/12` with master (#11033)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* update GH WF

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* L2 Staking and Voting (#11034)

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* set EpochSize on L2

* allow voting and activating

* move election test contract to vote dir

* updated test to allow testing of L2 with no reward distribution

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* lint: function order

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* initial validators contract review

* Remove block gas limit flag for `governance/voting` CI tests

* bump version

* ++ tests && format

* removed comments

* getValidatorGroupSlashingMultiplier allowed only on L1

* reverting changes to test contract size issue

* minimal changes

* allow slashing multiplier reset on L2

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>

* COP, KES, USDT Oracle config (#10984)

* Yaml file drafts

* Update COPUSD Config

* Update KESUSD and rename USDKES.yaml to KESUSD.yaml

* Rename USDCOP.yaml to COPUSD.yaml

* Adding KESUSD data source

* CELOKES and KESUSD config

* chore: test USDTUSD config

* fix: remove openexchangerates from kesusd

* chore: add pair constants

* chore: add alfajores & baklava kesusd and usdtusd addresses

* fix: use pnpm instead of yarn

* fix: update min oracles for CELOKES

* chore: add mainnet kes hsms

* USDTUSD config from Nadiem

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* chore: latest deployed images

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* set celo-foundry to 0.5

* force CI test after changing PR base

---------

Co-authored-by: Nadiem Sissouno <53600650+sissnad@users.noreply.github.com>
Co-authored-by: Nadiem Sissouno <nadiem.sissouno@clabs.co>
Co-authored-by: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com>
Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Soloseng/update-celo-L2-distribution-logic (#11045)

* modified L2 CELO distribution logic

* rename functions

* ++ more name changes

* change more variable names

* ∆ gold to celo in contract

* contract rename

* forgotten names

* Celo token totalSupply() update (#11081)

* total supply update

* lint

* lint2

* hardcode L2toL1MessagePasser

* revert increaseSupply

* update goldtoken

* Update npm package versioning script to be compatible with other packages (#11041)

* updated script to allow for versioning devchain-anvil package

* run in PR as well

* reorg workflow to install node

* fixed utils test

* ++ workflow dispatch

* Soloseng/bytecode-tooling-fix (#11092)

* use the existing `build_artifacts` arg to also fetch 0.8 contracts

* git force run tests

* Create a ProxyFactory (#11095)

* Martinvol/fix interfaces migrations (#11084)

* Update README with Foundry version (#11097)

* Add Support for CeloToken Name in Registry (#11080)

* Updated Using registry v2

* using ICeloToken interface in distribution

* updated contracts to use `getCeloToken` instead of `getGoldToken`

* Changed `GOLD_TOKEN_REGISTRY_ID` to `CELO_TOKEN_REGISTRY_ID` throughtout repo

* fix tests

* replaced gold with celo

* updated migrations

* Bump version

* ++ celoToken & lockedCelo to registry during migration

* removed celoToken and LockedCelo from bytecode check

* update interface

* fixed LockedGold migration

* fix test

* ∆ gold name

* Soloseng/revert-celo-total-supply-changes (#11093)

* initial work

* accounting debug

* disable CELO transfers to celoDistribution schedule

* removed debug logs

* ++ celoDistributionSchedule to `usingRegistry` contract.

* Moved setting registry address to initialize function

* ∆ execution order

* updated release data

* updated variable name in test

* test fix

* ++ native transfer test

* refactor: reads supported Foundry version from an environment variable (#11046)

refactor(workflows): reads supported Foundry version from env variable

* Soloseng/publishing-version-fix (#11105)

* set override the default version

* ++ npm tag in workflow trigger

* PR feedback

* feat(foundry): publish L2 state in `@celo/devchain-anvil` (#11107)

* refactor(scripts/foundry): moves `run_e2e_tests...sh` file

Small house-keeping change to keep Foundry-related bash scripts organised in a single directory. This script doesn't seem to be called from anywhere, and doesn't have a yarn command in `package.json` so it was fine to move it without any changes in other files.

* feat(package.json): adds yarn commands for e2e and integration tests

Two helper commands to run two Foundry-related bash scripts during local development.

* refactor(migrations_sol): groups imports for better readability

* feat(scripts/foundry): adds MVP L2 migration script

Successfully deploys bytecode to `proxyAdminAddress`.
Does not yet dump state correctly, or call functions to active L2 correctly.

* feat(package.json): adds two helper yarn commands

1. `anvil-devchain:start-L2`: which creates and migrates an L2 devchain
2. `anvil-devchain:check-is-running`: which can be used to check that an anvil instance is running locally and serving at localhost:8546

* chore(migrations_sol): fix typo in function name

* chore(migrations_sol): nit simplifies code comment for better readability

* feat(scripts/foundry): activates CeloDistributionSchedule

Now successfully activates CeloDistributionSchedule.
Does not yet dump state correctly

* refactor(scripts/foundry): moves variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(scripts/foundry): moves more variables to `constants.sh`

Simplifies maintenance and readability of scripts.

* refactor(constants.sh): read bytecode from Foundry instead of Truffle

* chore(scripts/foundry): adds TODO comment

At this point, the migration works as intended and the L2 is activated.
But, I haven't yet saved the devchain state file.
I'll need to refactor the way the L1 and L2 move the state file around.

* refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_devchain.sh`

To keep it consistent with the L1 script

* style(migrations_sol): linting

* chore(scripts/foundry): remove debugging statements

* refactor(constants): adds L1 and L2 state file names

* feat(scripts/foundry): successfully dumps L2 state

* refactor(constants): uses `$ANVIL_RPC_URL` instead of hardcoded URL

* refactor(constants): moves libraries to constants

* fix(constants): adds `$PWD` to prevent errors on CI

On CI it seems like `jq` doesn't find the artifacts without an explicit path

```sh
./scripts/foundry/create_and_migrate_anvil_devchain.sh
  shell: /usr/bin/bash -e {0}
  env:
    FOUNDRY_CACHE_KEY: 2
    SUPPORTED_FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
    ANVIL_PORT: 8546
jq: error: Could not open file build/contracts/Registry.json: No such file or directory
jq: error: Could not open file build/contracts/Proxy.json: No such file or directory
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9808280627/job/27083755032#step:18:9

* chore(workflows): debugging `jq` error on CI

Can't find build artifacts on CI, so trying to work out what might be wrong.

* fix(constants): moves bytecode operation back into scripts

Since the constants are read before any foundry compilation occured, the constants can't read from the Foundry artifacts. Locally, I missed this because I had existing artifacts from previous compilations.

* chore(workflows): debugging `jq` CI error

* fix(scripts/foundry): uses Foundry `out/` directory

Mistakenly read artifacts from Truffle's `build/` directory. Took a while to remember that Foundry write artifacts to `out/`.

Source: https://book.getfoundry.sh/reference/forge/forge-build#build-modes

* chore(scripts/foundry): removes debugging statement

* feat(package.json): updates yarn command names

* docs(CONTRIBUTING): updates yarn command docs

* chore(workflows): add back NPM install step

Not confident enough to remove it in this PR.

* chore(workflows): removes code comment

* feat(workflows): publishes L1 and L2 state

Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.

* fix(scripts/foundry): remove unnecessary `stop_anvil` call

CI doesn't like `lsof` command in `stop_anvil.sh`

```sh
/runner/_work/celo-monorepo/celo-monorepo/packages/protocol/scripts/foundry/stop_anvil.sh: line 10: lsof: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811181588/job/27092901761?pr=11107#step:19:7073

* refactor(workflows): replace CI env with variable from `constants.sh`

Simplifies code and makes it easier to update ports in a single place.

* fix(workflows): adds back `stop_anvil.sh` and installs `lsof` explicitly

CI fails if I don't explicitly kill an existing anvil server, so I decided to install `lsof` which is used by `stop_anvil.sh` to kill processes.

```sh
error binding to 127.0.0.1:8546: error creating server listener: Address already in use (os error 98)
```

Source: https://github.com/celo-org/celo-monorepo/actions/runs/9811346558/job/27093342967?pr=11107#step:20:30

* chore(scripts/foundry): removes code comment

* fix(workflows): install `lsof` in the same step

Not sure if that's the bug, but the last run where the installation and use was in different steps didn't work.

* fix(workflows): hacky fix to run L2 anvil

I'm struggling to terminate the previous anvil server and re-start a new anvil server at the same address (local host 8546).

I tried to work around cumbersome CI environment issues (`lsof` which we use to identify the process is not available on CI).

For now, as a quick fix, I'll start anvil at an arbitrary different port 8547 and run the test against that localhost 8547.

I'll need to refactor this better.

* refactor(scripts/foundry): simplifying `lsof` query to find PID

* fix(workflows): try to terminate anvil server again

* fix(workflows): hacky workaround to prevent Anvil bug when loading state

Starting L1 from scratch instead of JSON state to circumvent this Anvil bug https://github.com/foundry-rs/foundry/issues/7502.

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* Update .github/workflows/protocol-devchain-anvil.yml

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* feat(constants): set CeloDistributionSchedule initial balance to 700M CELO

Arbitrary amount chosen to be approximately equal to `GoldToken.totalSupply()` on the L1 Mainnet (695,313,643 CELO as of this commit). During the real L2 genesis, the VM will calculate and set an appropriate balance.

```sh
# Get address of GoldToken
$ cast call \
0x000000000000000000000000000000000000ce10 \
"getAddressForStringOrDie(string calldata identifier)(address)" \
"GoldToken" \
--rpc-url https://forno.celo.org
0x471EcE3750Da237f93B8E339c536989b8978a438

# Call `totalSupply()` on `GoldToken.sol`
$ cast call \
0x471EcE3750Da237f93B8E339c536989b8978a438 \
"totalSupply()(uint256)" \
--rpc-url https://forno.celo.org
695313643195035937058427065 [6.953e26]

# Convert units from wei to ether
$ cast to-unit 695313643195035937058427065 ether
695313643.195035937058427065
```

* docs(README): improves README

More context, examples, background, files in the package.

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>

* chore: update CeloDistributionSchedule initial balance (#11140)

chore(constant): fix CeloDistributionSchedule initial balance

* L2 Governance Hotfix (#11014)

* lint: function ordering

* Deprecate L1 hotfix;
Implement L2 hotfix;

* BUMP version

* prepare hotfix on L2

* cleanup

* ++ setters and checks

* ++ more test cases

* PR feedback

* PR feedback

* PR feedback

* resetHotfix is public

* test: proof of concept 2e2 test using anvil devchain (#11020)

* chore(test-sol/FeeCurrencyDirectory)): use `@celo-...` remapping not `../..`

* test(test-sol/FeeCurrencyDirectory)): MVP e2e test

MVP demo of an e2e test using the devchain. This is not the pattern I'll suggest, but good to see the test passes end-to-end.

* chore(foundry.toml): adds `@test-sol` remapping

* chore(test-sol/e2e): adds MVP `utils.sol`

Idea is to have a Devchain class that can be inherited by Test contracts to have access to the deployed contracts on the devchain.

* test(FeeCurrencyDirectory): MVP test using `Devchain` class

* chore(migrations_sol): adds MVP script to run e2e tests

* style(test-sol/e2e): linting

* refactor(test-sol/FeeCurrencyDirectory): moves file to `.../e2e/`

* chore(migrations_sol): use `test-sol/e2e/*` path

* chore(test-sol/FeeCurrencyDirectory): match contract name in unit and e2e test

* style(test-sol/FeeCurrencyDirectory): linting

* chore(e2e/utils): removes unused imports and more

Cleans up
Adds `TODO` comments

* test(test-sol/e2e): renames contract with "E2E..."

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* chore(workflows/protocol_tests): excludes e2e test from workflow

I'm temporarily adding the "E2E..." prefix to the contract so I can exclude this test and the integration tests during the CI run.

In a separate PR, I'll refactor the tests into a directory structure like:

```
test-sol/unit/
test-sol/e2e/
test-sol/integration/
```

That way we could run tests with something like this:

```
# unit tests
forge test --match-path "*test-sol/unit/*"

# e2e tests
forge test --match-path "*test-sol/e2e/*"

# integration tests
forge test --match-path "*test-sol/integration/*"
```

* style(test-sol/e2e): linting

* chore(e2e): temporarily renames contract with "E2E..."

In subsequent PRs, I'll rename this more accurately.

* feat: add ReserveSpenderMultiSig to anvil migrations (#11028)

* feat(migrations_sol/migrationsConfig): adds `reserveSpenderMultiSig` configs

* feat(migrations_sol): adds `migrateReserveSpenderMultiSig`

Also adds contract calls in `migrateReserve` function.
Not tested, and not sure this works yet. I might be missing some changes.

* chore(test-sol/utils): adds `ReserveSpenderMultiSig.t.sol`

From the code comment:

  The purpose of this file is not to provide test coverage for `ReserveSpenderMultiSig.sol`.
  This is an empty test to force foundry to compile `ReserveSpenderMultiSig.sol`, and include its
  artifacts in the `/out` directory. `ReserveSpenderMultiSig.sol` is needed in the migrations
  script, but because it's on Solidity 0.5 it can't be imported there directly.
  If there is a better way to force foundry to compile `ReserveSpenderMultiSig.sol` without
  this file, this file can confidently be deleted.

* feat(migrations_sol/HelperInterFaces): adds `IReserveSpenderMultiSig`

The helper interface is used as a workaround to allow the migrations script (`Migrations.s.sol`) to be on Solidity 0.8, while the ReserveSpenderMultiSig contract is on Solidity 0.5. The migration script only needs to initialize the contract, which is why the helper interface only defines an `initialize` function.

* chore(migrations_sol): initialize `ReserveSpenderMultiSig`

* chore(migrations_sol): adds code comment for readability

* chore(migrations_sol): improves code comment, moves code block up

* chore(migrations_sol): fix typo

* style(migrations_sol): linting

* test: refactor foundry test directory into unit, e2e, and integration tests (#11023)

* chore(foundry.toml): adds `@mento-core/...` remapping

Also moves existing mappings into groups for better readability

* refactor(test-sol/common): moves files to `unit/common/`

Also updates imports respectively using remappings.

* refactor(test-sol/identity): moves files to `unit/identity/`

Also updates imports using remappings where necessary.

* refactor(test-sol/stability): moves files to `unit/stability/`

Also updates imports using remappings where necessary.

* refactor(test-sol/voting): moves files to `unit/voting/`

Also updates imports using remappings where necessary.

* refactor(test-sol/governance): moves files to `unit/governance/`

Also updates imports using remappings where necessary.

* chore(test-sol): update missing remappings

With these changes all contracts compile and resolve correctly.

* chore(workflows/protocol_tests): updates paths to `test-sol/unit`

* chore(workflows/protocol_tests): adds integration and e2e tests

* style(workflows/protocol_tests): refactors `forge test` for better readability

* chore(migrations_sol): moves scripts to `scripts/foundry/

Moves all bash scripts from `migrations_sol` to `scripts/foundry/`, and updates paths where necessary. We already have a directory for `scripts/truffle/` and `scripts/bash/`, so this makes it easier to find foundry-related bash scripts.

* test(governance/mock): move `MockGovernance` to `unit/` folder

* refactor(foundry.toml): rename `migrations-sol/` remapping

* refactor(workflows): refactor "run everything" step

Runs all tests in the `unit/` directory instead of all test files in the repo.
This makes sense from my perspective, because e2e tests (in the `e2e/` directory) and integration tests (in the `integration/` directory) require a connection to an anvil devchain serving at localhost.

The intent of this command is to ensure that no unit tests are forgotten, since unit tests are run explicitly by going through the directories above. But, the intention is not to run all tests in the repo generally.

* style(workflows/protocol-devchain-anvil): splits migration into 2 steps

This helps the script becoming more readable, and ensure error logs are clearly associated with a workflow step rather than a single bash script.

* chore(workflows): defines `ANVIL_PORT` env variable in workflow

Previously, the `$ANVIL_PORT` variable was exported and passed around as an env variable in a bash script.

But that required generating anvil migrations and running a devchain repeatedly.
Instead, the workflow does that once and different steps can access the devchain.

But, in that case the env variable is not passed around, so it has to be defined at the workflow level.

Source: https://docs.github.com/en/actions/learn-github-actions/variables

* chore(workflows/protocol_tests): removes code comment

* feat(scripts/foundry): adds `stop_anvil.sh`

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* feat(protocol/package.json): adds `anvil-devchain:...` (`start` and `stop`)

* refactor(scripts/foundry): use `stop_anvil.sh` to stop anvil

* refactor(migrations_sol): update `@migrations-sol` remapping

Previous the remapping was called `@celo-migrations`.

* docs(migrations_sol/README): renames README file

Also changes title to match NPM package name. This is a matter of personal preference. IMO this is a small improvement in readability for 3rd party users.

* docs(scripts/foundry): adds more links to `package.json`

Adds `repository` and `directory` to `package.json`.
This ensures npmjs.org displays hyperlinks to the github repository.

* docs(migrations_sol/CONTRIBUTING): adds MVP dev docs

We can complete this doc with additional information regarding the anvil devchain and migrations going forward.

* docs(migrations_sol/README): adds "how we work" section

This is helpful for 3rd party developers that found this package on npmjs.org.
The links help developers take action and help improve the anvil devchain.

* Soloseng/CHORE-update-workflow (#11029)

* update workflow to run on push to release branches

* ++ mintgoldschedule to migration test constants

* fixed inheritance

* added pretest check

---------

Co-authored-by: Arthur Gousset <46296830+arthurgousset@users.noreply.github.com>
Co-authored-by: Leszek Stachowski <leszek.stachowski@clabs.co>

* Added Check to CeloDistributionSchedule `activate` function (#11109)

* added check to activate function

* Updated function name

* changed the check to make sure that the address set in the goldToken contract is actually the celoDistributionSchedule contract address

* Use celoDistributionSchedule address set in registry instead of setting in CeloToken contract manually

* PR feedback

* ++ celo distribution schedule to registry

* updated path and added missing address to registry

* using 0.8 artifacts

* ++ comment

* test: `forge test` should be all green and exclude tests that require anvil (#11148)

* test(devchain/e2e): moves e2e demo test into new `devchain/` directory

This allows us to exclude all tests in the `devchain/` directory when running `forge test`

* test(devchain/migration): renames migration test to Migration.t.sol

Previously this was called Integration.t.sol, but that's not super obvious naming.

* feat(foundry.toml): excludes `/devchain` directory when running `forge test`

* feat(foundry.toml): adds profile for tests that require a devchain

The configs of this profile extend or overwrite the default profile. That means we can customise the `match_path` and `no_match_path` configs in that profile and run `forge test` with that profile by passing an environment variable `FOUNDRY_PROFILE=devchain`.

For example, once a devchain is serving at localhost:

```sh
FOUNDRY_PROFILE=devchain forge test -vvv \
--match-path "test-sol/devchain/e2e/*" \
--fork-url $ANVIL_RPC_URL
[⠒] Compiling...
No files changed, compilation skipped

Ran 1 test for test-sol/devchain/e2e/common/FeeCurrencyDirectory.t.sol:E2EDemo
[PASS] test_ShouldAllowOwnerSetCurrencyConfig() (gas: 94493)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 12.92ms (2.35ms CPU time)

Ran 1 test suite in 164.71ms (12.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
```

* docs(devchain/README): adds documentation for future reference

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* feat(workflows): adds profile env variable to CI workflows

This ensures that the correct profile is consumed on CI and the correct tests are run.

* Trigger Build

* docs(README): add note on devchain tests

Co-authored-by: Martín Volpe <volpe@clabs.co>

---------

Co-authored-by: alvarof2 <fernandez.f.alvaro@gmail.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* refactor: use constants across `test-sol/` and `migrations_sol/` (#11143)

* feat(test-sol/constants): adds registryAddress and proxyAdminAddress

* style(test-sol/constants): improves code comment

* refactor(test-sol/e2e/utils): use `REGISTRY_ADDRESS`

* refactor(migrations_sol): rename to `MigrationsConstants`

To avoid import clashes when importing `TestConstants` from `test-sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(test-sol): rename to `TestConstants`

To avoid import clashes when importing `MigrationsConstants` from `migrations_sol` as well.
Previously, both classes were called `Constants`, which leads to import clashes.

* refactor(Integration.t.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use `REGISTRY_ADDRESS`

* refactor(RevokeCeloAfterL2Transition.sol): use constants

* refactor(Accounts.t.sol): use constants

* refactor(CeloDistributionSchedule): use constants in `setUp()`

* refactor(CeloDistributionSchedule): use constants across file

* test(CeloDistributionSchedule): revert to previous variable in broken test

This test fails with this change

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(REGISTRY_ADDRESS);
```

```sh
forge test -vvv \
--match-path "test-sol/unit/*"

Failing tests:
Encountered 1 failing test in test-sol/unit/common/CeloDistributionSchedule.t.sol:CeloDistributionScheduleTest_activate
[FAIL. Reason: call reverted as expected, but without data] test_Reverts_WhenRegistryNotUpdated() (gas: 1877202)

Encountered a total of 1 failing tests, 2202 tests succeeded
```

But, passes with this change:

```diff
- celoDistributionSchedule.initialize(registryAddress);
+ celoDistributionSchedule.initialize(PROXY_ADMIN_ADDRESS);
```

```sh
$ forge test -vvv \
--match-path "test-sol/unit/*"

# ...
Ran 360 test suites in 4.60s (11.71s CPU time): 2203 tests passed, 0 failed, 0 skipped (2203 total tests)
```

I can sort of see why that's the case. In the current `setUp()` function the L2 is activated by arbitrarily deploying `Registry.sol` bytecode to the `proxyAdminAddress`.

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/test-sol/unit/common/CeloDistributionSchedule.t.sol#L68-L75

My hunch is that this _empty_ Registry is then used in this test. Since it's empty these two `UsingRegistry()` getters fails as expected by this test

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/CeloDistributionSchedule.sol#L77-L79

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts-0.8/common/UsingRegistry.sol#L82-L85

https://github.com/celo-org/celo-monorepo/blob/9d0276d9fd47471667ff577165f92d45e76a18c8/packages/protocol/contracts/common/Registry.sol#L49-L53

In my opinion, this is a janky way to test that the contract call reverts.

My reasoning and things I'd change:
1. `proxyAdminAddress` will not necessarily have `Registry` bytecode. _Any_ arbitrary bytecode activates the L2. So using that `proxyAdminAddress` is a valid `Registry` is not a good assumption.
2. I'd create a new purposely empty Registry in this test, so it's obvious to the reader why the test fails.
3. I'd update the test name since it's not obvious which contract the `Registry` is missing. Presumably it's the `CeloToken`, but it's not immediately obvious from the test name.

I'll probably fix this in a separate PR.

* refactor(FeeHandler.t.sol): use `REGISTRY_ADDRESS` constant

* refactor(GasPriceMinimum.t.sol): use constants

* refactor(GoldToken.t.sol): use `PROXY_ADMIN_ADDRESS`

* fix(test-sol): import forgotten `TestConstants`

All unit tests pass

```sh
forge test -vvv \
--match-path "test-sol/unit/*"
```

* refactor(IsL2Check.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(BlockchainParamters.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(EpochRewards.t.sol): use `PROXY_ADMIN_ADDRESS`

* refactor(GovernanceSlasher.t.sol): use constants

* refactor(DoubleSigningSlasher.t.sol): use constants

* refactor(DowntimeSlasher.t.sol): use constants

* refactor(Validators.t.sol): use constants

* refactor(Election.t.sol): use constants

* refactor(LockedGold.t.sol): use constants

* refactor(ReleaseGold.t.sol): use constants

* refactor(Escrow.t.sol): use constants

* refactor(FederatedAttestations.t.sol): use constants

* refactor(OdisPayments.t.sol): use constants

* style(GasPriceMinimum.t.sol): move import to top

* style(Random.t.sol): use constants

* feat(migrations_sol): import constants

To avoid redefining them and having a variable name clash at compilation:

```sh
Error (9097): Identifier already declared.
  --> test-sol/constants.sol:28:3:
   |
28 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> migrations_sol/constants.sol:33:3:
   |
33 |   address constant REGISTRY_ADDRESS = 0x000000000000000000000000000000000000ce10;
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```

* style(test-sol): linting

* chore(Governance.t.sol): updates to `TestConstants`

* chore(Election.t.sol): uses named import `{ Utils }` for readability

* chore(Governance.t.sol): updates to `TestConstants` in Contract

* refactor(CeloDistributionSchedule.t.sol):  use `REGISTRY_ADDRESS`

* test(CeloDistributionSchedule.t.sol): fix failing test due to merge conflict

I made a mistake when resolving a conflict earlier and committed too much.
This should fix the error, the test is all green now.

* test: migrate `FeeHandlerSeller.t.sol` to foundry (#11155)

* test(FeeHandlerSeller.t.sol): adds MVP contract outline

Test is currently failing

* test(FeeHandlerSeller.t.sol): use `GoldTokenMock` to work around missing transfer precompile

Test passes as expected ✅

* chore(FeeHandlerSeller.t.sol): remove unused code comments

* test(FeeHandlerSeller.t.sol): add test for revert when not owner

Test passes as expected ✅

* style(FeeHandlerSeller.t.sol): improve function naming

More explicit naming in compliance with VS code extension that suggests forge test naming.

* test(FeeHandlerSeller.t.sol): add test for setMinimumReports

Test passes as expected ✅

* test(FeeHandlerSeller.t.sol): refactor constants and simplify tests

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(FeeHandlerSeller.t.sol): remove unused imports

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test(feehandlerseller.ts): deletes TS test

Fully migrated to foundry test.

* refactor(FeeHandlerSeller.t.sol): use arbitrary token address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/FeeHandlerSeller.t.sol"
```

* test: migrate `UniswapFeeHandlerSeller.t.sol` to foundry (#11171)

* test(UniswapFeeHandlerSeller.t.sol): adds MVP test outline

First test passes as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for non-owner `setRouter` test

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* test(UniswapFeeHandlerSeller.t.sol): adds test for setting router to zero address

All tests pass as expected ✅

```sh
forge test -vvvv \
--match-path "test-sol/unit/common/UniswapFeeHandlerSeller.t.sol"
```

* chore(UniswapFeeHandlerSeller.t.sol): debugging `expectRevert`

I can't seem to get the contract to revert when the max number of routers are set per token. Although limit is hardcoded to 3, the `setRouter` function seems to accept more tokens than the limit.

```sh
Logs:
  Setting router 0
  Setting router 1
  Setting router 2
  Setting router 3
  Setting router 4
  Setting router 5
  Setting router 6
  Setting router 7
  Setting router 8
  Setting router 9
  Routers for token: 1
  ```

* fix(FeeHandlerSeller.t.sol): use distinct router addressees

Fixes a bug in the test where I couldn't trigger the expected revert.

* style(FeeHandlerSeller.t.sol): linting

* test(FeeHandlerSeller.t.sol): adds test for large list and applies linting

* refactor(FeeHandlerSeller.t.sol): removes setup() to improve readability

* chore(FeeHandlerSeller.t.sol): adds code comment for context

* test(uniswapfeehandlerseller.ts): removes TS test

Fully covered by newly added Foundry test `UniswapFeeHandlerSeller.t.sol`

* refactor: remove unused code comment in `Proxy.sol` (#11174)

* refactor(Proxy.sol): remove unused code comments

This code change makes a test fail:
test-sol/unit/common/ProxyFactory08.t.sol > test_verifyArtifacts

```sh
$ forge test

Failing tests:
Encountered 1 failing test in test-sol/unit/common/ProxyFactory08.t.sol:ProxyFactoryTest
[FAIL. Reason: panic: assertion failed (0x01)] test_verifyArtifacts() (gas: 188341)
```

I'm not 100% certain but it's maybe because the `packages/protocol/artifacts/Proxy/proxyInitCode0.5.17+commit.d19bba13.hex` artifact is derived from the contract with the code comments.

* refactor(ProxyFactory08.t.sol): simplify `getCode` arguments

This is semantically equivalent, see https://book.getfoundry.sh/cheatcodes/get-code

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `bytecode.object.`

* chore(artifacts/Proxy): adds `bytecode`

I simply copy/pasted the JSON value at `packages/protocol/out/Proxy.sol/Proxy.json` > `deployedBytecode.object.`

* docs(artifacts/Proxy/README): adds a note for future reference

* style(artifacts/Proxy/README): fix typo

* style(artifacts/Proxy/README): fix typo

* refactor: uses `L2Migration.s.sol` and simplifies migration script (#11177)

* refactor(constants.sh): renames target contract variable for better readability

* fix(interfaces/ICeloDistributionSchedule): removes 1 argument from `activate` function

As far as I can see, this interface was not defined correctly and had an argument too much.

* refactor(MigrationL2.s.sol): moves `activate` call to script and refactors bash file

Left two TODO comments.

* refactor(constants): uses `DEPLOYER_ACCOUNT`

* refactor(constant.sh): removes anvil private key (not used anymore)

* refactor(Migrations.s.sol): add `setupUsingRegistry()` to improve readability

* style(scripts/foundry): indent lines that don't start a command

* feat(IEpochRewards): adds new interface

* feat(UsingRegistry): adds EpochRewards

* refactor(MigrationL2): gets fractions from EpochRewards.sol

* chore(MigrationL2): delete console.log import

* chore(MigrationL2): deletes `TODO` comment

* style(protocol): linting

* Test celo-monorepo.yml trigger filters

* Remove useless workflow triggers

* Run on repository runners

---------

Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>

* Anvil migrations: use stable symbols (#11193)

* L2 devchain fix (#11200)

* L2 devchain fix

* fixes

* artifact fixes

* [DO NOT MERGE] Epoch manager WIP (#11189)

* Fix anvil devchain generation (#11226)

* Get epoch info of specified epoch (#11231)

* EpochManager FinishNextEpochProcessing unit tests (#11233)

* Bring back some functions removed since CR11 (#11239)

* Bring back getHotfixRecord function

* Bring back getMaxGroupSize

* Bring back getRegisteredValidatorSigners

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Epoch Manager "finishNextEpochProcessing"  gas test (#11240)

* Gas usage test

* prettify

* Isolate test run

* removal of struct

* Update gas test

* prettify

* refactor test a bit

* added another gas test

* prettify

* Don't update SortedLinkedList pointers when not necessary (#11241)

* Truffle works with anvil (#11230)

* Score manager gas optimization (#11246)

* Score manager gas optimization

* prettify

* PR comments

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>

* Add score manager setter role (#11244)

* Fix buyback and add fee split (#11234)

* Make Governance slasher able to remove validator and decrease slash m… (#11245)

* Adds backwards compatibility in `UsingPrecompile` contract.  (#11236)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

---------

Co-authored-by: Martín Volpe <volpe@clabs.co>
Co-authored-by: pahor167 <hornak.pavel@gmail.com>

* Finish epoch processing split (#11243)

* added `getEpochInfoOfEpoch(uint256)` to get epoch info of specific epochs

* updated natspec

* PR feedback

* Use constant

* breakup test; added more

* ++ registry to precompile contract

* added elected to epoch info

* numberValidatorsInSet backwards compatibility

* validator address & validatorSigner address from set

* support `getEpochNumber()` backwards compatibility in UsingRegistry

* using `getEpochByBlockNumber` instead of `getEpochByNumber`

* limit span of loop only to L2 blocks

* use binary search instead of blind loop

* ++ natspec

* added getEpochNumberOfBlock() backwards compatibility support

* ++ electedSigners

* make usingPrecompile onlyL1 contract

* ++ precompile override contract

* fix epoch manager bug and mock

* using precompileOverride in validators contract

* wording

* using indexed function when querying specific validator accounts or signers on L2

* fixed failing test

* using independent mapping for elected accounts and signers

* removed old elected list

* support 0.5.13 contracts using precompiles

* -- registry import

* ++ registry in PrecompilesOverride

* ++ more tests

* increase gaslimit

* moved election history update to epoch processing start.

* unused var

* clean up

* fixed e2e test

* simplify code

* Finish epoch processing split

* FinishEpochProcessing split e2e test

* setToProcessGroups unit tests

* process group unit tests

* Removed support for election historical data after that it's unlikely to be in use by external parties

* PR feedback

* -- spacing

* reorder state var

* stat var reorder

* small fix

* delete electedSigners at end of epochprocessing

* CI fix

* added comment

* prettify

* Pr comments

---------

Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
Co-authored-by: Martín Volpe <volpe@clabs.co>

* Prevent CELO Transfer to Unreleased Treasury (#11222)

* first compiling draft
no working test.

Co-authored-by: Martín Volpe <martinvol@users.noreply.github.com>

* Compiler fixes + finishNextEpochProcess

* allocateValidatorsRewards compilable

* First few tests

* test fix

* uisng registry instead

* updated registry ID var names

* typo

* ++ mock contracts in 0.8

* ++ passing test using mock

* Removal of using precompiles

* Score…
m-chrzan and others added 3 commits February 2, 2026 14:08
* Update of Delegation

* Refactor Governance voting weight calculation to use locked gold instead of total governance voting power. Update tests to reflect changes in upvote reporting for delegated votes.

---------

Co-authored-by: Pavel Hornak <pavel.hornak@clabs.co>
Co-authored-by: Martín Volpe <github@martinvol.pe>
#11623)

* feat(protocol): Fix Foundry release tooling to produce identical bytecode as Truffle

This PR fixes several issues in the Foundry-based release scripts to ensure
they produce bytecode identical to Truffle (excluding metadata hash).

Key fixes:

- foundry.toml: Use solc 0.5.14 for truffle-compat profile (0.5.13 has
  evm_version bug in Foundry), add lint_on_build = false to disable Solar
  linter for old 0.5.x syntax

- lib/compatibility/ast-code.ts: Fix getCompilerVersion to detect Foundry
  artifact compiler version from metadata.compiler.version path

- lib/compatibility/report.ts: Sort contracts alphabetically to ensure
  consistent ordering between Truffle and Foundry reports

- lib/compatibility/ignored-contracts-v9.ts: Support both tag format
  (core-contracts.vX) and branch format (release/core-contracts/X)

- scripts/foundry/make-release.ts: Add --rpcUrl parameter for local anvil
  testing, fix viem TypeScript errors, add L2 contracts to proxiedCoreContracts

- scripts/foundry/verify-bytecode-foundry.ts: Fix TypeScript errors for
  viem compatibility, use ts-node instead of node

- truffle-config-parent.js: Fix anvil network to use port 8545 and accept
  any chain ID for fork testing

Also adds:
- RELEASE_PROCESS_FOUNDRY.md: Documentation for Foundry release process
- releaseData/initializationData/release15.json: Empty init data for release 15

* lint

* typescript fix

* fix typescript 2

* PR comments

* Updated skill with release to Celo sepolia directly

* Add automatic contract verification to release script

- Add Blockscout and Celoscan verification after deployment
- Implement retry logic (up to 6 retries, max 60s delay) for block explorer indexing
- Support Celoscan API key via CLI flag (-a), env var, or .env.json
- Add -s flag to skip verification when needed
- Auto-skip verification for local forks
- Track linked libraries and foundry profiles for accurate verification
- Clean, minimal verification output (one line per contract)

Also updates documentation:
- SKILL.md: Add verification docs, update retry count, add Step 0 confirmation
- RELEASE_PROCESS_FOUNDRY.md: Add deployer keys, local fork, verification sections
- examples.md: Add verification examples and API key setup

* Update packages/protocol/releaseData/initializationData/release15.json

Co-authored-by: Mc01.eth <phenom.home@gmail.com>

* fix(protocol): Fix viem type compatibility for Foundry release scripts

- Replace PublicClient<Transport, Chain> and WalletClient with inferred
  types (SimplePublicClient/SimpleWalletClient) to avoid viem's strict
  generic constraints
- Use low-level call + encodeFunctionData + decodeFunctionResult for
  registry reads to work around viem's strict ReadContractParameters
- Use defineChain() instead of type casting for Celo Sepolia chain
  definition in make-release.ts and verify-bytecode-foundry.ts
- Add --transpile-only flag to ts-node in make-release-foundry.sh
- Require CELOSEPOLIA_FROM env var for celosepolia network in truffle config

These changes ensure compatibility with viem ^2.29.4 (tested with 2.45.0)
while maintaining type safety.

* refactor(protocol): Simplify viem client type definitions in release scripts

- Introduced explicit interfaces for PublicClient and WalletClient methods to enhance type safety and avoid complex generic constraints.
- Updated function signatures in make-release.ts to use the new interfaces, ensuring compatibility with viem.
- Maintained API compatibility by keeping the original registryAbi parameter.

These changes improve code clarity and maintainability while ensuring type safety in the release process.

* build fix

* Add node-cache-update skill documentation and increment cache version

- Introduced SKILL.md to document the process for updating the GitHub Actions node module cache when dependencies change.
- Incremented NODE_MODULE_CACHE_VERSION in celo-monorepo.yml from 9 to 10 to reflect recent dependency updates.

These changes ensure that CI builds use the correct dependencies and avoid issues with stale cached modules.

* Update truffle configuration to use port 8546 for anvil testing

- Changed the port setting in truffle-config-parent.js from the default 8545 to 8546 to align with the ANVIL_PORT defined in constants.sh. This adjustment ensures consistency in the development environment for anvil fork testing.

* claude skills

* skills support also antigravity

* fix: Log warnings when Celoscan API key cannot be read from .env.json and reorder imports.

* fix: remove accidentally re-added memview.sol submodule

---------

Co-authored-by: Pavel Hornak <pavel.hornak@clabs.co>
Co-authored-by: Mc01.eth <phenom.home@gmail.com>
Co-authored-by: Martín Volpe <github@martinvol.pe>
* Remove ganache from package.json

* Remove devchain scripts
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing lsof availability check causes script failure

High Severity

The scripts stop_anvil.sh and start_anvil.sh unconditionally execute kill $(lsof -t -i:$ANVIL_PORT) without checking if lsof is installed. With set -euo pipefail at the top, the scripts will crash immediately if lsof is unavailable. Unlike release-on-devchain.sh which checks if command -v lsof, these scripts directly invoke lsof, causing failures on systems where it isn't pre-installed (such as minimal container environments or fresh Ubuntu installations).

Additional Locations (1)

Fix in Cursor Fix in Web

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.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Free Tier 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.

Bugbot Autofix is kicking off a free cloud agent to fix these issues. This run is complimentary, but you can enable autofix for all future PRs in the Cursor dashboard.

protocol-test-matrix:
# Keeping name short because GitHub UI does not handle long names well
name: ${{ matrix.name }}
runs-on: ['self-hosted', 'monorepo-node18']
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devchain copy step removed but test still expects copied path

High Severity

The "Copy DevChain and Build generated from released tag" step was removed, but the "Test against current release" step still computes BUILD_AND_DEVCHAIN_DIR (which resolves to build/core-contracts.v14.anvil) and passes it to ci:test-make-release. The devchain artifact is downloaded to packages/protocol/.tmp/devchain but is never copied to the BUILD_AND_DEVCHAIN_DIR path, so the test will reference a directory that doesn't contain the expected devchain data.

Fix in Cursor Fix in Web

working-directory: packages/protocol
name: Generate anvil
runs-on: ['self-hosted', 'org', 'npm-publish']
runs-on: ['self-hosted', 'monorepo-node18']
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Runner label changed opposite to migration direction

Medium Severity

The runner was changed from ['self-hosted', 'org', 'npm-publish'] to ['self-hosted', 'monorepo-node18'], but every other workflow in this PR migrates away from monorepo-node18 to ['self-hosted', 'org', 'ubuntu22-node18']. This appears to be moving in the wrong direction — the monorepo-node18 label is being deprecated across all other workflows.

Fix in Cursor Fix in Web

yarn anvil-devchain:start-L2
mkdir .tmp/devchain
mv .tmp/devchain.json .tmp/devchain
mv .tmp/l2-devchain.json .tmp/devchain
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing yarn install in devchain generation workflow

Medium Severity

The yarn install and yarn build steps were removed, but the devchain generation step still runs yarn anvil-devchain:start-L2. Without yarn install, node_modules won't exist and any script dependencies won't be available, likely causing the yarn command to fail when it tries to resolve the script or its dependencies.

Fix in Cursor Fix in Web

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.