From 27709e383e4e5fe10219c6fcf8dcf2b1cc8dbd79 Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 5 Jun 2024 17:41:19 +0200 Subject: [PATCH] chore: use the new multi-chain endpoint for N1 telemetry (#11484) Since #11444 the telemetry data contains the `chain-id`, we can now use the multichain endpoint to send telemetry. With this change we gain resiliency to misconfiguration: for instance `testnet` nodes with config partially copied from `mainnet` will report their telemetry correctly labeled as `testnet`. --- nearcore/res/example-config-gc.json | 2 +- nearcore/res/example-config-no-gc.json | 2 +- nearcore/src/config.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nearcore/res/example-config-gc.json b/nearcore/res/example-config-gc.json index aac7f1551a2..2da1ccb4b22 100644 --- a/nearcore/res/example-config-gc.json +++ b/nearcore/res/example-config-gc.json @@ -25,7 +25,7 @@ "telemetry": { "endpoints": [ "https://explorer.mainnet.near.org/api/nodes", - "https://telemetry.nearone.org/nodes/mainnet" + "https://telemetry.nearone.org/nodes" ] }, "network": { diff --git a/nearcore/res/example-config-no-gc.json b/nearcore/res/example-config-no-gc.json index 1686affa6ac..23ba9e841ed 100644 --- a/nearcore/res/example-config-no-gc.json +++ b/nearcore/res/example-config-no-gc.json @@ -25,7 +25,7 @@ "telemetry": { "endpoints": [ "https://explorer.mainnet.near.org/api/nodes", - "https://telemetry.nearone.org/nodes/mainnet" + "https://telemetry.nearone.org/nodes" ] }, "network": { diff --git a/nearcore/src/config.rs b/nearcore/src/config.rs index 40f6bcb435e..0a519e3fe69 100644 --- a/nearcore/src/config.rs +++ b/nearcore/src/config.rs @@ -106,7 +106,7 @@ pub const NODE_KEY_FILE: &str = "node_key.json"; pub const VALIDATOR_KEY_FILE: &str = "validator_key.json"; pub const NETWORK_LEGACY_TELEMETRY_URL: &str = "https://explorer.{}.near.org/api/nodes"; -pub const NETWORK_TELEMETRY_URL: &str = "https://telemetry.nearone.org/nodes/{}"; +pub const NETWORK_TELEMETRY_URL: &str = "https://telemetry.nearone.org/nodes"; fn default_doomslug_step_period() -> Duration { Duration::milliseconds(100) @@ -863,7 +863,7 @@ pub fn init_configs( bail!("Test seed is not supported for {chain_id}"); } config.telemetry.endpoints.push(NETWORK_LEGACY_TELEMETRY_URL.replace("{}", &chain_id)); - config.telemetry.endpoints.push(NETWORK_TELEMETRY_URL.replace("{}", &chain_id)); + config.telemetry.endpoints.push(NETWORK_TELEMETRY_URL.to_string()); } _ => { // Create new configuration, key files and genesis for one validator. @@ -1510,7 +1510,7 @@ mod tests { assert_eq!( vec![ "https://explorer.mainnet.near.org/api/nodes".to_string(), - "https://telemetry.nearone.org/nodes/mainnet".to_string() + "https://telemetry.nearone.org/nodes".to_string() ], config.telemetry.endpoints );