Skip to content

Merge dev into pcv/l2-linear-rewards #752

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

Merged
merged 95 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
5e36583
fix: use path.join to manage path concat
abarmat Sep 21, 2022
0ca43ff
feat: add publish and mint to the CLI
abarmat Sep 21, 2022
45ce81e
chore: add reports for recent audits (#710)
pcarranzav Sep 28, 2022
b6219d3
chore: run GitHub actions when it makes sense (#707)
tmigone Sep 29, 2022
04cfd3a
chore: provide sane defaults for graph config (#721)
tmigone Oct 3, 2022
fdc0bae
chore: remove rinkeby and kovan references (#729)
tmigone Oct 4, 2022
f1c5fe7
feat: add optional expression logging to GRE (#728)
tmigone Oct 4, 2022
323bdf8
test: fix race condition in BridgeEscrow tests
pcarranzav Oct 4, 2022
08cddfa
chore: provide sane defaults for graph config (#727)
tmigone Oct 4, 2022
7b38314
test: don't use nc to check if evm is running
pcarranzav Oct 5, 2022
0b7055a
test: print gas report, and ensure evm is killed
pcarranzav Oct 13, 2022
3f16e5a
Merge pull request #732 from graphprotocol/pcv/test-gas-cat-report
pcarranzav Oct 14, 2022
1d5dde2
fix: prevent unpausing gateways if they're not configured (OZ M-01 fr…
pcarranzav Oct 20, 2022
ff11ec2
fix: use separate task to unpause bridge
pcarranzav Oct 20, 2022
6d4a0d7
fix(e2e): gateways start paused
pcarranzav Oct 21, 2022
16dc44e
fix: validate Arbitrum addresses and callhook senders are contracts (…
pcarranzav Oct 20, 2022
2dfacb6
fix: remove unnecessary L2 gas check (OZ N-01 from #700)
pcarranzav Oct 21, 2022
fa52952
fix: add storage gaps to GraphTokenGateway and GraphTokenUpgradeable …
pcarranzav Oct 21, 2022
bcb4802
fix: ensure l2Counterpart is nonzero (C4 M-201)
pcarranzav Oct 21, 2022
85312a0
fix: ensure contracts are only initialized once (C4 M-149)
pcarranzav Oct 21, 2022
2c4ac9d
fix(c4-117-g03): state variables should be cached in stack variables
tmigone Oct 24, 2022
76865a4
fix(c4-117-g05): require()/revert() strings longer than 32 bytes cost…
tmigone Oct 24, 2022
18afb3a
fix(c4-117-g06): keccak256() should only need to be called on a speci…
tmigone Oct 24, 2022
ee5d3cb
fix(c4-117-g11): using > 0 costs more gas than != 0 when used on a ui…
tmigone Oct 24, 2022
71314dd
fix(c4-117-g12): splitting require() statements that use && saves gas
tmigone Oct 24, 2022
d5aece4
fix(c4-117-g15): require() or revert() statements that check input ar…
tmigone Oct 24, 2022
2ad9f4e
fix(c4-6-g07): expressions for constant values such as a call to kecc…
tmigone Oct 24, 2022
e0440a8
fix(c4-6-g08): duplicated require()/revert() checks should be refacto…
tmigone Oct 24, 2022
3805ca9
fix(c4-6-13): use calldata instead of memory for function parameters
tmigone Oct 24, 2022
54157a7
fix(c4-86-g07): emitting or returning storage values
tmigone Oct 24, 2022
7d29d6d
fix(c4-172-g02): set allowance to 0 instead of decreasing allowance b…
tmigone Oct 24, 2022
534d224
fix(c4-287-g01): remove unused local variable
tmigone Oct 24, 2022
0b7ad55
fix(c4-272): remove unnecessary use of safe math
tmigone Oct 24, 2022
d091781
fix(c4-272): remove unnecessary usage of safemath
tmigone Oct 24, 2022
1f85e12
fix: further optimize governed contract
tmigone Oct 24, 2022
27902cc
fix: add visibility to managed immutable vars
tmigone Oct 24, 2022
e3a668e
fix: update e2e tests to new error messages
tmigone Oct 24, 2022
7e5ac05
feat(gre): add hardhat-secure-accounts to GRE (#696)
tmigone Oct 28, 2022
23f9dad
fix: avoid variable shadowing (C4 QA)
pcarranzav Oct 24, 2022
d90a2f3
fix: improve NatSpec and a few other details (C4 QA)
pcarranzav Oct 24, 2022
289f328
fix: typos in L1GraphTokenGateway (C4 QA)
pcarranzav Oct 24, 2022
d89c7a7
fix: make public functions external in GraphProxyAdmin (C4 QA)
pcarranzav Oct 24, 2022
a42bcbc
fix: make nonReentrant the first modifier (C4 QA)
pcarranzav Oct 24, 2022
ba1a870
fix: use underscore for private variables (C4 QA)
pcarranzav Oct 24, 2022
751240d
fix: emit the correct old admin in _setAdmin (C4 QA)
pcarranzav Oct 24, 2022
e789403
fix: prefer the term 'allowlist' for callhook senders
pcarranzav Oct 24, 2022
8d73fc3
fix: check deadline before recovering signature (C4 QA)
pcarranzav Oct 24, 2022
c74885f
fix: add some missing revert strings (C4 QA)
pcarranzav Oct 24, 2022
cc78a5c
fix: dont allow the router to be allowlisted (C4 QA)
pcarranzav Oct 24, 2022
38fa468
fix: mark some non-deployable contracts as abstract (C4 QA)
pcarranzav Oct 24, 2022
db2a17c
fix(Controller): mark a function that was public as external
pcarranzav Oct 24, 2022
dfd0a24
fix: use upgradeable OZ contracts (C4 QA)
pcarranzav Oct 24, 2022
eeb4bd0
fix: use explicit imports (C4 QA)
pcarranzav Oct 24, 2022
ae03579
fix: standardize function order in some contracts (C4 QA)
pcarranzav Oct 24, 2022
19928cc
fix: whitelist to allowlist
tmigone Oct 25, 2022
4bea094
fix: adjust some revert strings
pcarranzav Oct 25, 2022
ce0d0a3
test: fix revert strings
pcarranzav Oct 25, 2022
caf5ab5
fix: remove unneeded empty bytes from callhook data
pcarranzav Oct 31, 2022
598ecc3
chore: update arbitrum sdk to 3.0-rc1
tmigone Sep 26, 2022
a7ba535
fix(task): accept ownership only if pending owner matches
tmigone Sep 26, 2022
0aed5eb
feat(task): split unpause task into protocol and bridge tasks
tmigone Sep 26, 2022
a3fa719
feat(e2e): run L1 and L2 together in e2e tests
tmigone Sep 26, 2022
ad11bdf
feat(e2e): fetch deployment data from testnodes
tmigone Sep 27, 2022
e9cab36
chore: update README.md
tmigone Sep 27, 2022
7eb7ba2
fix(e2e): allow skipping bridge tests
tmigone Sep 27, 2022
1436a0c
fix(e2e): update github action to multi layer e2e tests
tmigone Sep 27, 2022
d9977b5
fix(e2e): bump gas limit for l2 scenario txs
tmigone Sep 28, 2022
6a9a999
chore(e2e): run nitro addressbook setup only on localnitro networks
tmigone Sep 28, 2022
9729f43
fix: allow e2e to run only on L2
tmigone Oct 3, 2022
85c2964
fix(e2e): use fixed gasLimit for CI send to L2
tmigone Oct 3, 2022
ee8c7f3
fix(e2e): use fixed gasLimit for redeem in CI
tmigone Oct 6, 2022
967e085
e2e: add bridge e2e tests (#720)
tmigone Oct 31, 2022
ae1d70b
fix: gateways now unpaused on e2e
tmigone Nov 2, 2022
60afb9e
Merge branch 'dev' into l2-public-testnet
abarmat Nov 2, 2022
b1be78b
chore: fix automerge wrong import
tmigone Oct 31, 2022
ccaf653
fix: remove unused task folder
abarmat Nov 2, 2022
dff1845
fix: wrong imports and params
abarmat Nov 2, 2022
5f1a3c4
fix: additional post merge fixes
tmigone Nov 3, 2022
32fc123
fix: update nitro task for nitro v2.0.8
tmigone Nov 3, 2022
5daa3c1
chore: add deployed addresses for L2 public testnet
abarmat Nov 4, 2022
fb40819
fix: minor tweaks to e2e
tmigone Nov 7, 2022
3605081
v1.17.0
abarmat Nov 7, 2022
1dd6f06
chore: bump npm package version to v2.0.0-testnet
tmigone Nov 7, 2022
d8fed24
fix(L1GraphTokenGateway): add a counterpartGateway getter for Router …
pcarranzav Nov 14, 2022
93f6939
Merge branch 'pcv/l2-bridge' into l2-public-testnet
pcarranzav Nov 23, 2022
dcc2cec
fix(e2e): no need to explicitly disable secure accounts
pcarranzav Nov 23, 2022
f45173c
Merge remote-tracking branch 'origin/dev' into l2-public-testnet
pcarranzav Nov 23, 2022
12e54e5
chore: bump @arbitrum/sdk to 3.0.0
pcarranzav Nov 23, 2022
43e719b
chore: bump package version to 2.0.0
pcarranzav Nov 23, 2022
4e2872b
fix: set flat bonding curve in all L2 configs
pcarranzav Nov 23, 2022
51c0441
test(e2e): reenable finalizeInboundTransfer revert check
pcarranzav Nov 23, 2022
aa85104
fix: use correct governance addresses on Arbitrum One
pcarranzav Nov 23, 2022
d35acb6
Merge pull request #751 from graphprotocol/l2-public-testnet
pcarranzav Nov 23, 2022
3fe26fa
Merge pull request #699 from graphprotocol/pcv/l2-bridge
pcarranzav Nov 23, 2022
f340c3a
Merge branch 'dev' into pcv/l2-linear-rewards
pcarranzav Nov 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ name: Run E2E tests
on:
push:
branches: [dev]
paths:
- contracts/**
- config/**
- e2e/**
- cli/**
- tasks/**
- scripts/**
- hardhat.config.ts
pull_request: {}

jobs:
Expand All @@ -25,9 +33,7 @@ jobs:
run: |
git clone https://github.com/edgeandnode/nitro
pushd nitro
git checkout ci
git submodule update --init --recursive
./test-node.bash --init --no-blockscout --detach
popd
NETWORK=localnitrol1 ADDRESS_BOOK=addresses.json GRAPH_CONFIG=config/graph.localhost.yml yarn test:e2e
NETWORK=localnitrol2 ADDRESS_BOOK=addresses.json GRAPH_CONFIG=config/graph.arbitrum-localhost.yml yarn test:e2e
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e
2 changes: 2 additions & 0 deletions .github/workflows/gre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Run GRE tests
on:
push:
branches: [dev]
paths:
- gre/**
pull_request: {}

jobs:
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ bin/
# Coverage and other reports
/reports
coverage.json

# Local test files
addresses-local.json
localNetwork.json
arbitrum-addresses-local.json
tx-*.log

# Keys
.keystore
4 changes: 2 additions & 2 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To deploy to a different network execute:
yarn deploy -- --network {networkName}

# Example
yarn deploy -- --network kovan
yarn deploy -- --network goerli
```

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

1. Make sure contracts are up to date as you please.
2. `yarn deploy-rinkeby` to deploy to Rinkeby. This will create new contracts with new addresses in `addresses.json`.
2. `yarn deploy-goerli` to deploy to Goerli. This will create new contracts with new addresses in `addresses.json`.
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`.
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.
5. Pull the updated package into the subgraph, and other apps that depend on the package.json.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ yarn add @graphprotocol/contracts

# Contract Addresses

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

# Local Setup

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

```
# A console to interact with testnet contracts
npx hardhat console --network rinkeby
npx hardhat console --network goerli
```

### Hardhat Tasks
Expand Down
67 changes: 30 additions & 37 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,52 @@ There are several types of e2e tests which can be run separately:
- Read and write interactions with the blockchain. _Requires an account with sufficient balance!_
- Example: a test validating that a user can add signal to a subgraph.

### Hardhat local node
### Hardhat local node (L1)

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

```bash
yarn test:e2e
L1_NETWORK=localhost yarn test:e2e
```

The command will perform the following actions:
The command will:
- start a hardhat local node
- deploy the L1 protocol
- configure the new L1 deployment
- Run all L1 e2e tests

- Start a hardhat node (localhost)
- Run `migrate:accounts` hardhat task to create keys for all protocol roles (deployer, governor, arbiter, etc). This currently doesn't support multisig accounts.
- Run `migrate` hardhat task to deploy the protocol
- Run `migrate:ownership` hardhat task to transfer ownership of governed contracts to the governor
- Run `migrate:unpause` to unpause the protocol
- Run `e2e` hardhat task to run all deployment tests (config and init)
- Run `e2e:scenario` hardhat task to run a scenario
### Arbitrum Nitro testnodes (L1/L2)

If you want to test the protocol on an L1/L2 setup, you can run:

```bash
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e
```

In this case the command will:
- deploy the L1 protocol
- configure the new L1 deployment
- deploy the L2 protocol
- configure the new L2 deployment
- configure the L1/L2 bridge
- Run all L1 e2e tests
- Run all L2 e2e tests

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.

### Other networks

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

```bash
# All e2e tests
npx hardhat e2e --network <network> --graph-config config/graph.<network>.yml
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

# Only deployment config tests
npx hardhat e2e:config --network <network> --graph-config config/graph.<network>.yml
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

# Only deployment init tests
npx hardhat e2e:init --network <network> --graph-config config/graph.<network>.yml
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

# Only a specific scenario
npx hardhat e2e:scenario <scenario> --network <network> --graph-config config/graph.<network>.yml
Expand All @@ -82,26 +97,4 @@ Scenarios are defined by an optional script and a test file:
- They run before the test file.
- Test file
- Should be named e2e/scenarios/{scenario-name}.test.ts.
- Standard chai/mocha/hardhat/ethers test file.

## Setting up Arbitrum's testnodes

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.

```bash
git clone https://github.com/offchainlabs/nitro
cd nitro
git submodule update --init --recursive

# Apply any changes you might want, see below for more info, and then start the testnodes
./test-node.bash --init
```

**Useful information**
- L1 RPC: [http://localhost:8545](http://localhost:8545/)
- L2 RPC: [http://localhost:8547](http://localhost:8547/)
- Blockscout explorer (L2 only): [http://localhost:4000/](http://localhost:4000/)
- Prefunded genesis key (L1 and L2): `e887f7d17d07cc7b8004053fb8826f6657084e88904bb61590e498ca04704cf2`

**Enable automine on L1**
In `docker-compose.yml` file edit the `geth` service command by removing the `--dev.period 1` flag.
- Standard chai/mocha/hardhat/ethers test file.
Loading