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

[Feature] Add deserde check for JsonStorageKey #1902

Open
mattsse opened this issue Jan 9, 2025 · 2 comments · May be fixed by #1915
Open

[Feature] Add deserde check for JsonStorageKey #1902

mattsse opened this issue Jan 9, 2025 · 2 comments · May be fixed by #1915
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mattsse
Copy link
Member

mattsse commented Jan 9, 2025

Component

rpc

Describe the feature you would like

Currently we do

s.parse().map(Self::Number)

this will succeed for larger 0x00...00 values because the parse impl of U256 strips leading zeros

we need a check that rejects values longer than 64 + 0x

TODO

  • add check if value > 64 && > 66 if startswith 0x

example

>>  {"jsonrpc":"2.0","id":1,"method":"eth_getStorageAt","params":["0xaa00000000000000000000000000000000000000","0x00000000000000000000000000000000000000000000000000000000000000000","latest"]}
<<  {"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000000000000000000000"}
response differs from expected (-- client, ++ test):
 {
   "id": 1,
   "jsonrpc": "2.0",
-  "result": "0x0000000000000000000000000000000000000000000000000000000000000000"
+  "error": {
+    "code": -32000,
+    "message": "unable to decode storage key: hex string too long, want at most 32 bytes"
+  }
 }

Additional context

No response

@mattsse mattsse added enhancement New feature or request good first issue Good for newcomers labels Jan 9, 2025
@programskillforverification
Copy link
Contributor

@mattsse
Copy link
Member Author

mattsse commented Jan 11, 2025

assigned, ty

@stevencartavia stevencartavia linked a pull request Jan 14, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants