From 5497069d544eea422c48146aa3ab00b1eb7cb0d7 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen <koushiro.cqx@gmail.com> Date: Sat, 21 May 2022 14:13:09 +0800 Subject: [PATCH] Unify rpc api and implementation name (#11469) * Unify rpc api and implementation name Signed-off-by: koushiro <koushiro.cqx@gmail.com> * MauanlSeal ==> ManualSealRpc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Remove extra Rpc naming in the structs Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Update doc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * fix merge Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> --- substrate/bin/node-template/node/src/rpc.rs | 8 ++-- substrate/bin/node/rpc/src/lib.rs | 37 ++++++++----------- substrate/client/beefy/rpc/src/lib.rs | 23 +++++------- .../client/consensus/babe/rpc/src/lib.rs | 12 +++--- .../client/finality-grandpa/rpc/src/lib.rs | 14 +++---- substrate/client/rpc/src/state/mod.rs | 8 ++-- substrate/client/sync-state-rpc/src/lib.rs | 10 ++--- substrate/frame/contracts/rpc/src/lib.rs | 6 +-- .../merkle-mountain-range/rpc/src/lib.rs | 7 ++-- .../frame/transaction-payment/rpc/src/lib.rs | 8 ++-- .../rpc/state-trie-migration-rpc/src/lib.rs | 8 ++-- substrate/utils/frame/rpc/system/src/lib.rs | 14 +++---- 12 files changed, 72 insertions(+), 83 deletions(-) diff --git a/substrate/bin/node-template/node/src/rpc.rs b/substrate/bin/node-template/node/src/rpc.rs index 7edae4d8147..981f375d0b4 100644 --- a/substrate/bin/node-template/node/src/rpc.rs +++ b/substrate/bin/node-template/node/src/rpc.rs @@ -39,14 +39,14 @@ where C::Api: BlockBuilder<Block>, P: TransactionPool + 'static, { - use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc}; - use substrate_frame_rpc_system::{SystemApiServer, SystemRpc}; + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; + use substrate_frame_rpc_system::{System, SystemApiServer}; let mut module = RpcModule::new(()); let FullDeps { client, pool, deny_unsafe } = deps; - module.merge(SystemRpc::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; - module.merge(TransactionPaymentRpc::new(client).into_rpc())?; + module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; + module.merge(TransactionPayment::new(client).into_rpc())?; // Extend this RPC with a custom API by using the following syntax. // `YourRpcStruct` should have a reference to a client, which is needed diff --git a/substrate/bin/node/rpc/src/lib.rs b/substrate/bin/node/rpc/src/lib.rs index 05aa973e102..e5b666195e1 100644 --- a/substrate/bin/node/rpc/src/lib.rs +++ b/substrate/bin/node/rpc/src/lib.rs @@ -37,12 +37,10 @@ use jsonrpsee::RpcModule; use node_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index}; use sc_client_api::AuxStore; use sc_consensus_babe::{Config, Epoch}; -use sc_consensus_babe_rpc::BabeRpc; use sc_consensus_epochs::SharedEpochChanges; use sc_finality_grandpa::{ FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, }; -use sc_finality_grandpa_rpc::GrandpaRpc; use sc_rpc::SubscriptionTaskExecutor; pub use sc_rpc_api::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; @@ -120,15 +118,15 @@ where B: sc_client_api::Backend<Block> + Send + Sync + 'static, B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>, { - use pallet_contracts_rpc::{ContractsApiServer, ContractsRpc}; - use pallet_mmr_rpc::{MmrApiServer, MmrRpc}; - use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc}; - use sc_consensus_babe_rpc::BabeApiServer; - use sc_finality_grandpa_rpc::GrandpaApiServer; + use pallet_contracts_rpc::{Contracts, ContractsApiServer}; + use pallet_mmr_rpc::{Mmr, MmrApiServer}; + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; + use sc_consensus_babe_rpc::{Babe, BabeApiServer}; + use sc_finality_grandpa_rpc::{Grandpa, GrandpaApiServer}; use sc_rpc::dev::{Dev, DevApiServer}; - use sc_sync_state_rpc::{SyncStateRpc, SyncStateRpcApiServer}; - use substrate_frame_rpc_system::{SystemApiServer, SystemRpc}; - use substrate_state_trie_migration_rpc::StateMigrationApiServer; + use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; + use substrate_frame_rpc_system::{System, SystemApiServer}; + use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer}; let mut io = RpcModule::new(()); let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa } = deps; @@ -142,15 +140,15 @@ where finality_provider, } = grandpa; - io.merge(SystemRpc::new(client.clone(), pool, deny_unsafe).into_rpc())?; + io.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; // Making synchronous calls in light client freezes the browser currently, // more context: https://github.com/paritytech/substrate/pull/3480 // These RPCs should use an asynchronous caller instead. - io.merge(ContractsRpc::new(client.clone()).into_rpc())?; - io.merge(MmrRpc::new(client.clone()).into_rpc())?; - io.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?; + io.merge(Contracts::new(client.clone()).into_rpc())?; + io.merge(Mmr::new(client.clone()).into_rpc())?; + io.merge(TransactionPayment::new(client.clone()).into_rpc())?; io.merge( - BabeRpc::new( + Babe::new( client.clone(), shared_epoch_changes.clone(), keystore, @@ -161,7 +159,7 @@ where .into_rpc(), )?; io.merge( - GrandpaRpc::new( + Grandpa::new( subscription_executor, shared_authority_set.clone(), shared_voter_state, @@ -172,14 +170,11 @@ where )?; io.merge( - SyncStateRpc::new(chain_spec, client.clone(), shared_authority_set, shared_epoch_changes)? + SyncState::new(chain_spec, client.clone(), shared_authority_set, shared_epoch_changes)? .into_rpc(), )?; - io.merge( - substrate_state_trie_migration_rpc::MigrationRpc::new(client.clone(), backend, deny_unsafe) - .into_rpc(), - )?; + io.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; io.merge(Dev::new(client, deny_unsafe).into_rpc())?; Ok(io) diff --git a/substrate/client/beefy/rpc/src/lib.rs b/substrate/client/beefy/rpc/src/lib.rs index ea35678a48b..c248d33cb6c 100644 --- a/substrate/client/beefy/rpc/src/lib.rs +++ b/substrate/client/beefy/rpc/src/lib.rs @@ -100,17 +100,17 @@ pub trait BeefyApi<Notification, Hash> { } /// Implements the BeefyApi RPC trait for interacting with BEEFY. -pub struct BeefyRpcHandler<Block: BlockT> { +pub struct Beefy<Block: BlockT> { signed_commitment_stream: BeefySignedCommitmentStream<Block>, beefy_best_block: Arc<RwLock<Option<Block::Hash>>>, executor: SubscriptionTaskExecutor, } -impl<Block> BeefyRpcHandler<Block> +impl<Block> Beefy<Block> where Block: BlockT, { - /// Creates a new BeefyRpcHandler instance. + /// Creates a new Beefy Rpc handler instance. pub fn new( signed_commitment_stream: BeefySignedCommitmentStream<Block>, best_block_stream: BeefyBestBlockStream<Block>, @@ -131,8 +131,7 @@ where } #[async_trait] -impl<Block> BeefyApiServer<notification::EncodedSignedCommitment, Block::Hash> - for BeefyRpcHandler<Block> +impl<Block> BeefyApiServer<notification::EncodedSignedCommitment, Block::Hash> for Beefy<Block> where Block: BlockT, { @@ -174,24 +173,20 @@ mod tests { use sp_runtime::traits::{BlakeTwo256, Hash}; use substrate_test_runtime_client::runtime::Block; - fn setup_io_handler() -> (RpcModule<BeefyRpcHandler<Block>>, BeefySignedCommitmentSender<Block>) - { + fn setup_io_handler() -> (RpcModule<Beefy<Block>>, BeefySignedCommitmentSender<Block>) { let (_, stream) = BeefyBestBlockStream::<Block>::channel(); setup_io_handler_with_best_block_stream(stream) } fn setup_io_handler_with_best_block_stream( best_block_stream: BeefyBestBlockStream<Block>, - ) -> (RpcModule<BeefyRpcHandler<Block>>, BeefySignedCommitmentSender<Block>) { + ) -> (RpcModule<Beefy<Block>>, BeefySignedCommitmentSender<Block>) { let (commitment_sender, commitment_stream) = BeefySignedCommitmentStream::<Block>::channel(); - let handler = BeefyRpcHandler::new( - commitment_stream, - best_block_stream, - sc_rpc::testing::test_executor(), - ) - .expect("Setting up the BEEFY RPC handler works"); + let handler = + Beefy::new(commitment_stream, best_block_stream, sc_rpc::testing::test_executor()) + .expect("Setting up the BEEFY RPC handler works"); (handler.into_rpc(), commitment_sender) } diff --git a/substrate/client/consensus/babe/rpc/src/lib.rs b/substrate/client/consensus/babe/rpc/src/lib.rs index d5f21606c62..af19d410346 100644 --- a/substrate/client/consensus/babe/rpc/src/lib.rs +++ b/substrate/client/consensus/babe/rpc/src/lib.rs @@ -49,7 +49,7 @@ pub trait BabeApi { } /// Provides RPC methods for interacting with Babe. -pub struct BabeRpc<B: BlockT, C, SC> { +pub struct Babe<B: BlockT, C, SC> { /// shared reference to the client. client: Arc<C>, /// shared reference to EpochChanges @@ -64,8 +64,8 @@ pub struct BabeRpc<B: BlockT, C, SC> { deny_unsafe: DenyUnsafe, } -impl<B: BlockT, C, SC> BabeRpc<B, C, SC> { - /// Creates a new instance of the BabeRpc handler. +impl<B: BlockT, C, SC> Babe<B, C, SC> { + /// Creates a new instance of the Babe Rpc handler. pub fn new( client: Arc<C>, shared_epoch_changes: SharedEpochChanges<B, Epoch>, @@ -79,7 +79,7 @@ impl<B: BlockT, C, SC> BabeRpc<B, C, SC> { } #[async_trait] -impl<B: BlockT, C, SC> BabeApiServer for BabeRpc<B, C, SC> +impl<B: BlockT, C, SC> BabeApiServer for Babe<B, C, SC> where B: BlockT, C: ProvideRuntimeApi<B> @@ -239,7 +239,7 @@ mod tests { fn test_babe_rpc_module( deny_unsafe: DenyUnsafe, - ) -> BabeRpc<Block, TestClient, sc_consensus::LongestChain<Backend, Block>> { + ) -> Babe<Block, TestClient, sc_consensus::LongestChain<Backend, Block>> { let builder = TestClientBuilder::new(); let (client, longest_chain) = builder.build_with_longest_chain(); let client = Arc::new(client); @@ -250,7 +250,7 @@ mod tests { let epoch_changes = link.epoch_changes().clone(); let keystore = create_temp_keystore::<AuthorityPair>(Sr25519Keyring::Alice).0; - BabeRpc::new(client.clone(), epoch_changes, keystore, config, longest_chain, deny_unsafe) + Babe::new(client.clone(), epoch_changes, keystore, config, longest_chain, deny_unsafe) } #[tokio::test] diff --git a/substrate/client/finality-grandpa/rpc/src/lib.rs b/substrate/client/finality-grandpa/rpc/src/lib.rs index cb51d71b20b..bdb86c125e2 100644 --- a/substrate/client/finality-grandpa/rpc/src/lib.rs +++ b/substrate/client/finality-grandpa/rpc/src/lib.rs @@ -66,7 +66,7 @@ pub trait GrandpaApi<Notification, Hash, Number> { } /// Provides RPC methods for interacting with GRANDPA. -pub struct GrandpaRpc<AuthoritySet, VoterState, Block: BlockT, ProofProvider> { +pub struct Grandpa<AuthoritySet, VoterState, Block: BlockT, ProofProvider> { executor: SubscriptionTaskExecutor, authority_set: AuthoritySet, voter_state: VoterState, @@ -74,9 +74,9 @@ pub struct GrandpaRpc<AuthoritySet, VoterState, Block: BlockT, ProofProvider> { finality_proof_provider: Arc<ProofProvider>, } impl<AuthoritySet, VoterState, Block: BlockT, ProofProvider> - GrandpaRpc<AuthoritySet, VoterState, Block, ProofProvider> + Grandpa<AuthoritySet, VoterState, Block, ProofProvider> { - /// Prepare a new [`GrandpaRpc`] + /// Prepare a new [`Grandpa`] Rpc handler. pub fn new( executor: SubscriptionTaskExecutor, authority_set: AuthoritySet, @@ -91,7 +91,7 @@ impl<AuthoritySet, VoterState, Block: BlockT, ProofProvider> #[async_trait] impl<AuthoritySet, VoterState, Block, ProofProvider> GrandpaApiServer<JustificationNotification, Block::Hash, NumberFor<Block>> - for GrandpaRpc<AuthoritySet, VoterState, Block, ProofProvider> + for Grandpa<AuthoritySet, VoterState, Block, ProofProvider> where VoterState: ReportVoterState + Send + Sync + 'static, AuthoritySet: ReportAuthoritySet + Send + Sync + 'static, @@ -243,7 +243,7 @@ mod tests { fn setup_io_handler<VoterState>( voter_state: VoterState, ) -> ( - RpcModule<GrandpaRpc<TestAuthoritySet, VoterState, Block, TestFinalityProofProvider>>, + RpcModule<Grandpa<TestAuthoritySet, VoterState, Block, TestFinalityProofProvider>>, GrandpaJustificationSender<Block>, ) where @@ -256,7 +256,7 @@ mod tests { voter_state: VoterState, finality_proof: Option<FinalityProof<Header>>, ) -> ( - RpcModule<GrandpaRpc<TestAuthoritySet, VoterState, Block, TestFinalityProofProvider>>, + RpcModule<Grandpa<TestAuthoritySet, VoterState, Block, TestFinalityProofProvider>>, GrandpaJustificationSender<Block>, ) where @@ -266,7 +266,7 @@ mod tests { let finality_proof_provider = Arc::new(TestFinalityProofProvider { finality_proof }); let executor = Arc::new(TaskExecutor::default()); - let rpc = GrandpaRpc::new( + let rpc = Grandpa::new( executor, TestAuthoritySet, voter_state, diff --git a/substrate/client/rpc/src/state/mod.rs b/substrate/client/rpc/src/state/mod.rs index 4b5b74950a4..232be4edc8a 100644 --- a/substrate/client/rpc/src/state/mod.rs +++ b/substrate/client/rpc/src/state/mod.rs @@ -167,7 +167,7 @@ pub fn new_full<BE, Block: BlockT, Client>( executor: SubscriptionTaskExecutor, deny_unsafe: DenyUnsafe, rpc_max_payload: Option<usize>, -) -> (StateApi<Block, Client>, ChildState<Block, Client>) +) -> (State<Block, Client>, ChildState<Block, Client>) where Block: BlockT + 'static, Block::Hash: Unpin, @@ -192,17 +192,17 @@ where rpc_max_payload, )); let backend = Box::new(self::state_full::FullState::new(client, executor, rpc_max_payload)); - (StateApi { backend, deny_unsafe }, ChildState { backend: child_backend }) + (State { backend, deny_unsafe }, ChildState { backend: child_backend }) } /// State API with subscriptions support. -pub struct StateApi<Block, Client> { +pub struct State<Block, Client> { backend: Box<dyn StateBackend<Block, Client>>, /// Whether to deny unsafe calls deny_unsafe: DenyUnsafe, } -impl<Block, Client> StateApiServer<Block::Hash> for StateApi<Block, Client> +impl<Block, Client> StateApiServer<Block::Hash> for State<Block, Client> where Block: BlockT + 'static, Client: Send + Sync + 'static, diff --git a/substrate/client/sync-state-rpc/src/lib.rs b/substrate/client/sync-state-rpc/src/lib.rs index 02a22a838b8..9540d94c579 100644 --- a/substrate/client/sync-state-rpc/src/lib.rs +++ b/substrate/client/sync-state-rpc/src/lib.rs @@ -37,7 +37,7 @@ //! ``` //! //! If the [`LightSyncStateExtension`] is not added as an extension to the chain spec, -//! the [`SyncStateRpc`] will fail at instantiation. +//! the [`SyncState`] will fail at instantiation. #![deny(unused_crate_dependencies)] @@ -125,21 +125,21 @@ pub struct LightSyncState<Block: BlockT> { /// An api for sync state RPC calls. #[rpc(client, server)] -pub trait SyncStateRpcApi { +pub trait SyncStateApi { /// Returns the JSON serialized chainspec running the node, with a sync state. #[method(name = "sync_state_genSyncSpec")] fn system_gen_sync_spec(&self, raw: bool) -> RpcResult<serde_json::Value>; } /// An api for sync state RPC calls. -pub struct SyncStateRpc<Block: BlockT, Client> { +pub struct SyncState<Block: BlockT, Client> { chain_spec: Box<dyn sc_chain_spec::ChainSpec>, client: Arc<Client>, shared_authority_set: SharedAuthoritySet<Block>, shared_epoch_changes: SharedEpochChanges<Block>, } -impl<Block, Client> SyncStateRpc<Block, Client> +impl<Block, Client> SyncState<Block, Client> where Block: BlockT, Client: HeaderBackend<Block> + sc_client_api::AuxStore + 'static, @@ -180,7 +180,7 @@ where } } -impl<Block, Backend> SyncStateRpcApiServer for SyncStateRpc<Block, Backend> +impl<Block, Backend> SyncStateApiServer for SyncState<Block, Backend> where Block: BlockT, Backend: HeaderBackend<Block> + sc_client_api::AuxStore + 'static, diff --git a/substrate/frame/contracts/rpc/src/lib.rs b/substrate/frame/contracts/rpc/src/lib.rs index 599e80676cb..77ae3f3ed35 100644 --- a/substrate/frame/contracts/rpc/src/lib.rs +++ b/substrate/frame/contracts/rpc/src/lib.rs @@ -173,12 +173,12 @@ where } /// Contracts RPC methods. -pub struct ContractsRpc<Client, Block> { +pub struct Contracts<Client, Block> { client: Arc<Client>, _marker: PhantomData<Block>, } -impl<Client, Block> ContractsRpc<Client, Block> { +impl<Client, Block> Contracts<Client, Block> { /// Create new `Contracts` with the given reference to the client. pub fn new(client: Arc<Client>) -> Self { Self { client, _marker: Default::default() } @@ -193,7 +193,7 @@ impl<Client, Block, AccountId, Balance, Hash> AccountId, Balance, Hash, - > for ContractsRpc<Client, Block> + > for Contracts<Client, Block> where Block: BlockT, Client: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>, diff --git a/substrate/frame/merkle-mountain-range/rpc/src/lib.rs b/substrate/frame/merkle-mountain-range/rpc/src/lib.rs index 12e4e11f882..75032d40f49 100644 --- a/substrate/frame/merkle-mountain-range/rpc/src/lib.rs +++ b/substrate/frame/merkle-mountain-range/rpc/src/lib.rs @@ -131,12 +131,12 @@ pub trait MmrApi<BlockHash> { } /// MMR RPC methods. -pub struct MmrRpc<Client, Block> { +pub struct Mmr<Client, Block> { client: Arc<Client>, _marker: PhantomData<Block>, } -impl<C, B> MmrRpc<C, B> { +impl<C, B> Mmr<C, B> { /// Create new `Mmr` with the given reference to the client. pub fn new(client: Arc<C>) -> Self { Self { client, _marker: Default::default() } @@ -144,8 +144,7 @@ impl<C, B> MmrRpc<C, B> { } #[async_trait] -impl<Client, Block, MmrHash> MmrApiServer<<Block as BlockT>::Hash> - for MmrRpc<Client, (Block, MmrHash)> +impl<Client, Block, MmrHash> MmrApiServer<<Block as BlockT>::Hash> for Mmr<Client, (Block, MmrHash)> where Block: BlockT, Client: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>, diff --git a/substrate/frame/transaction-payment/rpc/src/lib.rs b/substrate/frame/transaction-payment/rpc/src/lib.rs index b0be19fdb22..75ec42321ef 100644 --- a/substrate/frame/transaction-payment/rpc/src/lib.rs +++ b/substrate/frame/transaction-payment/rpc/src/lib.rs @@ -51,14 +51,14 @@ pub trait TransactionPaymentApi<BlockHash, ResponseType> { } /// Provides RPC methods to query a dispatchable's class, weight and fee. -pub struct TransactionPaymentRpc<C, P> { +pub struct TransactionPayment<C, P> { /// Shared reference to the client. client: Arc<C>, _marker: std::marker::PhantomData<P>, } -impl<C, P> TransactionPaymentRpc<C, P> { - /// Creates a new instance of the TransactionPaymentRpc helper. +impl<C, P> TransactionPayment<C, P> { + /// Creates a new instance of the TransactionPayment Rpc helper. pub fn new(client: Arc<C>) -> Self { Self { client, _marker: Default::default() } } @@ -84,7 +84,7 @@ impl From<Error> for i32 { #[async_trait] impl<C, Block, Balance> TransactionPaymentApiServer<<Block as BlockT>::Hash, RuntimeDispatchInfo<Balance>> - for TransactionPaymentRpc<C, Block> + for TransactionPayment<C, Block> where Block: BlockT, C: ProvideRuntimeApi<Block> + HeaderBackend<Block> + Send + Sync + 'static, diff --git a/substrate/utils/frame/rpc/state-trie-migration-rpc/src/lib.rs b/substrate/utils/frame/rpc/state-trie-migration-rpc/src/lib.rs index 531bf463f65..b6d403ff2fc 100644 --- a/substrate/utils/frame/rpc/state-trie-migration-rpc/src/lib.rs +++ b/substrate/utils/frame/rpc/state-trie-migration-rpc/src/lib.rs @@ -122,21 +122,21 @@ pub trait StateMigrationApi<BlockHash> { } /// An implementation of state migration specific RPC methods. -pub struct MigrationRpc<C, B, BA> { +pub struct StateMigration<C, B, BA> { client: Arc<C>, backend: Arc<BA>, deny_unsafe: DenyUnsafe, _marker: std::marker::PhantomData<(B, BA)>, } -impl<C, B, BA> MigrationRpc<C, B, BA> { +impl<C, B, BA> StateMigration<C, B, BA> { /// Create new state migration rpc for the given reference to the client. pub fn new(client: Arc<C>, backend: Arc<BA>, deny_unsafe: DenyUnsafe) -> Self { - MigrationRpc { client, backend, deny_unsafe, _marker: Default::default() } + StateMigration { client, backend, deny_unsafe, _marker: Default::default() } } } -impl<C, B, BA> StateMigrationApiServer<<B as BlockT>::Hash> for MigrationRpc<C, B, BA> +impl<C, B, BA> StateMigrationApiServer<<B as BlockT>::Hash> for StateMigration<C, B, BA> where B: BlockT, C: Send + Sync + 'static + sc_client_api::HeaderBackend<B>, diff --git a/substrate/utils/frame/rpc/system/src/lib.rs b/substrate/utils/frame/rpc/system/src/lib.rs index b044035c812..72ad99e435f 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<Error> for i32 { } /// An implementation of System-specific RPC methods on full client. -pub struct SystemRpc<P: TransactionPool, C, B> { +pub struct System<P: TransactionPool, C, B> { client: Arc<C>, pool: Arc<P>, deny_unsafe: DenyUnsafe, _marker: std::marker::PhantomData<B>, } -impl<P: TransactionPool, C, B> SystemRpc<P, C, B> { +impl<P: TransactionPool, C, B> System<P, C, B> { /// Create new `FullSystem` given client and transaction pool. pub fn new(client: Arc<C>, pool: Arc<P>, deny_unsafe: DenyUnsafe) -> Self { Self { client, pool, deny_unsafe, _marker: Default::default() } @@ -86,7 +86,7 @@ impl<P: TransactionPool, C, B> SystemRpc<P, C, B> { #[async_trait] impl<P, C, Block, AccountId, Index> - SystemApiServer<<Block as traits::Block>::Hash, AccountId, Index> for SystemRpc<P, C, Block> + SystemApiServer<<Block as traits::Block>::Hash, AccountId, Index> for System<P, C, Block> where C: sp_api::ProvideRuntimeApi<Block>, C: HeaderBackend<Block>, @@ -251,7 +251,7 @@ mod tests { let ext1 = new_transaction(1); block_on(pool.submit_one(&BlockId::number(0), source, ext1)).unwrap(); - let accounts = SystemRpc::new(client, pool, DenyUnsafe::Yes); + let accounts = System::new(client, pool, DenyUnsafe::Yes); // when let nonce = accounts.nonce(AccountKeyring::Alice.into()).await; @@ -270,7 +270,7 @@ mod tests { let pool = BasicPool::new_full(Default::default(), true.into(), None, spawner, client.clone()); - let accounts = SystemRpc::new(client, pool, DenyUnsafe::Yes); + let accounts = System::new(client, pool, DenyUnsafe::Yes); // when let res = accounts.dry_run(vec![].into(), None).await; @@ -289,7 +289,7 @@ mod tests { let pool = BasicPool::new_full(Default::default(), true.into(), None, spawner, client.clone()); - let accounts = SystemRpc::new(client, pool, DenyUnsafe::No); + let accounts = System::new(client, pool, DenyUnsafe::No); let tx = Transfer { from: AccountKeyring::Alice.into(), @@ -317,7 +317,7 @@ mod tests { let pool = BasicPool::new_full(Default::default(), true.into(), None, spawner, client.clone()); - let accounts = SystemRpc::new(client, pool, DenyUnsafe::No); + let accounts = System::new(client, pool, DenyUnsafe::No); let tx = Transfer { from: AccountKeyring::Alice.into(), -- GitLab