Fix eth_getStorageAt and uint256 definitions #509
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
As per the current spec, the tests for the
eth_getStorageAt
do not match the definition. Specifically the test\tests\eth_getStorage\get-storage.io
fails with the following request:The second parameter is the 'Storage slot' parameter defined as
$ref: '#/components/schemas/uint256'
. This has the following issues:The uint256 does not accept the leading 0s. The validation passes if the parameter is changed to
"0x100000000000000000000000000000000000000000000000000000000000000"
.The definition of
$ref: '#/components/schemas/uint256'
is not valid as it only allows 16 bytes:Summary
This PR fixes
eth_getStorageAt
definition by setting it to more specific data types. The 'Storage slot' parameter has been changed to$ref: '#/components/schemas/bytesMax32'
. This allows any of the values to be valid:The result value has been updated to always expect 32 bytes.
Additionally the definition of
$ref: '#/components/schemas/uint256'
has been extended to 32 bytes.Notes
For the 'Storage slot' parameter I used
bytesMax32
rather thanbytes32
orhash32
for two reasons:0x1
rather than0x0000000000000000000000000000000000000000000000000000000000000001