From 066f61aac7686cc1a92d2b32e049eca2fe1d3984 Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:03:23 +0200 Subject: [PATCH 1/3] fix(executor): Force no multicall on Polygon Relayer refund leaves must not be batched via multicall on Polygon. The existing executor implementation will attempt multicall in cases where there are multiple relayer refund leaves, and this imposes a soft deadlock on the executor. This can be recovered by executing one leaf at a time. A better solution is just to override the defaults for Polygon in the dataworker. --- src/dataworker/DataworkerClientHelper.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dataworker/DataworkerClientHelper.ts b/src/dataworker/DataworkerClientHelper.ts index 6ef82f2b6..f7ea4fae6 100644 --- a/src/dataworker/DataworkerClientHelper.ts +++ b/src/dataworker/DataworkerClientHelper.ts @@ -8,8 +8,8 @@ import { updateClients, updateSpokePoolClients, } from "../common"; -import { PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; -import { BundleDataClient, HubPoolClient, TokenClient } from "../clients"; +import { CHAIN_IDs, PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; +import { BundleDataClient, HubPoolClient, MultiCallerClient, TokenClient } from "../clients"; import { getBlockForChain } from "./DataworkerUtils"; import { Dataworker } from "./Dataworker"; import { ProposedRootBundle, SpokePoolClientsByChain } from "../interfaces"; @@ -30,6 +30,13 @@ export async function constructDataworkerClients( const commonClients = await constructClients(logger, config, baseSigner); const { hubPoolClient, configStoreClient } = commonClients; + // Relayer refund leaves must not be multicalled on Polygon, so force chunk size 1. + commonClients.multiCallerClient = new MultiCallerClient( + logger, + { ...config.multiCallChunkSize, [CHAIN_IDs.POLYGON]: 1 }, + baseSigner + ); + await updateClients(commonClients, config, logger); await hubPoolClient.update(); From 51cf66a45baae547b4708480065090846b50950d Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:46:01 +0200 Subject: [PATCH 2/3] Apply James' comments --- src/common/ClientHelper.ts | 8 +++++++- src/dataworker/DataworkerClientHelper.ts | 11 ++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/common/ClientHelper.ts b/src/common/ClientHelper.ts index d1f7bf1c2..03e19a12c 100644 --- a/src/common/ClientHelper.ts +++ b/src/common/ClientHelper.ts @@ -1,6 +1,7 @@ import assert from "assert"; import winston from "winston"; import { + CHAIN_IDs, getProvider, getDeployedContract, getDeploymentBlockNumber, @@ -339,7 +340,12 @@ export async function constructClients( config.timeToCache ); - const multiCallerClient = new MultiCallerClient(logger, config.multiCallChunkSize, hubSigner); + // Force chunk size 1 on Polygon to avoid stuck executions. + const multiCallerClient = new MultiCallerClient( + logger, + { ...config.multiCallChunkSize, [CHAIN_IDs.POLYGON]: 1 }, + hubSigner + ); // Define the Arweave client as "read-only" to prevent any accidental writes to the Arweave network. // Only the dataworker should have write access to the Arweave network - we will define that in diff --git a/src/dataworker/DataworkerClientHelper.ts b/src/dataworker/DataworkerClientHelper.ts index f7ea4fae6..6ef82f2b6 100644 --- a/src/dataworker/DataworkerClientHelper.ts +++ b/src/dataworker/DataworkerClientHelper.ts @@ -8,8 +8,8 @@ import { updateClients, updateSpokePoolClients, } from "../common"; -import { CHAIN_IDs, PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; -import { BundleDataClient, HubPoolClient, MultiCallerClient, TokenClient } from "../clients"; +import { PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; +import { BundleDataClient, HubPoolClient, TokenClient } from "../clients"; import { getBlockForChain } from "./DataworkerUtils"; import { Dataworker } from "./Dataworker"; import { ProposedRootBundle, SpokePoolClientsByChain } from "../interfaces"; @@ -30,13 +30,6 @@ export async function constructDataworkerClients( const commonClients = await constructClients(logger, config, baseSigner); const { hubPoolClient, configStoreClient } = commonClients; - // Relayer refund leaves must not be multicalled on Polygon, so force chunk size 1. - commonClients.multiCallerClient = new MultiCallerClient( - logger, - { ...config.multiCallChunkSize, [CHAIN_IDs.POLYGON]: 1 }, - baseSigner - ); - await updateClients(commonClients, config, logger); await hubPoolClient.update(); From 2045f1b317937bed9e2dcf8e6fbff3306df2adac Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:43:48 +0200 Subject: [PATCH 3/3] Relocate again --- src/common/ClientHelper.ts | 8 +------- src/dataworker/DataworkerClientHelper.ts | 5 ++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/common/ClientHelper.ts b/src/common/ClientHelper.ts index 03e19a12c..d1f7bf1c2 100644 --- a/src/common/ClientHelper.ts +++ b/src/common/ClientHelper.ts @@ -1,7 +1,6 @@ import assert from "assert"; import winston from "winston"; import { - CHAIN_IDs, getProvider, getDeployedContract, getDeploymentBlockNumber, @@ -340,12 +339,7 @@ export async function constructClients( config.timeToCache ); - // Force chunk size 1 on Polygon to avoid stuck executions. - const multiCallerClient = new MultiCallerClient( - logger, - { ...config.multiCallChunkSize, [CHAIN_IDs.POLYGON]: 1 }, - hubSigner - ); + const multiCallerClient = new MultiCallerClient(logger, config.multiCallChunkSize, hubSigner); // Define the Arweave client as "read-only" to prevent any accidental writes to the Arweave network. // Only the dataworker should have write access to the Arweave network - we will define that in diff --git a/src/dataworker/DataworkerClientHelper.ts b/src/dataworker/DataworkerClientHelper.ts index 6ef82f2b6..bebd574e8 100644 --- a/src/dataworker/DataworkerClientHelper.ts +++ b/src/dataworker/DataworkerClientHelper.ts @@ -8,7 +8,7 @@ import { updateClients, updateSpokePoolClients, } from "../common"; -import { PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; +import { CHAIN_IDs, PriceClient, acrossApi, coingecko, defiLlama, Signer, getArweaveJWKSigner } from "../utils"; import { BundleDataClient, HubPoolClient, TokenClient } from "../clients"; import { getBlockForChain } from "./DataworkerUtils"; import { Dataworker } from "./Dataworker"; @@ -27,6 +27,9 @@ export async function constructDataworkerClients( baseSigner: Signer ): Promise { const signerAddr = await baseSigner.getAddress(); + + // Force chunk size 1 on Polygon to avoid stuck executions. + config.multiCallChunkSize[CHAIN_IDs.POLYGON] = 1; const commonClients = await constructClients(logger, config, baseSigner); const { hubPoolClient, configStoreClient } = commonClients;