From 6250ae78cb18c76a9dc2b4a9120ad7efe418dccd Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Wed, 15 May 2024 17:46:08 +0800 Subject: [PATCH] chore: remove useless trait bounds from struct definition (#1429) --- client/cli/src/frontier_db_cmd/mapping_db.rs | 5 +++-- client/cli/src/frontier_db_cmd/meta_db.rs | 2 +- client/cli/src/frontier_db_cmd/mod.rs | 3 ++- client/db/src/kv/mod.rs | 6 +++--- client/db/src/lib.rs | 3 +-- client/db/src/sql/mod.rs | 4 ++-- client/mapping-sync/src/kv/worker.rs | 3 ++- client/mapping-sync/src/sql/mod.rs | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/client/cli/src/frontier_db_cmd/mapping_db.rs b/client/cli/src/frontier_db_cmd/mapping_db.rs index fc6b269caf..35983e4b3c 100644 --- a/client/cli/src/frontier_db_cmd/mapping_db.rs +++ b/client/cli/src/frontier_db_cmd/mapping_db.rs @@ -40,14 +40,15 @@ pub enum MappingKey { EthBlockOrTransactionHash(H256), } -pub struct MappingDb<'a, B: BlockT, C> { +pub struct MappingDb<'a, B, C> { cmd: &'a FrontierDbCmd, client: Arc, backend: Arc>, } -impl<'a, B: BlockT, C> MappingDb<'a, B, C> +impl<'a, B, C> MappingDb<'a, B, C> where + B: BlockT, C: HeaderBackend + ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, { diff --git a/client/cli/src/frontier_db_cmd/meta_db.rs b/client/cli/src/frontier_db_cmd/meta_db.rs index c94716c7fa..76134dfed4 100644 --- a/client/cli/src/frontier_db_cmd/meta_db.rs +++ b/client/cli/src/frontier_db_cmd/meta_db.rs @@ -58,7 +58,7 @@ impl FromStr for MetaKey { } } -pub struct MetaDb<'a, B: BlockT, C> { +pub struct MetaDb<'a, B, C> { cmd: &'a FrontierDbCmd, backend: Arc>, } diff --git a/client/cli/src/frontier_db_cmd/mod.rs b/client/cli/src/frontier_db_cmd/mod.rs index a88194e714..195709fcf1 100644 --- a/client/cli/src/frontier_db_cmd/mod.rs +++ b/client/cli/src/frontier_db_cmd/mod.rs @@ -98,12 +98,13 @@ pub enum DbValue { } impl FrontierDbCmd { - pub fn run( + pub fn run( &self, client: Arc, backend: Arc>, ) -> sc_cli::Result<()> where + B: BlockT, C: HeaderBackend + ProvideRuntimeApi, C::Api: fp_rpc::EthereumRuntimeRPCApi, { diff --git a/client/db/src/kv/mod.rs b/client/db/src/kv/mod.rs index 47f85704dd..af82834e0d 100644 --- a/client/db/src/kv/mod.rs +++ b/client/db/src/kv/mod.rs @@ -62,7 +62,7 @@ pub mod static_keys { } #[derive(Clone)] -pub struct Backend { +pub struct Backend { client: Arc, meta: Arc>, mapping: Arc>, @@ -180,7 +180,7 @@ impl> Backend { } } -pub struct MetaDb { +pub struct MetaDb { db: Arc>, _marker: PhantomData, } @@ -247,7 +247,7 @@ pub struct MappingCommitment { pub ethereum_transaction_hashes: Vec, } -pub struct MappingDb { +pub struct MappingDb { db: Arc>, write_lock: Arc>, _marker: PhantomData, diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index eea7f396df..916f040aaa 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -22,14 +22,13 @@ use std::sync::Arc; // Substrate pub use sc_client_db::DatabaseSource; -use sp_runtime::traits::Block as BlockT; pub mod kv; #[cfg(feature = "sql")] pub mod sql; #[derive(Clone)] -pub enum Backend { +pub enum Backend { KeyValue(Arc>), #[cfg(feature = "sql")] Sql(Arc>), diff --git a/client/db/src/sql/mod.rs b/client/db/src/sql/mod.rs index 5de8d96980..86cebf59f4 100644 --- a/client/db/src/sql/mod.rs +++ b/client/db/src/sql/mod.rs @@ -93,7 +93,7 @@ pub enum BackendConfig<'a> { } #[derive(Clone)] -pub struct Backend { +pub struct Backend { /// The Sqlite connection. pool: SqlitePool, /// The additional overrides for the logs handler. @@ -104,7 +104,7 @@ pub struct Backend { num_ops_timeout: i32, } -impl Backend +impl Backend where Block: BlockT, { diff --git a/client/mapping-sync/src/kv/worker.rs b/client/mapping-sync/src/kv/worker.rs index b9695382e1..7beccd0f0f 100644 --- a/client/mapping-sync/src/kv/worker.rs +++ b/client/mapping-sync/src/kv/worker.rs @@ -98,8 +98,9 @@ impl MappingSyncWorker { } } -impl Stream for MappingSyncWorker +impl Stream for MappingSyncWorker where + Block: BlockT, C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, C: HeaderBackend + StorageProvider, diff --git a/client/mapping-sync/src/sql/mod.rs b/client/mapping-sync/src/sql/mod.rs index 86c5b2db80..89e2d87630 100644 --- a/client/mapping-sync/src/sql/mod.rs +++ b/client/mapping-sync/src/sql/mod.rs @@ -63,7 +63,7 @@ pub struct SyncWorker { _phantom: std::marker::PhantomData<(Block, Backend, Client)>, } -impl SyncWorker +impl SyncWorker where Block: BlockT, Client: ProvideRuntimeApi,