Skip to content

Commit

Permalink
add flow to detect v06 postOp reverts (#343)
Browse files Browse the repository at this point in the history
* add flow to detect v06 postOp reverts

* remove hyphen

---------

Co-authored-by: mouseless <[email protected]>
  • Loading branch information
mouseless0x and mouseless0x authored Oct 23, 2024
1 parent 5e56949 commit e453977
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/rpc/estimation/gasEstimationsV06.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { z } from "zod"
import type { SimulateHandleOpResult } from "./types"
import type { AltoConfig } from "../../createConfig"
import { deepHexlify } from "../../utils/userop"
import { parseFailedOpWithRevert } from "./gasEstimationsV07"

export class GasEstimatorV06 {
private config: AltoConfig
Expand Down Expand Up @@ -63,6 +64,20 @@ export class GasEstimatorV06 {
} as const
}

// custom error thrown by entryPoint if code override is used
if (
decodedError &&
decodedError.errorName === "FailedOpWithRevert" &&
decodedError.args
) {
return {
result: "failed",
data: `${decodedError.args?.[1]} ${parseFailedOpWithRevert(
decodedError.args?.[2] as Hex
)}`
} as const
}

if (
decodedError &&
decodedError.errorName === "Error" &&
Expand Down
Loading

0 comments on commit e453977

Please sign in to comment.