Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/log op when rejected #241

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
>
Loading