mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
* Companion PR for #6215 * rpc: fix reviewer comments * "Update Substrate" Co-authored-by: parity-processbot <> Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Generated
+136
-134
File diff suppressed because it is too large
Load Diff
@@ -134,7 +134,10 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
||||
grandpa::LinkHalf<Block, FullClient<RuntimeApi, Executor>, FullSelectChain>,
|
||||
babe::BabeLink<Block>
|
||||
),
|
||||
grandpa::SharedVoterState,
|
||||
(
|
||||
grandpa::SharedVoterState,
|
||||
Arc<GrandpaFinalityProofProvider<FullBackend, Block>>,
|
||||
),
|
||||
)
|
||||
>,
|
||||
Error
|
||||
@@ -200,9 +203,11 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
||||
let justification_stream = grandpa_link.justification_stream();
|
||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||
let shared_voter_state = grandpa::SharedVoterState::empty();
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
||||
|
||||
let import_setup = (block_import.clone(), grandpa_link, babe_link.clone());
|
||||
let rpc_setup = shared_voter_state.clone();
|
||||
let rpc_setup = (shared_voter_state.clone(), finality_proof_provider.clone());
|
||||
|
||||
let babe_config = babe_link.config().clone();
|
||||
let shared_epoch_changes = babe_link.epoch_changes().clone();
|
||||
@@ -229,6 +234,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
||||
shared_authority_set: shared_authority_set.clone(),
|
||||
justification_stream: justification_stream.clone(),
|
||||
subscription_executor,
|
||||
finality_provider: finality_proof_provider.clone(),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -316,8 +322,7 @@ fn new_full<RuntimeApi, Executor>(
|
||||
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
||||
let (shared_voter_state, finality_proof_provider) = rpc_setup;
|
||||
|
||||
let (network, network_status_sinks, system_rpc_tx, network_starter) =
|
||||
service::build_network(service::BuildNetworkParams {
|
||||
@@ -357,8 +362,6 @@ fn new_full<RuntimeApi, Executor>(
|
||||
|
||||
let (block_import, link_half, babe_link) = import_setup;
|
||||
|
||||
let shared_voter_state = rpc_setup;
|
||||
|
||||
let overseer_client = client.clone();
|
||||
let spawner = task_manager.spawn_handle();
|
||||
let leaves: Vec<_> = select_chain.clone()
|
||||
|
||||
+13
-6
@@ -23,12 +23,13 @@ use std::sync::Arc;
|
||||
use polkadot_primitives::v0::{Block, BlockNumber, AccountId, Nonce, Balance, Hash};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use txpool_api::TransactionPool;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};
|
||||
use sp_consensus::SelectChain;
|
||||
use sp_consensus_babe::BabeApi;
|
||||
use sc_client_api::light::{Fetcher, RemoteBlockchain};
|
||||
use sc_consensus_babe::Epoch;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sc_finality_grandpa::FinalityProofProvider;
|
||||
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
@@ -57,19 +58,21 @@ pub struct BabeDeps {
|
||||
}
|
||||
|
||||
/// Dependencies for GRANDPA
|
||||
pub struct GrandpaDeps {
|
||||
pub struct GrandpaDeps<B> {
|
||||
/// Voting round info.
|
||||
pub shared_voter_state: sc_finality_grandpa::SharedVoterState,
|
||||
/// Authority set info.
|
||||
pub shared_authority_set: sc_finality_grandpa::SharedAuthoritySet<Hash, BlockNumber>,
|
||||
/// Receives notifications about justification events from Grandpa.
|
||||
pub justification_stream: sc_finality_grandpa::GrandpaJustificationStream<Block>,
|
||||
/// Subscription manager to keep track of pubsub subscribers.
|
||||
/// Executor to drive the subscription manager in the Grandpa RPC handler.
|
||||
pub subscription_executor: sc_rpc::SubscriptionTaskExecutor,
|
||||
/// Finality proof provider.
|
||||
pub finality_provider: Arc<FinalityProofProvider<B, Block>>,
|
||||
}
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P, SC> {
|
||||
pub struct FullDeps<C, P, SC, B> {
|
||||
/// The client instance to use.
|
||||
pub client: Arc<C>,
|
||||
/// Transaction pool instance.
|
||||
@@ -81,11 +84,11 @@ pub struct FullDeps<C, P, SC> {
|
||||
/// BABE specific dependencies.
|
||||
pub babe: BabeDeps,
|
||||
/// GRANDPA specific dependencies.
|
||||
pub grandpa: GrandpaDeps,
|
||||
pub grandpa: GrandpaDeps<B>,
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
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,
|
||||
@@ -95,6 +98,8 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
SC: SelectChain<Block> + 'static,
|
||||
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
|
||||
B::State: sc_client_api::StateBackend<sp_runtime::traits::HashFor<Block>>,
|
||||
{
|
||||
use frame_rpc_system::{FullSystem, SystemApi};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
@@ -120,6 +125,7 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
shared_authority_set,
|
||||
justification_stream,
|
||||
subscription_executor,
|
||||
finality_provider,
|
||||
} = grandpa;
|
||||
|
||||
io.extend_with(
|
||||
@@ -146,6 +152,7 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
shared_voter_state,
|
||||
justification_stream,
|
||||
subscription_executor,
|
||||
finality_provider,
|
||||
))
|
||||
);
|
||||
io
|
||||
|
||||
@@ -132,7 +132,10 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
||||
grandpa::LinkHalf<Block, FullClient<RuntimeApi, Executor>, FullSelectChain>,
|
||||
babe::BabeLink<Block>
|
||||
),
|
||||
grandpa::SharedVoterState,
|
||||
(
|
||||
grandpa::SharedVoterState,
|
||||
Arc<GrandpaFinalityProofProvider<FullBackend, Block>>,
|
||||
),
|
||||
)
|
||||
>,
|
||||
Error
|
||||
@@ -203,9 +206,11 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
||||
let justification_stream = grandpa_link.justification_stream();
|
||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||
let shared_voter_state = grandpa::SharedVoterState::empty();
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
||||
|
||||
let import_setup = (block_import.clone(), grandpa_link, babe_link.clone());
|
||||
let rpc_setup = shared_voter_state.clone();
|
||||
let rpc_setup = (shared_voter_state.clone(), finality_proof_provider.clone());
|
||||
|
||||
let babe_config = babe_link.config().clone();
|
||||
let shared_epoch_changes = babe_link.epoch_changes().clone();
|
||||
@@ -232,6 +237,7 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
||||
shared_authority_set: shared_authority_set.clone(),
|
||||
justification_stream: justification_stream.clone(),
|
||||
subscription_executor,
|
||||
finality_provider: finality_proof_provider.clone(),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -303,8 +309,7 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
||||
let (shared_voter_state, finality_proof_provider) = rpc_setup;
|
||||
|
||||
let (network, network_status_sinks, system_rpc_tx, network_starter) =
|
||||
service::build_network(service::BuildNetworkParams {
|
||||
@@ -345,8 +350,6 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
|
||||
let (block_import, link_half, babe_link) = import_setup;
|
||||
|
||||
let shared_voter_state = rpc_setup;
|
||||
|
||||
if role.is_authority() {
|
||||
let proposer = consensus::ProposerFactory::new(
|
||||
client.clone(),
|
||||
|
||||
Reference in New Issue
Block a user