Skip to content
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

Resuscitated Arbitrum Sepolia to Sepolia devnet deployment #305

Merged
merged 10 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Default
* @jaybuidl @shotaronowhere
* @jaybuidl @mani99brar

# Veascan
veascan-subgraph-inbox/ @jaybuidl @alcercu
veascan-subgraph-outbox/ @jaybuidl @alcercu
veascan-web/ @jaybuidl @alcercu

# Owned by everyone
yarn.lock @jaybuidl @shotaronowhere @alcercu
.gitignore @jaybuidl @shotaronowhere @alcercu
yarn.lock @jaybuidl @mani99brar @alcercu
.gitignore @jaybuidl @mani99brar @alcercu
7 changes: 4 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@9c0534dd12d09f22d69fbb301a1955249e49d910 # master
uses: sonarsource/sonarcloud-github-action@eb211723266fe8e83102bac7361f0a05c3ac1d1b # v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# misc
.DS_Store
.env
.env.test
.env.testnet
.env.devnet
.env.local
.env.development.local
.env.test.local
.env.production.local


#------------------------------------
# FILE GENERATED AS FOLLOWS
# curl -sL https://www.toptal.com/developers/gitignore/api/vim,node,visualstudiocode,yarn | sed 's|\(!.yarn/cache\)|#\1|' > .gitignore
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
],
"prettier.configPath": ".prettierrc.json",
"eslint.alwaysShowStatus": true,
"eslint.packageManager": "yarn"
"eslint.packageManager": "yarn",
"shellcheck.customArgs": [
"--external-sources"
]
}
4 changes: 2 additions & 2 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments

#### Sepolia

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

#### Arbitrum Sepolia

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

#### Chiado

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const paramsByChainId = {
epochPeriod: 1800, // 30 min
minChallengePeriod: 0, // 30 min
numEpochTimeout: 10000000000000, // never
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoreable Nice comment, it made it very easy to figure out where the value came from

sequencerLimit: 86400,
maxMissingBlocks: 10000000000000,
routerChainId: 11155111,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/01-outbox/01-arb-to-gnosis-outbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const paramsByChainId = {
numEpochTimeout: 1000000, // never
maxMissingBlocks: 1000000, // any
routerChainId: 11155111,
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
WETH: "0x8d74e5e4DA11629537C4575cB0f33b4F0Dfa42EB",
sequencerLimit: 86400, // 24 hours
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum SenderChains {
const paramsByChainId = {
GNOSIS_CHIADO: {
epochPeriod: 1800, // 30 minutes
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
},
HARDHAT: {
amb: ethers.constants.AddressZero,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/02-inbox/02-gnosis-to-arb-inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const paramsByChainId = {
},
GNOSIS_CHIADO: {
epochPeriod: 7200, // 2 hours
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0x8448E15d0e706C0298dECA99F0b4744030e59d7d",
},
HARDHAT: {
epochPeriod: 600, // 10 minutes
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/03-routers/03-arb-to-gnosis-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const paramsByChainId = {
},
ETHEREUM_SEPOLIA: {
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
amb: "0x87A19d769D875964E9Cd41dDBfc397B2543764E6",
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
},
HARDHAT: {
arbitrumInbox: ethers.constants.AddressZero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum RouterChains {
const paramsByChainId = {
ETHEREUM_SEPOLIA: {
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
},
HARDHAT: {
arbitrumBridge: ethers.constants.AddressZero,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/03-routers/03-gnosis-to-arb-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const paramsByChainId = {
},
ETHEREUM_SEPOLIA: {
arbitrumBridge: "0x38f918D0E9F1b721EDaA41302E399fa1B79333a9", // https://developer.arbitrum.io/useful-addresses
amb: "0x99Ca51a3534785ED619f46A79C7Ad65Fa8d85e7a",
amb: "0xf2546D6648BD2af6a008A7e7C1542BB240329E11", // https://docs.gnosischain.com/bridges/About%20Token%20Bridges/amb-bridge#key-contracts
},
HARDHAT: {
arbitrumBridge: ethers.constants.AddressZero,
Expand Down
32 changes: 16 additions & 16 deletions contracts/deployments/arbitrumSepolia/VeaInboxArbToEthDevnet.json

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions contracts/deployments/sepolia/VeaOutboxArbToEthDevnet.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/vea-contracts",
"version": "0.1.14",
"version": "0.4.0",
"description": "Smart contracts for Vea",
"repository": {
"type": "git",
Expand Down Expand Up @@ -79,7 +79,7 @@
"@typescript-eslint/parser": "^5.59.1",
"chai": "^4.3.7",
"chai-ethers": "^0.0.1",
"dotenv": "^16.0.3",
"dotenv": "^16.4.5",
"ethereumjs-util": "^7.1.5",
"ethers": "^5.7.2",
"hardhat": "^2.14.0",
Expand All @@ -93,11 +93,11 @@
"hardhat-watcher": "^2.5.0",
"json-schema": "^0.4.0",
"mocha": "^10.2.0",
"node-fetch": "^3.3.1",
"node-fetch": "^3.3.2",
"shelljs": "^0.8.5",
"solhint": "^3.4.1",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"ts-node": "^10.9.2",
"typechain": "^8.1.1",
"typescript": "^4.9.5"
}
Expand Down
4 changes: 4 additions & 0 deletions relayer-cli/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ VEAINBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS=0xAb53e341121448Ae259Da8fa17f216Cb0e21199C
VEAOUTBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS=0x906dE43dBef27639b1688Ac46532a16dc07Ce410
VEAOUTBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS=0xAb53e341121448Ae259Da8fa17f216Cb0e21199C

# Subgraph endpoints, Example: "85918/vea-inbox-arb-sepolia-devnet/version/latest"
VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_SUBGRAPH=11111/your-subgraph/version/your-version
VEAINBOX_ARBSEPOLIA_TO_CHIADO_SUBGRAPH=11111/your-subgraph/version/your-version

TRANSACTION_BATCHER_CONTRACT_ADDRESS_SEPOLIA=0xe7953da7751063d0a41ba727c32c762d3523ade8
TRANSACTION_BATCHER_CONTRACT_ADDRESS_CHIADO=0xcC0a08D4BCC5f91ee9a1587608f7a2975EA75d73

Expand Down
2 changes: 1 addition & 1 deletion relayer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@kleros/vea-contracts": "workspace:^",
"@typechain/ethers-v5": "^10.2.0",
"dotenv": "^16.0.3",
"dotenv": "^16.4.5",
"pm2": "^5.2.2",
"typescript": "^4.9.5",
"web3": "^1.10.4",
Expand Down
45 changes: 45 additions & 0 deletions relayer-cli/src/consts/bridgeRoutes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// File for handling contants and configurations
require("dotenv").config();

interface IBridge {
chainId: number;
veaInbox: string;
veaOutbox: string;
batcher: string;
rpcOutbox: string;
}

// Using destination chainId to get the route configuration.
const bridges: { [chainId: number]: IBridge } = {
11155111: {
chainId: 11155111,
veaInbox: process.env.VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS,
veaOutbox: process.env.VEAOUTBOX_ARBSEPOLIA_TO_SEPOLIA_ADDRESS,
batcher: process.env.TRANSACTION_BATCHER_CONTRACT_ADDRESS_SEPOLIA,
rpcOutbox: process.env.RPC_SEPOLIA,
},
10200: {
chainId: 10200,
veaInbox: process.env.VEAINBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS,
veaOutbox: process.env.VEAOUTBOX_ARBSEPOLIA_TO_CHIADO_ADDRESS,
batcher: process.env.TRANSACTION_BATCHER_CONTRACT_ADDRESS_CHIADO,
rpcOutbox: process.env.RPC_CHIADO,
},
};

const getBridgeConfig = (chainId: number): IBridge | undefined => {
return bridges[chainId];
};

const getInboxSubgraph = (chainId: number): string => {
switch (chainId) {
case 11155111:
return process.env.VEAINBOX_ARBSEPOLIA_TO_SEPOLIA_SUBGRAPH;
case 10200:
return process.env.VEAINBOX_ARBSEPOLIA_TO_CHIADO_SUBGRAPH;
default:
throw new Error("Invalid chainid");
}
};

export { getBridgeConfig, getInboxSubgraph };
3 changes: 1 addition & 2 deletions relayer-cli/src/devnetRelayExample.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { relayAllFrom } from "./utils/relay";
import * as fs from "fs";
require("dotenv").config();

// let chain_ids = [5, 10200];
let chain_ids = [11155111];
Expand All @@ -23,7 +22,7 @@ const epochPeriod = 1800; // 30 min
for (const chain_id of chain_ids) {
let nonce = await initialize(chain_id);
// This is libghtbulb switch address in arbitrum sepolia
const sender = "0x4A9EF2E97B780ea6E8DE3fD8acd4cBA8C061F173";
const sender = "0x28d6D503F4c5734cD926E96b63C61527d975B382";
nonce = await relayAllFrom(chain_id, nonce, sender);
if (nonce != null) await updateStateFile(chain_id, Math.floor(Date.now() / 1000), nonce);
}
Expand Down
4 changes: 4 additions & 0 deletions relayer-cli/src/state/11155111.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"ts": 1725086460,
"nonce": "6"
}
20 changes: 6 additions & 14 deletions relayer-cli/src/utils/proof.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import request from "graphql-request";
import { getInboxSubgraph } from "../consts/bridgeRoutes";

const getMessageDataToRelay = async (chainid: number, nonce: number) => {
try {
const subgraph = getSubgraph(chainid);
const subgraph = getInboxSubgraph(chainid);

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

try {
const subgraph = getSubgraph(chainid);
const subgraph = getInboxSubgraph(chainid);

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

const proof = [];

Expand Down Expand Up @@ -75,13 +76,4 @@ const getProofIndices = (nonce: number, count: number) => {
return proof;
};

const getSubgraph = (chainid: number): string => {
switch (chainid) {
case 11155111:
return "vea-inbox-arb-sepolia-devnet";
default:
throw new Error("Invalid chainid");
}
};

export { getProofAtCount, getSubgraph, getMessageDataToRelay };
export { getProofAtCount, getMessageDataToRelay };
Loading
Loading