diff --git a/crates/humanode-peer/src/cli/run.rs b/crates/humanode-peer/src/cli/run.rs index ab38af5f8..9a421c05c 100644 --- a/crates/humanode-peer/src/cli/run.rs +++ b/crates/humanode-peer/src/cli/run.rs @@ -39,7 +39,7 @@ pub async fn run() -> sc_cli::Result<()> { task_manager, import_queue, .. - } = service::new_partial(&config).await?; + } = service::new_partial(&config)?; Ok((cmd.run(client, import_queue), task_manager)) }) .await @@ -52,7 +52,7 @@ pub async fn run() -> sc_cli::Result<()> { client, task_manager, .. - } = service::new_partial(&config).await?; + } = service::new_partial(&config)?; Ok((cmd.run(client, config.substrate.database), task_manager)) }) .await @@ -65,7 +65,7 @@ pub async fn run() -> sc_cli::Result<()> { client, task_manager, .. - } = service::new_partial(&config).await?; + } = service::new_partial(&config)?; Ok((cmd.run(client, config.substrate.chain_spec), task_manager)) }) .await @@ -79,7 +79,7 @@ pub async fn run() -> sc_cli::Result<()> { task_manager, import_queue, .. - } = service::new_partial(&config).await?; + } = service::new_partial(&config)?; Ok((cmd.run(client, import_queue), task_manager)) }) .await @@ -100,7 +100,7 @@ pub async fn run() -> sc_cli::Result<()> { task_manager, backend, .. - } = service::new_partial(&config).await?; + } = service::new_partial(&config)?; let aux_revert = Box::new(|client, backend, blocks| { sc_consensus_babe::revert(Arc::clone(&client), backend, blocks)?; sc_consensus_grandpa::revert(client, blocks)?; @@ -162,7 +162,7 @@ pub async fn run() -> sc_cli::Result<()> { cmd.run::(config.substrate) } BenchmarkCmd::Block(cmd) => { - let partial = service::new_partial(&config).await?; + let partial = service::new_partial(&config)?; cmd.run(partial.client) } #[cfg(not(feature = "runtime-benchmarks"))] @@ -172,7 +172,7 @@ pub async fn run() -> sc_cli::Result<()> { ), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => { - let partial = service::new_partial(&config).await?; + let partial = service::new_partial(&config)?; let db = partial.backend.expose_db(); let storage = partial.backend.expose_storage(); @@ -184,7 +184,7 @@ pub async fn run() -> sc_cli::Result<()> { ), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Overhead(cmd) => { - let partial = service::new_partial(&config).await?; + let partial = service::new_partial(&config)?; let ext_builder = RemarkBuilder { client: Arc::clone(&partial.client), }; @@ -203,7 +203,7 @@ pub async fn run() -> sc_cli::Result<()> { ), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Extrinsic(cmd) => { - let partial = service::new_partial(&config).await?; + let partial = service::new_partial(&config)?; let existential_deposit = <::ExistentialDeposit as Get>::get(); let ext_factory = ExtrinsicFactory(vec![ Box::new(RemarkBuilder { @@ -233,7 +233,7 @@ pub async fn run() -> sc_cli::Result<()> { let runner = root.create_humanode_runner(cmd)?; runner .async_run(|config| async move { - let partial = service::new_partial(&config).await?; + let partial = service::new_partial(&config)?; let frontier_backend = match partial.other.4 { fc_db::Backend::KeyValue(kv_fb) => Arc::new(kv_fb), _ => { diff --git a/crates/humanode-peer/src/service/frontier.rs b/crates/humanode-peer/src/service/frontier.rs index f871eb9bf..7d5539f8b 100644 --- a/crates/humanode-peer/src/service/frontier.rs +++ b/crates/humanode-peer/src/service/frontier.rs @@ -24,7 +24,7 @@ pub fn db_config_dir(config: &sc_service::Configuration) -> std::path::PathBuf { } /// Create frontier backend. -pub async fn frontier_backend( +pub fn backend( config: &Configuration, client: Arc, fb_config: &configuration::FrontierBackend, @@ -40,7 +40,7 @@ pub async fn frontier_backend( let db_path = db_config_dir(config).join("sql"); std::fs::create_dir_all(&db_path)?; - let backend = fc_db::sql::Backend::new( + let backend = futures::executor::block_on(fc_db::sql::Backend::new( fc_db::sql::BackendConfig::Sqlite(fc_db::sql::SqliteBackendConfig { path: Path::new("sqlite:///") .join(db_path) @@ -54,8 +54,7 @@ pub async fn frontier_backend( fb_config.frontier_sql_backend_pool_size, std::num::NonZeroU32::new(fb_config.frontier_sql_backend_num_ops_timeout), Arc::clone(ð_overrides), - ) - .await + )) .map_err(|err| ServiceError::Application(err.into()))?; Ok(FrontierBackend::Sql(backend)) diff --git a/crates/humanode-peer/src/service/mod.rs b/crates/humanode-peer/src/service/mod.rs index d0cb16116..d8facb35f 100644 --- a/crates/humanode-peer/src/service/mod.rs +++ b/crates/humanode-peer/src/service/mod.rs @@ -87,7 +87,7 @@ pub fn keystore_container( } /// Extract substrate partial components. -pub async fn new_partial( +pub fn new_partial( config: &Configuration, ) -> Result< PartialComponents< @@ -170,13 +170,12 @@ pub async fn new_partial( Arc::clone(&client), )?; - let frontier_backend = frontier::frontier_backend( + let frontier_backend = frontier::backend( config, Arc::clone(&client), fronter_backend_config, fc_storage::overrides_handle(Arc::clone(&client)), - ) - .await?; + )?; let frontier_block_import = FrontierBlockImport::new(babe_block_import, Arc::clone(&client)); @@ -237,7 +236,7 @@ pub async fn new_full(config: Configuration) -> Result