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

storageAt Error: hex data is odd-length #1132

Closed
wighawag opened this issue Nov 1, 2020 · 4 comments
Closed

storageAt Error: hex data is odd-length #1132

wighawag opened this issue Nov 1, 2020 · 4 comments
Labels
discussion Questions, feedback and general information.

Comments

@wighawag
Copy link

wighawag commented Nov 1, 2020

When calling provider.getStorageAt to a storage slot with zero data I get :

Error: hex data is odd-length (argument="value", value="0x0", code=INVALID_ARGUMENT, version=bytes/5.0.5)

I guess this is because the raw data from the rpc is "0x0" and ethers does not try to sanitize that before passing to hexlify here :

return hexlify(await this.perform("getStorageAt", params));

@ricmoo
Copy link
Member

ricmoo commented Nov 1, 2020

What backend is this? Can you send me an address and storage position and backend you used for this?

This used to be a bug in old versions of ganache. I’ll fix it, but curious about who’s doing this. :)

@ricmoo ricmoo added enhancement New feature or improvement. on-deck This Enhancement or Bug is currently being worked on. labels Nov 1, 2020
@wighawag
Copy link
Author

wighawag commented Nov 1, 2020

This was running in a test against hardhat : https://github.com/nomiclabs/hardhat
I created an issue there : NomicFoundation/hardhat#978

@ricmoo
Copy link
Member

ricmoo commented Nov 18, 2020

It looks like this was fixed upstream. And I'm debating now whether it makes sense for ethers to try interpreting this sort of result. If treated as a bytes, it should pad on the right, if a value pad on the left. Since it is ambiguous, I think I'm going to recommend not handling invalid data in this case...

I'm open to discussion though.

@ricmoo ricmoo added discussion Questions, feedback and general information. and removed enhancement New feature or improvement. on-deck This Enhancement or Bug is currently being worked on. labels Nov 18, 2020
@ricmoo
Copy link
Member

ricmoo commented Nov 24, 2020

Closing this now, but please feel free to re-open to continue discussions.

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

2 participants