Skip to content

Fix SyncProgress() Unmarshalling#24181

Closed
jclapis wants to merge 3 commits intoethereum:masterfrom
jclapis:fix-sync-unmarshal
Closed

Fix SyncProgress() Unmarshalling#24181
jclapis wants to merge 3 commits intoethereum:masterfrom
jclapis:fix-sync-unmarshal

Conversation

@jclapis
Copy link
Copy Markdown

@jclapis jclapis commented Jan 3, 2022

This PR fixes #24180. It changes the fields in ethereum.SyncProgress to be hexutil.Uint64 instead of uint64 so they unmarshal correctly when using the Geth library to connect to a Geth RPC endpoint.

I believe this retains the spirit of the changes in PR 23576 because it unmarshals the struct all at once instead of manually handling the individual fields. However, I'm not sure if numbers being returned in 0x format via the RPC endpoints is standard behavior or not so this might cause issues with other clients. A more robust change that retains the above spirit would be to add prefix-checking support to the hexutil.Uint64 unmarshallers so it could handle incoming numbers in any format. I'm not sure if that's necessary so I've left it well-enough alone here.

@jclapis jclapis requested a review from gballet as a code owner January 3, 2022 06:43
@fjl
Copy link
Copy Markdown
Contributor

fjl commented Jan 5, 2022

Thanks for the quick issue report and PR! Since SyncProgress is supposed to be stable API, I have decided to fix it a bit differently in #24199.

@fjl fjl closed this Jan 5, 2022
@jclapis jclapis deleted the fix-sync-unmarshal branch January 5, 2022 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyncProgress() fails unmarshalling in Geth v1.10.14

2 participants