This tutorial explains how to debug common issues you may face when sending UserOperations.
The UserOperation was able to make it onchain, but an error occurred in one of the smart contracts it interacted with, and thus the entire operation had to be reverted. This can be due to
preVerificationGas
or callGasLimit
paddingcallData
of your UserOperations
You can use a tool like Tenderly to help simulate and debug the UserOperation.
If you think the issue may be related to gas, simulate using the Entrypoint contract, 0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789
, and pasting in your UserOperation into the tuple
field.
For example, your UserOperation may look something like
You can use the simulateHandleOp
function and pass that UserOperation in the op
field (don’t forget to add array brackets around it, because technically it handles a “bundle” of UserOperations).
Expand for images and click to enlarge
Error may look something like this
You can use a tool like https://bia.is/tools/abi-decoder/ to upload your ABI, enter the data in, and decode the error message. Try using the ABI of every smart contract your dapp could be interacting with.
Similar to above, except your contract is reverting without any error codes. Try reviewing your smart contract’s code, your callData
, and using Tenderly to debug. It may help to have your contract verified.
The example below shows you how to debug your own smart contract.
Insert any address
- Enter your smart contract’s address hereEnter raw input data
- Enter the callData
of your contract’s function (right after callData = encodeFunctionData()
)Expand for images and click to enlarge
You might be using the mainnet RPC url instead of the testnet RPC url (or vis versa). Make sure you select the right network in the CDP portal
Expand for images and click to enlarge
This likely means that you updated the UserOperation after getting a signature from our Paymaster service. Our Paymaster signs the UserOperation with the UserOperation itself, so make sure you’re not making any changes to the UserOperation after it’s already been signed by our Paymaster paymasterClient.getPaymasterData()
. If you need to adjust things like callData
, preVerificationGas
, or callGasLimit
, you will need to receive a new signature from our Paymaster. Also if you’re handling multiple UserOperation, make sure the paymaster signature matches the right UserOperation.