From 1cb95523944e41ddca16f03f423f326c728b1245 Mon Sep 17 00:00:00 2001 From: "James Morris, MS" <96435344+james-a-morris@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:12:30 -0500 Subject: [PATCH 1/5] improve(zora): add multicall entry (#809) Signed-off-by: james-a-morris --- package.json | 2 +- src/utils/Multicall.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a3d70555..6724b00c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@across-protocol/sdk", "author": "UMA Team", - "version": "3.3.28", + "version": "3.3.29", "license": "AGPL-3.0", "homepage": "https://docs.across.to/reference/sdk", "files": [ diff --git a/src/utils/Multicall.ts b/src/utils/Multicall.ts index daad7019..3b2ef6f4 100644 --- a/src/utils/Multicall.ts +++ b/src/utils/Multicall.ts @@ -30,6 +30,7 @@ const DETERMINISTIC_MULTICALL_CHAINS = [ CHAIN_IDs.MAINNET, CHAIN_IDs.POLYGON, CHAIN_IDs.SCROLL, + CHAIN_IDs.ZORA, // Testnet: CHAIN_IDs.BASE_SEPOLIA, CHAIN_IDs.BLAST_SEPOLIA, From 1249377b565c2ffa2f40923502df61c06c8a9716 Mon Sep 17 00:00:00 2001 From: "James Morris, MS" <96435344+james-a-morris@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:26:26 -0500 Subject: [PATCH 2/5] chore: bump constants for zora family (#810) Signed-off-by: james-a-morris --- package.json | 4 ++-- yarn.lock | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6724b00c..311df23c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@across-protocol/sdk", "author": "UMA Team", - "version": "3.3.29", + "version": "3.3.30", "license": "AGPL-3.0", "homepage": "https://docs.across.to/reference/sdk", "files": [ @@ -99,7 +99,7 @@ }, "dependencies": { "@across-protocol/across-token": "^1.0.0", - "@across-protocol/constants": "^3.1.24", + "@across-protocol/constants": "^3.1.25", "@across-protocol/contracts": "^3.0.19", "@eth-optimism/sdk": "^3.3.1", "@ethersproject/bignumber": "^5.7.0", diff --git a/yarn.lock b/yarn.lock index bb008c67..fdb69ac3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21,6 +21,11 @@ resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.24.tgz#01fe49330bb467dd01813387ddbac741bc74a035" integrity sha512-guKtvIbif//vsmSZbwGubTWVtfkWiyWenr2sVyo63U/68GOW89ceJRLu4efLjeLVGiSrNAJtFUCv9dTwrrosWA== +"@across-protocol/constants@^3.1.25": + version "3.1.25" + resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.25.tgz#60d6d9814582ff91faf2b6d9f51d6dccb447b4ce" + integrity sha512-GpZoYn7hETYL2BPMM2GqXAer6+l/xuhder+pvpb00HJcb/sqCjF7vaaeKxjKJ3jKtyeulYmdu0NDkeNm5KbNWA== + "@across-protocol/contracts@^0.1.4": version "0.1.4" resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-0.1.4.tgz#64b3d91e639d2bb120ea94ddef3d160967047fa5" From 0c71440c1edac533a5472057b199bdd0b4fa875f Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:20:40 +0100 Subject: [PATCH 3/5] improve(retryProvider): Skip quorum on pending blocks (#811) The relayer is currently using the pending block to determine the current base fee. This is inherently incompatible with quorum because some chains will typically not return a consistent pending block. --- package.json | 2 +- src/providers/retryProvider.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 311df23c..62577d2e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@across-protocol/sdk", "author": "UMA Team", - "version": "3.3.30", + "version": "3.3.31", "license": "AGPL-3.0", "homepage": "https://docs.across.to/reference/sdk", "files": [ diff --git a/src/providers/retryProvider.ts b/src/providers/retryProvider.ts index 76d4f38e..8b1a3c29 100644 --- a/src/providers/retryProvider.ts +++ b/src/providers/retryProvider.ts @@ -320,7 +320,7 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider { } // getBlockByNumber should only use the quorum if it's not asking for the latest block. - if (method === "eth_getBlockByNumber" && params[0] !== "latest") { + if (method === "eth_getBlockByNumber" && params[0] !== "latest" && params[0] !== "pending") { return this.nodeQuorumThreshold; } From 72bd17f1bbe9a7e4688ab76efbadfb1abf940bf5 Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:18:54 +0100 Subject: [PATCH 4/5] chore(multicall3): Drop explicit OP stack entries (#812) OP stack entries are not required here because Multicall3 is assumed to be deployed at the standard address. https://specs.optimism.io/protocol/preinstalls.html#multicall3 --- src/utils/Multicall.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/utils/Multicall.ts b/src/utils/Multicall.ts index 3b2ef6f4..bc82e2de 100644 --- a/src/utils/Multicall.ts +++ b/src/utils/Multicall.ts @@ -21,20 +21,15 @@ const NON_DETERMINISTIC_MULTICALL_ADDRESSES = { [CHAIN_IDs.ZK_SYNC]: "0xF9cda624FBC7e059355ce98a31693d299FACd963", }; -// Multicall3 is an OP stack predeploy, so don't specify it here. +// @notice Multicall3 is an OP stack preinstall, so don't specify it here. const DETERMINISTIC_MULTICALL_CHAINS = [ CHAIN_IDs.ALEPH_ZERO, CHAIN_IDs.ARBITRUM, - CHAIN_IDs.INK, CHAIN_IDs.LINEA, CHAIN_IDs.MAINNET, CHAIN_IDs.POLYGON, CHAIN_IDs.SCROLL, - CHAIN_IDs.ZORA, // Testnet: - CHAIN_IDs.BASE_SEPOLIA, - CHAIN_IDs.BLAST_SEPOLIA, - CHAIN_IDs.INK_SEPOLIA, CHAIN_IDs.POLYGON_AMOY, CHAIN_IDs.SCROLL_SEPOLIA, CHAIN_IDs.SEPOLIA, From a7615d0c68d847cfd8a42c992df32390b5931e01 Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:49:34 -0500 Subject: [PATCH 5/5] feat(BundleDataClient): Remove 0-value deposits and fills and 0-value empty-message slow fills (#800) --- package.json | 2 +- .../BundleDataClient/BundleDataClient.ts | 19 +++++++++++++++++-- src/utils/DepositUtils.ts | 12 ++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 62577d2e..f1eefac8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@across-protocol/sdk", "author": "UMA Team", - "version": "3.3.31", + "version": "3.3.32", "license": "AGPL-3.0", "homepage": "https://docs.across.to/reference/sdk", "files": [ diff --git a/src/clients/BundleDataClient/BundleDataClient.ts b/src/clients/BundleDataClient/BundleDataClient.ts index 22c7ecb3..fd992c95 100644 --- a/src/clients/BundleDataClient/BundleDataClient.ts +++ b/src/clients/BundleDataClient/BundleDataClient.ts @@ -31,6 +31,7 @@ import { isSlowFill, mapAsync, bnUint32Max, + isZeroValueDeposit, } from "../../utils"; import winston from "winston"; import { @@ -778,6 +779,9 @@ export class BundleDataClient { continue; } originClient.getDepositsForDestinationChain(destinationChainId).forEach((deposit) => { + if (isZeroValueDeposit(deposit)) { + return; + } depositCounter++; const relayDataHash = this.getRelayHashFromEvent(deposit); if (v3RelayHashes[relayDataHash]) { @@ -793,6 +797,14 @@ export class BundleDataClient { slowFillRequest: undefined, }; + // Once we've saved the deposit hash into v3RelayHashes, then we can exit early here if the inputAmount + // is 0 because there can be no expired amount to refund and no unexecutable slow fill amount to return + // if this deposit did expire. Input amount can only be zero at this point if the message is non-empty, + // but the message doesn't matter for expired deposits and unexecutable slow fills. + if (deposit.inputAmount.eq(0)) { + return; + } + // If deposit block is within origin chain bundle block range, then save as bundle deposit. // If deposit is in bundle and it has expired, additionally save it as an expired deposit. // If deposit is not in the bundle block range, then save it as an older deposit that @@ -840,7 +852,10 @@ export class BundleDataClient { await forEachAsync( destinationClient .getFillsForOriginChain(originChainId) - .filter((fill) => fill.blockNumber <= destinationChainBlockRange[1]), + // We can remove fills for deposits with input amount equal to zero because these will result in 0 refunded + // tokens to the filler. We can't remove non-empty message deposit here in case there is a slow fill + // request for the deposit, we'd want to see the fill took place. + .filter((fill) => fill.blockNumber <= destinationChainBlockRange[1] && !isZeroValueDeposit(fill)), async (fill) => { const relayDataHash = this.getRelayHashFromEvent(fill); fillCounter++; @@ -933,7 +948,7 @@ export class BundleDataClient { await forEachAsync( destinationClient .getSlowFillRequestsForOriginChain(originChainId) - .filter((request) => request.blockNumber <= destinationChainBlockRange[1]), + .filter((request) => request.blockNumber <= destinationChainBlockRange[1] && !isZeroValueDeposit(request)), async (slowFillRequest: SlowFillRequestWithBlock) => { const relayDataHash = this.getRelayHashFromEvent(slowFillRequest); diff --git a/src/utils/DepositUtils.ts b/src/utils/DepositUtils.ts index 59ab124c..5dd97aec 100644 --- a/src/utils/DepositUtils.ts +++ b/src/utils/DepositUtils.ts @@ -125,6 +125,18 @@ export async function queryHistoricalDepositForFill( }; } +/** + * Returns true if filling this deposit (as a slow or fast fill) or refunding it would not change any state + * on-chain. The dataworker functions can use this to conveniently filter out useless deposits. + * @dev The reason we allow a 0-input deposit to have a non-empty message is that the message might be used + * to pay the filler in an indirect way so it might have economic value as a fast or slow fill. + * @param deposit Deposit to check. + * @returns True if deposit's input amount is 0 and message is empty. + */ +export function isZeroValueDeposit(deposit: Pick): boolean { + return deposit.inputAmount.eq(0) && isMessageEmpty(deposit.message); +} + /** * Determines if a message is empty or not. * @param message The message to check.