Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Polkadot companion for Substrate#10463 #4519

Merged
merged 12 commits into from
Jan 5, 2022
Merged
16 changes: 16 additions & 0 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1125,6 +1126,7 @@ pub fn kusama_staging_testnet_config() -> Result<KusamaChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1147,6 +1149,7 @@ pub fn westend_staging_testnet_config() -> Result<WestendChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1172,6 +1175,7 @@ pub fn rococo_staging_testnet_config() -> Result<RococoChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1649,6 +1653,7 @@ pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1667,6 +1672,7 @@ pub fn kusama_development_config() -> Result<KusamaChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1685,6 +1691,7 @@ pub fn westend_development_config() -> Result<WestendChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1707,6 +1714,7 @@ pub fn rococo_development_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1729,6 +1737,7 @@ pub fn versi_development_config() -> Result<RococoChainSpec, String> {
None,
Some("versi"),
None,
None,
Default::default(),
))
}
Expand All @@ -1752,6 +1761,7 @@ pub fn wococo_development_config() -> Result<RococoChainSpec, String> {
None,
Some(WOCOCO_DEV_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1783,6 +1793,7 @@ pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1814,6 +1825,7 @@ pub fn kusama_local_testnet_config() -> Result<KusamaChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1845,6 +1857,7 @@ pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1877,6 +1890,7 @@ pub fn rococo_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand Down Expand Up @@ -1931,6 +1945,7 @@ pub fn wococo_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
Expand All @@ -1953,6 +1968,7 @@ pub fn versi_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
24 changes: 20 additions & 4 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use {
},
polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig,
polkadot_overseer::BlockInfo,
sc_client_api::ExecutorProvider,
sc_client_api::{BlockBackend, ExecutorProvider},
sp_trie::PrefixedMemoryDB,
tracing::info,
};
Expand Down Expand Up @@ -762,10 +762,24 @@ where
// Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change
// anything in terms of behaviour, but makes the logs more consistent with the other
// Substrate nodes.
config.network.extra_sets.push(grandpa::grandpa_peers_set_config());

let grandpa_protocol_name = grandpa::protocol_standard_name(
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
&config.chain_spec,
);
config
.network
.extra_sets
.push(grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));

let beefy_protocol_name = beefy_gadget::protocol_standard_name(
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
&config.chain_spec,
);
if chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi() {
config.network.extra_sets.push(beefy_gadget::beefy_peers_set_config());
config
.network
.extra_sets
.push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone()));
}

{
Expand Down Expand Up @@ -1080,6 +1094,7 @@ where
signed_commitment_sender: beefy_link,
min_block_delta: if chain_spec.is_wococo() { 4 } else { 8 },
prometheus_registry: prometheus_registry.clone(),
protocol_name: beefy_protocol_name,
};

let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _>(beefy_params);
Expand All @@ -1104,6 +1119,7 @@ where
keystore: keystore_opt,
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
protocol_name: grandpa_protocol_name,
};

let enable_grandpa = !disable_grandpa;
Expand Down
1 change: 1 addition & 0 deletions node/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}
Expand Down