-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
BaseProvider getStorageAt position is not spec-compliant #2982
Comments
The change should probably go into Thanks! I'll fix this today. :) (Note: in v6, the formatter has a |
Thanks so much! Makes sense to me :) |
This should be fixed in 5.6.7. Try it out and let me know if you still have any problems. Thanks! :) |
Sorry for the inconvenience guys. Fixing this was a tough call, as we accidentally deviated from the "standard" previously. |
No worries; I'm a huge fan of things being standards compliant. :) I've already made changes in v6 that are aligned with this too. |
just tried this and am seeing the same error |
Did you update to the latest version? 5.6.8? |
i did! went there first actually. trying 5.6.7 now |
5.6.7 should work too. I’ll re-open and look at it tomorrow. |
i am seeing this most readily when i do a uniswap v3 swap then try to trace the transaction using |
both 5.6.7 and 5.6.8 are not working now.
|
Can you once try removing lock files and reinstalling on your end if it solves the problem? |
@3commascapital @0xdagarn Have you tried @zemse suggestion of removing any lock files and re-installing? Can you make sure the version of the I've just tried to reproduce this against the latest version and it still works for me. |
Same error when I use |
Closing older issues. But if this is still happening in v6, please re-open or start a new issue. Thanks! :) |
Ethers Version
@ethersproject/providers
5.6.5
Search Terms
BaseProvider,getStorageAt
Describe the Problem
I came across this while trying to use
provider.getStorageAt(someAddress, 0);
against a fresh install of Hardhat. The fresh install evidently used Hardhat v2.9.5 that includes a change to make Hardhat network'seth_getStorageAt
spec compliant (Hardhat PR here, references spec found here). Apparently the spec requires the storage position passed intoeth_getStorageAt
to be a 32 byte hex string, which BaseProvider doesn't do.Calling
getStorageAt
would give this Hardhat error:InvalidArgumentsError: Errors encountered in param 1: Storage slot argument must have a length of 66 ("0x" + 32 bytes), but '0x0' has a length of 3
. Eventually I tracked it down to this line: https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/base-provider.ts#L1482I was able to fix it locally by changing the
hexValue(p)
tohexZeroPad(p, 32)
. I'm happy to open a PR but I'm not sure if that's the best place to make the change / if it totally preserves backward compatibility for other use cases.For any passerby, downgrading Hardhat version to <= v2.9.4 seems to be a sufficient workaround for now
Code Snippet
Contract ABI
No response
Errors
No response
Environment
node.js (v12 or newer), Hardhat
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: