-
Notifications
You must be signed in to change notification settings - Fork 4.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
web3.utils.sha3 and web3.utils.soliditySha3 return null when an empty byte sequence is hashed #1961
Comments
web3.utils.sha3
and web3.utils.soliditySha3
return null
when an empty string is hashed
I've had this issue crop up in ENS as well. |
I would much rather see it return the actual hash by default, but it's better than nothing. I imagine the argument against fixing this is concern about backward compatibility... maybe it's possible to deprecate the old function and create a new one that has the fix by default? |
Yes, this is correct. I think adding new functions with close to the same behavior will lead to confusion by most developers. It's better to just add a configuration property for now and to apply the breaking change later with a minor release. |
@smarx I've just applied this change to the |
Based on the code, this appears to be done intentionally for some reason, but it seems like a very bad idea to return the wrong answer. There's also no mention of this non-standard behavior in the documentation.
From https://github.com/ethereum/web3.js/blob/1.0/packages/web3-utils/src/utils.js#L434,L435:
Removing those lines would fix the problem.
The text was updated successfully, but these errors were encountered: