Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,13 +849,24 @@ where
.extra_sets
.push(grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));

let beefy_protocol_name =
beefy_gadget::protocol_standard_name(&genesis_hash, &config.chain_spec);
let beefy_gossip_proto_name =
beefy_gadget::gossip_protocol_name(&genesis_hash, config.chain_spec.fork_id());
// `beefy_on_demand_justifications_handler` is given to `beefy-gadget` task to be run,
// while `beefy_req_resp_cfg` is added to `config.network.request_response_protocols`.
let (beefy_on_demand_justifications_handler, beefy_req_resp_cfg) =
beefy_gadget::communication::request_response::BeefyJustifsRequestHandler::new(
&genesis_hash,
config.chain_spec.fork_id(),
client.clone(),
);
if enable_beefy {
config
.network
.extra_sets
.push(beefy_gadget::beefy_peers_set_config(beefy_protocol_name.clone()));
.push(beefy_gadget::communication::beefy_peers_set_config(
beefy_gossip_proto_name.clone(),
));
config.network.request_response_protocols.push(beefy_req_resp_cfg);
}

let peerset_protocol_names =
Expand Down Expand Up @@ -1174,16 +1185,23 @@ where
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };

if enable_beefy {
let justifications_protocol_name = beefy_on_demand_justifications_handler.protocol_name();
let network_params = beefy_gadget::BeefyNetworkParams {
network: network.clone(),
gossip_protocol_name: beefy_gossip_proto_name,
justifications_protocol_name,
_phantom: core::marker::PhantomData::<Block>,
};
let beefy_params = beefy_gadget::BeefyParams {
client: client.clone(),
backend: backend.clone(),
runtime: client.clone(),
key_store: keystore_opt.clone(),
network: network.clone(),
network_params,
min_block_delta: if chain_spec.is_wococo() { 4 } else { 8 },
prometheus_registry: prometheus_registry.clone(),
protocol_name: beefy_protocol_name,
links: beefy_links,
on_demand_justifications_handler: beefy_on_demand_justifications_handler,
};

let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _, _>(beefy_params);
Expand Down
4 changes: 3 additions & 1 deletion rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ pub struct GrandpaDeps<B> {
pub finality_provider: Arc<FinalityProofProvider<B, Block>>,
}

use beefy_gadget::notification::{BeefyBestBlockStream, BeefyVersionedFinalityProofStream};
use beefy_gadget::communication::notification::{
BeefyBestBlockStream, BeefyVersionedFinalityProofStream,
};
/// Dependencies for BEEFY
pub struct BeefyDeps {
/// Receives notifications about finality proof events from BEEFY.
Expand Down