From e3af561097dfa66425dd3a2602e4ab1e8e4fe458 Mon Sep 17 00:00:00 2001 From: Fionna Chan <13184582+fionnachan@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:25:42 +0800 Subject: [PATCH 1/3] feat: remove atlas testnet (#2013) --- .../public/images/AtlasLogo.png | Bin 5341 -> 0 bytes .../src/util/orbitChainsData.json | 50 ------------------ 2 files changed, 50 deletions(-) delete mode 100644 packages/arb-token-bridge-ui/public/images/AtlasLogo.png diff --git a/packages/arb-token-bridge-ui/public/images/AtlasLogo.png b/packages/arb-token-bridge-ui/public/images/AtlasLogo.png deleted file mode 100644 index 6d256c9ab6773ae31b4a90230c1f554d8f8c00b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5341 zcmbVQcQjmGzaCLT1R+5X3DHBeL<^#KqJ?0186!dTVYHA}7eVwAZA7n81~X%j=p{O% z%n*IF(ZVDIck;b=ee2$J*Zt?)YwfeoexCh2zrFWaXYIXyvCj;(=xJ}$0ssJd9c^_J z0Duhnr_xZ6kjV?Z>!ju`NZZ5!00`s<0NzFb0H-AAEgk^y6$b#e{sI8xGXVfr&m5%j z6B2R7K~GB^a2cIA)K2PM_0)dh0|3x5|EXkv>>M@{NDa|3(4fXsab6P;t`w}|CP8E# z-iBsmBZbgx0Dw7PM_t9te{L729Jr#H*K>ebxSB(sBe$K+EX_YZglD!?`g@Z(Mv08{ zNO zK9u|e1B@eO)g5qOl~u!A2Jnj!$##)boW4rn|AR;rSnX4(vZ^H&r$1Q{T6l_g(0<|a zYZ_;u9U=CPM^AJQi;GYvf#j9cwLB1}BK>2Q2gT}7@jQZ5mdptxB$d4CsumNH#-u5m z7HXk_cj#-butcJ0NuF8NC94Es8X$!nhGh|@K&Q&8l2uo;N_aqmG^Xd0QK-9+kg2z> zopdz0b_?58<2WFre7mHpTR#pMyyo74=X0x{Zr&i{meG`Nmh^c;3CiVw`Bc_pNd8a! zB8EjT{e0I5hciqhHYgsO=Aemh)$M$9nIL~a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%l{h^(i63Y%BbL%1tllze4#gPz~WYbQSwa$LscG#7Yl*vE~}~x zzcrNnE)!`kQSvR^d=w-g=-{$%_9v+`8rf_s19(UkF|FO1~C z2hp&EINC$N@*r<8sR2leOG=B1KNgjgHItB(my(m0dL$w)E-x-FhU=LBUjjD|M`x#i v|6gGD*8e3*Ao%YH5N9{A55(Th^Z#n3CI1Q1OLTwuXI(lPhUzt{e}(-Q6NX)} diff --git a/packages/arb-token-bridge-ui/src/util/orbitChainsData.json b/packages/arb-token-bridge-ui/src/util/orbitChainsData.json index 406f89a78b..6e7879dd77 100644 --- a/packages/arb-token-bridge-ui/src/util/orbitChainsData.json +++ b/packages/arb-token-bridge-ui/src/util/orbitChainsData.json @@ -781,56 +781,6 @@ } } }, - { - "chainId": 1183, - "confirmPeriodBlocks": 150, - "ethBridge": { - "bridge": "0xCAeCF7c5c2769e250Ef69592dD470D40BC61D1f7", - "inbox": "0x44199D537Aa690bE3B4446602e0c66F2B992D51e", - "outbox": "0xAD6A8df458dBD6b440F50313C5d53E3C5b4734e9", - "rollup": "0x357717a0F9Ac8714A5995109Fba3BAd3b5f0954F", - "sequencerInbox": "0x146bCf344F949ad4c9Fcf339eb4415981aE21dF9" - }, - "nativeToken": "0x566f8345F7bF45358FaB2802C19c60D691dE04e4", - "explorerUrl": "https://testnet.theatlas.tech", - "rpcUrl": "https://theatlas.tech", - "isCustom": true, - "isTestnet": true, - "name": "Atlas Testnet", - "slug": "atlas-testnet", - "parentChainId": 421614, - "retryableLifetimeSeconds": 604800, - "tokenBridge": { - "parentCustomGateway": "0xE5A8943e36f93491f97A521447772fCF529533B5", - "parentErc20Gateway": "0xBc89C0A2CCA8A0e1583AA6d4e22B36E26661C78E", - "parentGatewayRouter": "0xc93fDF8327e04776fd184188bB4EC8521E5E96D7", - "parentMultiCall": "0xce1CAd780c529e66e3aa6D952a1ED9A6447791c1", - "parentProxyAdmin": "0x0000000000000000000000000000000000000000", - "parentWeth": "0x0000000000000000000000000000000000000000", - "parentWethGateway": "0x0000000000000000000000000000000000000000", - "childCustomGateway": "0x2c2Be954C9B79d9cA2CF145d9d6363F3c3784615", - "childErc20Gateway": "0xDfCD9f6154BEA2E98e8aE493f3Fec2E22De52D6a", - "childGatewayRouter": "0xBc63Ec54dA9Ee3B2b3D4cA5DE3622a3F85e0F219", - "childMultiCall": "0x54AFaf5Fd025A99708e73e52c317454bD52B1e77", - "childProxyAdmin": "0xE1C9a27C47bb9691bA5b4E35eb7617B39F6098B9", - "childWeth": "0x0000000000000000000000000000000000000000", - "childWethGateway": "0x0000000000000000000000000000000000000000" - }, - "bridgeUiConfig": { - "color": "#889B6F", - "network": { - "name": "Atlas Testnet", - "logo": "/images/AtlasLogo.png", - "description": "Aarc is the first modular layer for unified borderless dapps." - }, - "nativeTokenData": { - "name": "Aarc", - "symbol": "AARC", - "decimals": 18, - "logoUrl": "/images/AtlasLogo.png" - } - } - }, { "chainId": 2730, "confirmPeriodBlocks": 64, From d4c70d55a2877215ff1848a59a253781a8f187d7 Mon Sep 17 00:00:00 2001 From: doug <4741454+douglance@users.noreply.github.com> Date: Tue, 22 Oct 2024 08:59:58 -0400 Subject: [PATCH 2/3] feat: fetch contracts from rollup for automation (#1981) --- .../add-orbit-chain-request.yml | 34 ++----------------- .github/workflows/build-test.yml | 2 +- packages/scripts/package.json | 1 + .../tests/__mocks__/chainDataMocks.ts | 4 +-- .../__snapshots__/transforms.test.ts.snap | 12 +++---- .../addOrbitChain/tests/transforms.test.ts | 4 +-- .../scripts/src/addOrbitChain/transforms.ts | 29 ++++++++++------ 7 files changed, 32 insertions(+), 54 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/add-orbit-chain-request.yml b/.github/ISSUE_TEMPLATE/add-orbit-chain-request.yml index 32a6398dce..75eebf1e8b 100644 --- a/.github/ISSUE_TEMPLATE/add-orbit-chain-request.yml +++ b/.github/ISSUE_TEMPLATE/add-orbit-chain-request.yml @@ -121,50 +121,20 @@ 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: value: | - ## Rollup contract addresses + ## Rollup contract address - type: markdown attributes: 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 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 3d60b8d978..e99b5f4bb6 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -153,7 +153,7 @@ jobs: - name: Install node_modules uses: OffchainLabs/actions/node-modules/install@main - + - name: Build run: yarn workspace scripts build diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 0c53feef3e..e9d310eb63 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -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", diff --git a/packages/scripts/src/addOrbitChain/tests/__mocks__/chainDataMocks.ts b/packages/scripts/src/addOrbitChain/tests/__mocks__/chainDataMocks.ts index 564357146f..6b47b03366 100644 --- a/packages/scripts/src/addOrbitChain/tests/__mocks__/chainDataMocks.ts +++ b/packages/scripts/src/addOrbitChain/tests/__mocks__/chainDataMocks.ts @@ -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", @@ -191,7 +191,7 @@ export const mockIncomingChainData: IncomingChainData = { bridge: "0x0000000000000000000000000000000000000001", inbox: "0x0000000000000000000000000000000000000002", outbox: "0x0000000000000000000000000000000000000003", - rollup: "0x0000000000000000000000000000000000000004", + rollup: "0xeedE9367Df91913ab149e828BDd6bE336df2c892", sequencerInbox: "0x0000000000000000000000000000000000000005", parentGatewayRouter: "0x0000000000000000000000000000000000000009", childGatewayRouter: "0x0000000000000000000000000000000000000016", diff --git a/packages/scripts/src/addOrbitChain/tests/__snapshots__/transforms.test.ts.snap b/packages/scripts/src/addOrbitChain/tests/__snapshots__/transforms.test.ts.snap index 70e1a3d876..84d87c2798 100644 --- a/packages/scripts/src/addOrbitChain/tests/__snapshots__/transforms.test.ts.snap +++ b/packages/scripts/src/addOrbitChain/tests/__snapshots__/transforms.test.ts.snap @@ -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, @@ -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", diff --git a/packages/scripts/src/addOrbitChain/tests/transforms.test.ts b/packages/scripts/src/addOrbitChain/tests/transforms.test.ts index c7f0690106..d0c078f157 100644 --- a/packages/scripts/src/addOrbitChain/tests/transforms.test.ts +++ b/packages/scripts/src/addOrbitChain/tests/transforms.test.ts @@ -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 diff --git a/packages/scripts/src/addOrbitChain/transforms.ts b/packages/scripts/src/addOrbitChain/transforms.ts index e34dbf45a2..b90ee3893e 100644 --- a/packages/scripts/src/addOrbitChain/transforms.ts +++ b/packages/scripts/src/addOrbitChain/transforms.ts @@ -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"; @@ -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 @@ -131,7 +133,7 @@ export const createAndValidateOrbitChain = async ( }; export const updateAndValidateOrbitChainsList = async ( - orbitChain: ReturnType, + orbitChain: OrbitChain, targetJsonPath: string ) => { core.startGroup("Orbit ChainsList Update and Validation"); @@ -153,7 +155,7 @@ export const commitChangesAndCreatePR = async ( branchName: string, targetJsonPath: string, updatedOrbitChainsList: ReturnType, - orbitChain: ReturnType + orbitChain: OrbitChain ) => { core.startGroup("Commit Changes and Create Pull Request"); console.log("Preparing to commit changes..."); @@ -181,7 +183,7 @@ export const commitChangesAndCreatePR = async ( export const setOutputs = ( branchName: string, - orbitChain: ReturnType, + orbitChain: OrbitChain, targetJsonPath: string ) => { core.startGroup("Set Outputs"); @@ -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 => { 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, From 0654a9315c5d5569cba349a7b326ce068a39d4c7 Mon Sep 17 00:00:00 2001 From: doug <4741454+douglance@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:14:14 -0400 Subject: [PATCH 3/3] feat: adds prettier run after updating orbit chains list (#2009) --- packages/scripts/src/addOrbitChain/index.ts | 3 +++ packages/scripts/src/addOrbitChain/transforms.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/scripts/src/addOrbitChain/index.ts b/packages/scripts/src/addOrbitChain/index.ts index 64d66647f0..13ce85c114 100644 --- a/packages/scripts/src/addOrbitChain/index.ts +++ b/packages/scripts/src/addOrbitChain/index.ts @@ -8,6 +8,7 @@ import { updateAndValidateOrbitChainsList, commitChangesAndCreatePR, setOutputs, + runPrettier, } from "./transforms"; /** @@ -36,6 +37,8 @@ export async function addOrbitChain(targetJsonPath: string): Promise { targetJsonPath ); + await runPrettier(targetJsonPath); + await commitChangesAndCreatePR( branchName, targetJsonPath, diff --git a/packages/scripts/src/addOrbitChain/transforms.ts b/packages/scripts/src/addOrbitChain/transforms.ts index b90ee3893e..4a8c499a97 100644 --- a/packages/scripts/src/addOrbitChain/transforms.ts +++ b/packages/scripts/src/addOrbitChain/transforms.ts @@ -8,6 +8,7 @@ import { JsonRpcProvider } from "@ethersproject/providers"; import axios from "axios"; import * as fs from "fs"; import sharp from "sharp"; +import prettier from "prettier"; import { commitChanges, @@ -437,3 +438,18 @@ export const updateOrbitChainsFile = ( return orbitChains; }; + +export async function runPrettier(targetJsonPath: string): Promise { + try { + const fileContent = fs.readFileSync(targetJsonPath, "utf8"); + const prettierConfig = await prettier.resolveConfig(targetJsonPath); + const formattedContent = await prettier.format(fileContent, { + ...prettierConfig, + filepath: targetJsonPath, + }); + fs.writeFileSync(targetJsonPath, formattedContent); + console.log(`Prettier formatting applied to ${targetJsonPath}`); + } catch (error) { + warning(`Failed to run Prettier: ${error}`); + } +}