Polkadot companion for Substrate#10463 (#4519)

* Grandpa and Beefy protocol names include chain id

Signed-off-by: acatangiu <adrian@parity.io>

* chain_spec: include fork id

* use simplified protocol name

* fix after merge

* avoid using hash default, even for protocol names

* update lockfile for substrate

Co-authored-by: parity-processbot <>
This commit is contained in:
Adrian Catangiu
2022-01-05 19:43:08 +02:00
committed by GitHub
parent b93c6e68ab
commit 80606491e4
4 changed files with 281 additions and 222 deletions
+245 -219
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -1103,6 +1103,7 @@ pub fn polkadot_staging_testnet_config() -> Result<PolkadotChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1125,6 +1126,7 @@ pub fn kusama_staging_testnet_config() -> Result<KusamaChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1147,6 +1149,7 @@ pub fn westend_staging_testnet_config() -> Result<WestendChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1172,6 +1175,7 @@ pub fn rococo_staging_testnet_config() -> Result<RococoChainSpec, String> {
),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1649,6 +1653,7 @@ pub fn polkadot_development_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1667,6 +1672,7 @@ pub fn kusama_development_config() -> Result<KusamaChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1685,6 +1691,7 @@ pub fn westend_development_config() -> Result<WestendChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1707,6 +1714,7 @@ pub fn rococo_development_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1729,6 +1737,7 @@ pub fn versi_development_config() -> Result<RococoChainSpec, String> {
None,
Some("versi"),
None,
None,
Default::default(),
))
}
@@ -1752,6 +1761,7 @@ pub fn wococo_development_config() -> Result<RococoChainSpec, String> {
None,
Some(WOCOCO_DEV_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1783,6 +1793,7 @@ pub fn polkadot_local_testnet_config() -> Result<PolkadotChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1814,6 +1825,7 @@ pub fn kusama_local_testnet_config() -> Result<KusamaChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1845,6 +1857,7 @@ pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1877,6 +1890,7 @@ pub fn rococo_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1931,6 +1945,7 @@ pub fn wococo_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
@@ -1953,6 +1968,7 @@ pub fn versi_local_testnet_config() -> Result<RococoChainSpec, String> {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
))
}
+19 -3
View File
@@ -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,
};
@@ -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()));
}
{
@@ -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);
@@ -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;
@@ -45,6 +45,7 @@ pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}