From 462e63e9af43e1ecbdd223a76f37814dfdcec004 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:04:21 +0530 Subject: [PATCH 1/8] add blocktag support env variable --- src/cli/config/bundler.ts | 3 ++- src/cli/config/options.ts | 7 +++++++ src/executor/executor.ts | 9 ++++++--- src/executor/utils.ts | 6 +++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/cli/config/bundler.ts b/src/cli/config/bundler.ts index 9711ab33..5d61a1d7 100644 --- a/src/cli/config/bundler.ts +++ b/src/cli/config/bundler.ts @@ -124,7 +124,8 @@ export const rpcArgsSchema = z.object({ "rpc-url": z.string().url(), "send-transaction-rpc-url": z.string().url().optional(), "polling-interval": z.number().int().min(0), - "max-block-range": z.number().int().min(0).optional() + "max-block-range": z.number().int().min(0).optional(), + "block-tag-support-disabled": z.boolean().optional().default(false) }) export const bundleCopmressionArgsSchema = z.object({ diff --git a/src/cli/config/options.ts b/src/cli/config/options.ts index 5eed5969..0f02846d 100644 --- a/src/cli/config/options.ts +++ b/src/cli/config/options.ts @@ -252,6 +252,13 @@ export const rpcOptions: CliCommandOptions = { description: "Max block range for getLogs calls", type: "number", require: false + }, + "block-tag-support-disabled": { + description: + "Disable sending block tag when sending eth_estimateGas call", + type: "boolean", + require: false, + default: false } } diff --git a/src/executor/executor.ts b/src/executor/executor.ts index ae692166..83ce8076 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -116,6 +116,7 @@ export class Executor { reputationManager: InterfaceReputationManager compressionHandler: CompressionHandler | null gasPriceManager: GasPriceManager + disableBlockTagSupport: boolean mutex: Mutex constructor( @@ -131,6 +132,7 @@ export class Executor { simulateTransaction = false, legacyTransactions = false, fixedGasLimitForEstimation?: bigint, + disableBlockTagSupport = false, localGasLimitCalculation = false ) { this.publicClient = publicClient @@ -145,6 +147,7 @@ export class Executor { this.localGasLimitCalculation = localGasLimitCalculation this.compressionHandler = compressionHandler this.gasPriceManager = gasPriceManager + this.disableBlockTagSupport = disableBlockTagSupport this.entryPoints = entryPoints this.mutex = new Mutex() @@ -263,7 +266,7 @@ export class Executor { newRequest.nonce, newRequest.maxFeePerGas, newRequest.maxPriorityFeePerGas, - "latest", + this.disableBlockTagSupport ? undefined : "latest", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, @@ -574,7 +577,7 @@ export class Executor { nonce, gasPriceParameters.maxFeePerGas, gasPriceParameters.maxPriorityFeePerGas, - "pending", + this.disableBlockTagSupport ? undefined : "pending", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, @@ -854,7 +857,7 @@ export class Executor { nonce, gasPriceParameters.maxFeePerGas, gasPriceParameters.maxPriorityFeePerGas, - "pending", + this.disableBlockTagSupport ? undefined : "pending", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, diff --git a/src/executor/utils.ts b/src/executor/utils.ts index 0e98e707..4e53538c 100644 --- a/src/executor/utils.ts +++ b/src/executor/utils.ts @@ -127,7 +127,7 @@ export async function filterOpsAndEstimateGas( nonce: number, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, - blockTag: "latest" | "pending", + blockTag: "latest" | "pending" | undefined, onlyPre1559: boolean, fixedGasLimitForEstimation: bigint | undefined, reputationManager: InterfaceReputationManager, @@ -176,7 +176,7 @@ export async function filterOpsAndEstimateGas( { account: wallet, nonce: nonce, - blockTag, + blockTag: blockTag, ...(fixedGasLimitForEstimation !== undefined && { gas: fixedGasLimitForEstimation }), @@ -200,7 +200,7 @@ export async function filterOpsAndEstimateGas( data: createCompressedCalldata(opsToSend, perOpInflatorId), gas: fixedGasLimitForEstimation, nonce: nonce, - blockTag, + blockTag: blockTag, ...gasOptions }) } From 13367e2843f4353c2dd0fa2c33ed49086ee0b3d9 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:09:51 +0530 Subject: [PATCH 2/8] don't run canary on every PR --- .github/workflows/canary.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 0b1c2234..154484f7 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -3,9 +3,6 @@ on: push: branches: - main - pull_request: - branches: - - main workflow_dispatch: jobs: From 98880091873953922b86d7a4f9d686fad77a7227 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:25:41 +0530 Subject: [PATCH 3/8] pass flag to executor --- src/cli/setupServer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cli/setupServer.ts b/src/cli/setupServer.ts index 9635d2fe..fe51fd9f 100644 --- a/src/cli/setupServer.ts +++ b/src/cli/setupServer.ts @@ -203,6 +203,7 @@ const getExecutor = ({ !parsedArgs.tenderly, parsedArgs["legacy-transactions"], parsedArgs["fixed-gas-limit-for-estimation"], + parsedArgs["block-tag-support-disabled"], parsedArgs["local-gas-limit-calculation"] ) } From 8e12f6d34cd9b9a991fec79e0336081b8f3bab7c Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:42:37 +0530 Subject: [PATCH 4/8] add logs --- src/executor/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/executor/utils.ts b/src/executor/utils.ts index 4e53538c..7064c610 100644 --- a/src/executor/utils.ts +++ b/src/executor/utils.ts @@ -207,7 +207,7 @@ export async function filterOpsAndEstimateGas( return { simulatedOps, gasLimit, resubmitAllOps: false } } catch (err: unknown) { - logger.error({ err }, "error estimating gas") + logger.error({ err, blockTag }, "error estimating gas") const e = parseViemError(err) if (e instanceof ContractFunctionRevertedError) { @@ -345,7 +345,7 @@ export async function filterOpsAndEstimateGas( } else { sentry.captureException(err) logger.error( - { error: JSON.stringify(err) }, + { error: JSON.stringify(err), blockTag }, "error estimating gas" ) return { simulatedOps: [], gasLimit: 0n, resubmitAllOps: false } From 2e2e288ad133bc26a2f8457b87ef1b3acb09153a Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:48:15 +0530 Subject: [PATCH 5/8] add logs --- src/executor/executor.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/executor/executor.ts b/src/executor/executor.ts index 83ce8076..445041bb 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -150,6 +150,10 @@ export class Executor { this.disableBlockTagSupport = disableBlockTagSupport this.entryPoints = entryPoints + logger.error("executor initialized", { + disableBlockTagSupport + }) + this.mutex = new Mutex() } From da4aed18f3fb6d8d3841bbb648c8d265a6788764 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 13:52:52 +0530 Subject: [PATCH 6/8] add logs --- src/cli/setupServer.ts | 4 ++++ src/executor/executor.ts | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/setupServer.ts b/src/cli/setupServer.ts index fe51fd9f..4c6268ac 100644 --- a/src/cli/setupServer.ts +++ b/src/cli/setupServer.ts @@ -184,6 +184,10 @@ const getExecutor = ({ compressionHandler: CompressionHandler | null gasPriceManager: GasPriceManager }): Executor => { + logger.error("executor initialized", { + disableBlockTagSupport: parsedArgs["block-tag-support-disabled"] + }) + return new Executor( client, walletClient, diff --git a/src/executor/executor.ts b/src/executor/executor.ts index 445041bb..83ce8076 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -150,10 +150,6 @@ export class Executor { this.disableBlockTagSupport = disableBlockTagSupport this.entryPoints = entryPoints - logger.error("executor initialized", { - disableBlockTagSupport - }) - this.mutex = new Mutex() } From 7b5e94dc0095064df8c90280f4b10d76d68e2f63 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 14:01:05 +0530 Subject: [PATCH 7/8] fix log --- src/cli/setupServer.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cli/setupServer.ts b/src/cli/setupServer.ts index 4c6268ac..c5e1698e 100644 --- a/src/cli/setupServer.ts +++ b/src/cli/setupServer.ts @@ -184,9 +184,12 @@ const getExecutor = ({ compressionHandler: CompressionHandler | null gasPriceManager: GasPriceManager }): Executor => { - logger.error("executor initialized", { - disableBlockTagSupport: parsedArgs["block-tag-support-disabled"] - }) + logger.error( + { + disableBlockTagSupport: parsedArgs["block-tag-support-disabled"] + }, + "executor initialized" + ) return new Executor( client, From 5c7ef25bfdf9ae0265cafeb6e6c938066fd6046a Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sun, 9 Jun 2024 14:12:34 +0530 Subject: [PATCH 8/8] remove unused logs --- src/cli/setupServer.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/cli/setupServer.ts b/src/cli/setupServer.ts index c5e1698e..fe51fd9f 100644 --- a/src/cli/setupServer.ts +++ b/src/cli/setupServer.ts @@ -184,13 +184,6 @@ const getExecutor = ({ compressionHandler: CompressionHandler | null gasPriceManager: GasPriceManager }): Executor => { - logger.error( - { - disableBlockTagSupport: parsedArgs["block-tag-support-disabled"] - }, - "executor initialized" - ) - return new Executor( client, walletClient,