From 4de90c98376022de20157227b792e30a68228724 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:52:00 +0100 Subject: [PATCH 1/5] log rejected op fields + fix INTERNAL FAILURE error --- src/executor/executor.ts | 6 ++++++ src/executor/executorManager.ts | 1 + src/executor/utils.ts | 6 +++++- src/types/mempool.ts | 7 ++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/executor/executor.ts b/src/executor/executor.ts index 55a44705..ae692166 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -610,6 +610,7 @@ export class Executor { error: { entryPoint, userOpHash: owh.userOperationHash, + userOperation: owh.mempoolUserOperation, reason: "INTERNAL FAILURE" } } @@ -625,6 +626,7 @@ export class Executor { error: { entryPoint, userOpHash: op.owh.userOperationHash, + userOperation: op.owh.mempoolUserOperation, reason: op.reason as string } } @@ -720,6 +722,7 @@ export class Executor { error: { entryPoint, userOpHash: owh.userOperationHash, + userOperation: owh.mempoolUserOperation, reason: "INTERNAL FAILURE" } } @@ -892,6 +895,7 @@ export class Executor { entryPoint, this.walletClient.chain.id ), + userOperation: compressedOp, reason: "INTERNAL FAILURE" } } @@ -910,6 +914,7 @@ export class Executor { error: { entryPoint, userOpHash: simulatedOp.owh.userOperationHash, + userOperation: simulatedOp.owh.mempoolUserOperation, reason: simulatedOp.reason as string } } @@ -957,6 +962,7 @@ export class Executor { error: { entryPoint, userOpHash: op.userOperationHash, + userOperation: op.mempoolUserOperation, reason: "INTERNAL FAILURE" } } diff --git a/src/executor/executorManager.ts b/src/executor/executorManager.ts index cdd1ed5d..91f7b7b0 100644 --- a/src/executor/executorManager.ts +++ b/src/executor/executorManager.ts @@ -222,6 +222,7 @@ export class ExecutorManager { }) this.logger.warn( { + userOperation: result.error.userOperation, userOpHash: result.error.userOpHash, reason: result.error.reason }, diff --git a/src/executor/utils.ts b/src/executor/utils.ts index 9c6235d4..0e98e707 100644 --- a/src/executor/utils.ts +++ b/src/executor/utils.ts @@ -68,6 +68,7 @@ export function simulatedOpsToResults( status: "failure", error: { entryPoint: transactionInfo.entryPoint, + userOperation: sop.owh.mempoolUserOperation, userOpHash: sop.owh.userOperationHash, reason: sop.reason as string } @@ -307,7 +308,10 @@ export async function filterOpsAndEstimateGas( "user op in batch invalid" ) - if (errorResult.errorName !== "FailedOp") { + if ( + errorResult.errorName !== "FailedOpWithRevert" && + errorResult.errorName !== "FailedOp" + ) { logger.error( { errorName: errorResult.errorName, diff --git a/src/types/mempool.ts b/src/types/mempool.ts index e8846ab3..3b77df47 100644 --- a/src/types/mempool.ts +++ b/src/types/mempool.ts @@ -90,11 +90,16 @@ export type BundleResult = Result< userOperation: UserOperationInfo transactionInfo: TransactionInfo }, - { reason: string; userOpHash: HexData32; entryPoint: Address }, { reason: string userOpHash: HexData32 + entryPoint: Address userOperation: MempoolUserOperation + }, + { + reason: string + userOpHash: HexData32 entryPoint: Address + userOperation: MempoolUserOperation } > From e2e6e099f0691a389c506c9ae3c0a583bf6236d6 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:44:08 +0100 Subject: [PATCH 2/5] stringify userOperation --- src/executor/executorManager.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/executor/executorManager.ts b/src/executor/executorManager.ts index 91f7b7b0..5d36a256 100644 --- a/src/executor/executorManager.ts +++ b/src/executor/executorManager.ts @@ -1,3 +1,4 @@ +import util from "node:util" import type { Metrics, Logger, GasPriceManager } from "@alto/utils" import type { InterfaceReputationManager, @@ -222,7 +223,7 @@ export class ExecutorManager { }) this.logger.warn( { - userOperation: result.error.userOperation, + userOperation: util.inspect(result.error.userOperation), userOpHash: result.error.userOpHash, reason: result.error.reason }, From 146897d7fc0a78cb20e13f53dac6564f9180ca32 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:57:25 +0100 Subject: [PATCH 3/5] safely stringify bigint type --- src/executor/executorManager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/executor/executorManager.ts b/src/executor/executorManager.ts index 5d36a256..64f9240c 100644 --- a/src/executor/executorManager.ts +++ b/src/executor/executorManager.ts @@ -223,7 +223,11 @@ export class ExecutorManager { }) this.logger.warn( { - userOperation: util.inspect(result.error.userOperation), + userOperation: JSON.stringify( + result.error.userOperation, + (_k, v) => + typeof v === "bigint" ? v.toString() : v + ), userOpHash: result.error.userOpHash, reason: result.error.reason }, From 91d1ca857d1aaaa185f09e572658e669e68c10a5 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:05:45 +0100 Subject: [PATCH 4/5] fix build --- src/executor/executorManager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/executor/executorManager.ts b/src/executor/executorManager.ts index 64f9240c..43a6ac30 100644 --- a/src/executor/executorManager.ts +++ b/src/executor/executorManager.ts @@ -1,4 +1,3 @@ -import util from "node:util" import type { Metrics, Logger, GasPriceManager } from "@alto/utils" import type { InterfaceReputationManager, From 044d62dbb6545d314c1e733bbd4dda5bbe4010b8 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:37:55 +0100 Subject: [PATCH 5/5] add changeset --- .changeset/mean-dingos-admire.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/mean-dingos-admire.md diff --git a/.changeset/mean-dingos-admire.md b/.changeset/mean-dingos-admire.md new file mode 100644 index 00000000..0acae7a0 --- /dev/null +++ b/.changeset/mean-dingos-admire.md @@ -0,0 +1,5 @@ +--- +"@pimlico/alto": patch +--- + +Log userOperation fields when rejected