-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ethereum JSON-RPC responses should not include leading zero in hex #10170
Comments
@iand are you working on this? |
@jennijuju not currently |
hey @iand Are you able to provide some more feedback on what actions should be taken on #10170 ? I have added some tests to the eth types module and don't see any problems with encoding and decoding and leading zeroes. Are you saying that this test case should fail because there's a leading zero? https://github.com/filecoin-project/lotus/pull/10229/files#diff-9b386017c36b3007a1b2f036c642d2577c9a54ddbd161b4fdc05237ae5abd8baR41 |
I think that our issue here related to the type "EthFilterID" and the lotus codebase has this as a EthHash. The JsonRPC api returns it as a hash, and then seperately the conformation json spec believes that it should be an "int" like variable which would not allow leading 0x01 zeroes, but a hash may have them. I think the biggest question I have now is whether it makes sense for EthFilterID to be an EthHash throughout the lotus codebase, but when passed to the JSONRPC should we act as if it's an int? |
an example EthFilterID return result is |
Checklist
Latest release
, or the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.Lotus component
Lotus Version
Describe the Bug
According to the json-rpc schema, many places that represent values as hex must not contain a leading zero (after the
0x
). For example0x098a0c6ef2224342b2a8727ae5111fd000000000000000000000000000000000
must be encoded as0x98a0c6ef2224342b2a8727ae5111fd000000000000000000000000000000000
. The Go hex encoder pads to an even number of characters by including a leading zero if necessary.The conformance tests in #10102 enforce this and I'm seeing intermittent failures
The fields that are affected can be found by grepping
itests/specs/eth_openrpc.json
for^0x([1-9a-f]
. At a glance I think it affects the json encoding of types like EthUint64 and EthBytes but I haven't made a comprehensive list.For more information see:
Logging Information
Repo Steps
No response
The text was updated successfully, but these errors were encountered: