From 072fb85df94b987b52bf862153e10a11c0170916 Mon Sep 17 00:00:00 2001 From: Tommy Volk Date: Wed, 25 Sep 2024 15:05:31 -0500 Subject: [PATCH] chore: remove unused const strings --- fedimint-build/src/envs.rs | 2 -- fedimint-client/src/transaction/sm.rs | 2 -- fedimint-core/src/config.rs | 8 -------- fedimint-core/src/core.rs | 1 - fedimint-core/src/endpoint_constants.rs | 1 - fedimint-core/src/envs.rs | 6 +----- fedimint-server/src/config/io.rs | 5 ----- fedimint-testing-core/src/envs.rs | 18 ------------------ fedimintd/src/envs.rs | 3 --- modules/fedimint-mint-client/benches/notes.rs | 2 +- modules/fedimint-mint-client/src/lib.rs | 2 -- .../fedimint-wallet-client/src/client_db.rs | 2 -- 12 files changed, 2 insertions(+), 50 deletions(-) diff --git a/fedimint-build/src/envs.rs b/fedimint-build/src/envs.rs index 5e886d8113c..4518611c6a6 100644 --- a/fedimint-build/src/envs.rs +++ b/fedimint-build/src/envs.rs @@ -3,6 +3,4 @@ pub const FORCE_GIT_HASH_ENV: &str = "FEDIMINT_BUILD_FORCE_GIT_HASH"; /// Env variable the cargo will set during crate build to pass the detected git /// hash to the binary itself. -// Note: Keep in sync with `fedimint_core::envs`, which is not reused-to avoid -// introducing extra dependencies between core and build modules. pub const FEDIMINT_BUILD_CODE_VERSION_ENV: &str = "FEDIMINT_BUILD_CODE_VERSION"; diff --git a/fedimint-client/src/transaction/sm.rs b/fedimint-client/src/transaction/sm.rs index b4d93349338..314e9326e62 100644 --- a/fedimint-client/src/transaction/sm.rs +++ b/fedimint-client/src/transaction/sm.rs @@ -17,8 +17,6 @@ use crate::{DynGlobalClientContext, DynState}; /// Reserved module instance id used for client-internal state machines pub const TRANSACTION_SUBMISSION_MODULE_INSTANCE: ModuleInstanceId = 0xffff; -pub const LOG_TARGET: &str = "transaction_submission"; - const RETRY_INTERVAL: Duration = Duration::from_secs(5); #[derive(Debug, Clone)] diff --git a/fedimint-core/src/config.rs b/fedimint-core/src/config.rs index 6ba897dbc63..6297fb25fb8 100644 --- a/fedimint-core/src/config.rs +++ b/fedimint-core/src/config.rs @@ -1030,14 +1030,6 @@ impl SGroup for G1Projective { /// of the config pub const META_FEDERATION_NAME_KEY: &str = "federation_name"; -/// Key under which the vetted gateways can be sent to client in the `meta` part -/// of the config -pub const META_VETTED_GATEWAYS_KEY: &str = "vetted_gateways"; - -/// Key under which the override URL can be sent to client in the `meta` part -/// of the config -pub const META_OVERRIDE_URL_KEY: &str = "meta_override_url"; - pub fn load_from_file(path: &Path) -> Result { let file = std::fs::File::open(path)?; Ok(serde_json::from_reader(file)?) diff --git a/fedimint-core/src/core.rs b/fedimint-core/src/core.rs index 3bae28a3e4f..fab02fa2a71 100644 --- a/fedimint-core/src/core.rs +++ b/fedimint-core/src/core.rs @@ -160,7 +160,6 @@ pub const MODULE_INSTANCE_ID_GLOBAL: u16 = u16::MAX; // Note: needs to be in alphabetical order of ModuleKind of each module, // as this is the ordering we currently hardcoded. // Should be used only for pre-modularization code we still have left -pub const LEGACY_HARDCODED_INSTANCE_ID_LN: ModuleInstanceId = 0; pub const LEGACY_HARDCODED_INSTANCE_ID_MINT: ModuleInstanceId = 1; pub const LEGACY_HARDCODED_INSTANCE_ID_WALLET: ModuleInstanceId = 2; diff --git a/fedimint-core/src/endpoint_constants.rs b/fedimint-core/src/endpoint_constants.rs index 1a06ccd98ea..d6acfa3d712 100644 --- a/fedimint-core/src/endpoint_constants.rs +++ b/fedimint-core/src/endpoint_constants.rs @@ -17,7 +17,6 @@ pub const CONSENSUS_CONFIG_GEN_PARAMS_ENDPOINT: &str = "consensus_config_gen_par pub const DEFAULT_CONFIG_GEN_PARAMS_ENDPOINT: &str = "default_config_gen_params"; pub const VERIFY_CONFIG_HASH_ENDPOINT: &str = "verify_config_hash"; pub const RECOVER_ENDPOINT: &str = "recover"; -pub const REGISTER_GATEWAY_ENDPOINT: &str = "register_gateway"; pub const RUN_DKG_ENDPOINT: &str = "run_dkg"; pub const SET_CONFIG_GEN_CONNECTIONS_ENDPOINT: &str = "set_config_gen_connections"; pub const SET_CONFIG_GEN_PARAMS_ENDPOINT: &str = "set_config_gen_params"; diff --git a/fedimint-core/src/envs.rs b/fedimint-core/src/envs.rs index e33374b88c5..559967d9ad8 100644 --- a/fedimint-core/src/envs.rs +++ b/fedimint-core/src/envs.rs @@ -8,10 +8,6 @@ use jsonrpsee_core::Serialize; use serde::Deserialize; use tracing::warn; -// Note: Keep in sync with `fedimint_build::envs`, which is not reused-to avoid -// introducing extra dependencies between core and build modules. -pub const FEDIMINT_BUILD_CODE_VERSION_ENV: &str = "FEDIMINT_BUILD_CODE_VERSION"; - /// In tests we want to routinely enable an extra unknown module to ensure /// all client code handles correct modules that client doesn't know about. pub const FM_USE_UNKNOWN_MODULE_ENV: &str = "FM_USE_UNKNOWN_MODULE"; @@ -37,7 +33,7 @@ pub fn is_rbf_withdrawal_enabled() -> bool { is_env_var_set("FM_UNSAFE_ENABLE_RBF_WITHDRAWAL") } -/// Get value of [`FEDIMINT_BUILD_CODE_VERSION_ENV`] at compile time +/// Get value of `FEDIMINT_BUILD_CODE_VERSION` at compile time #[macro_export] macro_rules! fedimint_build_code_version_env { () => { diff --git a/fedimint-server/src/config/io.rs b/fedimint-server/src/config/io.rs index 3516e40ba04..5140ac442ba 100644 --- a/fedimint-server/src/config/io.rs +++ b/fedimint-server/src/config/io.rs @@ -39,11 +39,6 @@ pub const JSON_EXT: &str = "json"; pub const ENCRYPTED_EXT: &str = "encrypt"; -/// Temporary directiry where server configs are stored / removed through the -/// setup process On setup complete, the configs are moved to the server config -/// directory and the staging directory is removed -pub const CONFIG_STAGING_DIR: &str = "cfg_staging"; - /// Reads the server from the local, private, and consensus cfg files pub fn read_server_config(password: &str, path: &Path) -> anyhow::Result { let salt = fs::read_to_string(path.join(SALT_FILE))?; diff --git a/fedimint-testing-core/src/envs.rs b/fedimint-testing-core/src/envs.rs index fad8602a060..b1fe4925382 100644 --- a/fedimint-testing-core/src/envs.rs +++ b/fedimint-testing-core/src/envs.rs @@ -10,24 +10,6 @@ pub const FM_PORT_ESPLORA_ENV: &str = "FM_PORT_ESPLORA"; // Env variable to TODO pub const FM_TEST_DIR_ENV: &str = "FM_TEST_DIR"; -// Env variable to TODO -pub const FM_PORT_CLN_ENV: &str = "FM_PORT_CLN"; - -// Env variable to TODO -pub const FM_GATEWAY_LIGHTNING_ADDR_ENV: &str = "FM_GATEWAY_LIGHTNING_ADDR"; - -// Env variable to TODO -pub const FM_PORT_LND_LISTEN_ENV: &str = "FM_PORT_LND_LISTEN"; - -// Env variable to TODO -pub const FM_LND_RPC_ADDR_ENV: &str = "FM_LND_RPC_ADDR"; - -// Env variable to TODO -pub const FM_LND_MACAROON_ENV: &str = "FM_LND_MACAROON"; - -// Env variable to TODO -pub const FM_LND_TLS_CERT_ENV: &str = "FM_LND_TLS_CERT"; - // Env variable to TODO pub const FM_TEST_BITCOIND_RPC_ENV: &str = "FM_TEST_BITCOIND_RPC"; diff --git a/fedimintd/src/envs.rs b/fedimintd/src/envs.rs index 044dec5ed5a..eaa293988b4 100644 --- a/fedimintd/src/envs.rs +++ b/fedimintd/src/envs.rs @@ -37,8 +37,5 @@ pub const FM_BIND_METRICS_API_ENV: &str = "FM_BIND_METRICS_API"; // Env variable to TODO pub const FM_PORT_ESPLORA_ENV: &str = "FM_PORT_ESPLORA"; -// Api authentication (pass,...) -pub const FM_DEFAULT_API_SECRETS_ENV: &str = "FM_DEFAULT_API_SECRETS"; - // Can be used to absolutely override the values stored in the db pub const FM_FORCE_API_SECRETS_ENV: &str = "FM_FORCE_API_SECRETS"; diff --git a/modules/fedimint-mint-client/benches/notes.rs b/modules/fedimint-mint-client/benches/notes.rs index cd2d4348240..f247460ec31 100644 --- a/modules/fedimint-mint-client/benches/notes.rs +++ b/modules/fedimint-mint-client/benches/notes.rs @@ -5,7 +5,7 @@ use fedimint_core::encoding::Decodable; use fedimint_mint_client::{SpendableNote, SpendableNoteUndecoded}; fn bench_note_decoding(c: &mut Criterion) { - pub const NOTE_HEX : &str = "a5dd3ebacad1bc48bd8718eed5a8da1d68f91323bef2848ac4fa2e6f8eed710f3178fd4aef047cc234e6b1127086f33cc408b39818781d9521475360de6b205f3328e490a6d99d5e2553a4553207c8bd"; + const NOTE_HEX : &str = "a5dd3ebacad1bc48bd8718eed5a8da1d68f91323bef2848ac4fa2e6f8eed710f3178fd4aef047cc234e6b1127086f33cc408b39818781d9521475360de6b205f3328e490a6d99d5e2553a4553207c8bd"; let mut group = c.benchmark_group("SpendableNote decoding"); diff --git a/modules/fedimint-mint-client/src/lib.rs b/modules/fedimint-mint-client/src/lib.rs index e8bd6f3cbcc..0bc6d70045d 100644 --- a/modules/fedimint-mint-client/src/lib.rs +++ b/modules/fedimint-mint-client/src/lib.rs @@ -90,8 +90,6 @@ use crate::output::{ const MINT_E_CASH_TYPE_CHILD_ID: ChildId = ChildId(0); -pub const LOG_TARGET: &str = "client::module::mint"; - /// An encapsulation of [`FederationId`] and e-cash notes in the form of /// [`TieredMulti`] for the purpose of spending e-cash /// out-of-band. Also used for validating and reissuing such out-of-band notes. diff --git a/modules/fedimint-wallet-client/src/client_db.rs b/modules/fedimint-wallet-client/src/client_db.rs index b7376d38712..be24e815471 100644 --- a/modules/fedimint-wallet-client/src/client_db.rs +++ b/modules/fedimint-wallet-client/src/client_db.rs @@ -53,8 +53,6 @@ impl fmt::Display for TweakIdx { } impl TweakIdx { - pub const ZERO: Self = TweakIdx(0); - #[must_use] pub fn next(self) -> Self { Self(self.0 + 1)