mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
* Companion PR for #5732 Add subscription RPC for listening on GRANDPA justifications. * grandpa-rpc: some merge fixes * "Update Substrate" Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+142
-137
File diff suppressed because it is too large
Load Diff
@@ -157,7 +157,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
|||||||
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
|
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
|
||||||
sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>,
|
sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>,
|
||||||
(
|
(
|
||||||
impl Fn(polkadot_rpc::DenyUnsafe) -> polkadot_rpc::RpcExtension,
|
impl Fn(polkadot_rpc::DenyUnsafe, polkadot_rpc::SubscriptionManager) -> polkadot_rpc::RpcExtension,
|
||||||
(
|
(
|
||||||
babe::BabeBlockImport<
|
babe::BabeBlockImport<
|
||||||
Block, FullClient<RuntimeApi, Executor>, FullGrandpaBlockImport<RuntimeApi, Executor>
|
Block, FullClient<RuntimeApi, Executor>, FullGrandpaBlockImport<RuntimeApi, Executor>
|
||||||
@@ -227,6 +227,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
|||||||
config.prometheus_registry(),
|
config.prometheus_registry(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
let justification_stream = grandpa_link.justification_stream();
|
||||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||||
let shared_voter_state = grandpa::SharedVoterState::empty();
|
let shared_voter_state = grandpa::SharedVoterState::empty();
|
||||||
|
|
||||||
@@ -242,7 +243,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
|||||||
let transaction_pool = transaction_pool.clone();
|
let transaction_pool = transaction_pool.clone();
|
||||||
let select_chain = select_chain.clone();
|
let select_chain = select_chain.clone();
|
||||||
|
|
||||||
move |deny_unsafe| -> polkadot_rpc::RpcExtension {
|
move |deny_unsafe, subscriptions| -> polkadot_rpc::RpcExtension {
|
||||||
let deps = polkadot_rpc::FullDeps {
|
let deps = polkadot_rpc::FullDeps {
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
pool: transaction_pool.clone(),
|
pool: transaction_pool.clone(),
|
||||||
@@ -256,6 +257,8 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
|||||||
grandpa: polkadot_rpc::GrandpaDeps {
|
grandpa: polkadot_rpc::GrandpaDeps {
|
||||||
shared_voter_state: shared_voter_state.clone(),
|
shared_voter_state: shared_voter_state.clone(),
|
||||||
shared_authority_set: shared_authority_set.clone(),
|
shared_authority_set: shared_authority_set.clone(),
|
||||||
|
justification_stream: justification_stream.clone(),
|
||||||
|
subscriptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
jsonrpc-core = "14.0.3"
|
jsonrpc-core = "14.0.3"
|
||||||
|
jsonrpc-pubsub = "14.0.3"
|
||||||
polkadot-primitives = { path = "../primitives" }
|
polkadot-primitives = { path = "../primitives" }
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use sc_client_api::light::{Fetcher, RemoteBlockchain};
|
|||||||
use sc_consensus_babe::Epoch;
|
use sc_consensus_babe::Epoch;
|
||||||
use sp_block_builder::BlockBuilder;
|
use sp_block_builder::BlockBuilder;
|
||||||
pub use sc_rpc::DenyUnsafe;
|
pub use sc_rpc::DenyUnsafe;
|
||||||
|
pub use jsonrpc_pubsub::manager::SubscriptionManager;
|
||||||
|
|
||||||
/// A type representing all RPC extensions.
|
/// A type representing all RPC extensions.
|
||||||
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
||||||
@@ -62,6 +63,10 @@ pub struct GrandpaDeps {
|
|||||||
pub shared_voter_state: sc_finality_grandpa::SharedVoterState,
|
pub shared_voter_state: sc_finality_grandpa::SharedVoterState,
|
||||||
/// Authority set info.
|
/// Authority set info.
|
||||||
pub shared_authority_set: sc_finality_grandpa::SharedAuthoritySet<Hash, BlockNumber>,
|
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.
|
||||||
|
pub subscriptions: jsonrpc_pubsub::manager::SubscriptionManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Full client dependencies
|
/// Full client dependencies
|
||||||
@@ -114,6 +119,8 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
|||||||
let GrandpaDeps {
|
let GrandpaDeps {
|
||||||
shared_voter_state,
|
shared_voter_state,
|
||||||
shared_authority_set,
|
shared_authority_set,
|
||||||
|
justification_stream,
|
||||||
|
subscriptions,
|
||||||
} = grandpa;
|
} = grandpa;
|
||||||
|
|
||||||
io.extend_with(
|
io.extend_with(
|
||||||
@@ -138,6 +145,8 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
|||||||
GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
||||||
shared_authority_set,
|
shared_authority_set,
|
||||||
shared_voter_state,
|
shared_voter_state,
|
||||||
|
justification_stream,
|
||||||
|
subscriptions,
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
io
|
io
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
|||||||
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
|
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
|
||||||
sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>,
|
sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>,
|
||||||
(
|
(
|
||||||
impl Fn(polkadot_rpc::DenyUnsafe) -> polkadot_rpc::RpcExtension,
|
impl Fn(polkadot_rpc::DenyUnsafe, polkadot_rpc::SubscriptionManager) -> polkadot_rpc::RpcExtension,
|
||||||
(
|
(
|
||||||
babe::BabeBlockImport<
|
babe::BabeBlockImport<
|
||||||
Block, FullClient<RuntimeApi, Executor>, FullGrandpaBlockImport<RuntimeApi, Executor>
|
Block, FullClient<RuntimeApi, Executor>, FullGrandpaBlockImport<RuntimeApi, Executor>
|
||||||
@@ -202,6 +202,7 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
|||||||
config.prometheus_registry(),
|
config.prometheus_registry(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
let justification_stream = grandpa_link.justification_stream();
|
||||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||||
let shared_voter_state = grandpa::SharedVoterState::empty();
|
let shared_voter_state = grandpa::SharedVoterState::empty();
|
||||||
|
|
||||||
@@ -217,7 +218,7 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
|||||||
let transaction_pool = transaction_pool.clone();
|
let transaction_pool = transaction_pool.clone();
|
||||||
let select_chain = select_chain.clone();
|
let select_chain = select_chain.clone();
|
||||||
|
|
||||||
move |deny_unsafe| -> polkadot_rpc::RpcExtension {
|
move |deny_unsafe, subscriptions| -> polkadot_rpc::RpcExtension {
|
||||||
let deps = polkadot_rpc::FullDeps {
|
let deps = polkadot_rpc::FullDeps {
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
pool: transaction_pool.clone(),
|
pool: transaction_pool.clone(),
|
||||||
@@ -231,6 +232,8 @@ pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool)
|
|||||||
grandpa: polkadot_rpc::GrandpaDeps {
|
grandpa: polkadot_rpc::GrandpaDeps {
|
||||||
shared_voter_state: shared_voter_state.clone(),
|
shared_voter_state: shared_voter_state.clone(),
|
||||||
shared_authority_set: shared_authority_set.clone(),
|
shared_authority_set: shared_authority_set.clone(),
|
||||||
|
justification_stream: justification_stream.clone(),
|
||||||
|
subscriptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user