Ensure we send the correct polkadot node version to telemetry (#1307)

This is basically a hack, but with the current way we initialize the node this is the easiest
solution to ensure we send the correct version etc.
This commit is contained in:
Bastian Köcher
2022-05-30 19:50:00 +02:00
committed by GitHub
parent 154ea86efb
commit 6f416eece2
5 changed files with 13 additions and 5 deletions
Generated
+2
View File
@@ -2027,10 +2027,12 @@ dependencies = [
"futures 0.3.21",
"futures-timer",
"parking_lot 0.12.0",
"polkadot-cli",
"polkadot-client",
"polkadot-primitives",
"polkadot-service",
"polkadot-test-client",
"sc-cli",
"sc-client-api",
"sc-consensus-babe",
"sc-network",
@@ -12,6 +12,7 @@ parking_lot = "0.12.0"
tracing = "0.1.34"
# Substrate
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -27,6 +28,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
@@ -32,6 +32,7 @@ use polkadot_client::{ClientHandle, ExecuteWithClient, FullBackend};
use polkadot_service::{
AuxStore, BabeApi, CollatorPair, Configuration, Handle, NewFull, Role, TaskManager,
};
use sc_cli::SubstrateCli;
use sc_client_api::{
blockchain::BlockStatus, Backend, BlockchainEvents, HeaderBackend, ImportNotifications,
StorageProof, UsageProvider,
@@ -359,12 +360,17 @@ fn build_polkadot_full_node(
/// Builds a relay chain interface by constructing a full relay chain node
pub fn build_inprocess_relay_chain(
polkadot_config: Configuration,
mut polkadot_config: Configuration,
parachain_config: &Configuration,
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
task_manager: &mut TaskManager,
hwbench: Option<sc_sysinfo::HwBench>,
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
// This is essentially a hack, but we want to ensure that we send the correct node version
// to the telemetry.
polkadot_config.impl_version = polkadot_cli::Cli::impl_version();
polkadot_config.impl_name = polkadot_cli::Cli::impl_name();
let (full_node, collator_key) = build_polkadot_full_node(
polkadot_config,
parachain_config,
+1 -2
View File
@@ -310,8 +310,7 @@ pub fn run() -> Result<()> {
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
let state_version =
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: Block = generate_genesis_block(&config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
+1 -2
View File
@@ -567,8 +567,7 @@ pub fn run() -> Result<()> {
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
let state_version =
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: crate::service::Block =
generate_genesis_block(&config.chain_spec, state_version)