diff --git a/substrate/bin/node/rpc/src/lib.rs b/substrate/bin/node/rpc/src/lib.rs index 4646524a25ba..936ca5870aeb 100644 --- a/substrate/bin/node/rpc/src/lib.rs +++ b/substrate/bin/node/rpc/src/lib.rs @@ -86,7 +86,7 @@ pub struct BeefyDeps { } /// Full client dependencies. -pub struct FullDeps { +pub struct FullDeps { /// The client instance to use. pub client: Arc, /// Transaction pool instance. @@ -141,7 +141,7 @@ where C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BabeApi, C::Api: BlockBuilder, - P: TransactionPool + 'static, + P: TransactionPool + 'static + ?Sized, SC: SelectChain + 'static, B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::backend::StateBackend>, diff --git a/substrate/client/basic-authorship/src/basic_authorship.rs b/substrate/client/basic-authorship/src/basic_authorship.rs index 1519c76c42c0..b188632480b1 100644 --- a/substrate/client/basic-authorship/src/basic_authorship.rs +++ b/substrate/client/basic-authorship/src/basic_authorship.rs @@ -59,7 +59,7 @@ const DEFAULT_SOFT_DEADLINE_PERCENT: Percent = Percent::from_percent(50); const LOG_TARGET: &'static str = "basic-authorship"; /// [`Proposer`] factory. -pub struct ProposerFactory { +pub struct ProposerFactory { spawn_handle: Box, /// The client instance. client: Arc, @@ -87,7 +87,7 @@ pub struct ProposerFactory { _phantom: PhantomData, } -impl Clone for ProposerFactory { +impl Clone for ProposerFactory { fn clone(&self) -> Self { Self { spawn_handle: self.spawn_handle.clone(), @@ -103,7 +103,7 @@ impl Clone for ProposerFactory { } } -impl ProposerFactory { +impl ProposerFactory { /// Create a new proposer factory. /// /// Proof recording will be disabled when using proposers built by this instance to build @@ -129,7 +129,7 @@ impl ProposerFactory { } } -impl ProposerFactory { +impl ProposerFactory { /// Create a new proposer factory with proof recording enabled. /// /// Each proposer created by this instance will record a proof while building a block. @@ -162,7 +162,7 @@ impl ProposerFactory { } } -impl ProposerFactory { +impl ProposerFactory { /// Set the default block size limit in bytes. /// /// The default value for the block size limit is: @@ -193,7 +193,7 @@ impl ProposerFactory { impl ProposerFactory where - A: TransactionPool + 'static, + A: TransactionPool + 'static + ?Sized, Block: BlockT, C: HeaderBackend + ProvideRuntimeApi + Send + Sync + 'static, C::Api: ApiExt + BlockBuilderApi, @@ -228,7 +228,7 @@ where impl sp_consensus::Environment for ProposerFactory where - A: TransactionPool + 'static, + A: TransactionPool + 'static + ?Sized, Block: BlockT, C: HeaderBackend + ProvideRuntimeApi + CallApiAt + Send + Sync + 'static, C::Api: ApiExt + BlockBuilderApi, @@ -244,7 +244,7 @@ where } /// The proposer logic. -pub struct Proposer { +pub struct Proposer { spawn_handle: Box, client: Arc, parent_hash: Block::Hash, @@ -261,7 +261,7 @@ pub struct Proposer { impl sp_consensus::Proposer for Proposer where - A: TransactionPool + 'static, + A: TransactionPool + 'static + ?Sized, Block: BlockT, C: HeaderBackend + ProvideRuntimeApi + CallApiAt + Send + Sync + 'static, C::Api: ApiExt + BlockBuilderApi, @@ -312,7 +312,7 @@ const MAX_SKIPPED_TRANSACTIONS: usize = 8; impl Proposer where - A: TransactionPool, + A: TransactionPool + ?Sized, Block: BlockT, C: HeaderBackend + ProvideRuntimeApi + CallApiAt + Send + Sync + 'static, C::Api: ApiExt + BlockBuilderApi, diff --git a/substrate/client/mixnet/src/run.rs b/substrate/client/mixnet/src/run.rs index 5ed45a0e799e..1a7ff9536b02 100644 --- a/substrate/client/mixnet/src/run.rs +++ b/substrate/client/mixnet/src/run.rs @@ -161,7 +161,7 @@ pub async fn run( C: BlockchainEvents + ProvideRuntimeApi + HeaderBackend, C::Api: MixnetApi, S: SyncOracle, - P: TransactionPool + LocalTransactionPool + 'static, + P: TransactionPool + LocalTransactionPool + 'static + ?Sized, { let local_peer_id = network.local_peer_id(); let Some(local_peer_id) = to_core_peer_id(&local_peer_id) else { diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction.rs index 723440d1b111..3b48ace5df1f 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction.rs @@ -43,7 +43,7 @@ use std::sync::Arc; pub(crate) const LOG_TARGET: &str = "rpc-spec-v2"; /// An API for transaction RPC calls. -pub struct Transaction { +pub struct Transaction { /// Substrate client. client: Arc, /// Transactions pool. @@ -52,7 +52,7 @@ pub struct Transaction { executor: SubscriptionTaskExecutor, } -impl Transaction { +impl Transaction { /// Creates a new [`Transaction`]. pub fn new(client: Arc, pool: Arc, executor: SubscriptionTaskExecutor) -> Self { Transaction { client, pool, executor } @@ -67,7 +67,7 @@ impl Transaction { const TX_SOURCE: TransactionSource = TransactionSource::External; #[async_trait] -impl TransactionApiServer> for Transaction +impl TransactionApiServer> for Transaction where Pool: TransactionPool + Sync + Send + 'static, Pool::Hash: Unpin, diff --git a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs index 68c19010e31c..f419a70f5cb2 100644 --- a/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs +++ b/substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs @@ -43,7 +43,7 @@ use std::{collections::HashMap, sync::Arc}; use super::error::ErrorBroadcast; /// An API for transaction RPC calls. -pub struct TransactionBroadcast { +pub struct TransactionBroadcast { /// Substrate client. client: Arc, /// Transactions pool. @@ -57,14 +57,14 @@ pub struct TransactionBroadcast { } /// The state of a broadcast operation. -struct BroadcastState { +struct BroadcastState { /// Handle to abort the running future that broadcasts the transaction. handle: AbortHandle, /// Associated tx hash. tx_hash: ::Hash, } -impl TransactionBroadcast { +impl TransactionBroadcast { /// Creates a new [`TransactionBroadcast`]. pub fn new( client: Arc, @@ -116,7 +116,7 @@ const TX_SOURCE: TransactionSource = TransactionSource::External; #[async_trait] impl TransactionBroadcastApiServer for TransactionBroadcast where - Pool: TransactionPool + Sync + Send + 'static, + Pool: TransactionPool + Sync + Send + 'static + ?Sized, Pool::Error: IntoPoolError, ::Hash: Unpin, Client: HeaderBackend + BlockchainEvents + Send + Sync + 'static, diff --git a/substrate/client/rpc/src/author/mod.rs b/substrate/client/rpc/src/author/mod.rs index 975f66406a6a..756c4c265e82 100644 --- a/substrate/client/rpc/src/author/mod.rs +++ b/substrate/client/rpc/src/author/mod.rs @@ -48,7 +48,7 @@ use self::error::{Error, Result}; pub use sc_rpc_api::author::*; /// Authoring API -pub struct Author { +pub struct Author { /// Substrate client client: Arc, /// Transactions pool @@ -61,7 +61,7 @@ pub struct Author { executor: SubscriptionTaskExecutor, } -impl Author { +impl Author { /// Create new instance of Authoring API. pub fn new( client: Arc, @@ -82,7 +82,7 @@ impl Author { const TX_SOURCE: TransactionSource = TransactionSource::External; #[async_trait] -impl AuthorApiServer, BlockHash

> for Author +impl AuthorApiServer, BlockHash

> for Author where P: TransactionPool + Sync + Send + 'static, Client: HeaderBackend + ProvideRuntimeApi + Send + Sync + 'static, diff --git a/substrate/client/service/src/builder.rs b/substrate/client/service/src/builder.rs index 06fc2ea3b304..73aee40c0f9f 100644 --- a/substrate/client/service/src/builder.rs +++ b/substrate/client/service/src/builder.rs @@ -349,7 +349,7 @@ where } /// Parameters to pass into `build`. -pub struct SpawnTasksParams<'a, TBl: BlockT, TCl, TExPool, TRpc, Backend> { +pub struct SpawnTasksParams<'a, TBl: BlockT, TCl, TExPool: ?Sized, TRpc, Backend> { /// The service configuration. pub config: Configuration, /// A shared client returned by `new_full_parts`. @@ -405,7 +405,8 @@ where TBl::Hash: Unpin, TBl::Header: Unpin, TBackend: 'static + sc_client_api::backend::Backend + Send, - TExPool: MaintainedTransactionPool::Hash> + 'static, + TExPool: + MaintainedTransactionPool::Hash> + 'static + ?Sized, { let SpawnTasksParams { mut config, @@ -536,7 +537,7 @@ pub async fn propagate_transaction_notifications( telemetry: Option, ) where Block: BlockT, - ExPool: MaintainedTransactionPool::Hash>, + ExPool: MaintainedTransactionPool::Hash> + ?Sized, { // transaction notifications transaction_pool @@ -623,7 +624,8 @@ where + 'static, TBackend: sc_client_api::backend::Backend + 'static, >::Api: sp_session::SessionKeys + sp_api::Metadata, - TExPool: MaintainedTransactionPool::Hash> + 'static, + TExPool: + MaintainedTransactionPool::Hash> + 'static + ?Sized, TBl::Hash: Unpin, TBl::Header: Unpin, { @@ -736,7 +738,7 @@ pub struct BuildNetworkParams< 'a, TBl: BlockT, TNet: NetworkBackend::Hash>, - TExPool, + TExPool: ?Sized, TImpQu, TCl, > { @@ -788,7 +790,7 @@ where + HeaderBackend + BlockchainEvents + 'static, - TExPool: TransactionPool::Hash> + 'static, + TExPool: TransactionPool::Hash> + 'static + ?Sized, TImpQu: ImportQueue + 'static, TNet: NetworkBackend::Hash>, { diff --git a/substrate/client/service/src/lib.rs b/substrate/client/service/src/lib.rs index d251fd2b58fa..ceb8f14997b6 100644 --- a/substrate/client/service/src/lib.rs +++ b/substrate/client/service/src/lib.rs @@ -130,7 +130,14 @@ impl RpcHandlers { } /// An incomplete set of chain components, but enough to run the chain ops subcommands. -pub struct PartialComponents { +pub struct PartialComponents< + Client, + Backend, + SelectChain, + ImportQueue, + TransactionPool: ?Sized, + Other, +> { /// A shared client instance. pub client: Arc, /// A shared backend instance. @@ -425,12 +432,12 @@ where } /// Transaction pool adapter. -pub struct TransactionPoolAdapter { +pub struct TransactionPoolAdapter { pool: Arc

