Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

web3_sha3 should accept hex-encoded string #1375

Closed
domob1812 opened this issue Oct 13, 2021 · 1 comment · Fixed by #1593
Closed

web3_sha3 should accept hex-encoded string #1375

domob1812 opened this issue Oct 13, 2021 · 1 comment · Fixed by #1593
Assignees
Milestone

Comments

@domob1812
Copy link
Contributor

The web3_sha3 RPC method is supposed to accept a hex-encoded string for the data to hash. So for instance, to get the Keccak hash of Move(string,string,string,uint256,uint256,address,uint256,address) (for a Solidity event topic), the call should be:

web3_sha3 ("0x4d6f766528737472696e672c737472696e672c737472696e672c75696e743235362c75696e743235362c616464726573732c75696e743235362c6164647265737329")

This call returns the expected value of 0x1241ca91bf224e988427ae79840cc9e3a02fa0579a3bd3fffc1f5c363192a873 for me with a real geth instance (version 1.10.8) as well as the old ganache-cli (version 6.12.2).

However, with the new ganache in development, I get 0xfb003308ec3db2d4f5b4afd507e20a6405153cdacffdee04022877e29465e778. I do get the correct result if I pass in the string directly, i.e.

web3_sha3 ("Move(string,string,string,uint256,uint256,address,uint256,address)")

From what I can see in the code this is kind of "intended". However, isn't this a bug, as ganache should follow the RPC spec and be consistent with the behaviour of other clients (like geth)?

@davidmurdoch
Copy link
Member

Thanks for trying out the alpha. It should work to spec. This will be fixed before release to stable. Thank you for reporting this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants