-
Notifications
You must be signed in to change notification settings - Fork 20k
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: support networkID in hex format #30263
Conversation
I get $ curl -X POST https://mainnet.optimism.io -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": 0, "method": "net_version", "params": []}'
{"jsonrpc":"2.0","result":"10","id":0} |
I think we should support hex. |
The problem is, there is no spec for this method. While Geth has been returning decimal, most other methods return numbers as hex. |
There is an issue for adding a spec here (and the proposed spec uses hex...): ethereum/execution-apis#540 |
Maybe it depends on the RPC server.
|
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.
SGTM
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.
LGTM
Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead of "10"), so when converting the string to big.Int, we cannot specify base 10; otherwise, it will encounter errors with hexadecimal network IDs.
Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead of "10"), so when converting the string to big.Int, we cannot specify base 10; otherwise, it will encounter errors with hexadecimal network IDs.