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

Fix getUserOperationError for UserOp execution reverted 0x #2879

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

lwin-kyaw
Copy link
Contributor

@lwin-kyaw lwin-kyaw commented Oct 17, 2024

The function, getUserOperationError has run time error when processing UserOperationError: UserOperation reverted during simulation with reason: 0x. Please refer to the following capture.

Error

Screenshot 2024-10-17 at 21 58 53

Even though this is unknown contract execution reverted error, it should be displaying the original error instead of this runtime issue, which leads to some confusion for debugging.

This PR includes a very small fix in getUserOperationError function which validates the calls values from function input before proceeding to determine the contract call data.

To reproduce the error

Test input

const error = new RpcRequestError({
  body: {},
  error: {
    code: -32521,
    message: 'UserOperation reverted during simulation with reason: 0x',
  },
  url: '',
})

Expected

It should return the original error message (UserOperation reverted during simulation with reason: 0x) with the UserOperation object provided to the RPC call.

[UserOperationExecutionError: Execution reverted with reason: UserOperation reverted during simulation with reason: 0x.

Request Arguments:
  callData:              0xdeadbeef
  callGasLimit:          1
  factory:               0x0000000000000000000000000000000000000000
  factoryData:           0xdeadbeef
  maxFeePerGas:          0.000000001 gwei
  maxPriorityFeePerGas:  0.000000002 gwei
  nonce:                 1
  paymaster:             0xffff
  paymasterData:         0xdeadbeef
  preVerificationGas:    1
  sender:                0xdeadbeef
  signature:             0xdeadbeef
  verificationGasLimit:  1

Details: UserOperation reverted during simulation with reason: 0x
Version: [email protected]]

PR-Codex overview

This PR focuses on fixing a runtime error in the getUserOperationError function by adding a condition to check for calls and enhancing the test coverage for scenarios where execution is reverted without calls.

Detailed summary

  • Fixed a runtime error in getUserOperationError by adding a check for calls.
  • Updated the test for getUserOperationError to handle the case of execution reverted without calls.
  • Added a new test case that checks the output when a specific RpcRequestError occurs.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Oct 17, 2024

🦋 Changeset detected

Latest commit: 9167294

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 17, 2024

@lwin-kyaw is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom jxom merged commit 8b34dd7 into wevm:main Oct 17, 2024
7 of 14 checks passed
@github-actions github-actions bot mentioned this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants