From eb3b4f2651ffe682f93b2a81906a24a22a472dbf Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Tue, 29 Jul 2025 14:54:56 +0300 Subject: [PATCH] rustfmt ghost rpc and fix typos Signed-off-by: Uncle Stretch --- Cargo.toml | 2 +- rpc/src/lib.rs | 58 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 83a0c9a..83f469c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ homepage.workspace = true [workspace.package] license = "GPL-3.0-only" authors = ["571nky", "57r37ch", "f4750"] -version = "0.7.207" +version = "0.7.208" edition = "2021" homepage = "https://ghostchain.io" repository = "https://git.ghostchain.io/ghostchain/ghost-node" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index c31345b..a7549a4 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -1,17 +1,15 @@ use std::sync::Arc; -use jsonrpsee::RpcModule; -use primitives::{ - AccountId, Balance, Block, BlockNumber, Hash, Nonce, -}; -use sc_client_api::AuxStore; +use babe_primitives::BabeApi; +use block_builder_api::BlockBuilder; +use consensus_common::SelectChain; use grandpa::FinalityProofProvider; +use jsonrpsee::RpcModule; +use primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce}; +use sc_client_api::AuxStore; pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; use sp_api::ProvideRuntimeApi; -use block_builder_api::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; -use consensus_common::SelectChain; -use babe_primitives::BabeApi; use sp_keystore::KeystorePtr; use tx_pool_api::TransactionPool; @@ -61,7 +59,16 @@ pub struct FullDeps { } pub fn create_full_rpc( - FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, backend } : FullDeps, + FullDeps { + client, + pool, + select_chain, + chain_spec, + deny_unsafe, + babe, + grandpa, + backend, + }: FullDeps, ) -> Result> where C: ProvideRuntimeApi @@ -80,20 +87,19 @@ where B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::StateBackend>, { - use frame_rpc_system::{System, SystemApiServer}; - use pallet_transaction_payment_rpc::{ - TransactionPayment, TransactionPaymentApiServer, - }; use babe_rpc::{Babe, BabeApiServer}; + use frame_rpc_system::{System, SystemApiServer}; use grandpa_rpc::{Grandpa, GrandpaApiServer}; + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer}; use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; - use substrate_state_trie_migration_rpc::{ - StateMigration, StateMigrationApiServer, - }; + use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer}; let mut io = RpcModule::new(()); - let BabeDeps { babe_worker_handle, keystore } = babe; + let BabeDeps { + babe_worker_handle, + keystore, + } = babe; let GrandpaDeps { shared_voter_state, shared_authority_set, @@ -103,10 +109,13 @@ where } = grandpa; let chain_name = chain_spec.name().to_string(); - let genesis_hash = client.hash(0).ok().flatten().expect("Genesis block exists; qed;"); + let genesis_hash = client + .hash(0) + .ok() + .flatten() + .expect("Genesis block exists; qed;"); let properties = chain_spec.properties(); - io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?; io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; @@ -119,7 +128,8 @@ where keystore, select_chain, deny_unsafe, - ).into_rpc() + ) + .into_rpc(), )?; io.merge( @@ -129,7 +139,8 @@ where shared_voter_state, justification_stream, finality_provider, - ).into_rpc(), + ) + .into_rpc(), )?; io.merge( @@ -137,8 +148,9 @@ where chain_spec, client.clone(), shared_authority_set, - babe_worker_handle - )?.into_rpc(), + babe_worker_handle, + )? + .into_rpc(), )?; Ok(io)