Skip to content

Commit

Permalink
decode error
Browse files Browse the repository at this point in the history
(simulation no longer error)
  • Loading branch information
drortirosh committed May 16, 2024
1 parent 07467b0 commit cdb6233
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .idea/aa-bundler.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions packages/utils/src/ERC4337Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { BigNumber, BigNumberish, BytesLike, ethers } from 'ethers'
import Debug from 'debug'
import { PackedUserOperation } from './Utils'

import { IEntryPoint__factory } from './types'

const debug = Debug('aa.utils')

// UserOperation is the first parameter of getUserOpHash
Expand Down Expand Up @@ -60,7 +58,10 @@ export function unpackAccountGasLimits (accountGasLimits: BytesLike): {
callGasLimit: BigNumber
} {
const [verificationGasLimit, callGasLimit] = unpackUint(accountGasLimits)
return { verificationGasLimit, callGasLimit }
return {
verificationGasLimit,
callGasLimit
}
}

export function packUint (high128: BigNumberish, low128: BigNumberish): string {
Expand Down Expand Up @@ -268,8 +269,6 @@ export function getUserOpHash (op: UserOperation, entryPoint: string, chainId: n

const ErrorSig = keccak256(Buffer.from('Error(string)')).slice(0, 10) // 0x08c379a0
const FailedOpSig = keccak256(Buffer.from('FailedOp(uint256,string)')).slice(0, 10) // 0x220266b6
// TODO: this is a temporary fix as ValidationResult is a struct starting with EntryPoint v0.7
const ValidationResultSig = IEntryPoint__factory.createInterface().getSighash('ValidationResult')

interface DecodedError {
message: string
Expand All @@ -296,8 +295,6 @@ export function decodeErrorReason (error: string | Error): DecodedError | undefi
message,
opIndex
}
} else if (error.startsWith(ValidationResultSig)) {
return IEntryPoint__factory.createInterface().decodeErrorResult('ValidationResult', error) as any
}
}

Expand Down

0 comments on commit cdb6233

Please sign in to comment.