Skip to content

Commit d35acb6

Browse files
authored
Merge pull request #751 from graphprotocol/l2-public-testnet
L2 public testnet deployment and related fixes
2 parents d8fed24 + aa85104 commit d35acb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1828
-959
lines changed

.github/workflows/e2e.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ name: Run E2E tests
33
on:
44
push:
55
branches: [dev]
6+
paths:
7+
- contracts/**
8+
- config/**
9+
- e2e/**
10+
- cli/**
11+
- tasks/**
12+
- scripts/**
13+
- hardhat.config.ts
614
pull_request: {}
715

816
jobs:
@@ -25,9 +33,7 @@ jobs:
2533
run: |
2634
git clone https://github.com/edgeandnode/nitro
2735
pushd nitro
28-
git checkout ci
2936
git submodule update --init --recursive
3037
./test-node.bash --init --no-blockscout --detach
3138
popd
32-
NETWORK=localnitrol1 ADDRESS_BOOK=addresses.json GRAPH_CONFIG=config/graph.localhost.yml yarn test:e2e
33-
NETWORK=localnitrol2 ADDRESS_BOOK=addresses.json GRAPH_CONFIG=config/graph.arbitrum-localhost.yml yarn test:e2e
39+
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e

.github/workflows/gre.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Run GRE tests
33
on:
44
push:
55
branches: [dev]
6+
paths:
7+
- gre/**
68
pull_request: {}
79

810
jobs:

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ bin/
1919
# Coverage and other reports
2020
/reports
2121
coverage.json
22+
23+
# Local test files
24+
addresses-local.json
25+
localNetwork.json
26+
arbitrum-addresses-local.json
27+
tx-*.log
28+
29+
# Keys
30+
.keystore

DEPLOYMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ To deploy to a different network execute:
4040
yarn deploy -- --network {networkName}
4141
4242
# Example
43-
yarn deploy -- --network kovan
43+
yarn deploy -- --network goerli
4444
```
4545

4646
The network must be configured in the `hardhat.config.ts` as explained in https://hardhat.org/config.
@@ -100,7 +100,7 @@ Some contracts require the address from previously deployed contracts. For that
100100
### Deploying a new testnet
101101

102102
1. Make sure contracts are up to date as you please.
103-
2. `yarn deploy-rinkeby` to deploy to Rinkeby. This will create new contracts with new addresses in `addresses.json`.
103+
2. `yarn deploy-goerli` to deploy to Goerli. This will create new contracts with new addresses in `addresses.json`.
104104
3. Update the `package.json` and `package-lock.json` files with the new package version and publish a new npm package with `npm publish`. You can dry-run the files to be uploaded by running `npm publish --dry-run`.
105105
4. Merge this update into master, branch off and save for whatever version of the testnet is going on, and then tag this on the github repo, pointing to your branch (ex. at `testnet-phase-1` branch). This way we can always get the contract code for testnet, while continuing to do work on mainnet.
106106
5. Pull the updated package into the subgraph, and other apps that depend on the package.json.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ yarn add @graphprotocol/contracts
6363

6464
# Contract Addresses
6565

66-
The testnet runs on Rinkeby, while mainnet is on Ethereum Mainnet. The addresses for both of these can be found in `./addresses.json`.
66+
The testnet runs on Goerli, while mainnet is on Ethereum Mainnet. The addresses for both of these can be found in `./addresses.json`.
6767

6868
# Local Setup
6969

@@ -92,7 +92,7 @@ The most straightforward way to interact with the contracts is through the hardh
9292

9393
```
9494
# A console to interact with testnet contracts
95-
npx hardhat console --network rinkeby
95+
npx hardhat console --network goerli
9696
```
9797

9898
### Hardhat Tasks

TESTING.md

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,52 @@ There are several types of e2e tests which can be run separately:
3333
- Read and write interactions with the blockchain. _Requires an account with sufficient balance!_
3434
- Example: a test validating that a user can add signal to a subgraph.
3535

36-
### Hardhat local node
36+
### Hardhat local node (L1)
3737

38-
To run all e2e tests against a hardhat local node run:
38+
It can be useful to run E2E tests against a fresh protocol deployment on L1, this can be done with the following:
3939

4040
```bash
41-
yarn test:e2e
41+
L1_NETWORK=localhost yarn test:e2e
4242
```
4343

44-
The command will perform the following actions:
44+
The command will:
45+
- start a hardhat local node
46+
- deploy the L1 protocol
47+
- configure the new L1 deployment
48+
- Run all L1 e2e tests
4549

46-
- Start a hardhat node (localhost)
47-
- Run `migrate:accounts` hardhat task to create keys for all protocol roles (deployer, governor, arbiter, etc). This currently doesn't support multisig accounts.
48-
- Run `migrate` hardhat task to deploy the protocol
49-
- Run `migrate:ownership` hardhat task to transfer ownership of governed contracts to the governor
50-
- Run `migrate:unpause` to unpause the protocol
51-
- Run `e2e` hardhat task to run all deployment tests (config and init)
52-
- Run `e2e:scenario` hardhat task to run a scenario
50+
### Arbitrum Nitro testnodes (L1/L2)
51+
52+
If you want to test the protocol on an L1/L2 setup, you can run:
53+
54+
```bash
55+
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e
56+
```
57+
58+
In this case the command will:
59+
- deploy the L1 protocol
60+
- configure the new L1 deployment
61+
- deploy the L2 protocol
62+
- configure the new L2 deployment
63+
- configure the L1/L2 bridge
64+
- Run all L1 e2e tests
65+
- Run all L2 e2e tests
66+
67+
Note that you'll need to setup the testnodes before running the tests. See [Quick Setup](https://github.com/edgeandnode/nitro#quick-setup) for details on how to do this.
5368

5469
### Other networks
5570

5671
To run tests against a live testnet or even mainnet run:
5772

5873
```bash
5974
# All e2e tests
60-
npx hardhat e2e --network <network> --graph-config config/graph.<network>.yml
75+
ARBITRUM_ADDRESS_BOOK=<arbitrum-address-book> npx hardhat e2e --network <network> --l1-graph-config config/graph.<l1-network>.yml --l2-graph-config config/graph.<l2-network>.yml
6176

6277
# Only deployment config tests
63-
npx hardhat e2e:config --network <network> --graph-config config/graph.<network>.yml
78+
ARBITRUM_ADDRESS_BOOK=<arbitrum-address-book> npx hardhat e2e:config --network <network> --l1-graph-config config/graph.<l1-network>.yml --l2-graph-config config/graph.<l2-network>.yml
6479

6580
# Only deployment init tests
66-
npx hardhat e2e:init --network <network> --graph-config config/graph.<network>.yml
81+
ARBITRUM_ADDRESS_BOOK=<arbitrum-address-book> npx hardhat e2e:init --network <network> --l1-graph-config config/graph.<l1-network>.yml --l2-graph-config config/graph.<l2-network>.yml
6782

6883
# Only a specific scenario
6984
npx hardhat e2e:scenario <scenario> --network <network> --graph-config config/graph.<network>.yml
@@ -82,26 +97,4 @@ Scenarios are defined by an optional script and a test file:
8297
- They run before the test file.
8398
- Test file
8499
- Should be named e2e/scenarios/{scenario-name}.test.ts.
85-
- Standard chai/mocha/hardhat/ethers test file.
86-
87-
## Setting up Arbitrum's testnodes
88-
89-
Arbitrum provides a quick way of setting up L1 and L2 testnodes for local development and testing. The following steps will guide you through the process of setting them up. Note that a local installation of Docker and Docker Compose is required.
90-
91-
```bash
92-
git clone https://github.com/offchainlabs/nitro
93-
cd nitro
94-
git submodule update --init --recursive
95-
96-
# Apply any changes you might want, see below for more info, and then start the testnodes
97-
./test-node.bash --init
98-
```
99-
100-
**Useful information**
101-
- L1 RPC: [http://localhost:8545](http://localhost:8545/)
102-
- L2 RPC: [http://localhost:8547](http://localhost:8547/)
103-
- Blockscout explorer (L2 only): [http://localhost:4000/](http://localhost:4000/)
104-
- Prefunded genesis key (L1 and L2): `e887f7d17d07cc7b8004053fb8826f6657084e88904bb61590e498ca04704cf2`
105-
106-
**Enable automine on L1**
107-
In `docker-compose.yml` file edit the `geth` service command by removing the `--dev.period 1` flag.
100+
- Standard chai/mocha/hardhat/ethers test file.

0 commit comments

Comments
 (0)