Companion PR for 'Add missing fields to the light sync state #7225' (#1801)

* Add sync_state_items

* Add SyncStateRpc

* "Update Substrate"

Co-authored-by: parity-processbot <>
This commit is contained in:
Ashley
2020-10-15 12:28:00 +02:00
committed by GitHub
parent 5ba73b5b7b
commit c7e729e07b
6 changed files with 188 additions and 184 deletions
+19 -6
View File
@@ -28,9 +28,11 @@ use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};
use sp_consensus::SelectChain;
use sp_consensus_babe::BabeApi;
use sp_keystore::SyncCryptoStorePtr;
use sc_client_api::AuxStore;
use sc_client_api::light::{Fetcher, RemoteBlockchain};
use sc_consensus_babe::Epoch;
use sc_finality_grandpa::FinalityProofProvider;
use sc_sync_state_rpc::{SyncStateRpcApi, SyncStateRpcHandler};
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
/// A type representing all RPC extensions.
@@ -80,6 +82,8 @@ pub struct FullDeps<C, P, SC, B> {
pub pool: Arc<P>,
/// The SelectChain Strategy
pub select_chain: SC,
/// A copy of the chain spec.
pub chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
/// BABE specific dependencies.
@@ -90,9 +94,8 @@ pub struct FullDeps<C, P, SC, B> {
/// Instantiate all RPC extensions.
pub fn create_full<C, P, SC, B>(deps: FullDeps<C, P, SC, B>) -> RpcExtension where
C: ProvideRuntimeApi<Block>,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error=BlockChainError>,
C: Send + Sync + 'static,
C: ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore +
HeaderMetadata<Block, Error=BlockChainError> + Send + Sync + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BabeApi<Block>,
@@ -112,6 +115,7 @@ pub fn create_full<C, P, SC, B>(deps: FullDeps<C, P, SC, B>) -> RpcExtension whe
client,
pool,
select_chain,
chain_spec,
deny_unsafe,
babe,
grandpa,
@@ -138,8 +142,8 @@ pub fn create_full<C, P, SC, B>(deps: FullDeps<C, P, SC, B>) -> RpcExtension whe
io.extend_with(
sc_consensus_babe_rpc::BabeApi::to_delegate(
BabeRpcHandler::new(
client,
shared_epoch_changes,
client.clone(),
shared_epoch_changes.clone(),
keystore,
babe_config,
select_chain,
@@ -149,13 +153,22 @@ pub fn create_full<C, P, SC, B>(deps: FullDeps<C, P, SC, B>) -> RpcExtension whe
);
io.extend_with(
GrandpaApi::to_delegate(GrandpaRpcHandler::new(
shared_authority_set,
shared_authority_set.clone(),
shared_voter_state,
justification_stream,
subscription_executor,
finality_provider,
))
);
io.extend_with(
SyncStateRpcApi::to_delegate(SyncStateRpcHandler::new(
chain_spec,
client,
shared_authority_set,
shared_epoch_changes,
deny_unsafe,
))
);
io
}