-
Notifications
You must be signed in to change notification settings - Fork 795
Hashing is inconsistent with respect to ethers js #2633
Comments
What is super bizarre is my tests with Address work fine. It is uint that specifically is giving strange results even if there is an explanation for this , the documentation is highly insufficient and this is very confusing |
Okay i found another clue. It looks like in rust, Uint only matches JS if doing 'encode' and Address only matches if doing 'encodePacked' . The reference on JS is doing ' ethers.utils.solidityKeccak256 '. To my limited knowledge, that JS reference is doing encodePacked so i thought rust would also always be doing that. uh oh. unfortunately, this means it is impossible for me to match hashes on a struct that has both an address and a uint. This seems like a bug... ? |
Okay i forked the code and changed it to this ''' let mut buf = [0; 32]; */
''' and now it works like a charm for me. Needs some investigation for sure ! |
Btw im talking abt etherscore/src/abi/encode_packed having an issue here |
This is an unfortunate limitation of
|
Uhh so
And 2 ) so there is absolutely no way to do solidityKeccak256(tokens[]) in rust yet ? 🤔 i feel like these are some serious problems as they relate to applications that want to use ECRecover with rust backend |
Version
2.0.10
Platform
Linux Mint 20
Description
Enter your issue details here.
Okay i have narrowed down my hashing problem to a smaller test scenario that proves my woes.
check this out :
this rust code
outputs this: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
and this javascript code which i hoped would be the same
outputs this : 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563
why might this be ?
The text was updated successfully, but these errors were encountered: