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

feat: adds rollup data fetching from Orbit template #1981

Merged
merged 48 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9398e29
feat: adds new scripts project
douglance Sep 27, 2024
0a58302
prettier fix
douglance Sep 27, 2024
35a2145
Merge branch 'master' into dl/new-script-proj
douglance Oct 1, 2024
660785c
Merge branch 'master' into dl/new-script-proj
douglance Oct 1, 2024
dd3847e
respond to pr feedback
douglance Oct 1, 2024
52d57b2
remove error for contract acheck
douglance Oct 1, 2024
f51e11d
preserve order of json file
douglance Oct 1, 2024
ca7d0af
fix ordering
douglance Oct 1, 2024
4ac1c8c
fix output of transform
douglance Oct 1, 2024
7273524
Merge branch 'master' into dl/new-script-proj
douglance Oct 2, 2024
8520033
remove goerli
douglance Oct 2, 2024
a23aca6
update tests in ci
douglance Oct 2, 2024
0352235
Merge branch 'master' into dl/new-script-proj
douglance Oct 2, 2024
943b3cc
update trigger
douglance Oct 2, 2024
e268280
update triggers
douglance Oct 2, 2024
dbb8aa7
fix project name
douglance Oct 2, 2024
1dba588
migrate to chainsdata
douglance Oct 2, 2024
03f2abe
build the validation script
douglance Oct 2, 2024
87840c4
Merge branch 'master' into dl/new-script-proj
douglance Oct 3, 2024
e35e65d
more cleanup
douglance Oct 3, 2024
f11556d
update issue template to use dropdown
douglance Oct 3, 2024
92a2614
Update packages/scripts/src/addOrbitChain/schemas.ts
douglance Oct 3, 2024
b1f7332
address PR comments
douglance Oct 3, 2024
6edf09d
update holesky placeholders
douglance Oct 3, 2024
63dfe53
update url transform
douglance Oct 3, 2024
f40e167
Merge branch 'master' into dl/new-script-proj
douglance Oct 4, 2024
33c5f90
addresses PR comments
douglance Oct 4, 2024
ad68c13
fix extra space
douglance Oct 7, 2024
7bcd724
feat: adds rollup data fetching to simplify input
douglance Oct 9, 2024
d1cec7d
fix name
douglance Oct 9, 2024
84f036f
fix types
douglance Oct 9, 2024
402fc64
Merge branch 'master' into dl/fs-905
fionnachan Oct 10, 2024
edb4fff
Merge branch 'master' into dl/fs-905
douglance Oct 10, 2024
4da6794
Merge branch 'master' into dl/fs-905
douglance Oct 10, 2024
0b1ccd2
update the rollup data fetching to arb/sdk
douglance Oct 14, 2024
9ed56ad
Merge branch 'master' into dl/fs-905
douglance Oct 14, 2024
c86d1e4
remove comments
douglance Oct 14, 2024
eb5ceca
Merge branch 'master' into dl/fs-905
douglance Oct 17, 2024
46c6563
revert yarn lock changes
douglance Oct 18, 2024
0b81040
Merge branch 'main' into dl/fs-905
douglance Oct 18, 2024
eda964b
Merge branch 'master' into dl/fs-905
fionnachan Oct 18, 2024
b9a81eb
fix yarn.lock after merge potentially
douglance Oct 18, 2024
87353c4
Merge branch 'dl/fs-905' of github.com:OffchainLabs/arbitrum-token-br…
douglance Oct 18, 2024
7abf2c0
actually fix yarn lock
douglance Oct 18, 2024
00b52eb
fix prettier
douglance Oct 18, 2024
c1a17dc
Merge branch 'master' into dl/fs-905
douglance Oct 21, 2024
3a6db91
make rollup addresses singular
douglance Oct 21, 2024
e1f8993
Merge branch 'master' into dl/fs-905
spsjvc Oct 22, 2024
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
32 changes: 1 addition & 31 deletions .github/ISSUE_TEMPLATE/add-orbit-chain-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ body:
attributes:
value: |
Please fill out this section with your chain configuration details and contract addresses. As a reminder, you can get all contract addresses by running [getAllContracts](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/feat-add-verification-scripts/examples/verify-rollup/README.md#get-all-contracts).
- type: input
id: confirmPeriodBlocks
attributes:
label: confirmPeriodBlocks
placeholder: ex. 45818
validations:
required: true

- type: markdown
attributes:
Expand All @@ -135,34 +128,11 @@ body:
attributes:
douglance marked this conversation as resolved.
Show resolved Hide resolved
value: |
You can find this information under the `"coreContracts" : {...}` key.
- type: input
id: bridge
attributes:
label: bridge
validations:
required: true
- type: input
id: inbox
attributes:
label: inbox
validations:
required: true
- type: input
id: outbox
attributes:
label: outbox
validations:
required: true
- type: input
id: rollup
attributes:
label: rollup
validations:
required: true
- type: input
id: sequencerInbox
attributes:
label: sequencerInbox
description: Please provide the address of the rollup contract. Other core contract addresses will be fetched automatically.
validations:
required: true

Expand Down
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@arbitrum/sdk": "^4.0.1",
"@octokit/rest": "^21.0.2",
"axios": "^1.7.7",
"commander": "^12.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const mockIncomingChainData: IncomingChainData = {
description: "This is a test chain.",
chainLogo: "https://example.com/testchain.png",
color: "#FF0000",
rpcUrl: "https://testrpc.com",
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
explorerUrl: "https://testexplorer.com",
parentChainId: "421614",
confirmPeriodBlocks: "150",
Expand All @@ -191,7 +191,7 @@ export const mockIncomingChainData: IncomingChainData = {
bridge: "0x0000000000000000000000000000000000000001",
inbox: "0x0000000000000000000000000000000000000002",
outbox: "0x0000000000000000000000000000000000000003",
rollup: "0x0000000000000000000000000000000000000004",
rollup: "0xeedE9367Df91913ab149e828BDd6bE336df2c892",
sequencerInbox: "0x0000000000000000000000000000000000000005",
parentGatewayRouter: "0x0000000000000000000000000000000000000009",
childGatewayRouter: "0x0000000000000000000000000000000000000016",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ exports[`Transforms > transformIncomingDataToOrbitChain > should transform incom
"chainId": 1234567890,
"confirmPeriodBlocks": 150,
"ethBridge": {
"bridge": "0x0000000000000000000000000000000000000001",
"inbox": "0x0000000000000000000000000000000000000002",
"outbox": "0x0000000000000000000000000000000000000003",
"rollup": "0x0000000000000000000000000000000000000004",
"sequencerInbox": "0x0000000000000000000000000000000000000005",
"bridge": "0x6c7FAC4edC72E86B3388B48979eF37Ecca5027e6",
"inbox": "0x6396825803B720bc6A43c63caa1DcD7B31EB4dd0",
"outbox": "0xc7491a559b416540427f9f112C5c98b1412c5d51",
"rollup": "0xeedE9367Df91913ab149e828BDd6bE336df2c892",
"sequencerInbox": "0x529a2061A1973be80D315770bA9469F3Da40D938",
},
"explorerUrl": "https://testexplorer.com",
"isArbitrum": true,
Expand All @@ -70,7 +70,7 @@ exports[`Transforms > transformIncomingDataToOrbitChain > should transform incom
"nativeToken": "0x0000000000000000000000000000000000000006",
"parentChainId": 421614,
"retryableLifetimeSeconds": 604800,
"rpcUrl": "https://testrpc.com",
"rpcUrl": "https://sepolia-rollup.arbitrum.io/rpc",
"slug": "test-chain",
"tokenBridge": {
"childCustomGateway": "0x0000000000000000000000000000000000000014",
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/src/addOrbitChain/tests/transforms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe("Transforms", () => {
});

describe("transformIncomingDataToOrbitChain", () => {
it("should transform incoming chain data to OrbitChain format", () => {
it("should transform incoming chain data to OrbitChain format", async () => {
const chainLogoPath = "/images/mockChain_Logo.png";
const nativeTokenLogoPath = "/images/mockChain_NativeTokenLogo.png";

const result = transformIncomingDataToOrbitChain(
const result = await transformIncomingDataToOrbitChain(
mockIncomingChainData as IncomingChainData,
chainLogoPath,
nativeTokenLogoPath
Expand Down
29 changes: 18 additions & 11 deletions packages/scripts/src/addOrbitChain/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import * as core from "@actions/core";
import { warning } from "@actions/core";
import { getArbitrumNetworkInformationFromRollup } from "@arbitrum/sdk";
import { JsonRpcProvider } from "@ethersproject/providers";
import axios from "axios";
import * as fs from "fs";
import sharp from "sharp";
Expand Down Expand Up @@ -118,7 +120,7 @@ export const createAndValidateOrbitChain = async (
) => {
core.startGroup("Orbit Chain Creation and Validation");
console.log("Creating OrbitChain object...");
const orbitChain = transformIncomingDataToOrbitChain(
const orbitChain = await transformIncomingDataToOrbitChain(
validatedIncomingData,
chainLogoPath,
nativeTokenLogoPath
Expand All @@ -131,7 +133,7 @@ export const createAndValidateOrbitChain = async (
};

export const updateAndValidateOrbitChainsList = async (
orbitChain: ReturnType<typeof transformIncomingDataToOrbitChain>,
orbitChain: OrbitChain,
targetJsonPath: string
) => {
core.startGroup("Orbit ChainsList Update and Validation");
Expand All @@ -153,7 +155,7 @@ export const commitChangesAndCreatePR = async (
branchName: string,
targetJsonPath: string,
updatedOrbitChainsList: ReturnType<typeof updateOrbitChainsFile>,
orbitChain: ReturnType<typeof transformIncomingDataToOrbitChain>
orbitChain: OrbitChain
) => {
core.startGroup("Commit Changes and Create Pull Request");
console.log("Preparing to commit changes...");
Expand Down Expand Up @@ -181,7 +183,7 @@ export const commitChangesAndCreatePR = async (

export const setOutputs = (
branchName: string,
orbitChain: ReturnType<typeof transformIncomingDataToOrbitChain>,
orbitChain: OrbitChain,
targetJsonPath: string
) => {
core.startGroup("Set Outputs");
Expand Down Expand Up @@ -334,23 +336,28 @@ export const fetchAndSaveImage = async (
return `/${imageSavePath}`;
};

export const transformIncomingDataToOrbitChain = (
export const transformIncomingDataToOrbitChain = async (
chainData: IncomingChainData,
chainLogoPath: string,
nativeTokenLogoPath?: string
): OrbitChain => {
): Promise<OrbitChain> => {
const parentChainId = parseInt(chainData.parentChainId, 10);
const isTestnet = TESTNET_PARENT_CHAIN_IDS.includes(parentChainId);
const provider = new JsonRpcProvider(chainData.rpcUrl);
const rollupData = await getArbitrumNetworkInformationFromRollup(
chainData.rollup,
provider
);

return {
chainId: parseInt(chainData.chainId, 10),
confirmPeriodBlocks: parseInt(chainData.confirmPeriodBlocks, 10),
confirmPeriodBlocks: rollupData.confirmPeriodBlocks,
ethBridge: {
bridge: chainData.bridge,
inbox: chainData.inbox,
outbox: chainData.outbox,
bridge: rollupData.ethBridge.bridge,
inbox: rollupData.ethBridge.inbox,
outbox: rollupData.ethBridge.outbox,
rollup: chainData.rollup,
sequencerInbox: chainData.sequencerInbox,
sequencerInbox: rollupData.ethBridge.sequencerInbox,
},
nativeToken: chainData.nativeTokenAddress,
explorerUrl: chainData.explorerUrl,
Expand Down
Loading