From f0d970358744cdf06eae9497a08e045492660af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Fri, 24 Feb 2023 16:52:56 +0200 Subject: [PATCH] Feature/fix db name collision (#3103) * Fix db naming collision * Increase gateway timeout to accommodate bandwidth spending time --- clients/client-core/src/config/mod.rs | 4 ++-- clients/credential/src/main.rs | 7 +++++-- common/config/src/lib.rs | 2 +- nym-api/src/support/config/mod.rs | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index a48b2b59b9..5d9a243bbb 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use nym_config::defaults::NymNetworkDetails; -use nym_config::{NymConfig, OptionalSet, DB_FILE_NAME}; +use nym_config::{NymConfig, OptionalSet, CRED_DB_FILE_NAME}; use nym_sphinx::params::PacketSize; use serde::{Deserialize, Serialize}; use std::marker::PhantomData; @@ -579,7 +579,7 @@ impl Client { } fn default_database_path(id: &str) -> PathBuf { - T::default_data_directory(id).join(DB_FILE_NAME) + T::default_data_directory(id).join(CRED_DB_FILE_NAME) } } diff --git a/clients/credential/src/main.rs b/clients/credential/src/main.rs index 2a47930510..90e7a27f32 100644 --- a/clients/credential/src/main.rs +++ b/clients/credential/src/main.rs @@ -11,7 +11,7 @@ use commands::*; use error::Result; use log::*; use nym_bin_common::completions::fig_generate; -use nym_config::{DATA_DIR, DB_FILE_NAME}; +use nym_config::{CRED_DB_FILE_NAME, DATA_DIR}; use nym_network_defaults::{setup_env, NymNetworkDetails}; use std::process::exit; use std::time::{Duration, SystemTime}; @@ -73,7 +73,10 @@ async fn main() -> Result<()> { match args.command { Command::Run(r) => { - let db_path = r.client_home_directory.join(DATA_DIR).join(DB_FILE_NAME); + let db_path = r + .client_home_directory + .join(DATA_DIR) + .join(CRED_DB_FILE_NAME); let shared_storage = credential_storage::initialise_storage(db_path).await; let recovery_storage = recovery_storage::RecoveryStorage::new(r.recovery_dir)?; diff --git a/common/config/src/lib.rs b/common/config/src/lib.rs index 746e1c6443..4d38e55467 100644 --- a/common/config/src/lib.rs +++ b/common/config/src/lib.rs @@ -18,7 +18,7 @@ pub mod defaults; pub const CONFIG_DIR: &str = "config"; pub const DATA_DIR: &str = "data"; -pub const DB_FILE_NAME: &str = "db.sqlite"; +pub const CRED_DB_FILE_NAME: &str = "credentials_database.db"; pub trait NymConfig: Default + Serialize + DeserializeOwned { fn template() -> &'static str; diff --git a/nym-api/src/support/config/mod.rs b/nym-api/src/support/config/mod.rs index 25d949cd11..e9d8f02914 100644 --- a/nym-api/src/support/config/mod.rs +++ b/nym-api/src/support/config/mod.rs @@ -26,7 +26,8 @@ const DEFAULT_GATEWAY_PING_INTERVAL: Duration = Duration::from_secs(60); // bought bandwidth tokens to not have time to be spent; Once we remove the gateway from the // bandwidth bridging protocol, we can come back to a smaller timeout value const DEFAULT_GATEWAY_RESPONSE_TIMEOUT: Duration = Duration::from_secs(5 * 60); -const DEFAULT_GATEWAY_CONNECTION_TIMEOUT: Duration = Duration::from_millis(2_500); +// This timeout value should be big enough to accommodate an initial bandwidth acquirement +const DEFAULT_GATEWAY_CONNECTION_TIMEOUT: Duration = Duration::from_secs(2 * 60); const DEFAULT_TEST_ROUTES: usize = 3; const DEFAULT_MINIMUM_TEST_ROUTES: usize = 1;