From da3f60ba37372f162b8e4888c645806779efc1b8 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 14 May 2026 12:10:34 +0300 Subject: [PATCH 1/3] build: update rust edition 2021 --- Cargo.lock | 1 - Cargo.toml | 2 +- api/Cargo.toml | 2 +- config/Cargo.toml | 2 +- controller/Cargo.toml | 2 +- impls/Cargo.toml | 2 +- integration/Cargo.toml | 2 +- libwallet/Cargo.toml | 2 +- rustfmt.toml | 2 +- util/Cargo.toml | 2 +- 10 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21de04b..a4dc53d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1485,7 +1485,6 @@ dependencies = [ "grin_core", "grin_util", "grin_wallet_util", - "log", "pretty_assertions", "rand 0.6.5", "serde", diff --git a/Cargo.toml b/Cargo.toml index ce75779..e90314a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ keywords = [ "crypto", "grin", "mimblewimble" ] readme = "README.md" exclude = ["**/*.grin", "**/*.grin2"] build = "src/build/build.rs" -edition = "2018" +edition = "2021" [[bin]] name = "grin-wallet" diff --git a/api/Cargo.toml b/api/Cargo.toml index 9beb252..a85781e 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] -edition = "2018" +edition = "2021" [dependencies] log = "0.4" diff --git a/config/Cargo.toml b/config/Cargo.toml index d1c325b..f646b3d 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] workspace = ".." -edition = "2018" +edition = "2021" [dependencies] rand = "0.6" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 070088e..6a3a5ca 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] #build = "src/build/build.rs" -edition = "2018" +edition = "2021" [dependencies] futures = "0.3" diff --git a/impls/Cargo.toml b/impls/Cargo.toml index 70f7f69..6dfc918 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] -edition = "2018" +edition = "2021" [dependencies] blake2-rfc = "0.2" diff --git a/integration/Cargo.toml b/integration/Cargo.toml index a624573..1230be2 100644 --- a/integration/Cargo.toml +++ b/integration/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" repository = "https://github.com/mimblewimble/grin" keywords = [ "crypto", "grin", "mimblewimble" ] workspace = ".." -edition = "2018" +edition = "2021" [dependencies] hyper = "0.12" diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 8fd614d..e826004 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] #build = "src/build/build.rs" -edition = "2018" +edition = "2021" [dependencies] blake2-rfc = "0.2" diff --git a/rustfmt.toml b/rustfmt.toml index b2b2431..c691d12 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,2 @@ hard_tabs = true -edition = "2018" +edition = "2021" diff --git a/util/Cargo.toml b/util/Cargo.toml index 5242e12..ef22dde 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] workspace = ".." -edition = "2018" +edition = "2021" [dependencies] rand = "0.6" From 30c976139181011ff98480ae9cbe19eaa5870dba Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 14 May 2026 13:09:49 +0300 Subject: [PATCH 2/3] cargo: format all --- config/src/config.rs | 2 +- controller/src/command.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/src/config.rs b/config/src/config.rs index cf87704..2c37ae7 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -476,4 +476,4 @@ impl GlobalWalletConfig { .replace("WARN", "Warning") .replace("ERROR", "Error") } -} \ No newline at end of file +} diff --git a/controller/src/command.rs b/controller/src/command.rs index 536a3f3..77fdb79 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -82,7 +82,7 @@ where C: NodeClient + 'static, K: keychain::Keychain + 'static, { -// Assume global chain type has already been initialized. + // Assume global chain type has already been initialized. let chain_type = global::get_chain_type(); let mut w_lock = owner_api.wallet_inst.lock(); From 941899fb92d590496e9447fe3fb9630ba34df66f Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 14 May 2026 13:38:25 +0300 Subject: [PATCH 3/3] build: fix tests and warnings --- api/src/foreign.rs | 4 ++-- api/src/owner.rs | 4 ++-- controller/tests/common/mod.rs | 8 ++++++-- libwallet/src/mwixnet/onion/crypto/dalek.rs | 3 +++ tests/common/mod.rs | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/api/src/foreign.rs b/api/src/foreign.rs index 77c6575..1d96256 100644 --- a/api/src/foreign.rs +++ b/api/src/foreign.rs @@ -147,7 +147,7 @@ where /// // These traits can be replaced with alternative implementations if desired /// /// let mut wallet = Box::new(DefaultWalletImpl::<'static, HTTPNodeClient>::new(node_client.clone()).unwrap()) - /// as Box, HTTPNodeClient, ExtKeychain>>; + /// as Box, HTTPNodeClient, ExtKeychain>>; /// /// // Wallet LifeCycle Provider provides all functions init wallet and work with seeds, etc... /// let lc = wallet.lc_provider().unwrap(); @@ -500,7 +500,7 @@ macro_rules! doctest_helper_setup_doc_env_foreign { DefaultWalletImpl::<'static, HTTPNodeClient>::new(node_client.clone()).unwrap(), ) as Box< - WalletInst< + dyn WalletInst< 'static, DefaultLCProvider, HTTPNodeClient, diff --git a/api/src/owner.rs b/api/src/owner.rs index a749d8b..d291b2b 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -152,7 +152,7 @@ where /// // These traits can be replaced with alternative implementations if desired /// /// let mut wallet = Box::new(DefaultWalletImpl::<'static, HTTPNodeClient>::new(node_client.clone()).unwrap()) - /// as Box, HTTPNodeClient, ExtKeychain>>; + /// as Box, HTTPNodeClient, ExtKeychain>>; /// /// // Wallet LifeCycle Provider provides all functions init wallet and work with seeds, etc... /// let lc = wallet.lc_provider().unwrap(); @@ -2628,7 +2628,7 @@ macro_rules! doctest_helper_setup_doc_env { DefaultWalletImpl::<'static, HTTPNodeClient>::new(node_client.clone()).unwrap(), ) as Box< - WalletInst< + dyn WalletInst< 'static, DefaultLCProvider, HTTPNodeClient, diff --git a/controller/tests/common/mod.rs b/controller/tests/common/mod.rs index 114667a..24f600d 100644 --- a/controller/tests/common/mod.rs +++ b/controller/tests/common/mod.rs @@ -96,8 +96,12 @@ pub fn setup_global_chain_type() { pub fn create_wallet_proxy( test_dir: &str, -) -> WalletProxy, LocalWalletClient, ExtKeychain> -{ +) -> WalletProxy< + '_, + DefaultLCProvider<'_, LocalWalletClient, ExtKeychain>, + LocalWalletClient, + ExtKeychain, +> { WalletProxy::new(test_dir) } diff --git a/libwallet/src/mwixnet/onion/crypto/dalek.rs b/libwallet/src/mwixnet/onion/crypto/dalek.rs index a10c65b..38fd408 100644 --- a/libwallet/src/mwixnet/onion/crypto/dalek.rs +++ b/libwallet/src/mwixnet/onion/crypto/dalek.rs @@ -117,11 +117,13 @@ impl Writeable for DalekPublicKey { } /// Encapsulates an ed25519_dalek::Signature and provides (de-)serialization +#[allow(dead_code)] #[derive(Clone, Debug, PartialEq)] pub struct DalekSignature(Signature); impl DalekSignature { /// Convert hex string to DalekSignature. + #[allow(dead_code)] pub fn from_hex(hex: &str) -> Result { let bytes = grin_util::from_hex(hex) .map_err(|_| DalekError::HexError(format!("failed to decode {}", hex)))?; @@ -131,6 +133,7 @@ impl DalekSignature { } /// Verifies DalekSignature + #[allow(dead_code)] pub fn verify(&self, pk: &DalekPublicKey, msg: &[u8]) -> Result<(), DalekError> { pk.as_ref() .verify(&msg, &self.0) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 569fd33..2116457 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -494,4 +494,5 @@ impl From for WalletAPIReturnError { } #[derive(Clone, Debug, Serialize, Deserialize)] +#[allow(dead_code)] pub struct RetrieveSummaryInfoResp(pub bool, pub WalletInfo);