, client: Arc, } -impl TransactionPoolAdapter { +impl TransactionPoolAdapter { /// Constructs a new instance of [`TransactionPoolAdapter`]. pub fn new(pool: Arc

, client: Arc) -> Self { Self { pool, client } @@ -442,7 +449,7 @@ impl TransactionPoolAdapter { /// Function extracted to simplify the test and prevent creating `ServiceFactory`. fn transactions_to_propagate(pool: &Pool) -> Vec<(H, B::Extrinsic)> where - Pool: TransactionPool, + Pool: TransactionPool + ?Sized, B: BlockT, H: std::hash::Hash + Eq + sp_runtime::traits::Member + sp_runtime::traits::MaybeSerialize, E: IntoPoolError + From, @@ -467,7 +474,7 @@ where + Send + Sync + 'static, - Pool: 'static + TransactionPool, + Pool: 'static + TransactionPool + ?Sized, B: BlockT, H: std::hash::Hash + Eq + sp_runtime::traits::Member + sp_runtime::traits::MaybeSerialize, E: 'static + IntoPoolError + From, diff --git a/substrate/client/service/src/metrics.rs b/substrate/client/service/src/metrics.rs index a411a83a784e..6e3dc4704039 100644 --- a/substrate/client/service/src/metrics.rs +++ b/substrate/client/service/src/metrics.rs @@ -184,7 +184,7 @@ impl MetricsService { ) where TBl: Block, TCl: ProvideRuntimeApi + UsageProvider, - TExPool: MaintainedTransactionPool::Hash>, + TExPool: MaintainedTransactionPool::Hash> + ?Sized, TNet: NetworkStatusProvider, TSync: SyncStatusProvider, { diff --git a/substrate/client/transaction-pool/api/src/lib.rs b/substrate/client/transaction-pool/api/src/lib.rs index 0a313c5b782d..400c0cced974 100644 --- a/substrate/client/transaction-pool/api/src/lib.rs +++ b/substrate/client/transaction-pool/api/src/lib.rs @@ -407,7 +407,7 @@ pub trait LocalTransactionPool: Send + Sync { ) -> Result; } -impl LocalTransactionPool for Arc { +impl LocalTransactionPool for Arc { type Block = T::Block; type Hash = T::Hash; diff --git a/substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs b/substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs index 8017f67455d7..890279958c2a 100644 --- a/substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs +++ b/substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs @@ -768,7 +768,7 @@ pub async fn notification_future(client: Arc, txpoo where Block: BlockT, Client: sc_client_api::BlockchainEvents, - Pool: MaintainedTransactionPool, + Pool: MaintainedTransactionPool + ?Sized, { let import_stream = client .import_notification_stream() diff --git a/substrate/utils/frame/rpc/system/src/lib.rs b/substrate/utils/frame/rpc/system/src/lib.rs index bb0592599b2a..3e76b1254caa 100644 --- a/substrate/utils/frame/rpc/system/src/lib.rs +++ b/substrate/utils/frame/rpc/system/src/lib.rs @@ -70,14 +70,14 @@ impl From for i32 { } /// An implementation of System-specific RPC methods on full client. -pub struct System { +pub struct System { client: Arc, pool: Arc

, deny_unsafe: DenyUnsafe, _marker: std::marker::PhantomData, } -impl System { +impl System { /// Create new `FullSystem` given client and transaction pool. pub fn new(client: Arc, pool: Arc

, deny_unsafe: DenyUnsafe) -> Self { Self { client, pool, deny_unsafe, _marker: Default::default() } @@ -93,7 +93,7 @@ where C: Send + Sync + 'static, C::Api: AccountNonceApi, C::Api: BlockBuilder, - P: TransactionPool + 'static, + P: TransactionPool + 'static + ?Sized, Block: traits::Block, AccountId: Clone + Display + Codec + Send + 'static, Nonce: Clone + Display + Codec + Send + traits::AtLeast32Bit + 'static, @@ -178,7 +178,7 @@ where /// placed after all ready txpool transactions. fn adjust_nonce(pool: &P, account: AccountId, nonce: Nonce) -> Nonce where - P: TransactionPool, + P: TransactionPool + ?Sized, AccountId: Clone + std::fmt::Display + Encode, Nonce: Clone + std::fmt::Display + Encode + traits::AtLeast32Bit + 'static, {