From 8b140e5dab35e6cd22f157ec013d5e59161ba22f Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Thu, 21 Dec 2023 10:50:20 -0500 Subject: [PATCH] improve(dataworker): Only use Multicall3 on Mainnet to save gas (#1129) --- src/dataworker/Dataworker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dataworker/Dataworker.ts b/src/dataworker/Dataworker.ts index 403aa5adb..76d0ee403 100644 --- a/src/dataworker/Dataworker.ts +++ b/src/dataworker/Dataworker.ts @@ -1560,7 +1560,9 @@ export class Dataworker { ], message: "Executed SlowRelayLeaf 🌿!", mrkdwn, - unpermissioned: true, + // If mainnet, send through Multicall3 so it can be batched with PoolRebalanceLeaf executions, otherwise + // SpokePool.multicall() is fine. + unpermissioned: Number(chainId) === 1, // If simulating mainnet execution, can fail as it may require funds to be sent from // pool rebalance leaf. canFailInSimulation: relayData.destinationChainId === this.clients.hubPoolClient.chainId, @@ -2123,7 +2125,9 @@ export class Dataworker { args: [rootBundleId, leaf, relayerRefundTree.getHexProof(leaf)], message: "Executed RelayerRefundLeaf 🌿!", mrkdwn, - unpermissioned: true, + // If mainnet, send through Multicall3 so it can be batched with PoolRebalanceLeaf executions, otherwise + // SpokePool.multicall() is fine. + unpermissioned: Number(chainId) === 1, // If simulating mainnet execution, can fail as it may require funds to be sent from // pool rebalance leaf. canFailInSimulation: leaf.chainId === this.clients.hubPoolClient.chainId,