Unverified Commit 22a384a5 authored by André Silva's avatar André Silva Committed by GitHub
Browse files

grandpa: enable observer for light client (#3019)

* grandpa: enable observer for light client

* update Substrate

* service: fix missing import

* runtime: bump spec versions

Co-authored-by: parity-processbot <>
parent 71bd3e0d
Pipeline #139479 passed with stages
in 15 minutes and 7 seconds
This diff is collapsed.
......@@ -25,7 +25,6 @@ mod parachains_db;
#[cfg(feature = "full-node")]
use {
std::time::Duration,
tracing::info,
polkadot_network_bridge::RequestMultiplexer,
polkadot_node_core_av_store::Config as AvailabilityConfig,
......@@ -51,6 +50,7 @@ use sp_core::traits::SpawnNamed;
use polkadot_subsystem::jaeger;
use std::sync::Arc;
use std::time::Duration;
use prometheus_endpoint::Registry;
use sc_executor::native_executor_instance;
......@@ -1004,7 +1004,7 @@ pub fn new_full<RuntimeApi, Executor>(
name: Some(name),
observer_enabled: false,
keystore: keystore_opt,
is_authority: role.is_authority(),
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
};
......@@ -1112,6 +1112,8 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
telemetry
});
config.network.extra_sets.push(grandpa::grandpa_peers_set_config());
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
......@@ -1122,7 +1124,7 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
on_demand.clone(),
));
let (grandpa_block_import, _) = grandpa::block_import(
let (grandpa_block_import, grandpa_link) = grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
......@@ -1172,6 +1174,26 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
block_announce_validator_builder: None,
})?;
let enable_grandpa = !config.disable_grandpa;
if enable_grandpa {
let name = config.network.node_name.clone();
let config = grandpa::Config {
gossip_duration: Duration::from_millis(1000),
justification_period: 512,
name: Some(name),
observer_enabled: false,
keystore: None,
local_role: config.role.clone(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
};
task_manager.spawn_handle().spawn_blocking(
"grandpa-observer",
grandpa::run_grandpa_observer(config, grandpa_link, network.clone())?,
);
}
if config.offchain_worker.enabled {
let _ = service::build_offchain_workers(
&config,
......
......@@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 9030,
spec_version: 9031,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
......
......@@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("polkadot"),
impl_name: create_runtime_str!("parity-polkadot"),
authoring_version: 0,
spec_version: 9030,
spec_version: 9031,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
......
......@@ -110,7 +110,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("rococo"),
impl_name: create_runtime_str!("parity-rococo-v1.6"),
authoring_version: 0,
spec_version: 9003,
spec_version: 9004,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
......
......@@ -118,7 +118,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("westend"),
impl_name: create_runtime_str!("parity-westend"),
authoring_version: 2,
spec_version: 9030,
spec_version: 9031,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment