mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 06:08:00 +00:00
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:
Generated
+2
@@ -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,
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user