You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some systems like ERC-4337 (Account Abstraction) use eth_call to extract onchain data by forcing a revert. (example). These revert bytes are then parsed using libraries like viem.
Currently viem can't properly parse Hedera's RPC response as the error code for an onchain revert isn't what the library expected.
For context, here is a sample reverting eth_call response that viem can parse (it parses into the viem type ContractFunctionRevertError):
viem checks if the error code is 3 and if so treats it as a onchain revert and keeps the data field containing the revert bytes. Although couldn't find any eip or spec that says the error code 3 is a hard requirement.
Solution
Change the error response code from -32008 to 3 when a onchain revert occurs
Alternatives
No response
The text was updated successfully, but these errors were encountered:
Hello @mouseless-eth, appreciate the nice catch! I did some research and indeed the value 3 is well used by other well-known services like Alchemy, Infura, etc. Here are some refferences to it:
Problem
Some systems like ERC-4337 (Account Abstraction) use eth_call to extract onchain data by forcing a revert. (example). These revert bytes are then parsed using libraries like viem.
Currently viem can't properly parse Hedera's RPC response as the error code for an onchain revert isn't what the library expected.
For context, here is a sample reverting eth_call response that viem can parse (it parses into the viem type
ContractFunctionRevertError
):This is what Hedera's reverting message looks like and it is being parsed into a
CallExecutionError
viem typeviem checks if the error code is 3 and if so treats it as a onchain revert and keeps the data field containing the revert bytes. Although couldn't find any eip or spec that says the error code 3 is a hard requirement.
Solution
Change the error response code from
-32008
to3
when a onchain revert occursAlternatives
No response
The text was updated successfully, but these errors were encountered: