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

companion for substrate#13883 #7059

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 2 additions & 6 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ where
babe::block_import(babe_config.clone(), beefy_block_import, client.clone())?;

let slot_duration = babe_link.config().slot_duration();
let import_queue = babe::import_queue(
let (import_queue, babe_worker_handle) = babe::import_queue(
babe_link.clone(),
block_import.clone(),
Some(Box::new(justification_import)),
Expand Down Expand Up @@ -552,9 +552,6 @@ where
Some(shared_authority_set.clone()),
);

let shared_epoch_changes = babe_link.epoch_changes().clone();
let slot_duration = babe_config.slot_duration();
andresilva marked this conversation as resolved.
Show resolved Hide resolved

let import_setup = (block_import, grandpa_link, babe_link, beefy_voter_links);
let rpc_setup = shared_voter_state.clone();

Expand All @@ -576,8 +573,7 @@ where
chain_spec: chain_spec.cloned_box(),
deny_unsafe,
babe: polkadot_rpc::BabeDeps {
babe_config: babe_config.clone(),
shared_epoch_changes: shared_epoch_changes.clone(),
babe_worker_handle: babe_worker_handle.clone(),
keystore: keystore.clone(),
},
grandpa: polkadot_rpc::GrandpaDeps {
Expand Down
22 changes: 6 additions & 16 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::sync::Arc;
use jsonrpsee::RpcModule;
use polkadot_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce};
use sc_client_api::AuxStore;
use sc_consensus_babe::{BabeConfiguration, Epoch};
use sc_consensus_beefy::communication::notification::{
BeefyBestBlockStream, BeefyVersionedFinalityProofStream,
};
Expand All @@ -42,10 +41,8 @@ pub type RpcExtension = RpcModule<()>;

/// Extra dependencies for BABE.
pub struct BabeDeps {
/// BABE protocol config.
pub babe_config: BabeConfiguration,
/// BABE pending epoch changes.
pub shared_epoch_changes: sc_consensus_epochs::SharedEpochChanges<Block, Epoch>,
/// A handle to the BABE worker for issuing requests.
pub babe_worker_handle: sc_consensus_babe::BabeWorkerHandle<Block>,
/// The keystore that manages the keys of the node.
pub keystore: KeystorePtr,
}
Expand Down Expand Up @@ -129,7 +126,7 @@ where
let mut io = RpcModule::new(());
let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, beefy } =
deps;
let BabeDeps { keystore, babe_config, shared_epoch_changes } = babe;
let BabeDeps { babe_worker_handle, keystore } = babe;
let GrandpaDeps {
shared_voter_state,
shared_authority_set,
Expand All @@ -143,15 +140,8 @@ where
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
io.merge(Mmr::new(client.clone()).into_rpc())?;
io.merge(
Babe::new(
client.clone(),
shared_epoch_changes.clone(),
keystore,
babe_config,
select_chain,
deny_unsafe,
)
.into_rpc(),
Babe::new(client.clone(), babe_worker_handle.clone(), keystore, select_chain, deny_unsafe)
.into_rpc(),
)?;
io.merge(
Grandpa::new(
Expand All @@ -164,7 +154,7 @@ where
.into_rpc(),
)?;
io.merge(
SyncState::new(chain_spec, client, shared_authority_set, shared_epoch_changes)?.into_rpc(),
SyncState::new(chain_spec, client, shared_authority_set, babe_worker_handle)?.into_rpc(),
)?;

io.merge(
Expand Down