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

eth_getStorageAt returns incorrect error for an invalid index #1785

Closed
1 task done
Tracked by #1579
Rjected opened this issue Mar 15, 2023 · 2 comments
Closed
1 task done
Tracked by #1579

eth_getStorageAt returns incorrect error for an invalid index #1785

Rjected opened this issue Mar 15, 2023 · 2 comments
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior

Comments

@Rjected
Copy link
Member

Rjected commented Mar 15, 2023

Describe the bug

The eth_getStorageAt/get-storage-invalid-key test in the rpc-compat suite fails because we return the wrong error:

>>  {"jsonrpc":"2.0","id":11,"method":"eth_getStorageAt","params":["0xaa00000000000000000000000000000000000000","0xasdf","latest"]}
<<  {"jsonrpc":"2.0","error":{"code":-32602,"message":"invalid value: string \"asdf\", expected a 32 byte hex string at line 1 column 8"},"id":11}
response differs from expected:
 {
   "error": {
-    "code": -32602,
+    "code": -32000,
-    "message": "invalid value: string "asdf", expected a 32 byte hex string at line 1 column 8"
+    "message": "invalid hex string"
   },
   "id": 11,
   "jsonrpc": "2.0"
 }

Instead, of returning "message": "invalid value: string "asdf", expected a 32 byte hex string at line 1 column 8", we should return "message": "invalid hex string"

Steps to reproduce

Run the setup for hive mentioned in #851, making sure to build the docker image from the dan/hive-ci branch.

The command for running the eth_getStorageAt/get-storage-invalid-key test:

./hive --client reth --sim ethereum/rpc-compat --sim.limit "/eth_getStorage/get-storage-invalid-key"

Node logs

No response

Platform(s)

No response

What version/commit are you on?

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@Rjected Rjected added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled A-rpc Related to the RPC implementation and removed S-needs-triage This issue needs to be labelled labels Mar 15, 2023
@mattsse
Copy link
Collaborator

mattsse commented Mar 16, 2023

this is kinda cursed, because the server automatically answers with -32602: INVALID_PARAMS when it failed to deserialize

not sure how to fix this without significantly making the jsonrpsee trait definitions unpleasant to work with.

@onbjerg
Copy link
Member

onbjerg commented May 29, 2023

Assuming we fixed this?

@onbjerg onbjerg closed this as completed May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
Archived in project
Development

No branches or pull requests

3 participants