Skip to content

Commit 5e64c2a

Browse files
authored
Merge pull request #305 from kleros/feat/migrate-goerli-to-sepolia
Resuscitated Arbitrum Sepolia to Sepolia devnet deployment
2 parents 992dc11 + 7cb9d80 commit 5e64c2a

33 files changed

+1357
-825
lines changed

.github/CODEOWNERS

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Default
2-
* @jaybuidl @shotaronowhere
2+
* @jaybuidl @mani99brar
33

44
# Veascan
55
veascan-subgraph-inbox/ @jaybuidl @alcercu
66
veascan-subgraph-outbox/ @jaybuidl @alcercu
77
veascan-web/ @jaybuidl @alcercu
88

99
# Owned by everyone
10-
yarn.lock @jaybuidl @shotaronowhere @alcercu
11-
.gitignore @jaybuidl @shotaronowhere @alcercu
10+
yarn.lock @jaybuidl @mani99brar @alcercu
11+
.gitignore @jaybuidl @mani99brar @alcercu

.github/workflows/sonarcloud.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Harden Runner
23-
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
23+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
2424
with:
2525
egress-policy: audit
2626

27-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
27+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2828
with:
2929
# Disabling shallow clone is recommended for improving relevancy of reporting
3030
fetch-depth: 0
31+
3132
- name: SonarCloud Scan
32-
uses: sonarsource/sonarcloud-github-action@9c0534dd12d09f22d69fbb301a1955249e49d910 # master
33+
uses: sonarsource/sonarcloud-github-action@eb211723266fe8e83102bac7361f0a05c3ac1d1b # v3.0.0
3334
env:
3435
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3536
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# misc
2+
.DS_Store
3+
.env
4+
.env.test
5+
.env.testnet
6+
.env.devnet
7+
.env.local
8+
.env.development.local
9+
.env.test.local
10+
.env.production.local
11+
12+
113
#------------------------------------
214
# FILE GENERATED AS FOLLOWS
315
# curl -sL https://www.toptal.com/developers/gitignore/api/vim,node,visualstudiocode,yarn | sed 's|\(!.yarn/cache\)|#\1|' > .gitignore

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
],
1111
"prettier.configPath": ".prettierrc.json",
1212
"eslint.alwaysShowStatus": true,
13-
"eslint.packageManager": "yarn"
13+
"eslint.packageManager": "yarn",
14+
"shellcheck.customArgs": [
15+
"--external-sources"
16+
]
1417
}

contracts/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
1010

1111
#### Sepolia
1212

13-
- [VeaOutboxArbToEthDevnet](https://sepolia.etherscan.io/address/0x5AD255400913515C8DA7E82E6b8A109fA5c46135)
13+
- [VeaOutboxArbToEthDevnet](https://sepolia.etherscan.io/address/0xb8BF3B6bd3E1a0Cc9E2dB77dd492503310514674)
1414

1515
#### Arbitrum Sepolia
1616

17-
- [VeaInboxArbToEthDevnet](https://sepolia.arbiscan.io/address/0x77e95F54032f467eC45c48C6affc203f93858783)
17+
- [VeaInboxArbToEthDevnet](https://sepolia.arbiscan.io/address/0x0B5851fE2a931F619F73E739E5435C43976f1D68)
1818

1919
#### Chiado
2020

contracts/deploy/01-outbox/01-arb-sepolia-to-chiado-outbox.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const paramsByChainId = {
1515
epochPeriod: 1800, // 30 min
1616
minChallengePeriod: 0, // 30 min
1717
numEpochTimeout: 10000000000000, // never
18-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
18+
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
1919
sequencerLimit: 86400,
2020
maxMissingBlocks: 10000000000000,
2121
routerChainId: 11155111,

contracts/deploy/01-outbox/01-arb-to-gnosis-outbox.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const paramsByChainId = {
3131
numEpochTimeout: 1000000, // never
3232
maxMissingBlocks: 1000000, // any
3333
routerChainId: 11155111,
34-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
34+
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
3535
WETH: "0x8d74e5e4DA11629537C4575cB0f33b4F0Dfa42EB",
3636
sequencerLimit: 86400, // 24 hours
3737
},

contracts/deploy/02-inbox/02-chiado-to-arb-sepolia-inbox.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum SenderChains {
1010
const paramsByChainId = {
1111
GNOSIS_CHIADO: {
1212
epochPeriod: 1800, // 30 minutes
13-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
13+
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
1414
},
1515
HARDHAT: {
1616
amb: ethers.constants.AddressZero,

contracts/deploy/02-inbox/02-gnosis-to-arb-inbox.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const paramsByChainId = {
1515
},
1616
GNOSIS_CHIADO: {
1717
epochPeriod: 7200, // 2 hours
18-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
18+
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d",
1919
},
2020
HARDHAT: {
2121
epochPeriod: 600, // 10 minutes

contracts/deploy/03-routers/03-arb-to-gnosis-router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const paramsByChainId = {
1515
},
1616
ETHEREUM_SEPOLIA: {
1717
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
18-
amb: "0x87A19d769D875964E9Cd41dDBfc397B2543764E6",
18+
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
1919
},
2020
HARDHAT: {
2121
arbitrumInbox: ethers.constants.AddressZero,

contracts/deploy/03-routers/03-chiado-to-arb-sepolia-router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum RouterChains {
1010
const paramsByChainId = {
1111
ETHEREUM_SEPOLIA: {
1212
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
13-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
13+
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
1414
},
1515
HARDHAT: {
1616
arbitrumBridge: ethers.constants.AddressZero,

contracts/deploy/03-routers/03-gnosis-to-arb-router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const paramsByChainId = {
1515
},
1616
ETHEREUM_SEPOLIA: {
1717
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
18-
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
18+
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
1919
},
2020
HARDHAT: {
2121
arbitrumBridge: ethers.constants.AddressZero,

contracts/deployments/arbitrumSepolia/VeaInboxArbToEthDevnet.json

+16-16
Large diffs are not rendered by default.

contracts/deployments/sepolia/VeaOutboxArbToEthDevnet.json

+35-35
Large diffs are not rendered by default.

contracts/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/vea-contracts",
3-
"version": "0.1.14",
3+
"version": "0.4.0",
44
"description": "Smart contracts for Vea",
55
"repository": {
66
"type": "git",
@@ -79,7 +79,7 @@
7979
"@typescript-eslint/parser": "^5.59.1",
8080
"chai": "^4.3.7",
8181
"chai-ethers": "^0.0.1",
82-
"dotenv": "^16.0.3",
82+
"dotenv": "^16.4.5",
8383
"ethereumjs-util": "^7.1.5",
8484
"ethers": "^5.7.2",
8585
"hardhat": "^2.14.0",
@@ -93,11 +93,11 @@
9393
"hardhat-watcher": "^2.5.0",
9494
"json-schema": "^0.4.0",
9595
"mocha": "^10.2.0",
96-
"node-fetch": "^3.3.1",
96+
"node-fetch": "^3.3.2",
9797
"shelljs": "^0.8.5",
9898
"solhint": "^3.4.1",
9999
"solidity-coverage": "^0.8.2",
100-
"ts-node": "^10.9.1",
100+
"ts-node": "^10.9.2",
101101
"typechain": "^8.1.1",
102102
"typescript": "^4.9.5"
103103
}

relayer-cli/.env.dist

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ VEAINBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS=0xAb53e341121448Ae259Da8fa17f216Cb0e21199C
88
VEAOUTBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS=0x906dE43dBef27639b1688Ac46532a16dc07Ce410
99
VEAOUTBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS=0xAb53e341121448Ae259Da8fa17f216Cb0e21199C
1010

11+
# Subgraph endpoints, Example: "85918/vea-inbox-arb-sepolia-devnet/version/latest"
12+
VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_SUBGRAPH=11111/your-subgraph/version/your-version
13+
VEAINBOX_ARBSEPOLIA_TO_CHIADO_SUBGRAPH=11111/your-subgraph/version/your-version
14+
1115
TRANSACTION_BATCHER_CONTRACT_ADDRESS_SEPOLIA=0xe7953da7751063d0a41ba727c32c762d3523ade8
1216
TRANSACTION_BATCHER_CONTRACT_ADDRESS_CHIADO=0xcC0a08D4BCC5f91ee9a1587608f7a2975EA75d73
1317

relayer-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@kleros/vea-contracts": "workspace:^",
1717
"@typechain/ethers-v5": "^10.2.0",
18-
"dotenv": "^16.0.3",
18+
"dotenv": "^16.4.5",
1919
"pm2": "^5.2.2",
2020
"typescript": "^4.9.5",
2121
"web3": "^1.10.4",
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// File for handling contants and configurations
2+
require("dotenv").config();
3+
4+
interface IBridge {
5+
chainId: number;
6+
veaInbox: string;
7+
veaOutbox: string;
8+
batcher: string;
9+
rpcOutbox: string;
10+
}
11+
12+
// Using destination chainId to get the route configuration.
13+
const bridges: { [chainId: number]: IBridge } = {
14+
11155111: {
15+
chainId: 11155111,
16+
veaInbox: process.env.VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS,
17+
veaOutbox: process.env.VEAOUTBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS,
18+
batcher: process.env.TRANSACTION_BATCHER_CONTRACT_ADDRESS_SEPOLIA,
19+
rpcOutbox: process.env.RPC_SEPOLIA,
20+
},
21+
10200: {
22+
chainId: 10200,
23+
veaInbox: process.env.VEAINBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS,
24+
veaOutbox: process.env.VEAOUTBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS,
25+
batcher: process.env.TRANSACTION_BATCHER_CONTRACT_ADDRESS_CHIADO,
26+
rpcOutbox: process.env.RPC_CHIADO,
27+
},
28+
};
29+
30+
const getBridgeConfig = (chainId: number): IBridge | undefined => {
31+
return bridges[chainId];
32+
};
33+
34+
const getInboxSubgraph = (chainId: number): string => {
35+
switch (chainId) {
36+
case 11155111:
37+
return process.env.VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_SUBGRAPH;
38+
case 10200:
39+
return process.env.VEAINBOX_ARBSEPOLIA_TO_CHIADO_SUBGRAPH;
40+
default:
41+
throw new Error("Invalid chainid");
42+
}
43+
};
44+
45+
export { getBridgeConfig, getInboxSubgraph };

relayer-cli/src/devnetRelayExample.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { relayAllFrom } from "./utils/relay";
22
import * as fs from "fs";
3-
require("dotenv").config();
43

54
// let chain_ids = [5, 10200];
65
let chain_ids = [11155111];
@@ -23,7 +22,7 @@ const epochPeriod = 1800; // 30 min
2322
for (const chain_id of chain_ids) {
2423
let nonce = await initialize(chain_id);
2524
// This is libghtbulb switch address in arbitrum sepolia
26-
const sender = "0x4A9EF2E97B780ea6E8DE3fD8acd4cBA8C061F173";
25+
const sender = "0x28d6D503F4c5734cD926E96b63C61527d975B382";
2726
nonce = await relayAllFrom(chain_id, nonce, sender);
2827
if (nonce != null) await updateStateFile(chain_id, Math.floor(Date.now() / 1000), nonce);
2928
}

relayer-cli/src/state/11155111.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"ts": 1725086460,
3+
"nonce": "6"
4+
}

relayer-cli/src/utils/proof.ts

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import request from "graphql-request";
2+
import { getInboxSubgraph } from "../consts/bridgeRoutes";
23

34
const getMessageDataToRelay = async (chainid: number, nonce: number) => {
45
try {
5-
const subgraph = getSubgraph(chainid);
6+
const subgraph = getInboxSubgraph(chainid);
67

78
const result = await request(
8-
`https://api.studio.thegraph.com/query/67213/${subgraph}/version/latest`,
9+
`https://api.studio.thegraph.com/query/${subgraph}`,
910
`{
1011
messageSents(first: 5, where: {nonce: ${nonce}}) {
1112
nonce
@@ -37,9 +38,9 @@ const getProofAtCount = async (chainid: number, nonce: number, count: number): P
3738
query += "}";
3839

3940
try {
40-
const subgraph = getSubgraph(chainid);
41+
const subgraph = getInboxSubgraph(chainid);
4142

42-
const result = await request(`https://api.studio.thegraph.com/query/67213/${subgraph}/version/latest`, query);
43+
const result = await request(`https://api.studio.thegraph.com/query/${subgraph}`, query);
4344

4445
const proof = [];
4546

@@ -75,13 +76,4 @@ const getProofIndices = (nonce: number, count: number) => {
7576
return proof;
7677
};
7778

78-
const getSubgraph = (chainid: number): string => {
79-
switch (chainid) {
80-
case 11155111:
81-
return "vea-inbox-arb-sepolia-devnet";
82-
default:
83-
throw new Error("Invalid chainid");
84-
}
85-
};
86-
87-
export { getProofAtCount, getSubgraph, getMessageDataToRelay };
79+
export { getProofAtCount, getMessageDataToRelay };

0 commit comments

Comments
 (0)