Skip to content
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

Fix/remove the "validator" column #506

Open
jsdw opened this issue Oct 20, 2022 · 0 comments
Open

Fix/remove the "validator" column #506

jsdw opened this issue Oct 20, 2022 · 0 comments

Comments

@jsdw
Copy link
Collaborator

jsdw commented Oct 20, 2022

Substrate no longer sends the "validator" entry in the node details that we use to populate this column on startup. The node sends:

Object({
    "id": Number(
        1,
    ),
    "payload": Object({
        "authority": Bool(
            true,
        ),
        "chain": String(
            "Development",
        ),
        "config": String(
            "",
        ),
        "genesis_hash": String(
            "0x464b7834423d4592047df6c0cff83c7dae7daf05dc2fc46ebdc66d6a18e639c1",
        ),
        "implementation": String(
            "Parity Polkadot",
        ),
        "msg": String(
            "system.connected",
        ),
        "name": String(
            "illegal-battle-0921",
        ),
        "network_id": String(
            "12D3KooWCoVPXa5dAFJdTor1zXNb5EVFnT9ARdKvMy3efV1VZygU",
        ),
        "startup_time": String(
            "1666271078671",
        ),
        "sysinfo": Object({
            "core_count": Null,
            "cpu": Null,
            "is_virtual_machine": Null,
            "linux_distro": Null,
            "linux_kernel": Null,
            "memory": Null,
        }),
        "target_arch": String(
            "aarch64",
        ),
        "target_env": String(
            "",
        ),
        "target_os": String(
            "macos",
        ),
        "version": String(
            "0.9.29-41a9d84b152",
        ),
    }),
    "ts": String(
        "2022-10-20T14:04:42.019051+01:00",
    ),
})

This comes from the ConnectionMessage in substrate which looks like:

pub struct ConnectionMessage {
	/// Node's name.
	pub name: String,
	/// Node's implementation.
	pub implementation: String,
	/// Node's version.
	pub version: String,
	/// Node's configuration.
	pub config: String,
	/// Node's chain.
	pub chain: String,
	/// Node's genesis hash.
	pub genesis_hash: String,
	/// Node is an authority.
	pub authority: bool,
	/// Node's startup time.
	pub startup_time: String,
	/// Node's network ID.
	pub network_id: String,

	/// Node's OS.
	pub target_os: String,

	/// Node's ISA.
	pub target_arch: String,

	/// Node's target platform ABI or libc.
	pub target_env: String,

	/// Node's software and hardware information.
	pub sysinfo: Option<SysInfo>,
}

But we expect a payload like:

pub struct NodeDetails {
    pub chain: Box<str>,
    pub name: Box<str>,
    pub implementation: Box<str>,
    pub version: Box<str>,
    pub validator: Option<Box<str>>,
    pub network_id: node_types::NetworkId,
    pub startup_time: Option<Box<str>>,
    pub target_os: Option<Box<str>>,
    pub target_arch: Option<Box<str>>,
    pub target_env: Option<Box<str>>,
    pub sysinfo: Option<NodeSysInfo>,
    pub ip: Option<Box<str>>,
}

And the validator address, if present, populates the validator column.

We can see that it's almost always empty now, or it has a naff address.

Substrate nodes are started with a --validator flag (this guide runs through setting up a validator https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot#thousand-validators-programme).

I wonder whether we could add back a validator: bool entry in Substrate to this ConnectionMessage (no more address would be shown from this though, just a "yes/no" field). I also wonder whether any other message contains information we could use to extrapolate whether a node is a validator. I think an account address is associated with the node after startup, so perhaps it is sent along in another telemetry message?

Alternately, if that fails, we could just remove the validator column since it is no longer helpful.

Appendix

In telemetry_shard/src/main.rs's handle_message_from_node function we can add something like:

let all_msg: serde_json::Value = serde_json::from_slice(&bytes).unwrap();
println!("{all_msg:#?}");

to log all messages sent to the node. We don't need to start a telemetry_core up to do this so it's fairly easy to see what a node spits out and test that we are getting what we want from a local node.

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

No branches or pull requests

1 participant