Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik committed Oct 2, 2023
1 parent eef18a0 commit e0c85d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
33 changes: 15 additions & 18 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ pub struct FullDeps<C, P, B> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls.
pub deny_unsafe: DenyUnsafe,
/// GRANDPA RPC dependencies.
pub grandpa: GrandpaDeps<B>,
}

/// GRANDPA RPC dependncies.
pub struct GrandpaDeps<B> {
/// Subscription task executor.
pub subscription_executor: SubscriptionTaskExecutor,
/// GRANDPA authority set.
Expand All @@ -37,8 +45,6 @@ pub struct FullDeps<C, P, B> {
pub justification_stream: GrandpaJustificationStream<Block>,
/// Finality proof provider.
pub finality_proof_provider: Arc<FinalityProofProvider<B, Block>>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}

/// Instantiate all full RPC extensions.
Expand All @@ -57,25 +63,16 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcModule::new(());
let FullDeps {
client,
pool,
subscription_executor,
shared_authority_set,
shared_voter_state,
justification_stream,
finality_proof_provider,
deny_unsafe,
} = deps;
let FullDeps { client, pool, deny_unsafe, grandpa } = deps;

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client, pool, deny_unsafe).into_rpc())?;
module.merge(
Grandpa::new(
subscription_executor.clone(),
shared_authority_set.clone(),
shared_voter_state.clone(),
justification_stream.clone(),
finality_proof_provider.clone(),
grandpa.subscription_executor,
grandpa.shared_authority_set,
grandpa.shared_voter_state,
grandpa.justification_stream,
grandpa.finality_proof_provider,
)
.into_rpc(),
)?;
Expand Down
12 changes: 7 additions & 5 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
subscription_executor,
shared_authority_set: shared_authority_set.clone(),
shared_voter_state: shared_voter_state.clone(),
justification_stream: justification_stream.clone(),
finality_proof_provider: finality_proof_provider.clone(),
deny_unsafe,
grandpa: crate::rpc::GrandpaDeps {
subscription_executor,
shared_authority_set: shared_authority_set.clone(),
shared_voter_state: shared_voter_state.clone(),
justification_stream: justification_stream.clone(),
finality_proof_provider: finality_proof_provider.clone(),
},
};
crate::rpc::create_full(deps).map_err(Into::into)
})
Expand Down

0 comments on commit e0c85d7

Please sign in to comment.