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.
eth_call
(eth_getBalance
, etc...) accepts ablockTag
as its second parameter.The block tag can be the string
latest
orpending
, a block number or a block hash.If it’s a block number, it must be a non zero padded hex string.
Otherwise, geth returns this error:
0x0829ee2
is padded. Should be0x829ee2
.If it’s a block hash, if must be a 32 bytes hex string (zero padded if needed). If not padded, geth will return the following error:
0x281610a62b7bc11190c76e2774375feb7205baba91a3a4ff8a6a65139208cab
was trimmed. Should be0x0281610a62b7bc11190c76e2774375feb7205baba91a3a4ff8a6a65139208cab
.When passing a block hash as the block tag (to
eth_call
oreth_getBalance
), the zeros in the hex value are trimmed (and produce the previous error).This pull request fixes this issue by considering that if the block tag is an hex string, it will be considered as the block hash and won't be trimmed. If it's a number, it will be converted to a trimmed hex string.
Reproduce