Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]>
- Loading branch information