Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add integration tests for Anvil migrations #11002

Merged
merged 41 commits into from
Jun 5, 2024

Commits on May 21, 2024

  1. Configuration menu
    Copy the full SHA
    cd987f3 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Configuration menu
    Copy the full SHA
    601ad7c View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. Configuration menu
    Copy the full SHA
    3ae51c4 View commit details
    Browse the repository at this point in the history
  2. test(test-sol/integration): adds e2e test for GoldToken

    This is a test run, to see how `setUp()` and contract definitions work.
    
    1. run devchain
    
    ```sh
    ./migrations_sol/create_and_migrate_anvil_devchain.sh
    ```
    
    2. run test against devchain
    
    ```sh
    forge test \
    --match-path test-sol/integration/Integration.t.sol \
    --match-contract GoldTokenTest_General \
    -vvv \
    --fork-url http://127.0.0.1:8546
    ```
    
    Tests pass
    
    Output:
    
    ```sh
    [⠰] Compiling...
    No files changed, compilation skipped
    
    Running 3 tests for test-sol/integration/Integration.t.sol:GoldTokenTest_General
    [PASS] test_decimals() (gas: 10837)
    Logs:
      GoldToken address is: 0xfE8CbC1cFA1b3b8256f310bdfd40E60597083448
    
    [PASS] test_name() (gas: 12537)
    Logs:
      GoldToken address is: 0xfE8CbC1cFA1b3b8256f310bdfd40E60597083448
    
    [PASS] test_symbol() (gas: 12579)
    Logs:
      GoldToken address is: 0xfE8CbC1cFA1b3b8256f310bdfd40E60597083448
    
    Test result: ok. 3 passed; 0 failed; 0 skipped; finished in 135.40ms
    
    Ran 1 test suites: 3 tests passed, 0 failed, 0 skipped (3 total tests)
    ```
    arthurgousset committed May 28, 2024
    Configuration menu
    Copy the full SHA
    ee24877 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Configuration menu
    Copy the full SHA
    714bc75 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8651f31 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2024

  1. test(test-sol/integration): upgrades to solidity 0.8

    This is to allow me to use the `.code` property on deployed smart contracts, which is only supported on Solidity 0.8 and above.
    arthurgousset committed May 30, 2024
    Configuration menu
    Copy the full SHA
    eec3863 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    710059f View commit details
    Browse the repository at this point in the history
  3. nit(test-sol/integration): updates constructor visibility

    In Solidity versions 0.7.0 and later, constructors are implicitly internal, meaning they can only be called within the contract itself or derived contracts, making the visibility keyword redundant.
    arthurgousset committed May 30, 2024
    Configuration menu
    Copy the full SHA
    c4f55d5 View commit details
    Browse the repository at this point in the history
  4. nit(test-sol/integration): updates function state mutability

    The state mutability of a function can be restricted to view if the function does not modify the state of the blockchain. A view function promises not to alter the state, which allows the Ethereum Virtual Machine (EVM) to optimize how it handles the function.
    
    The function does not modify any state; it only reads from the registry and logs some information.
    arthurgousset committed May 30, 2024
    Configuration menu
    Copy the full SHA
    de6b143 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d99a746 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4df1e7c View commit details
    Browse the repository at this point in the history

Commits on May 31, 2024

  1. refactor(test-sol): adds registry array in constants.sol

    The goal is to use that in both the migration script (`Migration.s.sol`) and the integration test (`Integration.t.sol`).
    arthurgousset committed May 31, 2024
    Configuration menu
    Copy the full SHA
    dc6a6c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d6389c8 View commit details
    Browse the repository at this point in the history
  3. fix(test-sol/integration): adds back Test.sol import

    Mistakenly deleted earlier
    arthurgousset committed May 31, 2024
    Configuration menu
    Copy the full SHA
    ab7bab9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e372b8a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    130523e View commit details
    Browse the repository at this point in the history
  6. test(test-sol): adds helper to remove metadata from bytecode

    Also adds docstring for better readability.
    arthurgousset committed May 31, 2024
    Configuration menu
    Copy the full SHA
    1e61942 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e55c973 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    14bd4cf View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    075697e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    41bff1b View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2024

  1. Configuration menu
    Copy the full SHA
    c7511a8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e983e9a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bb386de View commit details
    Browse the repository at this point in the history
  4. Merge branch 'arthurgousset/chore/anvil-integration-tests' of github.…

    …com:celo-org/celo-monorepo into arthurgousset/chore/anvil-integration-tests
    arthurgousset committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    a4d4d8b View commit details
    Browse the repository at this point in the history
  5. fix(workflows/protocol_tests): downgrades foundry version

    The latest version has a regression that leads to a failing integration test. But, fixing a previous nightly build fixed the error.
    arthurgousset committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    1f7ab42 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2024

  1. Configuration menu
    Copy the full SHA
    2f9f837 View commit details
    Browse the repository at this point in the history
  2. chore(test-sol/utils): reverts deployCodeTo edit in ECDSAHelper

    Because I'm downgrading to a previous foundry version, I have to undo the change to this line made in this PR: #10997
    arthurgousset committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    30de987 View commit details
    Browse the repository at this point in the history
  3. style(protocol): linting

    I always forget to run `yarn prettify` in the top-level directory
    arthurgousset committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    dcb09e1 View commit details
    Browse the repository at this point in the history
  4. docs(workflows/protocol_tests): adds better code comment

    To explain what flags and arguments are used.
    arthurgousset committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    c27a53e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b9ce129 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7a740cb View commit details
    Browse the repository at this point in the history
  7. style(protocol): linting

    Using `yarn prettify` in the top-level directory
    arthurgousset committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    7201463 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    19faa9b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    d31c336 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a7f4905 View commit details
    Browse the repository at this point in the history
  11. refactor(migrations_sol&test-sol): removes Utils import

    Adds function in `Integration.t.sol` directly to avoid 0.5.x version problems.
    arthurgousset committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    75a4306 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    1e6b230 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2024

  1. refactor(test-sol/integration): use .code property instead of helpe…

    …r function
    
    Because the script is now on 0.8, we can use the `.code` property to fetch the runtime bytecode of a smart contract deployed on the devchain. Previously, we needed to load the bytecode from storage with inline assembly.
    arthurgousset committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    9c913ca View commit details
    Browse the repository at this point in the history
  2. refactor(foundry): simplifies configs to exclude tests

    Functionally this should be the same, but the configs and flags are more readable.
    arthurgousset committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    255f467 View commit details
    Browse the repository at this point in the history