From ac8d381e729b23db4c3f51260dee431bb2d7325b Mon Sep 17 00:00:00 2001 From: coderofstuff <114628839+coderofstuff@users.noreply.github.com> Date: Fri, 3 May 2024 08:53:35 -0600 Subject: [PATCH 1/2] Bump version to 0.14.0 (#466) --- Cargo.lock | 106 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 106 ++++++++++++++++++++++++++--------------------------- 2 files changed, 106 insertions(+), 106 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2eeb02b84..12be5a4e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2149,7 +2149,7 @@ dependencies = [ [[package]] name = "kaspa-addresses" -version = "0.13.6" +version = "0.14.0" dependencies = [ "borsh", "criterion", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "kaspa-addressmanager" -version = "0.13.6" +version = "0.14.0" dependencies = [ "borsh", "igd-next", @@ -2188,14 +2188,14 @@ dependencies = [ [[package]] name = "kaspa-alloc" -version = "0.13.6" +version = "0.14.0" dependencies = [ "mimalloc", ] [[package]] name = "kaspa-bip32" -version = "0.13.6" +version = "0.14.0" dependencies = [ "borsh", "bs58", @@ -2221,7 +2221,7 @@ dependencies = [ [[package]] name = "kaspa-cli" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "borsh", @@ -2265,7 +2265,7 @@ dependencies = [ [[package]] name = "kaspa-connectionmanager" -version = "0.13.6" +version = "0.14.0" dependencies = [ "duration-string", "futures-util", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "kaspa-consensus" -version = "0.13.6" +version = "0.14.0" dependencies = [ "arc-swap", "async-channel 2.1.1", @@ -2325,7 +2325,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "bincode", @@ -2362,7 +2362,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-notify" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "cfg-if 1.0.0", @@ -2381,7 +2381,7 @@ dependencies = [ [[package]] name = "kaspa-consensus-wasm" -version = "0.13.6" +version = "0.14.0" dependencies = [ "faster-hex 0.6.1", "js-sys", @@ -2403,7 +2403,7 @@ dependencies = [ [[package]] name = "kaspa-consensusmanager" -version = "0.13.6" +version = "0.14.0" dependencies = [ "duration-string", "futures", @@ -2421,7 +2421,7 @@ dependencies = [ [[package]] name = "kaspa-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "cfg-if 1.0.0", "ctrlc", @@ -2439,7 +2439,7 @@ dependencies = [ [[package]] name = "kaspa-daemon" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "borsh", @@ -2461,7 +2461,7 @@ dependencies = [ [[package]] name = "kaspa-database" -version = "0.13.6" +version = "0.14.0" dependencies = [ "bincode", "enum-primitive-derive", @@ -2483,7 +2483,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-client" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-stream", @@ -2514,7 +2514,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-stream", @@ -2543,7 +2543,7 @@ dependencies = [ [[package]] name = "kaspa-grpc-server" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-stream", @@ -2578,7 +2578,7 @@ dependencies = [ [[package]] name = "kaspa-hashes" -version = "0.13.6" +version = "0.14.0" dependencies = [ "blake2b_simd", "borsh", @@ -2599,7 +2599,7 @@ dependencies = [ [[package]] name = "kaspa-index-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -2618,7 +2618,7 @@ dependencies = [ [[package]] name = "kaspa-index-processor" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -2646,7 +2646,7 @@ dependencies = [ [[package]] name = "kaspa-math" -version = "0.13.6" +version = "0.14.0" dependencies = [ "borsh", "criterion", @@ -2667,14 +2667,14 @@ dependencies = [ [[package]] name = "kaspa-merkle" -version = "0.13.6" +version = "0.14.0" dependencies = [ "kaspa-hashes", ] [[package]] name = "kaspa-metrics-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "borsh", @@ -2690,7 +2690,7 @@ dependencies = [ [[package]] name = "kaspa-mining" -version = "0.13.6" +version = "0.14.0" dependencies = [ "criterion", "futures-util", @@ -2716,7 +2716,7 @@ dependencies = [ [[package]] name = "kaspa-mining-errors" -version = "0.13.6" +version = "0.14.0" dependencies = [ "kaspa-consensus-core", "thiserror", @@ -2724,7 +2724,7 @@ dependencies = [ [[package]] name = "kaspa-muhash" -version = "0.13.6" +version = "0.14.0" dependencies = [ "criterion", "kaspa-hashes", @@ -2737,7 +2737,7 @@ dependencies = [ [[package]] name = "kaspa-notify" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -2772,7 +2772,7 @@ dependencies = [ [[package]] name = "kaspa-os" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "borsh", @@ -2806,7 +2806,7 @@ dependencies = [ [[package]] name = "kaspa-p2p-flows" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "chrono", @@ -2837,7 +2837,7 @@ dependencies = [ [[package]] name = "kaspa-p2p-lib" -version = "0.13.6" +version = "0.14.0" dependencies = [ "borsh", "ctrlc", @@ -2868,7 +2868,7 @@ dependencies = [ [[package]] name = "kaspa-perf-monitor" -version = "0.13.6" +version = "0.14.0" dependencies = [ "kaspa-core", "log", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "kaspa-pow" -version = "0.13.6" +version = "0.14.0" dependencies = [ "criterion", "js-sys", @@ -2894,7 +2894,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-macros" -version = "0.13.6" +version = "0.14.0" dependencies = [ "convert_case 0.6.0", "proc-macro-error", @@ -2941,7 +2941,7 @@ dependencies = [ [[package]] name = "kaspa-rpc-service" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "kaspa-addresses", @@ -2970,7 +2970,7 @@ dependencies = [ [[package]] name = "kaspa-testing-integration" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -3030,7 +3030,7 @@ dependencies = [ [[package]] name = "kaspa-txscript" -version = "0.13.6" +version = "0.14.0" dependencies = [ "blake2b_simd", "borsh", @@ -3056,7 +3056,7 @@ dependencies = [ [[package]] name = "kaspa-txscript-errors" -version = "0.13.6" +version = "0.14.0" dependencies = [ "secp256k1", "thiserror", @@ -3064,7 +3064,7 @@ dependencies = [ [[package]] name = "kaspa-utils" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "async-trait", @@ -3092,7 +3092,7 @@ dependencies = [ [[package]] name = "kaspa-utils-tower" -version = "0.13.6" +version = "0.14.0" dependencies = [ "cfg-if 1.0.0", "futures", @@ -3106,7 +3106,7 @@ dependencies = [ [[package]] name = "kaspa-utxoindex" -version = "0.13.6" +version = "0.14.0" dependencies = [ "futures", "kaspa-consensus", @@ -3127,7 +3127,7 @@ dependencies = [ [[package]] name = "kaspa-wallet" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-std", "async-trait", @@ -3139,7 +3139,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-cli-wasm" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "js-sys", @@ -3153,7 +3153,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-core" -version = "0.13.6" +version = "0.14.0" dependencies = [ "aes", "ahash 0.8.6", @@ -3226,7 +3226,7 @@ dependencies = [ [[package]] name = "kaspa-wallet-macros" -version = "0.13.6" +version = "0.14.0" dependencies = [ "convert_case 0.5.0", "proc-macro-error", @@ -3239,7 +3239,7 @@ dependencies = [ [[package]] name = "kaspa-wasm" -version = "0.13.6" +version = "0.14.0" dependencies = [ "js-sys", "kaspa-addresses", @@ -3259,7 +3259,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-client" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-std", "async-trait", @@ -3289,7 +3289,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-proxy" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "clap 4.4.11", @@ -3308,7 +3308,7 @@ dependencies = [ [[package]] name = "kaspa-wrpc-server" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-trait", "borsh", @@ -3335,14 +3335,14 @@ dependencies = [ [[package]] name = "kaspa-wrpc-wasm" -version = "0.13.6" +version = "0.14.0" dependencies = [ "kaspa-wrpc-client", ] [[package]] name = "kaspad" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "clap 4.4.11", @@ -4669,7 +4669,7 @@ dependencies = [ [[package]] name = "rothschild" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "clap 4.4.11", @@ -5070,7 +5070,7 @@ dependencies = [ [[package]] name = "simpa" -version = "0.13.6" +version = "0.14.0" dependencies = [ "async-channel 2.1.1", "clap 4.4.11", diff --git a/Cargo.toml b/Cargo.toml index 4666e211e..09533a1e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ members = [ [workspace.package] rust-version = "1.77.0" -version = "0.13.6" +version = "0.14.0" authors = ["Kaspa developers"] license = "MIT/Apache-2.0" repository = "https://github.com/kaspanet/rusty-kaspa" @@ -75,58 +75,58 @@ include = [ ] [workspace.dependencies] -# kaspa-testing-integration = { version = "0.13.6", path = "testing/integration" } -kaspa-addresses = { version = "0.13.6", path = "crypto/addresses" } -kaspa-addressmanager = { version = "0.13.6", path = "components/addressmanager" } -kaspa-bip32 = { version = "0.13.6", path = "wallet/bip32" } -kaspa-cli = { version = "0.13.6", path = "cli" } -kaspa-connectionmanager = { version = "0.13.6", path = "components/connectionmanager" } -kaspa-consensus = { version = "0.13.6", path = "consensus" } -kaspa-consensus-core = { version = "0.13.6", path = "consensus/core" } -kaspa-consensus-notify = { version = "0.13.6", path = "consensus/notify" } -kaspa-consensus-wasm = { version = "0.13.6", path = "consensus/wasm" } -kaspa-consensusmanager = { version = "0.13.6", path = "components/consensusmanager" } -kaspa-core = { version = "0.13.6", path = "core" } -kaspa-daemon = { version = "0.13.6", path = "daemon" } -kaspa-database = { version = "0.13.6", path = "database" } -kaspa-grpc-client = { version = "0.13.6", path = "rpc/grpc/client" } -kaspa-grpc-core = { version = "0.13.6", path = "rpc/grpc/core" } -kaspa-grpc-server = { version = "0.13.6", path = "rpc/grpc/server" } -kaspa-hashes = { version = "0.13.6", path = "crypto/hashes" } -kaspa-index-core = { version = "0.13.6", path = "indexes/core" } -kaspa-index-processor = { version = "0.13.6", path = "indexes/processor" } -kaspa-math = { version = "0.13.6", path = "math" } -kaspa-merkle = { version = "0.13.6", path = "crypto/merkle" } -kaspa-metrics-core = { version = "0.13.6", path = "metrics/core" } -kaspa-mining = { version = "0.13.6", path = "mining" } -kaspa-mining-errors = { version = "0.13.6", path = "mining/errors" } -kaspa-muhash = { version = "0.13.6", path = "crypto/muhash" } -kaspa-notify = { version = "0.13.6", path = "notify" } -kaspa-os = { version = "0.13.6", path = "kaspa-os" } -kaspa-p2p-flows = { version = "0.13.6", path = "protocol/flows" } -kaspa-p2p-lib = { version = "0.13.6", path = "protocol/p2p" } -kaspa-perf-monitor = { version = "0.13.6", path = "metrics/perf_monitor" } -kaspa-pow = { version = "0.13.6", path = "consensus/pow" } -kaspa-rpc-core = { version = "0.13.6", path = "rpc/core" } -kaspa-rpc-macros = { version = "0.13.6", path = "rpc/macros" } -kaspa-rpc-service = { version = "0.13.6", path = "rpc/service" } -kaspa-txscript = { version = "0.13.6", path = "crypto/txscript" } -kaspa-txscript-errors = { version = "0.13.6", path = "crypto/txscript/errors" } -kaspa-utils = { version = "0.13.6", path = "utils" } -kaspa-utils-tower = { version = "0.13.6", path = "utils/tower" } -kaspa-utxoindex = { version = "0.13.6", path = "indexes/utxoindex" } -kaspa-wallet = { version = "0.13.6", path = "wallet/native" } -kaspa-wallet-cli-wasm = { version = "0.13.6", path = "wallet/wasm" } -kaspa-wallet-core = { version = "0.13.6", path = "wallet/core" } -kaspa-wallet-macros = { version = "0.13.6", path = "wallet/macros" } -kaspa-wasm = { version = "0.13.6", path = "wasm" } -kaspa-wrpc-client = { version = "0.13.6", path = "rpc/wrpc/client" } -kaspa-wrpc-core = { version = "0.13.6", path = "rpc/wrpc/core" } -kaspa-wrpc-proxy = { version = "0.13.6", path = "rpc/wrpc/proxy" } -kaspa-wrpc-server = { version = "0.13.6", path = "rpc/wrpc/server" } -kaspa-wrpc-wasm = { version = "0.13.6", path = "rpc/wrpc/wasm" } -kaspad = { version = "0.13.6", path = "kaspad" } -kaspa-alloc = { version = "0.13.6", path = "utils/alloc" } +# kaspa-testing-integration = { version = "0.14.0", path = "testing/integration" } +kaspa-addresses = { version = "0.14.0", path = "crypto/addresses" } +kaspa-addressmanager = { version = "0.14.0", path = "components/addressmanager" } +kaspa-bip32 = { version = "0.14.0", path = "wallet/bip32" } +kaspa-cli = { version = "0.14.0", path = "cli" } +kaspa-connectionmanager = { version = "0.14.0", path = "components/connectionmanager" } +kaspa-consensus = { version = "0.14.0", path = "consensus" } +kaspa-consensus-core = { version = "0.14.0", path = "consensus/core" } +kaspa-consensus-notify = { version = "0.14.0", path = "consensus/notify" } +kaspa-consensus-wasm = { version = "0.14.0", path = "consensus/wasm" } +kaspa-consensusmanager = { version = "0.14.0", path = "components/consensusmanager" } +kaspa-core = { version = "0.14.0", path = "core" } +kaspa-daemon = { version = "0.14.0", path = "daemon" } +kaspa-database = { version = "0.14.0", path = "database" } +kaspa-grpc-client = { version = "0.14.0", path = "rpc/grpc/client" } +kaspa-grpc-core = { version = "0.14.0", path = "rpc/grpc/core" } +kaspa-grpc-server = { version = "0.14.0", path = "rpc/grpc/server" } +kaspa-hashes = { version = "0.14.0", path = "crypto/hashes" } +kaspa-index-core = { version = "0.14.0", path = "indexes/core" } +kaspa-index-processor = { version = "0.14.0", path = "indexes/processor" } +kaspa-math = { version = "0.14.0", path = "math" } +kaspa-merkle = { version = "0.14.0", path = "crypto/merkle" } +kaspa-metrics-core = { version = "0.14.0", path = "metrics/core" } +kaspa-mining = { version = "0.14.0", path = "mining" } +kaspa-mining-errors = { version = "0.14.0", path = "mining/errors" } +kaspa-muhash = { version = "0.14.0", path = "crypto/muhash" } +kaspa-notify = { version = "0.14.0", path = "notify" } +kaspa-os = { version = "0.14.0", path = "kaspa-os" } +kaspa-p2p-flows = { version = "0.14.0", path = "protocol/flows" } +kaspa-p2p-lib = { version = "0.14.0", path = "protocol/p2p" } +kaspa-perf-monitor = { version = "0.14.0", path = "metrics/perf_monitor" } +kaspa-pow = { version = "0.14.0", path = "consensus/pow" } +kaspa-rpc-core = { version = "0.14.0", path = "rpc/core" } +kaspa-rpc-macros = { version = "0.14.0", path = "rpc/macros" } +kaspa-rpc-service = { version = "0.14.0", path = "rpc/service" } +kaspa-txscript = { version = "0.14.0", path = "crypto/txscript" } +kaspa-txscript-errors = { version = "0.14.0", path = "crypto/txscript/errors" } +kaspa-utils = { version = "0.14.0", path = "utils" } +kaspa-utils-tower = { version = "0.14.0", path = "utils/tower" } +kaspa-utxoindex = { version = "0.14.0", path = "indexes/utxoindex" } +kaspa-wallet = { version = "0.14.0", path = "wallet/native" } +kaspa-wallet-cli-wasm = { version = "0.14.0", path = "wallet/wasm" } +kaspa-wallet-core = { version = "0.14.0", path = "wallet/core" } +kaspa-wallet-macros = { version = "0.14.0", path = "wallet/macros" } +kaspa-wasm = { version = "0.14.0", path = "wasm" } +kaspa-wrpc-client = { version = "0.14.0", path = "rpc/wrpc/client" } +kaspa-wrpc-core = { version = "0.14.0", path = "rpc/wrpc/core" } +kaspa-wrpc-proxy = { version = "0.14.0", path = "rpc/wrpc/proxy" } +kaspa-wrpc-server = { version = "0.14.0", path = "rpc/wrpc/server" } +kaspa-wrpc-wasm = { version = "0.14.0", path = "rpc/wrpc/wasm" } +kaspad = { version = "0.14.0", path = "kaspad" } +kaspa-alloc = { version = "0.14.0", path = "utils/alloc" } # external From 7974dae589b4a463629d05d83c7e4727a7266492 Mon Sep 17 00:00:00 2001 From: aspect Date: Sun, 5 May 2024 10:52:46 +0300 Subject: [PATCH 2/2] rust 1.78 compatibility (#467) --- Cargo.toml | 1 + cli/Cargo.toml | 3 +++ .../addressmanager/src/stores/address_store.rs | 1 + consensus/core/Cargo.toml | 3 +++ consensus/core/src/sign.rs | 2 +- consensus/wasm/Cargo.toml | 3 +++ crypto/txscript/src/data_stack.rs | 1 + crypto/txscript/src/opcodes/mod.rs | 2 +- kaspad/src/args.rs | 2 +- kos/src/metrics/ipc.rs | 1 + mining/src/mempool/model/pool.rs | 1 + rpc/core/Cargo.toml | 3 +++ rpc/core/src/model/address.rs | 4 ++-- rpc/wrpc/client/src/client.rs | 4 ++-- rpc/wrpc/client/src/parse.rs | 14 +++++++------- utils/benches/bench.rs | 1 + wallet/core/Cargo.toml | 3 +++ wallet/core/src/storage/local/collection.rs | 6 +++--- wallet/core/src/tx/generator/test.rs | 3 ++- wallet/core/src/utxo/processor.rs | 2 +- 20 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 09533a1e8..25872b3ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -308,3 +308,4 @@ overflow-checks = true inherits = "release" debug = true strip = false + diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a936016a8..5b3622d95 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -78,3 +78,6 @@ features = [ [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tokio.workspace = true + +[lints.clippy] +empty_docs = "allow" diff --git a/components/addressmanager/src/stores/address_store.rs b/components/addressmanager/src/stores/address_store.rs index 41b12f6cc..accfcfda4 100644 --- a/components/addressmanager/src/stores/address_store.rs +++ b/components/addressmanager/src/stores/address_store.rs @@ -26,6 +26,7 @@ pub trait AddressesStoreReader { pub trait AddressesStore: AddressesStoreReader { fn set(&mut self, key: AddressKey, entry: Entry) -> StoreResult<()>; + #[allow(dead_code)] fn set_failed_count(&mut self, key: AddressKey, connection_failed_count: u64) -> StoreResult<()>; fn remove(&mut self, key: AddressKey) -> StoreResult<()>; } diff --git a/consensus/core/Cargo.toml b/consensus/core/Cargo.toml index 29646cfe1..43669547b 100644 --- a/consensus/core/Cargo.toml +++ b/consensus/core/Cargo.toml @@ -50,3 +50,6 @@ harness = false [features] devnet-prealloc = [] + +[lints.clippy] +empty_docs = "allow" diff --git a/consensus/core/src/sign.rs b/consensus/core/src/sign.rs index adf4aa731..e9171afe6 100644 --- a/consensus/core/src/sign.rs +++ b/consensus/core/src/sign.rs @@ -136,7 +136,7 @@ pub fn sign_with_multiple_v2(mut mutable_tx: SignableTransaction, privkeys: Vec< let mut additional_signatures_required = false; for i in 0..mutable_tx.tx.inputs.len() { let script = mutable_tx.entries[i].as_ref().unwrap().script_public_key.script(); - if let Some(schnorr_key) = map.get(&script.to_vec()) { + if let Some(schnorr_key) = map.get(script) { let sig_hash = calc_schnorr_signature_hash(&mutable_tx.as_verifiable(), i, SIG_HASH_ALL, &mut reused_values); let msg = secp256k1::Message::from_slice(sig_hash.as_bytes().as_slice()).unwrap(); let sig: [u8; 64] = *schnorr_key.sign_schnorr(msg).as_ref(); diff --git a/consensus/wasm/Cargo.toml b/consensus/wasm/Cargo.toml index a44169cf7..1da0b26a8 100644 --- a/consensus/wasm/Cargo.toml +++ b/consensus/wasm/Cargo.toml @@ -28,3 +28,6 @@ rand.workspace = true workflow-wasm.workspace = true workflow-log.workspace = true + +[lints.clippy] +empty_docs = "allow" diff --git a/crypto/txscript/src/data_stack.rs b/crypto/txscript/src/data_stack.rs index 0eafb8d14..74988042a 100644 --- a/crypto/txscript/src/data_stack.rs +++ b/crypto/txscript/src/data_stack.rs @@ -14,6 +14,7 @@ pub(crate) trait DataStack { fn pop_items(&mut self) -> Result<[T; SIZE], TxScriptError> where Vec: OpcodeData; + #[allow(dead_code)] fn peek_items(&self) -> Result<[T; SIZE], TxScriptError> where Vec: OpcodeData; diff --git a/crypto/txscript/src/opcodes/mod.rs b/crypto/txscript/src/opcodes/mod.rs index 9727e2e87..5d6096b7a 100644 --- a/crypto/txscript/src/opcodes/mod.rs +++ b/crypto/txscript/src/opcodes/mod.rs @@ -1013,7 +1013,7 @@ mod test { let mut reused_values = SigHashReusedValues::new(); for ErrorTestCase { init, code, error } in tests { let mut vm = TxScriptEngine::new(&mut reused_values, &cache); - vm.dstack = init.clone(); + vm.dstack.clone_from(&init); assert_eq!( code.execute(&mut vm) .expect_err(format!("Opcode {} should have errored (init: {:?})", code.value(), init.clone()).as_str()), diff --git a/kaspad/src/args.rs b/kaspad/src/args.rs index 7483d9091..e11672915 100644 --- a/kaspad/src/args.rs +++ b/kaspad/src/args.rs @@ -154,7 +154,7 @@ impl Args { config.is_archival = self.archival; // TODO: change to `config.enable_sanity_checks = self.sanity` when we reach stable versions config.enable_sanity_checks = true; - config.user_agent_comments = self.user_agent_comments.clone(); + config.user_agent_comments.clone_from(&self.user_agent_comments); config.block_template_cache_lifetime = self.block_template_cache_lifetime; config.p2p_listen_address = self.listen.unwrap_or(ContextualNetAddress::unspecified()); config.externalip = self.externalip.map(|v| v.normalize(config.default_p2p_port())); diff --git a/kos/src/metrics/ipc.rs b/kos/src/metrics/ipc.rs index 34e32dc20..3ca02be6c 100644 --- a/kos/src/metrics/ipc.rs +++ b/kos/src/metrics/ipc.rs @@ -18,6 +18,7 @@ impl MetricsIpc { } } +#[allow(dead_code)] #[async_trait] pub trait MetricsCtl: Send + Sync + 'static { async fn post_data(&self, data: MetricsSnapshot) -> Result<()>; diff --git a/mining/src/mempool/model/pool.rs b/mining/src/mempool/model/pool.rs index 1f9ff1552..5ad6970eb 100644 --- a/mining/src/mempool/model/pool.rs +++ b/mining/src/mempool/model/pool.rs @@ -36,6 +36,7 @@ pub(crate) trait Pool { /// Returns an index over either high or low priority transaction ids which can /// in turn be topologically ordered. + #[allow(dead_code)] fn index(&self, priority: Priority) -> PoolIndex { let transactions: TransactionIdSet = self.all().iter().filter_map(|(id, tx)| if tx.priority == priority { Some(*id) } else { None }).collect(); diff --git a/rpc/core/Cargo.toml b/rpc/core/Cargo.toml index 26783d50e..76fb13a73 100644 --- a/rpc/core/Cargo.toml +++ b/rpc/core/Cargo.toml @@ -42,3 +42,6 @@ workflow-wasm.workspace = true [dev-dependencies] serde_json.workspace = true + +[lints.clippy] +empty_docs = "allow" diff --git a/rpc/core/src/model/address.rs b/rpc/core/src/model/address.rs index 7ea382705..720cb4f86 100644 --- a/rpc/core/src/model/address.rs +++ b/rpc/core/src/model/address.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; pub type RpcAddress = kaspa_addresses::Address; -/// +/// Represents a UTXO entry of an address returned by the `GetUtxosByAddresses` RPC. #[derive(Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize)] #[serde(rename_all = "camelCase")] pub struct RpcUtxosByAddressesEntry { @@ -13,7 +13,7 @@ pub struct RpcUtxosByAddressesEntry { pub utxo_entry: RpcUtxoEntry, } -/// +/// Represents a balance of an address returned by the `GetBalancesByAddresses` RPC. #[derive(Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize)] #[serde(rename_all = "camelCase")] pub struct RpcBalancesByAddressesEntry { diff --git a/rpc/wrpc/client/src/client.rs b/rpc/wrpc/client/src/client.rs index 2b6d85646..573d2a500 100644 --- a/rpc/wrpc/client/src/client.rs +++ b/rpc/wrpc/client/src/client.rs @@ -363,9 +363,9 @@ impl KaspaRpcClient { // or 1.2.3.4:port where port is based on the network type. // if (parse_output.scheme.is_some() || !path_str.is_empty()) && parse_output.port.is_none() { - Ok(format!("{}://{}{}", scheme, parse_output.host.to_string(), path_str)) + Ok(format!("{}://{}{}", scheme, parse_output.host, path_str)) } else { - Ok(format!("{}://{}:{}{}", scheme, parse_output.host.to_string(), port, path_str)) + Ok(format!("{}://{}:{}{}", scheme, parse_output.host, port, path_str)) } } diff --git a/rpc/wrpc/client/src/parse.rs b/rpc/wrpc/client/src/parse.rs index 6928ad650..35db2c768 100644 --- a/rpc/wrpc/client/src/parse.rs +++ b/rpc/wrpc/client/src/parse.rs @@ -15,7 +15,7 @@ impl Display for ParseHostOutput<'_> { if let Some(scheme) = self.scheme { write!(f, "{}://", scheme)?; } - write!(f, "{}", self.host.to_string())?; + write!(f, "{}", self.host)?; if let Some(port) = self.port { write!(f, ":{}", port)?; } @@ -31,13 +31,13 @@ pub enum Host<'a> { Ipv6(Ipv6Addr), } -impl ToString for Host<'_> { - fn to_string(&self) -> String { +impl Display for Host<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Host::Domain(domain) => domain.to_string(), - Host::Hostname(hostname) => hostname.to_string(), - Host::Ipv4(ipv4) => ipv4.to_string(), - Host::Ipv6(ipv6) => format!("[{}]", ipv6), + Host::Domain(domain) => write!(f, "{}", domain), + Host::Hostname(hostname) => write!(f, "{}", hostname), + Host::Ipv4(ipv4) => write!(f, "{}", ipv4), + Host::Ipv6(ipv6) => write!(f, "[{}]", ipv6), } } } diff --git a/utils/benches/bench.rs b/utils/benches/bench.rs index d726fa257..15617134d 100644 --- a/utils/benches/bench.rs +++ b/utils/benches/bench.rs @@ -45,6 +45,7 @@ trait RwLockTrait { type WriteGuard; fn new(value: T) -> Self; async fn read_(&self) -> Self::ReadGuard; + #[allow(dead_code)] async fn write_(&self) -> Self::WriteGuard; } diff --git a/wallet/core/Cargo.toml b/wallet/core/Cargo.toml index 9c93fd031..c882ceedc 100644 --- a/wallet/core/Cargo.toml +++ b/wallet/core/Cargo.toml @@ -104,3 +104,6 @@ serde_repr.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] tokio.workspace = true + +[lints.clippy] +empty_docs = "allow" diff --git a/wallet/core/src/storage/local/collection.rs b/wallet/core/src/storage/local/collection.rs index 85cfb6aec..53c740710 100644 --- a/wallet/core/src/storage/local/collection.rs +++ b/wallet/core/src/storage/local/collection.rs @@ -44,7 +44,7 @@ where } pub fn insert(&mut self, id: Id, data: Arc) -> Result<()> { - if self.map.get(&id).is_some() { + if self.map.contains_key(&id) { self.map.remove(&id); self.vec.retain(|d| d.id() != &id); } @@ -84,7 +84,7 @@ where pub fn store_multiple(&mut self, data: Vec) -> Result<()> { for data in data.into_iter() { let id = data.id().clone(); - if self.map.get(&id).is_some() { + if self.map.contains_key(&id) { self.map.remove(&id); self.vec.retain(|d| d.id() != &id); } @@ -98,7 +98,7 @@ where pub fn store_single(&mut self, data: &Data) -> Result<()> { let id = data.id(); - if self.map.get(id).is_some() { + if self.map.contains_key(id) { self.map.remove(id); self.vec.retain(|d| d.id() != id); } diff --git a/wallet/core/src/tx/generator/test.rs b/wallet/core/src/tx/generator/test.rs index be7129f59..c26c38364 100644 --- a/wallet/core/src/tx/generator/test.rs +++ b/wallet/core/src/tx/generator/test.rs @@ -63,6 +63,7 @@ impl FeesExpected { } trait PendingTransactionExtension { + #[allow(dead_code)] fn tuple(self) -> (PendingTransaction, Transaction); fn expect(self, expected: &Expected) -> Self where @@ -297,7 +298,7 @@ impl Harness { Rc::new(Harness { generator, accumulator: RefCell::new(Accumulator::default()) }) } - pub fn fetch>(self: &Rc, expected: &Expected) -> Rc + pub fn fetch(self: &Rc, expected: &Expected) -> Rc where SOMPI: Into + Debug + Copy, { diff --git a/wallet/core/src/utxo/processor.rs b/wallet/core/src/utxo/processor.rs index 1f38d0a41..9d2ca9ce7 100644 --- a/wallet/core/src/utxo/processor.rs +++ b/wallet/core/src/utxo/processor.rs @@ -120,7 +120,7 @@ impl UtxoProcessor { } pub async fn bind_rpc(&self, rpc: Option) -> Result<()> { - *self.inner.rpc.lock().unwrap() = rpc.clone(); + self.inner.rpc.lock().unwrap().clone_from(&rpc); self.sync_proc().bind_rpc(rpc).await?; Ok(()) }