diff --git a/package.json b/package.json index 2227f2c9a..0cb3d7827 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@across-protocol/sdk", "author": "UMA Team", - "version": "3.1.30", + "version": "3.1.32", "license": "AGPL-3.0", "homepage": "https://docs.across.to/reference/sdk", "files": [ diff --git a/src/caching/Arweave/ArweaveClient.ts b/src/caching/Arweave/ArweaveClient.ts index cb2468d5b..33efa21bb 100644 --- a/src/caching/Arweave/ArweaveClient.ts +++ b/src/caching/Arweave/ArweaveClient.ts @@ -175,13 +175,21 @@ export class ArweaveClient { }); const results = await Promise.all( entries.map(async (edge) => { - const data = await this.get(edge.node.id, validator); - return isDefined(data) - ? { - data, - hash: edge.node.id, - } - : null; + try { + const data = await this.get(edge.node.id, validator); + return isDefined(data) + ? { + data, + hash: edge.node.id, + } + : null; + } catch (e) { + this.logger.warn({ + at: "ArweaveClient:getByTopic", + message: `Bad request for Arweave topic ${edge.node.id}: ${e}`, + }); + return null; + } }) ); return results.filter(isDefined); diff --git a/src/clients/SpokePoolClient.ts b/src/clients/SpokePoolClient.ts index 75c082862..f82490c3c 100644 --- a/src/clients/SpokePoolClient.ts +++ b/src/clients/SpokePoolClient.ts @@ -32,7 +32,7 @@ import { RelayerRefundExecutionWithBlock, RootBundleRelayWithBlock, SlowFillRequestWithBlock, - SpeedUp, + SpeedUpWithBlock, TokensBridged, V3FundsDepositedEvent, } from "../interfaces"; @@ -67,7 +67,7 @@ export class SpokePoolClient extends BaseAbstractClient { protected oldestTime = 0; protected depositHashes: { [depositHash: string]: DepositWithBlock } = {}; protected depositHashesToFills: { [depositHash: string]: FillWithBlock[] } = {}; - protected speedUps: { [depositorAddress: string]: { [depositId: number]: SpeedUp[] } } = {}; + protected speedUps: { [depositorAddress: string]: { [depositId: number]: SpeedUpWithBlock[] } } = {}; protected slowFillRequests: { [relayDataHash: string]: SlowFillRequestWithBlock } = {}; protected depositRoutes: { [originToken: string]: { [DestinationChainId: number]: boolean } } = {}; protected tokensBridged: TokensBridged[] = []; @@ -296,7 +296,7 @@ export class SpokePoolClient extends BaseAbstractClient { * Retrieves speed up requests grouped by depositor and depositId. * @returns A mapping of depositor addresses to deposit ids with their corresponding speed up requests. */ - public getSpeedUps(): { [depositorAddress: string]: { [depositId: number]: SpeedUp[] } } { + public getSpeedUps(): { [depositorAddress: string]: { [depositId: number]: SpeedUpWithBlock[] } } { return this.speedUps; } @@ -592,7 +592,8 @@ export class SpokePoolClient extends BaseAbstractClient { const speedUpEvents = [...(queryResults[eventsToQuery.indexOf("RequestedSpeedUpV3Deposit")] ?? [])]; for (const event of speedUpEvents) { - const speedUp: SpeedUp = { ...spreadEvent(event.args), originChainId: this.chainId }; + const rawEvent = spreadEventWithBlockNumber(event); + const speedUp = { ...rawEvent, originChainId: this.chainId } as SpeedUpWithBlock; assign(this.speedUps, [speedUp.depositor, speedUp.depositId], [speedUp]); // Find deposit hash matching this speed up event and update the deposit data associated with the hash, diff --git a/src/interfaces/SpokePool.ts b/src/interfaces/SpokePool.ts index 27e68da92..38b0af70f 100644 --- a/src/interfaces/SpokePool.ts +++ b/src/interfaces/SpokePool.ts @@ -74,6 +74,8 @@ export interface SpeedUp { updatedMessage: string; } +export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {} + export interface SlowFillRequest extends RelayData { destinationChainId: number; } diff --git a/src/providers/retryProvider.ts b/src/providers/retryProvider.ts index b99daf2d6..436be8449 100644 --- a/src/providers/retryProvider.ts +++ b/src/providers/retryProvider.ts @@ -41,6 +41,18 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider { ...inputs ) ); + + // This is added for interim testing to see whether relayer fill performance improves. + this.providers.forEach((provider) => { + const url = getOriginFromURL(provider.connection.url); + const { pollingInterval } = provider; + provider.pollingInterval = 1000; + logger?.debug({ + at: "RetryProvider", + message: `Dropped ${url} pollingInterval ${pollingInterval} -> ${provider.pollingInterval}.`, + }); + }); + if (this.nodeQuorumThreshold < 1 || !Number.isInteger(this.nodeQuorumThreshold)) { throw new Error( `nodeQuorum,Threshold cannot be < 1 and must be an integer. Currently set to ${this.nodeQuorumThreshold}` diff --git a/src/providers/utils.ts b/src/providers/utils.ts index b1a6a9270..b57ff762e 100644 --- a/src/providers/utils.ts +++ b/src/providers/utils.ts @@ -102,6 +102,8 @@ const IGNORED_FIELDS = { "l1BatchTimestamp", // zkSync "size", // Alchemy/Arbitrum (temporary) "totalDifficulty", // Quicknode/Alchemy (sometimes) + "logsBloom", // zkSync (third-party providers return 0x0..0) + "transactions", // Polygon yParity field in transactions[] ], eth_getLogs: ["blockTimestamp", "transactionLogIndex", "l1BatchNumber", "logType"], }; diff --git a/test/common.test.ts b/test/common.test.ts index 4f01e12d9..d02fcefb4 100644 --- a/test/common.test.ts +++ b/test/common.test.ts @@ -41,7 +41,7 @@ describe("Utils test", () => { const relayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS; // @todo: Ensure that NODE_URL_1 is always defined in test CI? - const rpcUrl = process.env.NODE_URL_1 ?? "https://cloudflare-eth.com"; + const rpcUrl = process.env.NODE_URL_1 ?? "https://mainnet.gateway.tenderly.co"; const provider = new providers.JsonRpcProvider(rpcUrl, 1); const spokePool: SpokePool = SpokePool__factory.connect(spokePoolAddress, provider); @@ -53,7 +53,7 @@ describe("Utils test", () => { await estimateTotalGasRequiredByUnsignedTransaction(fill, relayerAddress, provider, 0.0, gasPrice); expect(toBN(refGasEstimate).eq(toBN(refGasCost).mul(gasPrice))).to.be.true; - for (let gasMarkup = -0.99; gasMarkup <= 4.0; gasMarkup += 0.33) { + for (let gasMarkup = -0.99; gasMarkup <= 1.0; gasMarkup += 0.33) { const { nativeGasCost, tokenGasCost } = await estimateTotalGasRequiredByUnsignedTransaction( fill, relayerAddress,