diff --git a/Cargo.lock b/Cargo.lock index 50b11631c..286674a9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3805,7 +3805,7 @@ dependencies = [ [[package]] name = "fc-api" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "async-trait", "fp-storage", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "async-trait", "fp-consensus", @@ -3833,7 +3833,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "async-trait", "ethereum", @@ -3864,7 +3864,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fc-db", "fc-storage", @@ -3887,7 +3887,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -3942,7 +3942,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -3957,7 +3957,7 @@ dependencies = [ [[package]] name = "fc-storage" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -4149,7 +4149,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "hex", "impl-serde", @@ -4168,7 +4168,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "parity-scale-codec", @@ -4180,7 +4180,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -4193,7 +4193,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "evm", "frame-support", @@ -4209,7 +4209,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -4226,7 +4226,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "frame-support", "parity-scale-codec", @@ -4238,7 +4238,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "parity-scale-codec", "serde", @@ -8188,7 +8188,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ethereum", "ethereum-types", @@ -8211,7 +8211,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "environmental", "evm", @@ -8237,7 +8237,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fp-evm", ] @@ -8245,7 +8245,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bls12381" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "ark-bls12-381", "ark-ec", @@ -8257,7 +8257,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fp-evm", "sp-core", @@ -8287,7 +8287,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fp-evm", "frame-support", @@ -8299,7 +8299,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fp-evm", "num", @@ -8308,7 +8308,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "fp-evm", "ripemd", @@ -10528,7 +10528,7 @@ dependencies = [ [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "derive_more", "environmental", @@ -10585,7 +10585,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#cb1c8a774485c3fe1576281e2997cf2ff07f3c83" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v1.7.2#1fb09fb677efda7db5a9a2cc1391a77b34876876" dependencies = [ "case", "num_enum 0.7.3", diff --git a/node/src/service/frontier.rs b/node/src/service/frontier.rs index 80367c7a8..d525f80b4 100644 --- a/node/src/service/frontier.rs +++ b/node/src/service/frontier.rs @@ -53,7 +53,7 @@ pub fn spawn_tasks( task_manager: &TaskManager, client: Arc, backend: Arc, - frontier_backend: fc_db::Backend, + frontier_backend: Arc>, filter_pool: Option, overrides: Arc>, fee_history_cache: FeeHistoryCache, @@ -79,7 +79,7 @@ where BE: 'static + sc_client_api::backend::Backend, BE::State: sc_client_api::backend::StateBackend, { - match frontier_backend.clone() { + match &*frontier_backend { fc_db::Backend::KeyValue(bd) => { task_manager.spawn_essential_handle().spawn( "frontier-mapping-sync-worker", @@ -90,7 +90,7 @@ where client.clone(), backend.clone(), overrides.clone(), - Arc::new(bd), + bd.clone(), 3, 0, fc_mapping_sync::SyncStrategy::Parachain, @@ -107,10 +107,10 @@ where fc_mapping_sync::sql::SyncWorker::run( client.clone(), backend.clone(), - Arc::new(bd), + bd.clone(), client.import_notification_stream(), fc_mapping_sync::sql::SyncWorkerConfig { - read_notification_timeout: Duration::from_secs(10), + read_notification_timeout: Duration::from_secs(30), check_indexed_blocks_interval: Duration::from_secs(60), }, fc_mapping_sync::SyncStrategy::Parachain, @@ -168,9 +168,9 @@ where let (debug_task, debug_requester) = DebugHandler::task( Arc::clone(&client), Arc::clone(&backend), - match frontier_backend { - fc_db::Backend::KeyValue(bd) => Arc::new(bd), - fc_db::Backend::Sql(bd) => Arc::new(bd), + match &*frontier_backend { + fc_db::Backend::KeyValue(bd) => bd.clone(), + fc_db::Backend::Sql(bd) => bd.clone(), }, Arc::clone(&permit_pool), Arc::clone(&overrides), @@ -216,7 +216,7 @@ pub(crate) fn backend( client: Arc, config: &sc_service::Configuration, eth_rpc_config: EthRpcConfig, -) -> Result, String> +) -> Result, String> where B: 'static + sp_runtime::traits::Block, BE: 'static + sc_client_api::backend::Backend, @@ -229,9 +229,9 @@ where let db_config_dir = db_config_dir(config); let overrides = fc_storage::overrides_handle(client.clone()); match eth_rpc_config.frontier_backend_type { - FrontierBackendType::KeyValue => Ok(fc_db::Backend::::KeyValue( + FrontierBackendType::KeyValue => Ok(fc_db::Backend::::KeyValue(Arc::new( fc_db::kv::Backend::open(Arc::clone(&client), &config.database, &db_config_dir)?, - )), + ))), FrontierBackendType::Sql => { let db_path = db_config_dir.join("sql"); std::fs::create_dir_all(&db_path).expect("failed creating sql db directory"); @@ -251,7 +251,7 @@ where overrides, )) .unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err)); - Ok(fc_db::Backend::::Sql(backend)) + Ok(fc_db::Backend::::Sql(Arc::new(backend))) }, } } diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 2207ef42c..79e7e3a52 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -78,7 +78,7 @@ type Service = sc_service::PartialComponents< sc_consensus::DefaultImportQueue, sc_transaction_pool::FullPool>, ( - fc_db::Backend, + fc_db::Backend>, Option, fc_rpc_core::types::FeeHistoryCache, fc_rpc_core::types::FeeHistoryCacheLimit, @@ -308,6 +308,7 @@ where ) .await .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; + let frontier_backend = Arc::new(frontier_backend); let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); let import_queue_service = import_queue.service(); @@ -382,7 +383,6 @@ where let pool = transaction_pool.clone(); let network = network.clone(); let filter_pool = filter_pool.clone(); - let frontier_backend = frontier_backend.clone(); let overrides = overrides; let fee_history_cache = fee_history_cache.clone(); let max_past_logs = eth_rpc_config.max_past_logs; @@ -411,9 +411,9 @@ where network: network.clone(), sync: sync_service.clone(), filter_pool: filter_pool.clone(), - frontier_backend: match frontier_backend.clone() { - fc_db::Backend::KeyValue(bd) => Arc::new(bd), - fc_db::Backend::Sql(bd) => Arc::new(bd), + frontier_backend: match &*frontier_backend { + fc_db::Backend::KeyValue(bd) => bd.clone(), + fc_db::Backend::Sql(bd) => bd.clone(), }, max_past_logs, fee_history_cache: fee_history_cache.clone(), @@ -754,6 +754,7 @@ where ); } + let frontier_backend = Arc::new(frontier_backend); let force_authoring = config.force_authoring; let backoff_authoring_blocks = None::<()>; let slot_duration = sc_consensus_aura::slot_duration(&*client)?; @@ -917,9 +918,9 @@ where network: network.clone(), sync: sync_service.clone(), filter_pool: filter_pool.clone(), - frontier_backend: match frontier_backend.clone() { - fc_db::Backend::KeyValue(bd) => Arc::new(bd), - fc_db::Backend::Sql(bd) => Arc::new(bd), + frontier_backend: match &*frontier_backend { + fc_db::Backend::KeyValue(bd) => bd.clone(), + fc_db::Backend::Sql(bd) => bd.clone(), }, max_past_logs, fee_history_cache: fee_history_cache.clone(),