-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
ethclient: Fix eth_getBlockReceipts call when using block numbers or labels #28358
Conversation
…labels The String() version of BlockNumberOrHash uses decimal for all block numbers, including negative ones used to indicate labels. Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Happy to apply those changes to the test once the run of morning meetings is over, but worth noting that I just copied the test above it so it currently matches the style of testing used through that file. Do you want to make these style changes to all tests in the file while I'm at it? |
@holiman Updated just the new test for now as suggested and left the others. Happy to rework them to the same style if you'd like though but feels out of scope of this PR. |
Looks like CI failed because the VisualStudio run hit the 60 minute time out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ajsutton, LGTM!
…thereum#28358) The String() version of BlockNumberOrHash uses decimal for all block numbers, including negative ones used to indicate labels. Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
…rHash (ethereum#28358)" This reverts commit b7be93f.
…rHash (ethereum#28358)" This reverts commit b7be93f.
…thereum#28358) Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
* Copy ethereum/go-ethereum#27702 * Fix TestRPCGetBlockReceipts * Get ethclient compiling * Copy ethereum/go-ethereum#28087 * Copy ethereum/go-ethereum#28358
…thereum#28358) The String() version of BlockNumberOrHash uses decimal for all block numbers, including negative ones used to indicate labels. Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
…thereum#28358) The String() version of BlockNumberOrHash uses decimal for all block numbers, including negative ones used to indicate labels. Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
The String() version of BlockNumberOrHash uses decimal for all block numbers, including negative ones used to indicate labels. Switch to using BlockNumber.String() which encodes it correctly for use in the JSON-RPC API.
The incorrect encoding was introduced in #28087 when switching from the working but non-standard object encoding (e.g.
{"blockNumber":"0x7fffffffffffffff"}
) that comes from JSON serialisingBlockNumberOrHash
to usingString()
to return a single value. With this implementation ofString()
it matches the execution-apis spec for block hash, block number and block labels.