Skip to content

Commit b4d918b

Browse files
authored
test: consolidate unit/e2e test code (#908)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 25ef9d6 commit b4d918b

35 files changed

+743
-926
lines changed

packages/contracts/config/graph.arbitrum-hardhat.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ contracts:
5959
calls:
6060
- fn: "addMinter"
6161
minter: "${{RewardsManager.address}}"
62-
- fn: "renounceMinter"
6362
- fn: "transferOwnership"
6463
owner: *governor
6564
L2Curation:

packages/contracts/config/graph.hardhat.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ contracts:
6060
minter: "${{RewardsManager.address}}"
6161
- fn: "addMinter"
6262
minter: "${{L1GraphTokenGateway.address}}"
63-
- fn: "renounceMinter"
6463
- fn: "transferOwnership"
6564
owner: *governor
6665
Curation:

packages/contracts/hardhat.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const SKIP_LOAD = process.env.SKIP_LOAD === 'true'
2828

2929
function loadTasks() {
3030
require('@graphprotocol/sdk/gre')
31-
;['contracts', 'bridge', 'deployment', 'verify', 'e2e'].forEach((folder) => {
31+
;['contracts', 'bridge', 'deployment', 'migrate', 'verify', 'e2e'].forEach((folder) => {
3232
const tasksPath = path.join(__dirname, 'tasks', folder)
3333
fs.readdirSync(tasksPath)
3434
.filter((pth) => pth.includes('.ts'))

packages/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"addresses.json"
1414
],
1515
"dependencies": {
16-
"@graphprotocol/sdk": "workspace:^0.3.0",
16+
"@graphprotocol/sdk": "workspace:^0.4.0",
1717
"console-table-printer": "^2.11.1"
1818
},
1919
"devDependencies": {

packages/contracts/scripts/e2e

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,17 @@ if [[ "$L1_NETWORK" == "$L2_NETWORK" ]]; then
4545
fi
4646

4747
### > SCRIPT AUX FUNCTIONS <
48-
function pre_deploy() {
48+
function deploy() {
4949
local NETWORK=$1
5050
local GRAPH_CONFIG=$2
51-
52-
# Create named accounts
53-
npx hardhat migrate:accounts --network "$NETWORK" --graph-config "$GRAPH_CONFIG" --disable-secure-accounts
54-
51+
local ADDRESS_BOOK=$3
52+
53+
echo "Deploying protocol on $NETWORK"
54+
5555
# Fund accounts if using nitro test nodes
5656
if [[ "$NETWORK" == *"localnitro"* ]]; then
57-
npx hardhat nitro:fund-accounts --network "$NETWORK" --graph-config "$GRAPH_CONFIG" --disable-secure-accounts
57+
npx hardhat migrate:nitro:fund-accounts --network "$NETWORK" --graph-config "$GRAPH_CONFIG" --disable-secure-accounts
5858
fi
59-
}
60-
61-
function deploy() {
62-
local NETWORK=$1
63-
local GRAPH_CONFIG=$2
64-
local ADDRESS_BOOK=$3
6559

6660
# Deploy protocol
6761
npx hardhat migrate \
@@ -73,18 +67,6 @@ function deploy() {
7367
--address-book "$ADDRESS_BOOK"
7468
}
7569

76-
function post_deploy () {
77-
local NETWORK=$1
78-
local GRAPH_CONFIG=$2
79-
local ADDRESS_BOOK=$3
80-
81-
# Governor to accept contracts ownership
82-
npx hardhat migrate:ownership --network "$NETWORK" --graph-config "$GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --disable-secure-accounts
83-
84-
# Unpause the protocol
85-
npx hardhat migrate:unpause:protocol --network "$NETWORK" --graph-config "$GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --disable-secure-accounts
86-
}
87-
8870
function configure_bridge () {
8971
local L1_NETWORK=$1
9072
local L1_GRAPH_CONFIG=$2
@@ -94,29 +76,12 @@ function configure_bridge () {
9476
local ARBITRUM_ADDRESS_BOOK=$6
9577
local ARBITRUM_DEPLOYMENT_FILE=$7
9678

97-
# These settings are only used for CLI bridge commands
98-
# so we keep them here to avoid confusion with hardhat based tasks
99-
local L1_CHAIN_ID=${L1_CHAIN_ID:-"1337"}
100-
local L2_CHAIN_ID=${L2_CHAIN_ID:-"412346"}
101-
102-
local L1_RPC=${L1_RPC:-"http://127.0.0.1:8545"}
103-
local L2_RPC=${L2_RPC:-"http://127.0.0.1:8547"}
104-
105-
local L1_MNEMONIC=${L1_MNEMONIC:-"myth like bonus scare over problem client lizard pioneer submit female collect"}
106-
local L2_MNEMONIC=${L2_MNEMONIC:-"urge never interest human any economy gentle canvas anxiety pave unlock find"}
107-
10879
# Copy required arbitrum contract addresses to the local arbitrum address book
10980
if [[ "$L1_NETWORK" == *"localnitro"* ]]; then
110-
npx hardhat nitro:address-book-setup --deployment-file "$ARBITRUM_DEPLOYMENT_FILE" --arbitrum-address-book "$ARBITRUM_ADDRESS_BOOK"
81+
npx hardhat migrate:nitro:address-book --deployment-file "$ARBITRUM_DEPLOYMENT_FILE" --arbitrum-address-book "$ARBITRUM_ADDRESS_BOOK"
11182
fi
11283

113-
# Configure the bridge
114-
npx hardhat bridge:configure:l1 --network "$L1_NETWORK" --graph-config "$L1_GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --arbitrum-address-book "$ARBITRUM_ADDRESS_BOOK" --disable-secure-accounts
115-
npx hardhat bridge:configure:l2 --network "$L2_NETWORK" --graph-config "$L2_GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --arbitrum-address-book "$ARBITRUM_ADDRESS_BOOK" --disable-secure-accounts
116-
117-
# Unpause the bridge
118-
npx hardhat migrate:unpause:bridge --network "$L2_NETWORK" --graph-config "$L2_GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --disable-secure-accounts
119-
npx hardhat migrate:unpause:bridge --network "$L1_NETWORK" --graph-config "$L1_GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --disable-secure-accounts
84+
npx hardhat migrate:bridge --network "$L1_NETWORK" --l1-graph-config "$L1_GRAPH_CONFIG" --l2-graph-config "$L2_GRAPH_CONFIG" --address-book "$ADDRESS_BOOK" --arbitrum-address-book "$ARBITRUM_ADDRESS_BOOK" --disable-secure-accounts
12085
}
12186

12287
function test_e2e () {
@@ -188,18 +153,12 @@ fi
188153
## DEPLOY
189154
# Deploy L1
190155
if [[ -n "$L1_NETWORK" ]]; then
191-
echo "Deploying L1 protocol"
192-
pre_deploy "$L1_NETWORK" "$L1_GRAPH_CONFIG"
193156
deploy "$L1_NETWORK" "$L1_GRAPH_CONFIG" "$ADDRESS_BOOK"
194-
post_deploy "$L1_NETWORK" "$L1_GRAPH_CONFIG" "$ADDRESS_BOOK"
195157
fi
196158

197159
# Deploy L2
198160
if [[ -n "$L2_NETWORK" ]]; then
199-
echo "Deploying L2 protocol"
200-
pre_deploy "$L2_NETWORK" "$L2_GRAPH_CONFIG"
201161
deploy "$L2_NETWORK" "$L2_GRAPH_CONFIG" "$ADDRESS_BOOK"
202-
post_deploy "$L2_NETWORK" "$L2_GRAPH_CONFIG" "$ADDRESS_BOOK"
203162
fi
204163

205164
# Configure bridge

packages/contracts/tasks/bridge/configure.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

packages/contracts/tasks/bridge/to-l2.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { BigNumber } from 'ethers'
33
import { GRE_TASK_PARAMS } from '@graphprotocol/sdk/gre'
44
import { sendToL2 } from '@graphprotocol/sdk'
55
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
6-
import { TASK_NITRO_SETUP_SDK } from '../deployment/nitro'
76

87
export const TASK_BRIDGE_TO_L2 = 'bridge:send-to-l2'
98

@@ -30,7 +29,7 @@ task(TASK_BRIDGE_TO_L2, 'Bridge GRT tokens from L1 to L2')
3029
// If local, add nitro test node networks to sdk
3130
if (taskArgs.deploymentFile) {
3231
console.log('> Adding nitro test node network to sdk')
33-
await hre.run(TASK_NITRO_SETUP_SDK, { deploymentFile: taskArgs.deploymentFile })
32+
await hre.run('migrate:nitro:register', { deploymentFile: taskArgs.deploymentFile })
3433
}
3534

3635
// Get the sender, use L1 deployer if not provided

packages/contracts/tasks/deployment/accounts.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

packages/contracts/tasks/deployment/nitro.ts

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)