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

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

Merged

Commits on Jul 3, 2024

  1. 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.
    arthurgousset committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    17dc558 View commit details
    Browse the repository at this point in the history
  2. feat(package.json): adds yarn commands for e2e and integration tests

    Two helper commands to run two Foundry-related bash scripts during local development.
    arthurgousset committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    7ec412e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ccb8962 View commit details
    Browse the repository at this point in the history
  4. 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.
    arthurgousset committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    d772383 View commit details
    Browse the repository at this point in the history
  5. 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
    arthurgousset committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    4a6b28a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    884523e View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2024

  1. Configuration menu
    Copy the full SHA
    6c50678 View commit details
    Browse the repository at this point in the history
  2. feat(scripts/foundry): activates CeloDistributionSchedule

    Now successfully activates CeloDistributionSchedule.
    Does not yet dump state correctly
    arthurgousset committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    651c9b7 View commit details
    Browse the repository at this point in the history
  3. refactor(scripts/foundry): moves variables to constants.sh

    Simplifies maintenance and readability of scripts.
    arthurgousset committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    1b90853 View commit details
    Browse the repository at this point in the history
  4. refactor(scripts/foundry): moves more variables to constants.sh

    Simplifies maintenance and readability of scripts.
    arthurgousset committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    4a7606b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2fc22ef View commit details
    Browse the repository at this point in the history
  6. 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.
    arthurgousset committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    7315121 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3ea0477 View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2024

  1. refactor(scripts/foundry): rename to `create_and_migrate_anvil_l2_dev…

    …chain.sh`
    
    To keep it consistent with the L1 script
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    563ec74 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a5c8bf0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fca75d4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    209ca83 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e4671eb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    92c1dd8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ed9a6c0 View commit details
    Browse the repository at this point in the history
  8. 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
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    9e04ad9 View commit details
    Browse the repository at this point in the history
  9. chore(workflows): debugging jq error on CI

    Can't find build artifacts on CI, so trying to work out what might be wrong.
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    ad5d1ba View commit details
    Browse the repository at this point in the history
  10. 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.
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    9215e50 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    05f3532 View commit details
    Browse the repository at this point in the history
  12. 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
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    95d5a6d View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    dea18dd View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    5e60f18 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    05579f6 View commit details
    Browse the repository at this point in the history
  16. chore(workflows): add back NPM install step

    Not confident enough to remove it in this PR.
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    c505eba View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    276b569 View commit details
    Browse the repository at this point in the history
  18. feat(workflows): publishes L1 and L2 state

    Also updates integration test to explicitly run against L1 devchain, and not L2 devchain.
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    1e4cc56 View commit details
    Browse the repository at this point in the history
  19. 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
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    6311800 View commit details
    Browse the repository at this point in the history
  20. refactor(workflows): replace CI env with variable from constants.sh

    Simplifies code and makes it easier to update ports in a single place.
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    ec192f3 View commit details
    Browse the repository at this point in the history
  21. 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
    arthurgousset committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    58a1fd0 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    fa243ca View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2024

  1. 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.
    arthurgousset committed Jul 8, 2024
    Configuration menu
    Copy the full SHA
    ab7f5d0 View commit details
    Browse the repository at this point in the history
  2. 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.
    arthurgousset committed Jul 8, 2024
    Configuration menu
    Copy the full SHA
    28464b6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d29b220 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cd6ca05 View commit details
    Browse the repository at this point in the history
  5. fix(workflows): hacky workaround to prevent Anvil bug when loading state

    Starting L1 from scratch instead of JSON state to circumvent this Anvil bug foundry-rs/foundry#7502.
    arthurgousset committed Jul 8, 2024
    Configuration menu
    Copy the full SHA
    a906048 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2024

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

    Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
    arthurgousset and soloseng committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    b88b337 View commit details
    Browse the repository at this point in the history
  2. Update .github/workflows/protocol-devchain-anvil.yml

    Co-authored-by: soloseng <102702451+soloseng@users.noreply.github.com>
    arthurgousset and soloseng committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    ff291e0 View commit details
    Browse the repository at this point in the history
  3. 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
    ```
    arthurgousset committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    06e7fe7 View commit details
    Browse the repository at this point in the history
  4. docs(README): improves README

    More context, examples, background, files in the package.
    arthurgousset committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    85895b5 View commit details
    Browse the repository at this point in the history