mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
grandpa-rpc don't share subscription manager, only executor (#7039)
* service builder: fix todo about jsonrpc Option workaround * grandpa-rpc: only share executor instead of sub manager * grandpa-rpc: fix compilation * grandpa-rpc: rename to subscription_executor * node/cli: remove another unused jsonrpc dependency * grandpa: apply style fixes from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -38,8 +38,6 @@ codec = { package = "parity-scale-codec", version = "1.3.4" }
|
||||
serde = { version = "1.0.102", features = ["derive"] }
|
||||
futures = { version = "0.3.1", features = ["compat"] }
|
||||
hex-literal = "0.3.1"
|
||||
jsonrpc-core = "14.2.0"
|
||||
jsonrpc-pubsub = "14.2.0"
|
||||
log = "0.4.8"
|
||||
rand = "0.7.2"
|
||||
structopt = { version = "0.3.8", optional = true }
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
(
|
||||
impl Fn(
|
||||
node_rpc::DenyUnsafe,
|
||||
jsonrpc_pubsub::manager::SubscriptionManager
|
||||
sc_rpc::SubscriptionTaskExecutor,
|
||||
) -> node_rpc::IoHandler,
|
||||
(
|
||||
sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>,
|
||||
@@ -119,7 +119,7 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
let select_chain = select_chain.clone();
|
||||
let keystore = keystore.clone();
|
||||
|
||||
let rpc_extensions_builder = move |deny_unsafe, subscriptions| {
|
||||
let rpc_extensions_builder = move |deny_unsafe, subscription_executor| {
|
||||
let deps = node_rpc::FullDeps {
|
||||
client: client.clone(),
|
||||
pool: pool.clone(),
|
||||
@@ -134,7 +134,7 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
shared_voter_state: shared_voter_state.clone(),
|
||||
shared_authority_set: shared_authority_set.clone(),
|
||||
justification_stream: justification_stream.clone(),
|
||||
subscriptions,
|
||||
subscription_executor,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
jsonrpc-core = "14.2.0"
|
||||
jsonrpc-pubsub = "14.2.0"
|
||||
node-primitives = { version = "2.0.0-rc6", path = "../primitives" }
|
||||
node-runtime = { version = "2.0.0-rc6", path = "../runtime" }
|
||||
pallet-contracts-rpc = { version = "0.8.0-rc6", path = "../../../frame/contracts/rpc/" }
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use jsonrpc_pubsub::manager::SubscriptionManager;
|
||||
use node_primitives::{Block, BlockNumber, AccountId, Index, Balance, Hash};
|
||||
use sc_consensus_babe::{Config, Epoch};
|
||||
use sc_consensus_babe_rpc::BabeRpcHandler;
|
||||
@@ -46,6 +45,7 @@ use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend};
|
||||
use sp_consensus::SelectChain;
|
||||
use sp_consensus_babe::BabeApi;
|
||||
use sc_rpc::SubscriptionTaskExecutor;
|
||||
use sp_transaction_pool::TransactionPool;
|
||||
|
||||
/// Light client extra dependencies.
|
||||
@@ -78,8 +78,8 @@ pub struct GrandpaDeps {
|
||||
pub shared_authority_set: SharedAuthoritySet<Hash, BlockNumber>,
|
||||
/// Receives notifications about justification events from Grandpa.
|
||||
pub justification_stream: GrandpaJustificationStream<Block>,
|
||||
/// Subscription manager to keep track of pubsub subscribers.
|
||||
pub subscriptions: SubscriptionManager,
|
||||
/// Executor to drive the subscription manager in the Grandpa RPC handler.
|
||||
pub subscription_executor: SubscriptionTaskExecutor,
|
||||
}
|
||||
|
||||
/// Full client dependencies.
|
||||
@@ -139,7 +139,7 @@ pub fn create_full<C, P, SC>(
|
||||
shared_voter_state,
|
||||
shared_authority_set,
|
||||
justification_stream,
|
||||
subscriptions,
|
||||
subscription_executor,
|
||||
} = grandpa;
|
||||
|
||||
io.extend_with(
|
||||
@@ -172,7 +172,7 @@ pub fn create_full<C, P, SC>(
|
||||
shared_authority_set,
|
||||
shared_voter_state,
|
||||
justification_stream,
|
||||
subscriptions,
|
||||
subscription_executor,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user