-
Notifications
You must be signed in to change notification settings - Fork 143
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
Have error formatting comply with the JSON-RPC error format #252
Comments
I'm not sure of how the evm behaves in the real world. Is there any need to format errors from py-evm (or the default backend)? Would the evm have its own spec for errors it throws? I'm considering diving into this one. |
Looking at eth_getBalance as an example. The response contains the result encoded data in some formatted json. In eth-tester, t.get_balance simply returns the actual balance. Is the intent to mimic the response/error that the Ethereum JSON-RPC spec uses? Should the test methods like t.get_balance return a valid JSON response object? |
Looking at this a little bit deeper, I think this actually may be a change that is better in web3 somewhere in here: https://github.com/ethereum/web3.py/blob/main/web3/providers/eth_tester/main.py#L154-L176. It may as straightforward as catching the
and then have something similar in line 160 where we're catching the |
What was wrong?
eth-tester (or possibly py-evm) returns errors as strings instead of dicts, which makes downstream libraries have to account for a case in testing that isn't quite what they'd see if they were connected to a node.
How can it be fixed?
A JSON-RPC error format can be found here. Convert errors coming from
eth-tester
to be compliant.The text was updated successfully, but these errors were encountered: