Skip to content

Commit d4e78d6

Browse files
authored
Merge pull request #132 from OffchainLabs/add-test-on-ci
Add CI flow for testing all tutorials
2 parents 04d72f4 + 669411a commit d4e78d6

File tree

19 files changed

+314
-189
lines changed

19 files changed

+314
-189
lines changed

.github/workflows/test-all.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test all tutorials
2+
run-name: Test all tutorials
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
env:
10+
PRIVATE_KEY: "b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659"
11+
CHAIN_RPC: "http://127.0.0.1:3347"
12+
PARENT_CHAIN_RPC: "http://127.0.0.1:8547"
13+
# Env variables for specific tutorials
14+
L1_RPC: "http://127.0.0.1:8545"
15+
TransferTo: "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E"
16+
17+
jobs:
18+
test-all:
19+
name: Test all tutorials
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install node_modules
26+
uses: OffchainLabs/actions/node-modules/install@main
27+
28+
- name: Set up the local node
29+
# https://github.com/OffchainLabs/actions/blob/feat-simplify/run-nitro-test-node/action.yml
30+
uses: OffchainLabs/actions/run-nitro-test-node@feat-simplify
31+
with:
32+
nitro-testnode-ref: release
33+
args: --tokenbridge --l3node --l3-token-bridge
34+
35+
- name: Copy .env
36+
run: cp ./.env-sample ./.env
37+
38+
- name: Test
39+
run: yarn run testAll

.pre-commit-config.yaml

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

customNetwork.json

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,78 @@
1-
{
2-
"chainID": 412346,
3-
"confirmPeriodBlocks": 20,
4-
"ethBridge": {
5-
"bridge": "0x5eCF728ffC5C5E802091875f96281B5aeECf6C49",
6-
"inbox": "0x9f8c1c641336A371031499e3c362e40d58d0f254",
7-
"outbox": "0x50143333b44Ea46255BEb67255C9Afd35551072F",
8-
"rollup": "0x7d98BA231d29D5C202981542C0291718A7358c63",
9-
"sequencerInbox": "0x18d19C5d3E685f5be5b9C86E097f0E439285D216"
1+
[
2+
{
3+
"chainID": 412346,
4+
"confirmPeriodBlocks": 20,
5+
"ethBridge": {
6+
"bridge": "0x5eCF728ffC5C5E802091875f96281B5aeECf6C49",
7+
"inbox": "0x9f8c1c641336A371031499e3c362e40d58d0f254",
8+
"outbox": "0x50143333b44Ea46255BEb67255C9Afd35551072F",
9+
"rollup": "0x7d98BA231d29D5C202981542C0291718A7358c63",
10+
"sequencerInbox": "0x18d19C5d3E685f5be5b9C86E097f0E439285D216"
11+
},
12+
"explorerUrl": "",
13+
"isArbitrum": true,
14+
"isCustom": true,
15+
"name": "ArbLocal",
16+
"partnerChainID": 1337,
17+
"retryableLifetimeSeconds": 604800,
18+
"nitroGenesisBlock": 0,
19+
"nitroGenesisL1Block": 0,
20+
"depositTimeout": 900000,
21+
"tokenBridge": {
22+
"parentGatewayRouter": "0x093AAa96CD4387A68FC0e24C60140938Dc812549",
23+
"childGatewayRouter": "0x32656396981868E925280FB772b3f806892cf4bF",
24+
"parentErc20Gateway": "0x00D9fE1a2B67B8151aEdE8855c95E58D73FB4245",
25+
"childErc20Gateway": "0x7424e3DAAAAcd867c85ceB75c1E00119F2ee5eb7",
26+
"parentCustomGateway": "0x8407E6180dC009D20D26D4BABB4790C1d4E6D2aA",
27+
"childCustomGateway": "0x0B35cfE62314C3852A0942b5830c728353BD654F",
28+
"parentWethGateway": "0xB8F48Ba39fCfB44d70F6008fe1bf4F3E744044AF",
29+
"childWethGateway": "0x67aE8014BD1A0c1Ed747715d22b3b3a188aC324B",
30+
"parentWeth": "0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a",
31+
"childWeth": "0xA1abD387192e3bb4e84D3109181F9f005aBaF5CA",
32+
"parentProxyAdmin": "0x2A1f38c9097e7883570e0b02BFBE6869Cc25d8a3",
33+
"childProxyAdmin": "0x9F95547ABB0FfC92b4E37b3124d1e8613d5aB74A",
34+
"parentMultiCall": "0x49117fC32930E324F2E9A7BeA588FFb26008b8eC",
35+
"childMultiCall": "0x6B1E93aE298B64e8f5b9f43B65Dd8F1eaA6DD4c3"
36+
},
37+
"chainId": 412346,
38+
"parentChainId": 1337
1039
},
11-
"explorerUrl": "",
12-
"isArbitrum": true,
13-
"isCustom": true,
14-
"name": "ArbLocal",
15-
"partnerChainID": 1337,
16-
"retryableLifetimeSeconds": 604800,
17-
"nitroGenesisBlock": 0,
18-
"nitroGenesisL1Block": 0,
19-
"depositTimeout": 900000,
20-
"tokenBridge": {
21-
"parentGatewayRouter": "0x093AAa96CD4387A68FC0e24C60140938Dc812549",
22-
"childGatewayRouter": "0x32656396981868E925280FB772b3f806892cf4bF",
23-
"parentErc20Gateway": "0x00D9fE1a2B67B8151aEdE8855c95E58D73FB4245",
24-
"childErc20Gateway": "0x7424e3DAAAAcd867c85ceB75c1E00119F2ee5eb7",
25-
"parentCustomGateway": "0x8407E6180dC009D20D26D4BABB4790C1d4E6D2aA",
26-
"childCustomGateway": "0x0B35cfE62314C3852A0942b5830c728353BD654F",
27-
"parentWethGateway": "0xB8F48Ba39fCfB44d70F6008fe1bf4F3E744044AF",
28-
"childWethGateway": "0x67aE8014BD1A0c1Ed747715d22b3b3a188aC324B",
29-
"parentWeth": "0x7E32b54800705876d3b5cFbc7d9c226a211F7C1a",
30-
"childWeth": "0xA1abD387192e3bb4e84D3109181F9f005aBaF5CA",
31-
"parentProxyAdmin": "0x2A1f38c9097e7883570e0b02BFBE6869Cc25d8a3",
32-
"childProxyAdmin": "0x9F95547ABB0FfC92b4E37b3124d1e8613d5aB74A",
33-
"parentMultiCall": "0x49117fC32930E324F2E9A7BeA588FFb26008b8eC",
34-
"childMultiCall": "0x6B1E93aE298B64e8f5b9f43B65Dd8F1eaA6DD4c3"
35-
},
36-
"chainId": 412346,
37-
"parentChainId": 1337
38-
}
40+
{
41+
"chainID": 333333,
42+
"confirmPeriodBlocks": 20,
43+
"ethBridge": {
44+
"bridge": "0xA584795e24628D9c067A6480b033C9E96281fcA3",
45+
"inbox": "0xDcA690902d3154886Ec259308258D10EA5450996",
46+
"outbox": "0xda243bD61B011024FC923164db75Dde198AC6175",
47+
"rollup": "0xfe808cD61B3fe45c67c47B17DB49B96Fb2BFDfae",
48+
"sequencerInbox": "0x16c54EE2015CD824415c2077F4103f444E00A8cb"
49+
},
50+
"explorerUrl": "",
51+
"isArbitrum": true,
52+
"isCustom": true,
53+
"name": "ArbLocalL3",
54+
"partnerChainID": 412346,
55+
"retryableLifetimeSeconds": 604800,
56+
"nitroGenesisBlock": 0,
57+
"nitroGenesisL1Block": 0,
58+
"depositTimeout": 900000,
59+
"tokenBridge": {
60+
"parentGatewayRouter": "0xfE03DBdf7A126994dBd749631D7fbaB58C618c58",
61+
"childGatewayRouter": "0x8B6BC759226f8Fe687c8aD8Cc0DbF85E095e9297",
62+
"parentErc20Gateway": "0x6B0805Fc6e275ef66a0901D0CE68805631E271e5",
63+
"childErc20Gateway": "0xaa7d51aFFEeB32d99b1CB2fd6d81D7adA4a896e8",
64+
"parentCustomGateway": "0xA191D519260A06b32f8D04c84b9F457B8Caa0514",
65+
"childCustomGateway": "0xD4816AeF8f85A3C1E01Cd071a81daD4fa941625f",
66+
"parentWethGateway": "0x77603b0ea6a797C74Fa9ef11b5BdE04A4E03D550",
67+
"childWethGateway": "0xA6AB233B3c7bfd0399834897b5073974A3D467e2",
68+
"parentWeth": "0xA1abD387192e3bb4e84D3109181F9f005aBaF5CA",
69+
"childWeth": "0x582a8dBc77f665dF2c49Ce0a138978e9267dd968",
70+
"parentProxyAdmin": "0x1A61102c26ad3f64bA715B444C93388491fd8E68",
71+
"childProxyAdmin": "0x36C56eC2CF3a3f53db9F01d0A5Ae84b36fb0A1e2",
72+
"parentMultiCall": "0x20a3627Dcc53756E38aE3F92717DE9B23617b422",
73+
"childMultiCall": "0x052B15c8Ff0544287AE689C4F2FC53A3905d7Db3"
74+
},
75+
"chainId": 333333,
76+
"parentChainId": 412346
77+
}
78+
]

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
},
1313
"scripts": {
1414
"lint": "eslint .",
15-
"format": "prettier './**/*.{js,json,md,yml,sol}' --write && yarn run lint --fix"
15+
"format": "prettier './**/*.{js,json,md,yml,sol}' --write && yarn run lint --fix",
16+
"testAll": "tests/runAll.sh"
1617
},
1718
"devDependencies": {
1819
"chai": "^4.3.4",

packages/block-verification-in-parent-chain-assertion/scripts/exec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ const main = async (childChainBlockNumberToVerify: number) => {
4646
const nodeCreatedEventFilter = rollup.filters.NodeCreated(nodeId)
4747
const nodeCreatedEvents = await rollup.queryFilter(nodeCreatedEventFilter)
4848
if (!nodeCreatedEvents) {
49-
console.error(`INTERNAL ERROR: NodeCreated events not found for Rblock/node: ${nodeId}`)
50-
return
49+
throw new Error(`INTERNAL ERROR: NodeCreated events not found for Rblock/node: ${nodeId}`)
5150
}
5251
const nodeCreatedEvent = nodeCreatedEvents[0]
5352
console.log(`NodeCreated event found in transaction ${nodeCreatedEvent.transactionHash}`)
@@ -56,8 +55,7 @@ const main = async (childChainBlockNumberToVerify: number) => {
5655
* Finding the assertion within the NodeCreated event, and getting the afterState
5756
*/
5857
if (!nodeCreatedEvent.args) {
59-
console.error(`INTERNAL ERROR: NodeCreated event does not have an assertion for Rblock/node: ${nodeId}`)
60-
return
58+
throw new Error(`INTERNAL ERROR: NodeCreated event does not have an assertion for Rblock/node: ${nodeId}`)
6159
}
6260
const assertion = nodeCreatedEvent.args.assertion
6361
const afterState = assertion.afterState
@@ -91,7 +89,7 @@ const main = async (childChainBlockNumberToVerify: number) => {
9189
if (process.argv.length < 3) {
9290
console.log(`Missing block number of the child chain to verify whether it has been processed in the latest ${useCreatedNodeInsteadOfConfirmed ? 'created' : 'confirmed'} RBlock/node`)
9391
console.log(`Usage: yarn run exec <block number>`)
94-
process.exit()
92+
process.exit(1)
9593
}
9694

9795
const childChainBlockNumber = Number(process.argv[2]);

packages/custom-gateway-bridging/scripts/exec.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,19 @@ const main = async () => {
287287
/**
288288
* The `complete` boolean tells us if the cross-chain message was successful
289289
*/
290-
childChainDepositResult.complete
291-
? console.log(
292-
`Deposit to the child chain complete. Status: ${
293-
ParentToChildMessageStatus[childChainDepositResult.status]
294-
}`
295-
)
296-
: console.log(
297-
`Deposit to the child chain failed. Status ${
298-
ParentToChildMessageStatus[childChainDepositResult.status]
299-
}`
300-
)
290+
if (childChainDepositResult.complete) {
291+
console.log(
292+
`Deposit to the child chain complete. Status: ${
293+
ParentToChildMessageStatus[childChainDepositResult.status]
294+
}`
295+
)
296+
} else {
297+
throw new Error(
298+
`Deposit to the child chain failed. Status ${
299+
ParentToChildMessageStatus[childChainDepositResult.status]
300+
}`
301+
)
302+
}
301303

302304
/**
303305
* Get the Bridge token balance
@@ -427,17 +429,19 @@ const main = async () => {
427429
/**
428430
* The `complete` boolean tells us if the cross-chain message was successful
429431
*/
430-
childChainFinalResult.complete
431-
? console.log(
432-
`Deposit on child chain successful. Status: ${
433-
ParentToChildMessageStatus[childChainFinalResult.status]
434-
}`
435-
)
436-
: console.log(
437-
`Deposit on child chain failed. Status: ${
438-
ParentToChildMessageStatus[childChainFinalResult.status]
439-
}`
440-
)
432+
if (childChainFinalResult.complete) {
433+
console.log(
434+
`Deposit on child chain successful. Status: ${
435+
ParentToChildMessageStatus[childChainFinalResult.status]
436+
}`
437+
)
438+
} else {
439+
throw new Error(
440+
`Deposit on child chain failed. Status: ${
441+
ParentToChildMessageStatus[childChainFinalResult.status]
442+
}`
443+
)
444+
}
441445
}
442446

443447
main()

packages/delayedInbox-l2msg/scripts/normalTx.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ const main = async () => {
106106
if (status == true) {
107107
console.log(`Transaction executed on the child chain!!! 🥳`)
108108
} else {
109-
console.log(
109+
throw new Error(
110110
`The transaction failed to execute on the child chain. Please verify if the gas provided was enough`
111111
)
112-
return
113112
}
114113

115114
/**

packages/delayedInbox-l2msg/scripts/withdrawFunds.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ const main = async () => {
9595
`Transaction executed on the child chain!!! 🥳 After a challenge period has passed, you can go to https://bridge.arbitrum.io/ to execute your withdrawal and receive your funds!`
9696
)
9797
} else {
98-
console.log(
98+
throw new Error(
9999
`The transaction failed to execute on the child chain. Please verify if the gas provided was enough`
100100
)
101-
return
102101
}
103102
}
104103

packages/eth-deposit-to-different-address/scripts/exec.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,19 @@ const main = async () => {
9090
/**
9191
* The `complete` boolean tells us if the cross-chain message was successful
9292
*/
93-
transactionResult.complete
94-
? console.log(
95-
`Message successfully executed on the child chain. Status: ${
96-
EthDepositMessageStatus[await transactionResult.message.status()]
97-
}`
98-
)
99-
: console.log(
100-
`Message failed execution on the child chain . Status ${
101-
EthDepositMessageStatus[await transactionResult.message.status()]
102-
}`
103-
)
93+
if (transactionResult.complete) {
94+
console.log(
95+
`Message successfully executed on the child chain. Status: ${
96+
EthDepositMessageStatus[await transactionResult.message.status()]
97+
}`
98+
)
99+
} else {
100+
throw new Error(
101+
`Message failed execution on the child chain . Status ${
102+
EthDepositMessageStatus[await transactionResult.message.status()]
103+
}`
104+
)
105+
}
104106

105107
/**
106108
* Our destination address balance should be updated now

0 commit comments

Comments
 (0)