From 841fc32826c0c1d7865a6f2a0a11776ed564563c Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 22 Aug 2024 10:13:02 -0600 Subject: [PATCH 01/10] fix: correctly type error --- packages/utils/src/maticjs/error.ts | 1 + packages/utils/src/maticjs/proof.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/utils/src/maticjs/error.ts b/packages/utils/src/maticjs/error.ts index 90d4f2cd23..0a68c906c6 100644 --- a/packages/utils/src/maticjs/error.ts +++ b/packages/utils/src/maticjs/error.ts @@ -4,6 +4,7 @@ export enum MaticJsErrorType { BlockNotIncluded = "no_block_found", IncorrectTx = "incorrect_transaction", TxNotCheckpointed = "transaction_not_checkpointed", + NoExitHash = "no_exit_hash", } // custom errors for better error handling diff --git a/packages/utils/src/maticjs/proof.ts b/packages/utils/src/maticjs/proof.ts index c7698bbbd3..a8cbbd604f 100644 --- a/packages/utils/src/maticjs/proof.ts +++ b/packages/utils/src/maticjs/proof.ts @@ -64,7 +64,7 @@ export const generateExitPayload = async ( try { exitHash = await maticClient.exitUtil.getExitHash(burnTxHash, 0, eventSignature); } catch (error: any) { - throw new InfoError(MaticJsErrorType.TxNotCheckpointed, "Burn transaction has not been checkpointed yet"); + throw new InfoError(MaticJsErrorType.NoExitHash, "Could not retrieve the exit hash"); } // build payload for exit From 9fe5372c08bf045635701df8f8b88dbf88b2676d Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 22 Aug 2024 10:13:26 -0600 Subject: [PATCH 02/10] feat: log owner and threshold --- .../contracts/src/cli/op-mode/switchMode.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/deployments/contracts/src/cli/op-mode/switchMode.ts b/packages/deployments/contracts/src/cli/op-mode/switchMode.ts index da1510b283..255b25494d 100644 --- a/packages/deployments/contracts/src/cli/op-mode/switchMode.ts +++ b/packages/deployments/contracts/src/cli/op-mode/switchMode.ts @@ -1,6 +1,6 @@ import commandLineArgs from "command-line-args"; -import { Wallet } from "ethers"; +import { Contract, Wallet } from "ethers"; import { Env, getProviderFromHardhatConfig } from "../.."; import { SUPPORTED_DOMAINS, HUBS, updateIfNeeded } from "../helpers"; import { @@ -107,6 +107,17 @@ export const switchMode = async () => { // Update SpokeConnector console.log(`\tUpdating SpokeConnector (${deployments.SpokeConnector.address})...`); + const owner = await deployments.SpokeConnector.contract.owner(); + const contract = new Contract( + owner, + ["function getThreshold() view returns (uint256)"], + deployments.SpokeConnector.contract.provider, + ); + let threshold = "N/A"; + try { + threshold = await contract.getThreshold(); + } catch (e) {} + console.log(`\t\tOwner: ${owner}, threshold: ${threshold}`); await updateIfNeeded( optimistic ? { From f21268448f1edb04026f9ebffec3f0fb7484cfe7 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 22 Aug 2024 10:14:52 -0600 Subject: [PATCH 03/10] feat: clear-cache example --- packages/agents/lighthouse/example.http | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 packages/agents/lighthouse/example.http diff --git a/packages/agents/lighthouse/example.http b/packages/agents/lighthouse/example.http new file mode 100644 index 0000000000..d0ce866495 --- /dev/null +++ b/packages/agents/lighthouse/example.http @@ -0,0 +1,10 @@ +@lighthouseUrl = https://lighthouse-prover-subscriber.mainnet.connext.ninja + +@adminToken = foo + +POST {{lighthouseUrl}}/clear-cache +Content-Type: application/json + +{ + "adminToken": "{{adminToken}}" +} From 7b46545cb59bd7f426d6b77e79dfcb7f24344bc2 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 22 Aug 2024 10:23:15 -0600 Subject: [PATCH 04/10] chore: upgrade arbitrum sdk; fix binary search --- packages/agents/lighthouse/package.json | 2 +- packages/agents/lighthouse/src/mockable.ts | 12 ++++---- .../tasks/processFromRoot/helpers/arbitrum.ts | 15 +++++----- packages/deployments/contracts/package.json | 2 +- .../tasks/connector/processFromRoot.ts | 29 +++++++++++-------- .../contracts/tasks/connector/redeem.ts | 8 ++--- yarn.lock | 22 ++++++++++---- 7 files changed, 54 insertions(+), 36 deletions(-) diff --git a/packages/agents/lighthouse/package.json b/packages/agents/lighthouse/package.json index 7a14727341..f8664ae9c3 100644 --- a/packages/agents/lighthouse/package.json +++ b/packages/agents/lighthouse/package.json @@ -27,7 +27,7 @@ "author": "Connext", "license": "ISC", "dependencies": { - "@arbitrum/sdk": "3.1.11", + "@arbitrum/sdk": "4.0.1", "@connext/nxtp-adapters-database": "workspace:*", "@connext/nxtp-adapters-relayer": "workspace:*", "@connext/nxtp-adapters-subgraph": "workspace:*", diff --git a/packages/agents/lighthouse/src/mockable.ts b/packages/agents/lighthouse/src/mockable.ts index 95ce39dcaf..82232d94dd 100644 --- a/packages/agents/lighthouse/src/mockable.ts +++ b/packages/agents/lighthouse/src/mockable.ts @@ -9,8 +9,8 @@ import { getDeployedRootManagerContract as _getDeployedRootManagerContract } fro import { CrossChainMessenger as _OptimismCrossChainMessenger } from "@eth-optimism/sdk"; import { CrossChainMessenger as _MantleCrossChainMessenger } from "@mantleio/sdk"; import { sendWithRelayerWithBackup as _sendWithRelayerWithBackup } from "@connext/nxtp-adapters-relayer"; -import { EventFetcher as _EventFetcher, L2TransactionReceipt as _L2TransactionReceipt } from "@arbitrum/sdk"; -import { L1ToL2MessageGasEstimator } from "@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator"; +import { EventFetcher as _EventFetcher, ChildTransactionReceipt as _ChildTransactionReceipt } from "@arbitrum/sdk"; +import { ParentToChildMessageGasEstimator } from "@arbitrum/sdk/dist/lib/message/ParentToChildMessageGasEstimator"; import { getBaseFee as _getBaseFee } from "@arbitrum/sdk/dist/lib/utils/lib"; import { LineaSDK as _LineaSDK } from "@consensys/linea-sdk"; import { @@ -42,7 +42,7 @@ export const sendWithRelayerWithBackup = _sendWithRelayerWithBackup; export const EventFetcher = _EventFetcher; -export const L2TransactionReceipt = _L2TransactionReceipt; +export const ChildTransactionReceipt = _ChildTransactionReceipt; export const RollupUserLogic__factory = _RollupUserLogic__factory; @@ -72,8 +72,10 @@ export const getZkSyncWeb3Provider = (url: string): zk.Provider => { return new zk.Provider(url); }; -export const getL1ToL2MessageGasEstimator = (l2Provider: providers.JsonRpcProvider): L1ToL2MessageGasEstimator => { - return new L1ToL2MessageGasEstimator(l2Provider); +export const getParentToChildMessageGasEstimator = ( + l2Provider: providers.JsonRpcProvider, +): ParentToChildMessageGasEstimator => { + return new ParentToChildMessageGasEstimator(l2Provider); }; export const getContract = (address: string, abi: ContractInterface, provider?: providers.JsonRpcProvider) => diff --git a/packages/agents/lighthouse/src/tasks/processFromRoot/helpers/arbitrum.ts b/packages/agents/lighthouse/src/tasks/processFromRoot/helpers/arbitrum.ts index d906caa77a..c2bfdc4dc2 100644 --- a/packages/agents/lighthouse/src/tasks/processFromRoot/helpers/arbitrum.ts +++ b/packages/agents/lighthouse/src/tasks/processFromRoot/helpers/arbitrum.ts @@ -1,11 +1,11 @@ import { createLoggingContext, jsonifyError } from "@connext/nxtp-utils"; import { BigNumber, BigNumberish, utils } from "ethers"; -import { l2Networks } from "@arbitrum/sdk/dist/lib/dataEntities/networks"; +import { getChildrenForNetwork } from "@arbitrum/sdk"; import { NodeInterface__factory } from "@arbitrum/sdk/dist/lib/abi/factories/NodeInterface__factory"; import { getContext } from "../processFromRoot"; import { ConfirmDataDoesNotMatch, NoRootAvailable, RollUpNodeStaked } from "../errors"; -import { EventFetcher, JsonRpcProvider, L2TransactionReceipt, RollupUserLogic__factory } from "../../../mockable"; +import { EventFetcher, JsonRpcProvider, ChildTransactionReceipt, RollupUserLogic__factory } from "../../../mockable"; import { ArbitrumNodeCreatedEventsNotFound } from "../../../errors"; import { GetProcessArgsParams } from "."; @@ -37,7 +37,7 @@ export const getProcessFromArbitrumRootArgs = async ({ // // get the tx const spokeJsonProvider = new JsonRpcProvider(spokeProvider); const tx = await spokeJsonProvider.getTransactionReceipt(sendHash); - const l2TxnReceipt = new L2TransactionReceipt(tx); + const l2TxnReceipt = new ChildTransactionReceipt(tx); // @ts-ignore const dataIsOnL1 = await l2TxnReceipt.isDataAvailable(spokeJsonProvider); if (!dataIsOnL1) { @@ -45,7 +45,7 @@ export const getProcessFromArbitrumRootArgs = async ({ } // get the proof const hubJsonProvider = new JsonRpcProvider(hubProvider); - const [reader] = await l2TxnReceipt.getL2ToL1Messages(hubJsonProvider); + const [reader] = await l2TxnReceipt.getChildToParentMessages(hubJsonProvider); const msg = (reader as any).nitroReader; if (!msg?.event) { throw new Error(`Could not find event for message in ${sendHash}`); @@ -78,7 +78,7 @@ export const getProcessFromArbitrumRootArgs = async ({ // 2. (not used) Calculate the send root and the item hash using the `Outbox.sol` interface, then // find the event emitted after the `ethBlockNum` of the message containing a matching // sendRoot. Find the nodeNum from this event, and submit to chain (seen below) - const arbNetwork = l2Networks[spokeChainId]; + const arbNetwork = getChildrenForNetwork(hubChainId).find((n) => n.chainId === spokeChainId)!; const latest = await hubJsonProvider.getBlockNumber(); const fetcher = new EventFetcher(hubJsonProvider); logger.info("Fetching events", requestContext, methodContext, { @@ -105,7 +105,7 @@ export const getProcessFromArbitrumRootArgs = async ({ const log = logs[mid]; let sendCount = BigNumber.from(msg.event.position as BigNumberish); try { - const block = await msg.getBlockFromNodeLog(spokeJsonProvider, log); + const block = await msg.getBlockFromAssertionLog(spokeJsonProvider, log); sendCount = BigNumber.from(block.sendCount); } catch (e: unknown) { logger.warn("Failed to get block from node log", requestContext, methodContext, { @@ -116,6 +116,7 @@ export const getProcessFromArbitrumRootArgs = async ({ if (sendCount.gt(msg.event.position as BigNumberish)) { foundLog = log; right = mid - 1; + left = right + 1; } else { left = mid + 1; } @@ -123,7 +124,7 @@ export const getProcessFromArbitrumRootArgs = async ({ const earliestNodeWithExit = foundLog.event.nodeNum; const rollup = RollupUserLogic__factory.getContract(arbNetwork.ethBridge.rollup, RollupUserLogic__factory.abi); - const foundBlock = await msg.getBlockFromNodeNum( + const foundBlock = await msg.getBlockFromAssertionId( rollup.connect(hubJsonProvider), earliestNodeWithExit, spokeJsonProvider, diff --git a/packages/deployments/contracts/package.json b/packages/deployments/contracts/package.json index 61c958e88f..b263d88e67 100644 --- a/packages/deployments/contracts/package.json +++ b/packages/deployments/contracts/package.json @@ -54,7 +54,7 @@ "@eth-optimism/sdk": "3.2.0" }, "devDependencies": { - "@arbitrum/sdk": "3.1.11", + "@arbitrum/sdk": "4.0.1", "@certusone/wormhole-sdk": "0.9.21", "@connext/nxtp-utils": "workspace:*", "@consensys/linea-sdk": "0.1.6", diff --git a/packages/deployments/contracts/tasks/connector/processFromRoot.ts b/packages/deployments/contracts/tasks/connector/processFromRoot.ts index 78fcd94eee..fbaa1c6bb4 100644 --- a/packages/deployments/contracts/tasks/connector/processFromRoot.ts +++ b/packages/deployments/contracts/tasks/connector/processFromRoot.ts @@ -1,8 +1,8 @@ import { task } from "hardhat/config"; -import { EventFetcher, L2TransactionReceipt } from "@arbitrum/sdk"; +import { EventFetcher, ChildTransactionReceipt, getChildrenForNetwork } from "@arbitrum/sdk"; + import { BigNumber, BigNumberish, constants, Contract, providers, Wallet } from "ethers"; import { defaultAbiCoder, keccak256 } from "ethers/lib/utils"; -import { l2Networks } from "@arbitrum/sdk/dist/lib/dataEntities/networks"; import { DEFAULT_L2_CONTRACT_ADDRESSES, CrossChainMessenger as OptimismCrossChainMessenger, @@ -53,7 +53,7 @@ const processFromPolygonRoot = async (spoke: number, sendHash: string, hubProvid SEND_MESSAGE_EVENT_SIG, providerMapping, ); - if (!hash || !payload) { + if (!payload) { throw new Error(`no hash or payload. already or not yet ready to be processed`); } console.log("hash: ", hash); @@ -75,16 +75,16 @@ const processFromArbitrumRoot = async ( // // uint256 _index, x // // L2Message calldata _message x // // get the tx - const l2TxnReceipt = new L2TransactionReceipt(await spokeProvider.getTransactionReceipt(sendHash)); + const l2TxnReceipt = new ChildTransactionReceipt(await spokeProvider.getTransactionReceipt(sendHash)); // @ts-ignore const dataIsOnL1 = await l2TxnReceipt.isDataAvailable(spokeProvider); if (!dataIsOnL1) { throw new Error(`tx data not yet posted to l1`); } // get the proof - const [reader] = await l2TxnReceipt.getL2ToL1Messages(hubProvider); + const [reader] = await l2TxnReceipt.getChildToParentMessages(hubProvider); console.log("msg:", (reader as any).nitroReader.event); - const msg = (reader as any).nitroReader; + const msg = (reader as any).nitroReader; //as nitro.ChildToParentMessageReaderNitro; if (!msg?.event) { throw new Error(`Could not find event for message in ${sendHash}`); } @@ -115,13 +115,17 @@ const processFromArbitrumRoot = async ( // 2. Calculate the send root and the item hash using the `Outbox.sol` interface, then // find the event emitted after the `ethBlockNum` of the message containing a matching // sendRoot. Find the nodeNum from this event, and submit to chain. Not used. - const arbNetwork = l2Networks[spoke]; + const arbNetwork = getChildrenForNetwork(1).find((n) => n.chainId === spoke); + if (!arbNetwork) { + throw new Error(`could not find arbitrum child network for spoke ${spoke}`); + } const fetcher = new EventFetcher(hubProvider); console.log("searching for node created events at", arbNetwork.ethBridge.rollup); const logs = await fetcher.getEvents(RollupUserLogic__factory, (t) => t.filters.NodeCreated(), { fromBlock: msg.event.ethBlockNum.toNumber(), toBlock: "latest", }); + console.log("found", logs.length, "logs to sort through. searching for send count >", msg.event.position.toString()); // use binary search to find the first node with sendCount > this.event.position // default to the last node since we already checked above let foundLog: FetchedEvent = logs[logs.length - 1]; @@ -130,11 +134,11 @@ const processFromArbitrumRoot = async ( while (left <= right) { const mid = Math.floor((left + right) / 2); const log = logs[mid]; - const block = await msg.getBlockFromNodeLog(spokeProvider, log); - const sendCount = BigNumber.from(block.sendCount); - if (sendCount.gt(msg.event.position as BigNumberish)) { + const block = await msg.getBlockFromAssertionLog(spokeProvider, log); + if (BigNumber.from(block.sendCount).gt(msg.event.position as BigNumberish)) { foundLog = log; right = mid - 1; + left = right + 1; } else { left = mid + 1; } @@ -146,7 +150,7 @@ const processFromArbitrumRoot = async ( RollupUserLogic__factory.abi, deployer.connect(hubProvider), ); - const foundBlock = await msg.getBlockFromNodeNum(rollup, earliestNodeWithExit, spokeProvider); + const foundBlock = await msg.getBlockFromAssertionId(rollup, earliestNodeWithExit, spokeProvider); console.log("node:", earliestNodeWithExit.toString()); console.log("msg.position", msg.event.position.toString()); console.log("foundLog:", foundLog); @@ -324,7 +328,7 @@ export default task("process-from-root", "Call `Connector.processFromRoot()` to .addOptionalParam("networkType", "Type of network of contracts") .setAction( async ({ env: _env, tx: sendHash, spoke: _spoke, networkType: _networkType }: TaskArgs, { deployments }) => { - const deployer = Wallet.fromMnemonic(process.env.MAINNET_MNEMONIC!); + const deployer = Wallet.fromMnemonic(process.env.MAINNET_MNEMONIC ?? process.env.MNEMONIC!); const env = mustGetEnv(_env); const spoke = +_spoke; @@ -354,6 +358,7 @@ export default task("process-from-root", "Call `Connector.processFromRoot()` to args = await processFromOptimismRoot(spoke, sendHash, protocolConfig, l2Provider, l1Provider); break; case "Arbitrum": + method = "processMessageFromRoot"; args = await processFromArbitrumRoot(spoke, sendHash, l2Provider, l1Provider, deployer); break; case "Polygon": diff --git a/packages/deployments/contracts/tasks/connector/redeem.ts b/packages/deployments/contracts/tasks/connector/redeem.ts index dbe6c0f785..79034af550 100644 --- a/packages/deployments/contracts/tasks/connector/redeem.ts +++ b/packages/deployments/contracts/tasks/connector/redeem.ts @@ -1,4 +1,4 @@ -import { L1ToL2MessageStatus, L1TransactionReceipt } from "@arbitrum/sdk"; +import { ParentToChildMessageStatus, ParentTransactionReceipt } from "@arbitrum/sdk"; import { providers, Wallet } from "ethers"; import { task } from "hardhat/config"; @@ -26,16 +26,16 @@ const redeemFromArbitrum = async ( spokeProvider: providers.JsonRpcProvider, ) => { // Get the message receipt from arbitrum sdk - const receipt = new L1TransactionReceipt(await hubProvider.getTransactionReceipt(hash)); + const receipt = new ParentTransactionReceipt(await hubProvider.getTransactionReceipt(hash)); console.log("got l1 -> l2 message receipt on l1", receipt.transactionHash); // get the mesesage (assume only one arb message in receipt) - const [message] = await receipt.getL1ToL2Messages(signer.connect(spokeProvider)); + const [message] = await receipt.getParentToChildMessages(signer.connect(spokeProvider)); const { status } = await message.waitForStatus(); console.log("got l1 -> l2 message", message); // check to see if it needs redemption - if (status != L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2) { + if (status != ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD) { throw new Error(`Not ready to redeem, or was auto-redeemed. Status: ${status}`); } diff --git a/yarn.lock b/yarn.lock index 47f35db495..cac36eca47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -70,15 +70,16 @@ __metadata: languageName: node linkType: hard -"@arbitrum/sdk@npm:3.1.11": - version: 3.1.11 - resolution: "@arbitrum/sdk@npm:3.1.11" +"@arbitrum/sdk@npm:4.0.1": + version: 4.0.1 + resolution: "@arbitrum/sdk@npm:4.0.1" dependencies: "@ethersproject/address": ^5.0.8 "@ethersproject/bignumber": ^5.1.1 "@ethersproject/bytes": ^5.0.8 + async-mutex: ^0.4.0 ethers: ^5.1.0 - checksum: 79066b07d685755c53f4d7a2862f84c189ab07207d7c4cf8909b540cfbeb07007fec5d7cb9057c2c01df4ee196653cdbe17674bf80eb45bf2fb64f07b8d5f6a2 + checksum: 7404c019563538c078f24b9f965d99ca5080435cd681628ac0f7aef2f7777806ec10ffcb3b31ccb9b44d951572ed219cfc1bde8f5a3f0878b7cbd9af4b4b334d languageName: node linkType: hard @@ -2428,7 +2429,7 @@ __metadata: version: 0.0.0-use.local resolution: "@connext/lighthouse@workspace:packages/agents/lighthouse" dependencies: - "@arbitrum/sdk": 3.1.11 + "@arbitrum/sdk": 4.0.1 "@connext/nxtp-adapters-database": "workspace:*" "@connext/nxtp-adapters-relayer": "workspace:*" "@connext/nxtp-adapters-subgraph": "workspace:*" @@ -2946,7 +2947,7 @@ __metadata: version: 0.0.0-use.local resolution: "@connext/smart-contracts@workspace:packages/deployments/contracts" dependencies: - "@arbitrum/sdk": 3.1.11 + "@arbitrum/sdk": 4.0.1 "@certusone/wormhole-sdk": 0.9.21 "@connext/nxtp-utils": "workspace:*" "@consensys/linea-sdk": 0.1.6 @@ -10739,6 +10740,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:^0.4.0": + version: 0.4.1 + resolution: "async-mutex@npm:0.4.1" + dependencies: + tslib: ^2.4.0 + checksum: cb529c0d257c8ff8e5b26c81b36127a255e545edee2c42c76247d533b89a7664037d95f33130f964de49b111ad3324ead8dcccd419c47acdfeb7413ed93063a1 + languageName: node + linkType: hard + "async-retry@npm:^1.3.1": version: 1.3.3 resolution: "async-retry@npm:1.3.3" From c7550a11bc580bd50d2ee97ec0c48ba93c944c6f Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Fri, 23 Aug 2024 12:11:11 -0600 Subject: [PATCH 05/10] fix: build --- .../src/tasks/propagate/helpers/arbitrum.ts | 4 ++-- .../test/tasks/propagate/helpers/arbitrum.spec.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/agents/lighthouse/src/tasks/propagate/helpers/arbitrum.ts b/packages/agents/lighthouse/src/tasks/propagate/helpers/arbitrum.ts index b1215d96c4..5866c37e8d 100644 --- a/packages/agents/lighthouse/src/tasks/propagate/helpers/arbitrum.ts +++ b/packages/agents/lighthouse/src/tasks/propagate/helpers/arbitrum.ts @@ -6,7 +6,7 @@ import { NoSpokeConnector, NoHubConnector, NoProviderForDomain } from "../errors import { ExtraPropagateParam } from "../operations/propagate"; import { getJsonRpcProvider, - getL1ToL2MessageGasEstimator, + getParentToChildMessageGasEstimator, getBaseFee, getInterface, getBestProvider, @@ -62,7 +62,7 @@ export const getPropagateParams = async ( try { const l2Provider = getJsonRpcProvider(l2RpcUrl); - const l1ToL2MessageGasEstimate = getL1ToL2MessageGasEstimator(l2Provider); + const l1ToL2MessageGasEstimate = getParentToChildMessageGasEstimator(l2Provider); // example encoded payload: 0x4ff746f6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000207465737400000000000000000000000000000000000000000000000000000000 // length = 200 not including 0x = 100 bytes diff --git a/packages/agents/lighthouse/test/tasks/propagate/helpers/arbitrum.spec.ts b/packages/agents/lighthouse/test/tasks/propagate/helpers/arbitrum.spec.ts index 28c2a099d6..3456925ba4 100644 --- a/packages/agents/lighthouse/test/tasks/propagate/helpers/arbitrum.spec.ts +++ b/packages/agents/lighthouse/test/tasks/propagate/helpers/arbitrum.spec.ts @@ -7,19 +7,22 @@ import * as Mockable from "../../../../src/mockable"; import { getPropagateParams } from "../../../../src/tasks/propagate/helpers/arbitrum"; import { getInterfaceMock, propagateCtxMock, getBestProviderMock } from "../../../globalTestHook"; import { mock } from "../../../mock"; -import { L1ToL2MessageGasEstimator } from "@arbitrum/sdk"; +import { ParentToChildMessageGasEstimator } from "@arbitrum/sdk"; const requestContext = createRequestContext("test"); const estimateSubmissionFee = Promise.resolve(constants.One); const estimateRetryableTicketGasLimit = Promise.resolve(constants.Two); -let l1ToL2: SinonStubbedInstance; +let l1ToL2: SinonStubbedInstance; describe("Helpers: Arbitrum ", () => { beforeEach(() => { - l1ToL2 = createStubInstance(L1ToL2MessageGasEstimator, { estimateSubmissionFee, estimateRetryableTicketGasLimit }); + l1ToL2 = createStubInstance(ParentToChildMessageGasEstimator, { + estimateSubmissionFee, + estimateRetryableTicketGasLimit, + }); stub(Mockable, "getJsonRpcProvider").returns(createStubInstance(providers.JsonRpcProvider)); - stub(Mockable, "getL1ToL2MessageGasEstimator").returns(l1ToL2); + stub(Mockable, "getParentToChildMessageGasEstimator").returns(l1ToL2); stub(Mockable, "getBaseFee").resolves(BigNumber.from(1)); getInterfaceMock.returns({ encodeFunctionData: stub().resolves(mkBytes32("0xcalldadta")) }); }); From 97c05f06e618345735cd661892744253732e61da Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Sun, 25 Aug 2024 09:26:34 -0700 Subject: [PATCH 06/10] chore: update optimism sdk --- packages/agents/lighthouse/package.json | 2 +- yarn.lock | 264 +++++++++++++++++++++--- 2 files changed, 238 insertions(+), 28 deletions(-) diff --git a/packages/agents/lighthouse/package.json b/packages/agents/lighthouse/package.json index f8664ae9c3..90e5e4153b 100644 --- a/packages/agents/lighthouse/package.json +++ b/packages/agents/lighthouse/package.json @@ -35,7 +35,7 @@ "@connext/nxtp-utils": "workspace:*", "@connext/smart-contracts": "workspace:*", "@consensys/linea-sdk": "0.1.6", - "@eth-optimism/sdk": "3.2.0", + "@eth-optimism/sdk": "3.3.2", "@mantleio/sdk": "1.0.0", "@sinclair/typebox": "0.25.21", "@types/aws-lambda": "8.10.110", diff --git a/yarn.lock b/yarn.lock index cac36eca47..fb3c5fee40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,6 +23,13 @@ __metadata: languageName: node linkType: hard +"@adraffy/ens-normalize@npm:1.10.1": + version: 1.10.1 + resolution: "@adraffy/ens-normalize@npm:1.10.1" + checksum: 0836f394ea256972ec19a0b5e78cb7f5bcdfd48d8a32c7478afc94dd53ae44c04d1aa2303d7f3077b4f3ac2323b1f557ab9188e8059978748fdcd83e04a80dcc + languageName: node + linkType: hard + "@ampproject/remapping@npm:^2.2.0": version: 2.3.0 resolution: "@ampproject/remapping@npm:2.3.0" @@ -2437,7 +2444,7 @@ __metadata: "@connext/nxtp-utils": "workspace:*" "@connext/smart-contracts": "workspace:*" "@consensys/linea-sdk": 0.1.6 - "@eth-optimism/sdk": 3.2.0 + "@eth-optimism/sdk": 3.3.2 "@graphql-codegen/cli": 3.0.0 "@mantleio/sdk": 1.0.0 "@sinclair/typebox": 0.25.21 @@ -2950,8 +2957,8 @@ __metadata: "@arbitrum/sdk": 4.0.1 "@certusone/wormhole-sdk": 0.9.21 "@connext/nxtp-utils": "workspace:*" - "@consensys/linea-sdk": 0.1.6 - "@eth-optimism/sdk": 3.2.0 + "@consensys/linea-sdk": 0.3.0 + "@eth-optimism/sdk": 3.3.2 "@gelatonetwork/relay-context": 2.1.0 "@mantleio/sdk": 1.0.0 "@matterlabs/hardhat-zksync-deploy": 0.6.3 @@ -3019,6 +3026,23 @@ __metadata: languageName: node linkType: hard +"@consensys/linea-sdk@npm:0.3.0": + version: 0.3.0 + resolution: "@consensys/linea-sdk@npm:0.3.0" + dependencies: + better-sqlite3: ^9.4.3 + class-validator: ^0.14.1 + dotenv: ^16.4.5 + ethers: ^6.11.1 + lru-cache: ^10.2.0 + pg: ^8.11.3 + typeorm: ^0.3.20 + typeorm-naming-strategies: ^4.1.0 + winston: ^3.12.0 + checksum: 69aa2fb2d01c2acddb99f7c44d069ebf4d2ed7cf4415ab28bde3c7ffbdbbf9b290efdf8620175a8f6156feaed0d2eabb37b0cc7b2f543086e342b27baaf3b49d + languageName: node + linkType: hard + "@coral-xyz/borsh@npm:0.2.6": version: 0.2.6 resolution: "@coral-xyz/borsh@npm:0.2.6" @@ -3466,13 +3490,6 @@ __metadata: languageName: node linkType: hard -"@eth-optimism/contracts-bedrock@npm:0.17.1": - version: 0.17.1 - resolution: "@eth-optimism/contracts-bedrock@npm:0.17.1" - checksum: ae75458ca843dc36d050a484a97226112d1c5a1453cb8a59a1a64e4805052984663b2d83ca1a2764751ea182e09ee53ddc1ab19c6a94885a6e743371498060a2 - languageName: node - linkType: hard - "@eth-optimism/contracts@npm:0.6.0": version: 0.6.0 resolution: "@eth-optimism/contracts@npm:0.6.0" @@ -3510,9 +3527,9 @@ __metadata: languageName: node linkType: hard -"@eth-optimism/core-utils@npm:0.13.1": - version: 0.13.1 - resolution: "@eth-optimism/core-utils@npm:0.13.1" +"@eth-optimism/core-utils@npm:^0.13.2": + version: 0.13.2 + resolution: "@eth-optimism/core-utils@npm:0.13.2" dependencies: "@ethersproject/abi": ^5.7.0 "@ethersproject/abstract-provider": ^5.7.0 @@ -3525,27 +3542,26 @@ __metadata: "@ethersproject/properties": ^5.7.0 "@ethersproject/rlp": ^5.7.0 "@ethersproject/web": ^5.7.1 - chai: ^4.3.9 + chai: ^4.3.10 ethers: ^5.7.2 node-fetch: ^2.6.7 - checksum: ed1f1bcec4fd308463c6bd6e6cc8f6c89041dfa5e0c03c67ee487f5b3bef7bb34c59ea1f8039d00cc0e8696ed8ae9a4486c10d86b2db1d9dadb94294fc83b6fc + checksum: 4603b4a43b06d4b8117bdfa8175709a7ff8c708d7b439c16997c590fed976ee3b2989362b47aad4ffdbce0c1f9b8f86140d308e55fa553d2daaae1ba054ae927 languageName: node linkType: hard -"@eth-optimism/sdk@npm:3.2.0": - version: 3.2.0 - resolution: "@eth-optimism/sdk@npm:3.2.0" +"@eth-optimism/sdk@npm:3.3.2": + version: 3.3.2 + resolution: "@eth-optimism/sdk@npm:3.3.2" dependencies: "@eth-optimism/contracts": 0.6.0 - "@eth-optimism/contracts-bedrock": 0.17.1 - "@eth-optimism/core-utils": 0.13.1 + "@eth-optimism/core-utils": ^0.13.2 lodash: ^4.17.21 merkletreejs: ^0.3.11 rlp: ^2.2.7 - semver: ^7.5.4 + semver: ^7.6.0 peerDependencies: ethers: ^5 - checksum: e8101a3d9c3dde9f02bc0862aa1afe68235505976b27e1ea1bcb4524d4fd9531fdb66dcbb841ff3f8b38fd9110a51260f38a434532d72b6857710c1d76a1d2a4 + checksum: d24707c9540a5e9c7f4a123e7dd085ebd4cfa861ffce3fb124bd3c7c92da5d7c92ddf488582cfc3cda17bde010cfda5812c183750ae9cd0ebae913328eae47c2 languageName: node linkType: hard @@ -6577,6 +6593,15 @@ __metadata: languageName: node linkType: hard +"@noble/curves@npm:1.2.0": + version: 1.2.0 + resolution: "@noble/curves@npm:1.2.0" + dependencies: + "@noble/hashes": 1.3.2 + checksum: bb798d7a66d8e43789e93bc3c2ddff91a1e19fdb79a99b86cd98f1e5eff0ee2024a2672902c2576ef3577b6f282f3b5c778bebd55761ddbb30e36bf275e83dd0 + languageName: node + linkType: hard + "@noble/curves@npm:1.3.0, @noble/curves@npm:^1.0.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.3.0": version: 1.3.0 resolution: "@noble/curves@npm:1.3.0" @@ -6600,6 +6625,13 @@ __metadata: languageName: node linkType: hard +"@noble/hashes@npm:1.3.2": + version: 1.3.2 + resolution: "@noble/hashes@npm:1.3.2" + checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474 + languageName: node + linkType: hard + "@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.2.0, @noble/hashes@npm:^1.3.0, @noble/hashes@npm:^1.3.3, @noble/hashes@npm:~1.3.2": version: 1.3.3 resolution: "@noble/hashes@npm:1.3.3" @@ -8565,6 +8597,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:18.15.13": + version: 18.15.13 + resolution: "@types/node@npm:18.15.13" + checksum: 79cc5a2b5f98e8973061a4260a781425efd39161a0e117a69cd089603964816c1a14025e1387b4590c8e82d05133b7b4154fa53a7dffb3877890a66145e76515 + languageName: node + linkType: hard + "@types/node@npm:20.5.1": version: 20.5.1 resolution: "@types/node@npm:20.5.1" @@ -9969,6 +10008,13 @@ __metadata: languageName: node linkType: hard +"aes-js@npm:4.0.0-beta.5": + version: 4.0.0-beta.5 + resolution: "aes-js@npm:4.0.0-beta.5" + checksum: cc2ea969d77df939c32057f7e361b6530aa6cb93cb10617a17a45cd164e6d761002f031ff6330af3e67e58b1f0a3a8fd0b63a720afd591a653b02f649470e15b + languageName: node + linkType: hard + "aes-js@npm:^3.1.1, aes-js@npm:^3.1.2": version: 3.1.2 resolution: "aes-js@npm:3.1.2" @@ -11788,6 +11834,17 @@ __metadata: languageName: node linkType: hard +"better-sqlite3@npm:^9.4.3": + version: 9.6.0 + resolution: "better-sqlite3@npm:9.6.0" + dependencies: + bindings: ^1.5.0 + node-gyp: latest + prebuild-install: ^7.1.1 + checksum: be3a1d2a3f6f9b5141be6607a38c0a51fa5849495b071955e507bc0c2a2fb08430852c1bf03796eec1a53344b25645807db48dcb51c71b0662b74c5a70420bb0 + languageName: node + linkType: hard + "big-integer@npm:1.6.36": version: 1.6.36 resolution: "big-integer@npm:1.6.36" @@ -12886,7 +12943,22 @@ __metadata: languageName: node linkType: hard -"chai@npm:^4.3.4, chai@npm:^4.3.9": +"chai@npm:^4.3.10": + version: 4.5.0 + resolution: "chai@npm:4.5.0" + dependencies: + assertion-error: ^1.1.0 + check-error: ^1.0.3 + deep-eql: ^4.1.3 + get-func-name: ^2.0.2 + loupe: ^2.3.6 + pathval: ^1.1.1 + type-detect: ^4.1.0 + checksum: 70e5a8418a39e577e66a441cc0ce4f71fd551a650a71de30dd4e3e31e75ed1f5aa7119cf4baf4a2cb5e85c0c6befdb4d8a05811fad8738c1a6f3aa6a23803821 + languageName: node + linkType: hard + +"chai@npm:^4.3.4": version: 4.4.1 resolution: "chai@npm:4.4.1" dependencies: @@ -13194,7 +13266,7 @@ __metadata: languageName: node linkType: hard -"class-validator@npm:^0.14.0": +"class-validator@npm:^0.14.0, class-validator@npm:^0.14.1": version: 0.14.1 resolution: "class-validator@npm:0.14.1" dependencies: @@ -15144,7 +15216,7 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:^16.0.0, dotenv@npm:^16.0.3, dotenv@npm:^16.1.4": +"dotenv@npm:^16.0.0, dotenv@npm:^16.0.3, dotenv@npm:^16.1.4, dotenv@npm:^16.4.5": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c @@ -16800,6 +16872,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:^6.11.1": + version: 6.13.2 + resolution: "ethers@npm:6.13.2" + dependencies: + "@adraffy/ens-normalize": 1.10.1 + "@noble/curves": 1.2.0 + "@noble/hashes": 1.3.2 + "@types/node": 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.17.1 + checksum: 981860c736c7ae121774ad38ea07e3611ce524a77d2fcb77db499b65afe0cbe8f344cd5204d94b68b316349ff770fd2a7d9c8b2039da41c072f98d9864099925 + languageName: node + linkType: hard + "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" @@ -22641,6 +22728,20 @@ __metadata: languageName: node linkType: hard +"logform@npm:^2.6.0": + version: 2.6.1 + resolution: "logform@npm:2.6.1" + dependencies: + "@colors/colors": 1.6.0 + "@types/triple-beam": ^1.3.2 + fecha: ^4.2.0 + ms: ^2.1.1 + safe-stable-stringify: ^2.3.1 + triple-beam: ^1.3.0 + checksum: 0c6b95fa8350ccc33c7c33d77de2a9920205399706fc1b125151c857b61eb90873f4670d9e0e58e58c165b68a363206ae670d6da8b714527c838da3c84449605 + languageName: node + linkType: hard + "loglevel@npm:^1.8.0": version: 1.9.1 resolution: "loglevel@npm:1.9.1" @@ -22751,6 +22852,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^10.2.0": + version: 10.4.3 + resolution: "lru-cache@npm:10.4.3" + checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a + languageName: node + linkType: hard + "lru-cache@npm:^3.2.0": version: 3.2.0 resolution: "lru-cache@npm:3.2.0" @@ -25600,6 +25708,13 @@ __metadata: languageName: node linkType: hard +"pg-connection-string@npm:^2.6.4": + version: 2.6.4 + resolution: "pg-connection-string@npm:2.6.4" + checksum: 2c1d2ac1add1f93076f1594d217a0980f79add05dc48de6363e1c550827c78a6ee3e3b5420da9c54858f6b678cdb348aed49732ee68158b6cdb70f1d1c748cf9 + languageName: node + linkType: hard + "pg-int8@npm:1.0.1": version: 1.0.1 resolution: "pg-int8@npm:1.0.1" @@ -25616,6 +25731,15 @@ __metadata: languageName: node linkType: hard +"pg-pool@npm:^3.6.2": + version: 3.6.2 + resolution: "pg-pool@npm:3.6.2" + peerDependencies: + pg: ">=8.0" + checksum: 5ceee4320a35fce08777d085d50a30a1253574257e1e7c5c56c915056d387d340f797115580c8d90a46691f83c39a9b4da1fd810d9ad168cc455c79c289116f4 + languageName: node + linkType: hard + "pg-protocol@npm:*, pg-protocol@npm:^1.6.0": version: 1.6.0 resolution: "pg-protocol@npm:1.6.0" @@ -25623,6 +25747,13 @@ __metadata: languageName: node linkType: hard +"pg-protocol@npm:^1.6.1": + version: 1.6.1 + resolution: "pg-protocol@npm:1.6.1" + checksum: cce3f72cc4bdc04db9ce3fa38b2c45b745f0a95a925847b349087f52c02c4d51b7c74d8867e40639699d0c7609accfaffb6b1d221b3268d2bdc4bb8d6a2995a3 + languageName: node + linkType: hard + "pg-types@npm:^2.1.0, pg-types@npm:^2.2.0": version: 2.2.0 resolution: "pg-types@npm:2.2.0" @@ -25680,6 +25811,28 @@ __metadata: languageName: node linkType: hard +"pg@npm:^8.11.3": + version: 8.12.0 + resolution: "pg@npm:8.12.0" + dependencies: + pg-cloudflare: ^1.1.1 + pg-connection-string: ^2.6.4 + pg-pool: ^3.6.2 + pg-protocol: ^1.6.1 + pg-types: ^2.1.0 + pgpass: 1.x + peerDependencies: + pg-native: ">=3.0.1" + dependenciesMeta: + pg-cloudflare: + optional: true + peerDependenciesMeta: + pg-native: + optional: true + checksum: 8450b61c787f360e22182aa853548f834f13622714868d0789a60f63743d66ae28930cdca0ef0251bfc89b04679e9074c1398f172c2937bf59b5a360337f4149 + languageName: node + linkType: hard + "pgpass@npm:1.x": version: 1.0.5 resolution: "pgpass@npm:1.0.5" @@ -28151,7 +28304,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4": +"semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3": version: 7.6.0 resolution: "semver@npm:7.6.0" dependencies: @@ -28162,6 +28315,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.6.0": + version: 7.6.3 + resolution: "semver@npm:7.6.3" + bin: + semver: bin/semver.js + checksum: 4110ec5d015c9438f322257b1c51fe30276e5f766a3f64c09edd1d7ea7118ecbc3f379f3b69032bacf13116dc7abc4ad8ce0d7e2bd642e26b0d271b56b61a7d8 + languageName: node + linkType: hard + "semver@npm:~5.4.1": version: 5.4.1 resolution: "semver@npm:5.4.1" @@ -30618,6 +30780,13 @@ __metadata: languageName: node linkType: hard +"tslib@npm:2.4.0": + version: 2.4.0 + resolution: "tslib@npm:2.4.0" + checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113 + languageName: node + linkType: hard + "tslib@npm:2.5.0": version: 2.5.0 resolution: "tslib@npm:2.5.0" @@ -30745,6 +30914,13 @@ __metadata: languageName: node linkType: hard +"type-detect@npm:^4.1.0": + version: 4.1.0 + resolution: "type-detect@npm:4.1.0" + checksum: 3b32f873cd02bc7001b00a61502b7ddc4b49278aabe68d652f732e1b5d768c072de0bc734b427abf59d0520a5f19a2e07309ab921ef02018fa1cb4af155cdb37 + languageName: node + linkType: hard + "type-fest@npm:^0.18.0": version: 0.18.1 resolution: "type-fest@npm:0.18.1" @@ -30961,7 +31137,7 @@ __metadata: languageName: node linkType: hard -"typeorm@npm:^0.3.16": +"typeorm@npm:^0.3.16, typeorm@npm:^0.3.20": version: 0.3.20 resolution: "typeorm@npm:0.3.20" dependencies: @@ -33224,6 +33400,25 @@ __metadata: languageName: node linkType: hard +"winston@npm:^3.12.0": + version: 3.14.2 + resolution: "winston@npm:3.14.2" + dependencies: + "@colors/colors": ^1.6.0 + "@dabh/diagnostics": ^2.0.2 + async: ^3.2.3 + is-stream: ^2.0.0 + logform: ^2.6.0 + one-time: ^1.0.0 + readable-stream: ^3.4.0 + safe-stable-stringify: ^2.3.1 + stack-trace: 0.0.x + triple-beam: ^1.3.0 + winston-transport: ^4.7.0 + checksum: 9021637d3ab1d1e639d64e7217ed5ae63fb0e5325defdbce439f708e9b4e26c7a31eb4a731106790aa8ac6f80a3a89242de18d1991ab3838f9d84e55101f4607 + languageName: node + linkType: hard + "winston@npm:^3.9.0": version: 3.12.0 resolution: "winston@npm:3.12.0" @@ -33401,6 +33596,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:8.17.1": + version: 8.17.1 + resolution: "ws@npm:8.17.1" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 442badcce1f1178ec87a0b5372ae2e9771e07c4929a3180321901f226127f252441e8689d765aa5cfba5f50ac60dd830954afc5aeae81609aefa11d3ddf5cecf + languageName: node + linkType: hard + "ws@npm:^3.0.0": version: 3.3.3 resolution: "ws@npm:3.3.3" From fae5f97f09155718467ab97e510a4fca1c39e5df Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Sun, 25 Aug 2024 09:26:40 -0700 Subject: [PATCH 07/10] chore: fix tests --- .../processFromRoot/helpers/arbitrum.spec.ts | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/agents/lighthouse/test/tasks/processFromRoot/helpers/arbitrum.spec.ts b/packages/agents/lighthouse/test/tasks/processFromRoot/helpers/arbitrum.spec.ts index 64182017e7..5f0626d7ea 100644 --- a/packages/agents/lighthouse/test/tasks/processFromRoot/helpers/arbitrum.spec.ts +++ b/packages/agents/lighthouse/test/tasks/processFromRoot/helpers/arbitrum.spec.ts @@ -1,6 +1,6 @@ import { Logger, createRequestContext, expect, mkHash } from "@connext/nxtp-utils"; import { stub, SinonStub, createStubInstance, SinonStubbedInstance, spy } from "sinon"; -import { L2ToL1MessageReader } from "@arbitrum/sdk"; +import { ChildToParentMessageReader } from "@arbitrum/sdk"; import { NodeInterface__factory } from "@arbitrum/sdk/dist/lib/abi/factories/NodeInterface__factory"; import * as MockableFns from "../../../../src/mockable"; @@ -20,14 +20,14 @@ class MockJsonRpcProvider { } let isDataAvailableStub: SinonStub; -let l2ToL1MessageReader: SinonStubbedInstance; +let l2ToL1MessageReader: SinonStubbedInstance; class MockL2TransactionReceipt { public isDataAvailable = isDataAvailableStub; - public getL2ToL1Messages = stub().resolves([l2ToL1MessageReader]); + public getChildToParentMessages = stub().resolves([l2ToL1MessageReader]); } class MockL2TransactionReceiptTemp { public isDataAvailable = isDataAvailableStub; - public getL2ToL1Messages = stub().resolves([{}]); + public getChildToParentMessages = stub().resolves([{}]); } class MockEventFetcher { @@ -49,11 +49,11 @@ describe("Helpers: Arbitrum", () => { let confirmData: SinonStub; beforeEach(() => { isDataAvailableStub = stub().resolves(true); - l2ToL1MessageReader = createStubInstance(L2ToL1MessageReader, { + l2ToL1MessageReader = createStubInstance(ChildToParentMessageReader, { getOutboxProof: Promise.resolve(["hello", "world"]), } as any); (l2ToL1MessageReader as any).nitroReader = { - getBlockFromNodeNum: (...args: any) => + getBlockFromAssertionId: (...args: any) => Promise.resolve({ blockNumber: constants.One, nodeNum: constants.One, @@ -61,7 +61,7 @@ describe("Helpers: Arbitrum", () => { sendCount: constants.One, hash: mkHash("0x456"), } as any), - getBlockFromNodeLog: (...args: any) => + getBlockFromAssertionLog: (...args: any) => Promise.resolve({ blockNumber: constants.One, nodeNum: constants.One, @@ -71,7 +71,7 @@ describe("Helpers: Arbitrum", () => { } as any), event: { position: constants.One, ethBlockNum: constants.One }, }; - stub(MockableFns, "L2TransactionReceipt").value(MockL2TransactionReceipt); + stub(MockableFns, "ChildTransactionReceipt").value(MockL2TransactionReceipt); stub(MockableFns, "JsonRpcProvider").value(MockJsonRpcProvider); stub(MockableFns, "EventFetcher").value(MockEventFetcher); stub(MockableFns, "Outbox__factory").value(mockOutboxFactory); @@ -101,6 +101,7 @@ describe("Helpers: Arbitrum", () => { isDataAvailableStub.resolves(false); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -119,6 +120,7 @@ describe("Helpers: Arbitrum", () => { confirmData.returns([{ confirmData: "0xfoo" }]); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -143,6 +145,7 @@ describe("Helpers: Arbitrum", () => { ]); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -167,6 +170,7 @@ describe("Helpers: Arbitrum", () => { ]); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -182,9 +186,10 @@ describe("Helpers: Arbitrum", () => { }); it("should throw error in case msg event is not present", async () => { - stub(MockableFns, "L2TransactionReceipt").value(MockL2TransactionReceiptTemp); + stub(MockableFns, "ChildTransactionReceipt").value(MockL2TransactionReceiptTemp); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -201,6 +206,7 @@ describe("Helpers: Arbitrum", () => { it("should work", async () => { const args = await getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -219,6 +225,7 @@ describe("Helpers: Arbitrum", () => { stub(MockableFns, "EventFetcher").value(MockEventFetcherError); await expect( getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", @@ -235,7 +242,7 @@ describe("Helpers: Arbitrum", () => { it("should have warning in getBlockFromNodeLog fails", async () => { (l2ToL1MessageReader as any).nitroReader = { - getBlockFromNodeNum: (...args: any) => + getBlockFromAssertionId: (...args: any) => Promise.resolve({ blockNumber: constants.One, nodeNum: constants.One, @@ -243,7 +250,7 @@ describe("Helpers: Arbitrum", () => { sendCount: constants.One, hash: mkHash("0x456"), } as any), - getBlockFromNodeLog: (...args: any) => + getBlockFromAssertionLog: (...args: any) => Promise.reject({ blockNumber: constants.One, nodeNum: constants.One, @@ -256,6 +263,7 @@ describe("Helpers: Arbitrum", () => { const loggerSpy = spy(getContext().logger, "warn"); const args = await getProcessFromArbitrumRootArgs({ + isSpokeClaim: false, spokeChainId: 42161, spokeDomainId: "1", spokeProvider: "world", From e3b7d4ea3fbdc4cf82081c4e56de45505e75027c Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Sun, 25 Aug 2024 09:33:05 -0700 Subject: [PATCH 08/10] chore: update optimism sdk --- packages/deployments/contracts/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/deployments/contracts/package.json b/packages/deployments/contracts/package.json index b263d88e67..a12bbb555b 100644 --- a/packages/deployments/contracts/package.json +++ b/packages/deployments/contracts/package.json @@ -51,7 +51,7 @@ "author": "Connext", "license": "ISC", "dependencies": { - "@eth-optimism/sdk": "3.2.0" + "@eth-optimism/sdk": "3.3.2" }, "devDependencies": { "@arbitrum/sdk": "4.0.1", @@ -104,4 +104,4 @@ }, "gitHead": "937a7cde93e6ac1e151c6374f48adf83d3fa4ec6", "stableVersion": "0.1.25" -} +} \ No newline at end of file From aedd77f5382113d921fc1a24a410f870d0395680 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Sun, 25 Aug 2024 09:33:17 -0700 Subject: [PATCH 09/10] chore: improved logging --- .../contracts/tasks/connector/processFromRoot.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/deployments/contracts/tasks/connector/processFromRoot.ts b/packages/deployments/contracts/tasks/connector/processFromRoot.ts index fbaa1c6bb4..8dfdd5ac46 100644 --- a/packages/deployments/contracts/tasks/connector/processFromRoot.ts +++ b/packages/deployments/contracts/tasks/connector/processFromRoot.ts @@ -134,8 +134,15 @@ const processFromArbitrumRoot = async ( while (left <= right) { const mid = Math.floor((left + right) / 2); const log = logs[mid]; - const block = await msg.getBlockFromAssertionLog(spokeProvider, log); - if (BigNumber.from(block.sendCount).gt(msg.event.position as BigNumberish)) { + let sendCount = BigNumber.from(0); + try { + const block = await msg.getBlockFromAssertionLog(spokeProvider, log); + sendCount = BigNumber.from(block.sendCount); + } catch (e) { + console.warn("failed to get block:", e); + } + console.log("- sendCount", sendCount.toString()); + if (sendCount.gt(msg.event.position as BigNumberish)) { foundLog = log; right = mid - 1; left = right + 1; From 6bd90064c2cf521ef6b6990cdf08ca72fa6a0c3c Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Sun, 25 Aug 2024 09:37:05 -0700 Subject: [PATCH 10/10] chore: install --- packages/deployments/contracts/package.json | 2 +- yarn.lock | 195 +------------------- 2 files changed, 5 insertions(+), 192 deletions(-) diff --git a/packages/deployments/contracts/package.json b/packages/deployments/contracts/package.json index a12bbb555b..0cef63ee83 100644 --- a/packages/deployments/contracts/package.json +++ b/packages/deployments/contracts/package.json @@ -104,4 +104,4 @@ }, "gitHead": "937a7cde93e6ac1e151c6374f48adf83d3fa4ec6", "stableVersion": "0.1.25" -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index fb3c5fee40..159984c4eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,13 +23,6 @@ __metadata: languageName: node linkType: hard -"@adraffy/ens-normalize@npm:1.10.1": - version: 1.10.1 - resolution: "@adraffy/ens-normalize@npm:1.10.1" - checksum: 0836f394ea256972ec19a0b5e78cb7f5bcdfd48d8a32c7478afc94dd53ae44c04d1aa2303d7f3077b4f3ac2323b1f557ab9188e8059978748fdcd83e04a80dcc - languageName: node - linkType: hard - "@ampproject/remapping@npm:^2.2.0": version: 2.3.0 resolution: "@ampproject/remapping@npm:2.3.0" @@ -2957,7 +2950,7 @@ __metadata: "@arbitrum/sdk": 4.0.1 "@certusone/wormhole-sdk": 0.9.21 "@connext/nxtp-utils": "workspace:*" - "@consensys/linea-sdk": 0.3.0 + "@consensys/linea-sdk": 0.1.6 "@eth-optimism/sdk": 3.3.2 "@gelatonetwork/relay-context": 2.1.0 "@mantleio/sdk": 1.0.0 @@ -3026,23 +3019,6 @@ __metadata: languageName: node linkType: hard -"@consensys/linea-sdk@npm:0.3.0": - version: 0.3.0 - resolution: "@consensys/linea-sdk@npm:0.3.0" - dependencies: - better-sqlite3: ^9.4.3 - class-validator: ^0.14.1 - dotenv: ^16.4.5 - ethers: ^6.11.1 - lru-cache: ^10.2.0 - pg: ^8.11.3 - typeorm: ^0.3.20 - typeorm-naming-strategies: ^4.1.0 - winston: ^3.12.0 - checksum: 69aa2fb2d01c2acddb99f7c44d069ebf4d2ed7cf4415ab28bde3c7ffbdbbf9b290efdf8620175a8f6156feaed0d2eabb37b0cc7b2f543086e342b27baaf3b49d - languageName: node - linkType: hard - "@coral-xyz/borsh@npm:0.2.6": version: 0.2.6 resolution: "@coral-xyz/borsh@npm:0.2.6" @@ -6593,15 +6569,6 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.2.0": - version: 1.2.0 - resolution: "@noble/curves@npm:1.2.0" - dependencies: - "@noble/hashes": 1.3.2 - checksum: bb798d7a66d8e43789e93bc3c2ddff91a1e19fdb79a99b86cd98f1e5eff0ee2024a2672902c2576ef3577b6f282f3b5c778bebd55761ddbb30e36bf275e83dd0 - languageName: node - linkType: hard - "@noble/curves@npm:1.3.0, @noble/curves@npm:^1.0.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.3.0": version: 1.3.0 resolution: "@noble/curves@npm:1.3.0" @@ -6625,13 +6592,6 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.2": - version: 1.3.2 - resolution: "@noble/hashes@npm:1.3.2" - checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474 - languageName: node - linkType: hard - "@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.2.0, @noble/hashes@npm:^1.3.0, @noble/hashes@npm:^1.3.3, @noble/hashes@npm:~1.3.2": version: 1.3.3 resolution: "@noble/hashes@npm:1.3.3" @@ -8597,13 +8557,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:18.15.13": - version: 18.15.13 - resolution: "@types/node@npm:18.15.13" - checksum: 79cc5a2b5f98e8973061a4260a781425efd39161a0e117a69cd089603964816c1a14025e1387b4590c8e82d05133b7b4154fa53a7dffb3877890a66145e76515 - languageName: node - linkType: hard - "@types/node@npm:20.5.1": version: 20.5.1 resolution: "@types/node@npm:20.5.1" @@ -10008,13 +9961,6 @@ __metadata: languageName: node linkType: hard -"aes-js@npm:4.0.0-beta.5": - version: 4.0.0-beta.5 - resolution: "aes-js@npm:4.0.0-beta.5" - checksum: cc2ea969d77df939c32057f7e361b6530aa6cb93cb10617a17a45cd164e6d761002f031ff6330af3e67e58b1f0a3a8fd0b63a720afd591a653b02f649470e15b - languageName: node - linkType: hard - "aes-js@npm:^3.1.1, aes-js@npm:^3.1.2": version: 3.1.2 resolution: "aes-js@npm:3.1.2" @@ -11834,17 +11780,6 @@ __metadata: languageName: node linkType: hard -"better-sqlite3@npm:^9.4.3": - version: 9.6.0 - resolution: "better-sqlite3@npm:9.6.0" - dependencies: - bindings: ^1.5.0 - node-gyp: latest - prebuild-install: ^7.1.1 - checksum: be3a1d2a3f6f9b5141be6607a38c0a51fa5849495b071955e507bc0c2a2fb08430852c1bf03796eec1a53344b25645807db48dcb51c71b0662b74c5a70420bb0 - languageName: node - linkType: hard - "big-integer@npm:1.6.36": version: 1.6.36 resolution: "big-integer@npm:1.6.36" @@ -13266,7 +13201,7 @@ __metadata: languageName: node linkType: hard -"class-validator@npm:^0.14.0, class-validator@npm:^0.14.1": +"class-validator@npm:^0.14.0": version: 0.14.1 resolution: "class-validator@npm:0.14.1" dependencies: @@ -15216,7 +15151,7 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:^16.0.0, dotenv@npm:^16.0.3, dotenv@npm:^16.1.4, dotenv@npm:^16.4.5": +"dotenv@npm:^16.0.0, dotenv@npm:^16.0.3, dotenv@npm:^16.1.4": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 301a12c3d44fd49888b74eb9ccf9f07a1f5df43f489e7fcb89647a2edcd84c42d6bc349dc8df099cd18f07c35c7b04685c1a4f3e6a6a9e6b30f8d48c15b7f49c @@ -16872,21 +16807,6 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^6.11.1": - version: 6.13.2 - resolution: "ethers@npm:6.13.2" - dependencies: - "@adraffy/ens-normalize": 1.10.1 - "@noble/curves": 1.2.0 - "@noble/hashes": 1.3.2 - "@types/node": 18.15.13 - aes-js: 4.0.0-beta.5 - tslib: 2.4.0 - ws: 8.17.1 - checksum: 981860c736c7ae121774ad38ea07e3611ce524a77d2fcb77db499b65afe0cbe8f344cd5204d94b68b316349ff770fd2a7d9c8b2039da41c072f98d9864099925 - languageName: node - linkType: hard - "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" @@ -22728,20 +22648,6 @@ __metadata: languageName: node linkType: hard -"logform@npm:^2.6.0": - version: 2.6.1 - resolution: "logform@npm:2.6.1" - dependencies: - "@colors/colors": 1.6.0 - "@types/triple-beam": ^1.3.2 - fecha: ^4.2.0 - ms: ^2.1.1 - safe-stable-stringify: ^2.3.1 - triple-beam: ^1.3.0 - checksum: 0c6b95fa8350ccc33c7c33d77de2a9920205399706fc1b125151c857b61eb90873f4670d9e0e58e58c165b68a363206ae670d6da8b714527c838da3c84449605 - languageName: node - linkType: hard - "loglevel@npm:^1.8.0": version: 1.9.1 resolution: "loglevel@npm:1.9.1" @@ -22852,13 +22758,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.2.0": - version: 10.4.3 - resolution: "lru-cache@npm:10.4.3" - checksum: 6476138d2125387a6d20f100608c2583d415a4f64a0fecf30c9e2dda976614f09cad4baa0842447bd37dd459a7bd27f57d9d8f8ce558805abd487c583f3d774a - languageName: node - linkType: hard - "lru-cache@npm:^3.2.0": version: 3.2.0 resolution: "lru-cache@npm:3.2.0" @@ -25708,13 +25607,6 @@ __metadata: languageName: node linkType: hard -"pg-connection-string@npm:^2.6.4": - version: 2.6.4 - resolution: "pg-connection-string@npm:2.6.4" - checksum: 2c1d2ac1add1f93076f1594d217a0980f79add05dc48de6363e1c550827c78a6ee3e3b5420da9c54858f6b678cdb348aed49732ee68158b6cdb70f1d1c748cf9 - languageName: node - linkType: hard - "pg-int8@npm:1.0.1": version: 1.0.1 resolution: "pg-int8@npm:1.0.1" @@ -25731,15 +25623,6 @@ __metadata: languageName: node linkType: hard -"pg-pool@npm:^3.6.2": - version: 3.6.2 - resolution: "pg-pool@npm:3.6.2" - peerDependencies: - pg: ">=8.0" - checksum: 5ceee4320a35fce08777d085d50a30a1253574257e1e7c5c56c915056d387d340f797115580c8d90a46691f83c39a9b4da1fd810d9ad168cc455c79c289116f4 - languageName: node - linkType: hard - "pg-protocol@npm:*, pg-protocol@npm:^1.6.0": version: 1.6.0 resolution: "pg-protocol@npm:1.6.0" @@ -25747,13 +25630,6 @@ __metadata: languageName: node linkType: hard -"pg-protocol@npm:^1.6.1": - version: 1.6.1 - resolution: "pg-protocol@npm:1.6.1" - checksum: cce3f72cc4bdc04db9ce3fa38b2c45b745f0a95a925847b349087f52c02c4d51b7c74d8867e40639699d0c7609accfaffb6b1d221b3268d2bdc4bb8d6a2995a3 - languageName: node - linkType: hard - "pg-types@npm:^2.1.0, pg-types@npm:^2.2.0": version: 2.2.0 resolution: "pg-types@npm:2.2.0" @@ -25811,28 +25687,6 @@ __metadata: languageName: node linkType: hard -"pg@npm:^8.11.3": - version: 8.12.0 - resolution: "pg@npm:8.12.0" - dependencies: - pg-cloudflare: ^1.1.1 - pg-connection-string: ^2.6.4 - pg-pool: ^3.6.2 - pg-protocol: ^1.6.1 - pg-types: ^2.1.0 - pgpass: 1.x - peerDependencies: - pg-native: ">=3.0.1" - dependenciesMeta: - pg-cloudflare: - optional: true - peerDependenciesMeta: - pg-native: - optional: true - checksum: 8450b61c787f360e22182aa853548f834f13622714868d0789a60f63743d66ae28930cdca0ef0251bfc89b04679e9074c1398f172c2937bf59b5a360337f4149 - languageName: node - linkType: hard - "pgpass@npm:1.x": version: 1.0.5 resolution: "pgpass@npm:1.0.5" @@ -30780,13 +30634,6 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.4.0": - version: 2.4.0 - resolution: "tslib@npm:2.4.0" - checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113 - languageName: node - linkType: hard - "tslib@npm:2.5.0": version: 2.5.0 resolution: "tslib@npm:2.5.0" @@ -31137,7 +30984,7 @@ __metadata: languageName: node linkType: hard -"typeorm@npm:^0.3.16, typeorm@npm:^0.3.20": +"typeorm@npm:^0.3.16": version: 0.3.20 resolution: "typeorm@npm:0.3.20" dependencies: @@ -33400,25 +33247,6 @@ __metadata: languageName: node linkType: hard -"winston@npm:^3.12.0": - version: 3.14.2 - resolution: "winston@npm:3.14.2" - dependencies: - "@colors/colors": ^1.6.0 - "@dabh/diagnostics": ^2.0.2 - async: ^3.2.3 - is-stream: ^2.0.0 - logform: ^2.6.0 - one-time: ^1.0.0 - readable-stream: ^3.4.0 - safe-stable-stringify: ^2.3.1 - stack-trace: 0.0.x - triple-beam: ^1.3.0 - winston-transport: ^4.7.0 - checksum: 9021637d3ab1d1e639d64e7217ed5ae63fb0e5325defdbce439f708e9b4e26c7a31eb4a731106790aa8ac6f80a3a89242de18d1991ab3838f9d84e55101f4607 - languageName: node - linkType: hard - "winston@npm:^3.9.0": version: 3.12.0 resolution: "winston@npm:3.12.0" @@ -33596,21 +33424,6 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.17.1": - version: 8.17.1 - resolution: "ws@npm:8.17.1" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ">=5.0.2" - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 442badcce1f1178ec87a0b5372ae2e9771e07c4929a3180321901f226127f252441e8689d765aa5cfba5f50ac60dd830954afc5aeae81609aefa11d3ddf5cecf - languageName: node - linkType: hard - "ws@npm:^3.0.0": version: 3.3.3 resolution: "ws@npm:3.3.3"