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

Companion PR for warp sync support. #3382

Merged
9 commits merged into from
Aug 2, 2021
15 changes: 12 additions & 3 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,17 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
config.network.extra_sets.extend(peer_sets_info(is_authority));
}

config.network.request_response_protocols.push(sc_finality_grandpa_warp_sync::request_response_config_for_chain(
&config, task_manager.spawn_handle(), backend.clone(), import_setup.1.shared_authority_set().clone(),
));
let request_multiplexer = {
let (multiplexer, configs) = RequestMultiplexer::new();
config.network.request_response_protocols.extend(configs);
multiplexer
};

let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
import_setup.1.shared_authority_set().clone(),
));

let (network, system_rpc_tx, network_starter) =
service::build_network(service::BuildNetworkParams {
config: &config,
Expand All @@ -714,6 +716,7 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
import_queue,
on_demand: None,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -1136,6 +1139,11 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
telemetry.as_ref().map(|x| x.handle()),
)?;

let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
));

let (network, system_rpc_tx, network_starter) =
service::build_network(service::BuildNetworkParams {
config: &config,
Expand All @@ -1145,6 +1153,7 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
import_queue,
on_demand: Some(on_demand.clone()),
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;

let enable_grandpa = !config.disable_grandpa;
Expand Down
4 changes: 4 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,10 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities()
}

fn current_set_id() -> fg_primitives::SetId {
Grandpa::current_set_id()
}

fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
Expand Down
4 changes: 4 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,10 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities()
}

fn current_set_id() -> fg_primitives::SetId {
Grandpa::current_set_id()
}

fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
Expand Down
4 changes: 4 additions & 0 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,10 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities()
}

fn current_set_id() -> fg_primitives::SetId {
Grandpa::current_set_id()
}

fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
Expand Down
4 changes: 4 additions & 0 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities()
}

fn current_set_id() -> fg_primitives::SetId {
Grandpa::current_set_id()
}

fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
Expand Down
4 changes: 4 additions & 0 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,10 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities()
}

fn current_set_id() -> fg_primitives::SetId {
Grandpa::current_set_id()
}

fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
Expand Down