Kitchensink chain: Add BEEFY support (#2856)

Related to https://github.com/paritytech/polkadot-sdk/issues/2787

Adding BEEFY support to the kitchensink chain in order to be able to
extend the current warp sync zombienet tests with BEEFY enabled
This commit is contained in:
Serban Iorga
2024-01-06 12:18:38 +01:00
committed by GitHub
parent 930c151928
commit 2e4b8996c4
14 changed files with 320 additions and 93 deletions
+27 -1
View File
@@ -37,10 +37,13 @@ use jsonrpsee::RpcModule;
use node_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce};
use sc_client_api::AuxStore;
use sc_consensus_babe::BabeWorkerHandle;
use sc_consensus_beefy::communication::notification::{
BeefyBestBlockStream, BeefyVersionedFinalityProofStream,
};
use sc_consensus_grandpa::{
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
};
use sc_rpc::SubscriptionTaskExecutor;
pub use sc_rpc::SubscriptionTaskExecutor;
pub use sc_rpc_api::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
@@ -72,6 +75,16 @@ pub struct GrandpaDeps<B> {
pub finality_provider: Arc<FinalityProofProvider<B, Block>>,
}
/// Dependencies for BEEFY
pub struct BeefyDeps {
/// Receives notifications about finality proof events from BEEFY.
pub beefy_finality_proof_stream: BeefyVersionedFinalityProofStream<Block>,
/// Receives notifications about best block events from BEEFY.
pub beefy_best_block_stream: BeefyBestBlockStream<Block>,
/// Executor to drive the subscription manager in the BEEFY RPC handler.
pub subscription_executor: SubscriptionTaskExecutor,
}
/// Full client dependencies.
pub struct FullDeps<C, P, SC, B> {
/// The client instance to use.
@@ -88,6 +101,8 @@ pub struct FullDeps<C, P, SC, B> {
pub babe: BabeDeps,
/// GRANDPA specific dependencies.
pub grandpa: GrandpaDeps<B>,
/// BEEFY specific dependencies.
pub beefy: BeefyDeps,
/// Shared statement store reference.
pub statement_store: Arc<dyn sp_statement_store::StatementStore>,
/// The backend used by the node.
@@ -106,6 +121,7 @@ pub fn create_full<C, P, SC, B>(
deny_unsafe,
babe,
grandpa,
beefy,
statement_store,
backend,
mixnet_api,
@@ -133,6 +149,7 @@ where
use mmr_rpc::{Mmr, MmrApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use sc_consensus_babe_rpc::{Babe, BabeApiServer};
use sc_consensus_beefy_rpc::{Beefy, BeefyApiServer};
use sc_consensus_grandpa_rpc::{Grandpa, GrandpaApiServer};
use sc_rpc::{
dev::{Dev, DevApiServer},
@@ -205,5 +222,14 @@ where
io.merge(mixnet)?;
}
io.merge(
Beefy::<Block>::new(
beefy.beefy_finality_proof_stream,
beefy.beefy_best_block_stream,
beefy.subscription_executor,
)?
.into_rpc(),
)?;
Ok(io)
}