contracts icon indicating copy to clipboard operation
contracts copied to clipboard

feat(e2e): deploy and configure both layers with the e2e script

Open tmigone opened this issue 3 years ago • 2 comments
trafficstars

Motivation

Previously the e2e testing framework would allow running tests on either an L1 or L2 deployment, with cross-chain messages not being a possibility.

This PR updates the e2e framework so we can now deploy both L1 and L2, configure them fully (including bridge) and have the ability to send L1 <> L2 messages. This requires setting up Arbitrum Nitro local testnodes using the Edge & Node patched fork: https://github.com/edgeandnode/nitro. A new simple scenario that uses the bridge to send GRT from L1 to L2 is also included.

Also updating the GitHub CI action to make use of this, a tl;dr of what the action will now be doing:

  • Start an L1 node (geth) and an L2 sequencer connected to it.
  • Deploy arbitrum's contracts to L1/L2
  • Deploy The Graph protocol to L1/L2
  • Configure the protocol (L1, L2, bridge)
  • Run e2e tests on both L1 and L2 to check everything looks good
  • Run e2e scenarios on both L1 and L2
    • Publish subgraphs, add signal
    • Open allocations
    • Send GRT from L1 to L2
    • Close allocations (Not working yet, need to figure out a way of advancing time)

Coming up next:

  • Fully test the bridge configuration (including cross checking the addresses on both ends, contract ownership, auth, etc).
  • Test more operations
    • Send GRT to L2 without ticket autoredeem
    • Send GRT with additional calldata
    • Send GRT from L2 to L1

Changes

  • Update @arbitrum/sdk to v3.0.0-rc1
  • Improve some deployment tasks
  • Add some new nitro specific tasks
  • Update e2e testing framework to allow running L1 and L2 tests on a configured L1/L2 deployment (including bridge)
  • Update github action to run the L1/L2 e2e tests on nitro local testnodes.
  • Added a new e2e scenario to send GRT from L1 to L2

tmigone avatar Sep 22 '22 21:09 tmigone

Codecov Report

Base: 91.58% // Head: 91.58% // No change to project coverage :thumbsup:

Coverage data is based on head (ae1d70b) compared to base (caf5ab5). Patch has no changes to coverable lines.

Additional details and impacted files
@@                      Coverage Diff                      @@
##           pcv/fix-bridge-callhook-data     #717   +/-   ##
=============================================================
  Coverage                         91.58%   91.58%           
=============================================================
  Files                                42       42           
  Lines                              1997     1997           
  Branches                            361      361           
=============================================================
  Hits                               1829     1829           
  Misses                              168      168           
Flag Coverage Δ
unittests 91.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Sep 23 '22 19:09 codecov[bot]

I tried running the e2e locally, it worked OK when doing L1 only, then I set the L2_NETWORK variable to localhost and got some errors, I'm not sure how to set it to make it run on a local env.

The script makes the assumption that you are either running only on L1 or running both on L1/L2. I think running ONLY on L2 using a hardhat node (which is what you get with localhost) is not really a valid use case.

I got an error when doing L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e -> ProviderError: sender doesn't have enough funds to send tx. The max upfront cost is: 31501500000000 and the sender's account only has: 0 - should I run the nitro setup separately?

Yes you need to setup the nitro testnodes separately. You can check the TESTING.md file for instructions.

tmigone avatar Oct 03 '22 14:10 tmigone