nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.49k stars 787 forks source link

telemetry_ack response: protocol_version field does not contain correct data #3489

Closed dsiganos closed 3 years ago

dsiganos commented 3 years ago

The telemetry_ack response does not set the protocol_version field correctly.

zhyatt commented 3 years ago

@dsiganos What version are you currently seeing? There is a node version, which most on the main network should be 22+ and then protocol version has been at 18 since node version 21.0: https://docs.nano.org/releases/node-releases/#active-releases

dsiganos commented 3 years ago

I am seeing what looks like random data. It is different every time.

zhyatt commented 3 years ago

Here is an example of the summarized telemetry response RPC provides:

{
    "block_count": "130840938",
    "cemented_count": "130840759",
    "unchecked_count": "1913",
    "account_count": "26103759",
    "bandwidth_cap": "10485760",
    "peer_count": "267",
    "protocol_version": "18",
    "uptime": "4259684",
    "genesis_block": "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
    "major_version": "22",
    "minor_version": "1",
    "patch_version": "0",
    "pre_release_version": "0",
    "maker": "0",
    "timestamp": "1633371161330",
    "active_difficulty": "fffffff800000000"
}

Seems that version 18 is the mode from all responses and the raw option shows everyone with 18 as well it seems. Not sure how that is decoded off the wire though. Are you directly decoding the network response?

dsiganos commented 3 years ago

I should clarify that I am referring to the telemetry_ack network packet. Not RPC call.

dsiganos commented 3 years ago

Evidence of protocol_version changing...

ds@tux:~/nano/pynanocoin$ date; ./telemetry_req.py -b --peer [::ffff:167.172.215.52]:54000
Mon  4 Oct 19:36:33 BST 2021
connecting to ::ffff:167.172.215.52:54000
NetID: B, VerMaxUsingMin: 18/18/18, MsgType: 13(telemetry_ack), Extensions: 00CA
Signature: CB93A3C7FFDF922FEC3BA1BA515A161DD9A305D222F639F095FBC17DB6C61E9A4CF4C6375FEAA67D12DA3686F367D6CE9C510DB5A165A42569003D17A4C11809
Node ID: 810D551A6ADEF9D49C266335E4E6B9AF2B83534D1B0092C8CDF1B73C39FE6204
         node_31afcnf8oqqstkg4ersowmmdmdsdifbnt8r1kd6euwfq9iwzwri6tm4wga9g
Block Count: 49563134
Cemented Count: 49563134
Unchecked Count: 0
Account Count: 3701408
Bandwidth Cap: 10485760
Uptime: 81906368512 s
Peer Count: 25
Protocol Version: 165
Genesis Hash: 01A92459E69440D5C1088D3B31F4CA678BE944BAB3776C2E6B7665E9BD99BD5A
Major Version: 23
Minor Version: 0
Patch Version: 0
Pre-release Version: 2
Maker Version: 0
Timestamp: 1633372594719 ms
Active Difficulty: 18446726481523507200 (0xfffff00000000000)
ds@tux:~/nano/pynanocoin$ date; ./telemetry_req.py -b --peer [::ffff:167.172.215.52]:54000
Mon  4 Oct 19:36:52 BST 2021
connecting to ::ffff:167.172.215.52:54000
NetID: B, VerMaxUsingMin: 18/18/18, MsgType: 13(telemetry_ack), Extensions: 00CA
Signature: B993079E6A28DA6081CDED58830EFAA10DF3905019004AF8944C465E2C70569A60B2869C7C714E81FD6E1818C363672C17D755541ACCF6B27E37E90C68E90003
Node ID: 810D551A6ADEF9D49C266335E4E6B9AF2B83534D1B0092C8CDF1B73C39FE6204
         node_31afcnf8oqqstkg4ersowmmdmdsdifbnt8r1kd6euwfq9iwzwri6tm4wga9g
Block Count: 49563134
Cemented Count: 49563134
Unchecked Count: 0
Account Count: 3701408
Bandwidth Cap: 10485760
Uptime: 81906368512 s
Peer Count: 25
Protocol Version: 184
Genesis Hash: 01A92459E69440D5C1088D3B31F4CA678BE944BAB3776C2E6B7665E9BD99BD5A
Major Version: 23
Minor Version: 0
Patch Version: 0
Pre-release Version: 2
Maker Version: 0
Timestamp: 1633372613153 ms
Active Difficulty: 18446726481523507200 (0xfffff00000000000)
zhyatt commented 3 years ago

So either the RPC call is returning a static or local value which is correct for protocol version but not being pulled from the network messages (meaning the telemetry implementation or something with RPC retrieval is at fault), or the other decoding methods that are being used to decode messages off the wire are incorrect.

Given the other issue you logged about uptime being incorrect (#3490) and not changing as expected, I suspect the network message decoding in telemetry_req.py may be incorrect for the uptime and protocol version. Does that seem like a possibility?

dsiganos commented 3 years ago

It could be a parsing problem but I do not think so. I have double checked it. I think the RPC and network packet code work differently.

zhyatt commented 3 years ago

Hmm, odd. The most curious is this protocol_version one. It might be easiest to sort out since it is a static on all nodes as version 18 (0x12 hex): https://github.com/nanocurrency/nano-node/blob/38026fc25c25e813c804345b5ccdc1148a883043/nano/lib/config.hpp#L273

dsiganos commented 3 years ago

This will be fixed by issue #3490.