diff --git a/Cargo.lock b/Cargo.lock index bbfec3eaa8..bc163eb1f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/client/relay-chain-inprocess-interface/Cargo.toml b/client/relay-chain-inprocess-interface/Cargo.toml index f53b472e4d..37f3255345 100644 --- a/client/relay-chain-inprocess-interface/Cargo.toml +++ b/client/relay-chain-inprocess-interface/Cargo.toml @@ -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" } diff --git a/client/relay-chain-inprocess-interface/src/lib.rs b/client/relay-chain-inprocess-interface/src/lib.rs index 5c461463b4..3e7af9ed60 100644 --- a/client/relay-chain-inprocess-interface/src/lib.rs +++ b/client/relay-chain-inprocess-interface/src/lib.rs @@ -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, task_manager: &mut TaskManager, hwbench: Option, ) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option)> { + // 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, diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index 7e011cac09..47691d41e0 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -310,8 +310,7 @@ pub fn run() -> Result<()> { let parachain_account = AccountIdConversion::::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())); diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index c6753564ab..daf24797b5 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -567,8 +567,7 @@ pub fn run() -> Result<()> { let parachain_account = AccountIdConversion::::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)