You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Richard !
I hope you are not too tired by the devcon jet lag ^^
Anyway I found an interesting bug in ethers v5's base-provider :
when you call myProvider.getBlock(myBlockHash) with a block hash that start with 0, it will strip that 0 causing the block hash to be shorter than expected and thus causing the call of rpc method eth_getBlockByNumber instead of eth_getBlockByHash. This will in return cause the rpc node to return an error because obviously a block hash is an invalid block number.
After some investigation it seems that this bug is caused by the following stack base-provider -> getBlock() -> _getBlock() -> _getBlockTag() -> formatter -> blockTag() -> bytes -> hexValue()
this bug appeared in the browser and in node, and here are the minimal steps to reproduce (in node) :
(Im still in Ōsaka, so jet lag is t so much a problem, but reliable and non-slow internet is ;))
ricmoo
added
investigate
Under investigation and may be a bug.
bug
Verified to be an issue.
on-deck
This Enhancement or Bug is currently being worked on.
and removed
investigate
Under investigation and may be a bug.
on-deck
This Enhancement or Bug is currently being worked on.
labels
Oct 16, 2019
Hi Richard !
I hope you are not too tired by the devcon jet lag ^^
Anyway I found an interesting bug in ethers v5's
base-provider
:when you call
myProvider.getBlock(myBlockHash)
with a block hash that start with0
, it will strip that0
causing the block hash to be shorter than expected and thus causing the call of rpc methodeth_getBlockByNumber
instead ofeth_getBlockByHash
. This will in return cause the rpc node to return an error because obviously a block hash is an invalid block number.After some investigation it seems that this bug is caused by the following stack
base-provider
->getBlock()
->_getBlock()
->_getBlockTag()
->formatter
->blockTag()
->bytes
->hexValue()
this bug appeared in the browser and in node, and here are the minimal steps to reproduce (in node) :
As always thanks for your work and your time !
The text was updated successfully, but these errors were encountered: