This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Companion PR for #6215 #1654
Merged
Merged
Companion PR for #6215 #1654
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c102a75
Companion PR for #6215
octol 1b9c0cc
Merge branch 'master' into jon/on-demand-grandpa-finality-api
octol b205ae0
rpc: fix reviewer comments
octol 8724ac9
Merge remote-tracking branch 'origin/master' into jon/on-demand-grand…
octol 991c9b5
Merge remote-tracking branch 'origin/master' into jon/on-demand-grand…
897a96c
"Update Substrate"
3b0f776
Merge branch 'master' into jon/on-demand-grandpa-finality-api
andresilva b0afadd
Merge branch 'master' into jon/on-demand-grandpa-finality-api
andresilva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,12 +23,14 @@ 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 sp_runtime::traits::BlakeTwo256; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
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 +59,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 +85,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 +99,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: Send + Sync + 'static + sc_client_api::Backend<Block>, | ||||||||||
<B as sc_client_api::Backend<Block>>::State: sp_state_machine::Backend<BlakeTwo256>, | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
{ | ||||||||||
use frame_rpc_system::{FullSystem, SystemApi}; | ||||||||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; | ||||||||||
|
@@ -120,6 +126,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 +153,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 | ||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be removed with the edits below.