Skip to content

Commit

Permalink
Merge pull request #241 from pimlicolabs/feat/log-op-when-rejected
Browse files Browse the repository at this point in the history
Feat/log op when rejected
  • Loading branch information
mouseless0x authored Jun 6, 2024
2 parents 2b12c46 + 044d62d commit bb06c41
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-dingos-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pimlico/alto": patch
---

Log userOperation fields when rejected
6 changes: 6 additions & 0 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ export class Executor {
error: {
entryPoint,
userOpHash: owh.userOperationHash,
userOperation: owh.mempoolUserOperation,
reason: "INTERNAL FAILURE"
}
}
Expand All @@ -625,6 +626,7 @@ export class Executor {
error: {
entryPoint,
userOpHash: op.owh.userOperationHash,
userOperation: op.owh.mempoolUserOperation,
reason: op.reason as string
}
}
Expand Down Expand Up @@ -720,6 +722,7 @@ export class Executor {
error: {
entryPoint,
userOpHash: owh.userOperationHash,
userOperation: owh.mempoolUserOperation,
reason: "INTERNAL FAILURE"
}
}
Expand Down Expand Up @@ -892,6 +895,7 @@ export class Executor {
entryPoint,
this.walletClient.chain.id
),
userOperation: compressedOp,
reason: "INTERNAL FAILURE"
}
}
Expand All @@ -910,6 +914,7 @@ export class Executor {
error: {
entryPoint,
userOpHash: simulatedOp.owh.userOperationHash,
userOperation: simulatedOp.owh.mempoolUserOperation,
reason: simulatedOp.reason as string
}
}
Expand Down Expand Up @@ -957,6 +962,7 @@ export class Executor {
error: {
entryPoint,
userOpHash: op.userOperationHash,
userOperation: op.mempoolUserOperation,
reason: "INTERNAL FAILURE"
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/executor/executorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ export class ExecutorManager {
})
this.logger.warn(
{
userOperation: JSON.stringify(
result.error.userOperation,
(_k, v) =>
typeof v === "bigint" ? v.toString() : v
),
userOpHash: result.error.userOpHash,
reason: result.error.reason
},
Expand Down
6 changes: 5 additions & 1 deletion src/executor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion src/types/mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
>

0 comments on commit bb06c41

Please sign in to comment.