RPC: Add comment about `eth_protocolVersion` expectations

While looking at the RPC `eth_protocolVersion` to see exactly what it should
report when there are multiple `eth/NN` versions supported by a node, I found
some differences in the documentation:

- The old Ethereum wiki documents it as returning a decimal string.

- But Infura documents it as returning 0x-prefixed hex string.

- Geth 1.10.0 has removed this call entirely "as it makes no sense".

https://eth.wiki/json-rpc/API#eth_protocolversion
https://infura.io/docs/ethereum/json-rpc/eth-protocolVersion
https://blog.ethereum.org/2021/03/03/geth-v1-10-0/#compatibility
Signed-off-by: Jamie Lokier <jamie@shareable.org>
This commit is contained in:
Jamie Lokier 2021-07-22 17:42:57 +01:00
parent 22241f3cff
commit bb282a5348
No known key found for this signature in database
GPG Key ID: CBC25C68435C30A2
1 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,12 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB , server: RpcServer) =
result = getAccountDb(chain.headerFromTag(tag)) result = getAccountDb(chain.headerFromTag(tag))
server.rpc("eth_protocolVersion") do() -> string: server.rpc("eth_protocolVersion") do() -> string:
# Old Ethereum wiki documents this as returning a decimal string.
# Infura documents this as returning 0x-prefixed hex string.
# Geth 1.10.0 has removed this call "as it makes no sense".
# - https://eth.wiki/json-rpc/API#eth_protocolversion
# - https://infura.io/docs/ethereum/json-rpc/eth-protocolVersion
# - https://blog.ethereum.org/2021/03/03/geth-v1-10-0/#compatibility
result = $protocol_eth65.protocolVersion result = $protocol_eth65.protocolVersion
server.rpc("eth_syncing") do() -> JsonNode: server.rpc("eth_syncing") do() -> JsonNode: