Repository: tangle-network/gadget (language: rust)

Issue:
[TASK] Remove unused workspace dependencies
# Overview

There are a bunch of dependencies in the workspace that just aren't used.


Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 1c2a2f3bb..261d22525 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,224 +69,101 @@ sp-runtime = { version = "39.0.0", default-features = false }
 sc-utils = { version = "17.0.0", default-features = false }
 sp-api = { version = "34.0.0", default-features = false }
 sp-application-crypto = { version = "38.0.0", default-features = false }
-sp-consensus = { version = "0.40.0", default-features = false }
-sp-consensus-aura = { version = "0.40.0", default-features = false }
-sp-consensus-grandpa = { version = "21.0.0", default-features = false }
-sp-keyring = { version = "39.0.0", default-features = false }
 sp-keystore = { version = "0.40.0", default-features = false }
-sp-timestamp = { version = "34.0.0", default-features = false }
-sp-blockchain = { version = "37.0.1", default-features = false }
-sp-block-builder = { version = "34.0.0", default-features = false }
-sp-version = { version = "37.0.0", default-features = false }
 sp-externalities = { version = "0.29.0", default-features = false }
-sp-arithmetic = { version = "26.0.0", default-features = false }
-sp-test-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.0", default-features = false }
-sp-tracing = { version = "17.0.0", default-features = false }
-sp-runtime-interface = { version = "28.0.0", default-features = false }
 
 sc-client-api = { version = "37.0.0", default-features = false }
-sc-offchain = { version = "39.0.0", default-features = false }
-sc-basic-authorship = { version = "0.44.0", default-features = false }
-sc-consensus-aura = { version = "0.44.0", default-features = false }
-sc-consensus-grandpa = { version = "0.29.1", default-features = false }
-sc-executor = { version = "0.40.0", default-features = false }
-sc-service = { version = "0.45.0", default-features = false }
 sc-keystore = { version = "33.0.0", default-features = false }
-sc-telemetry = { version = "24.0.0", default-features = false }
-sc-transaction-pool-api = { version = "37.0.0", default-features = false }
-sc-cli = { version = "0.46.0", default-features = false }
-sc-consensus = { version = "0.43.0", default-features = false }
-sc-transaction-pool = { version = "37.0.0", default-features = false }
-sc-rpc-api = { version = "0.43.0", default-features = false }
-sc-rpc-spec-v2 = { version = "0.44.0", default-features = false }
-sc-block-builder = { version = "0.42.0", default-features = false }
 parity-scale-codec = { version = "3.6.12", default-features = false }
 
-prometheus-endpoint = { version = "0.17.0", package = "substrate-prometheus-endpoint", default-features = false }
-substrate-test-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.0", default-features = false }
-substrate-test-runtime-client = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.0", default-features = false }
-
-substrate-build-script-utils = { version = "11.0.0", default-features = false }
-pallet-im-online = { version = "36.0.0", default-features = false }
-substrate-frame-rpc-system = { version = "38.0.0", default-features = false }
-pallet-transaction-payment-rpc = { version = "40.0.0", default-features = false }
-fork-tree = { version = "13.0.0", default-features = false }
 scale-info = { version = "2.11.3", default-features = false }
 
 frame-system = { version = "37.1.0", default-features = false }
 frame-support = { version = "37.0.0", default-features = false }
-frame-executive = { version = "37.0.0", default-features = false }
 
 pallet-balances = { version = "38.0.0", default-features = false }
 pallet-timestamp = { version = "36.0.0", default-features = false }
 pallet-session = { version = "37.0.0", default-features = false }
 pallet-staking = { version = "37.0.0" }
-pallet-session-historical = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.0", default-features = false }
 pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v1.7.0", default-features = false }
 sp-staking = { version = "34.0.0", default-features = false }
 sp-npos-elections = { version = "34.0.0" }
 sp-session = { version = "35.0.0" }
 
-# ARK Libraries
-ark-std = { version = "0.4.0", default-features = false, features = ["print-trace", "std"] }
-ark-crypto-primitives = { version = "0.4.0", default-features = false }
-ark-ff = { version = "0.4.2", default-features = false }
-ark-poly = { version = "0.4.2", default-features = false }
-ark-ec = { version = "0.4.2", default-features = false }
-ark-relations = { version = "0.4.0", default-features = false }
-ark-serialize = { version = "0.4.2", default-features = false, features = ["derive"] }
-ark-groth16 = { version = "0.4.0", default-features = false }
-ark-inner-products = { git = "https://github.com/arkworks-rs/ripp", default-features = false }
-ark-circom = { git = "https://github.com/webb-tools/ark-circom.git", default-features = false }
-# ARK curves
-ark-bls12-381 = { version = "0.4", default-features = false, features = ["curve"] }
-ark-bn254 = { version = "0.4", default-features = false, features = ["curve"] }
-ark-secp256k1 = { version = "0.4", default-features = false }
-ark-ed25519 = { version = "0.4", default-features = false }
-
-aes-gcm = { version = "0.10", default-features = false, features = ["aes", "alloc", "getrandom", "zeroize"] }
-anyhow = "1.0.86"
-async-recursion2 = "1.0.5"
 async-trait = "0.1.82"
 auto_impl = "1.2.0"
-aws-config = "1.5.5"
-aws-types = "1.3.3"
-aws-sdk-kms = "1.40.0"
-aws-sdk-s3 = "1.45.0"
-aws-sdk-secretsmanager = "1.43.0"
 backoff = { version = "0.4.0", default-features = false }
-base64 = "0.22.1"
 bincode = "1.3.3"
-bincode2 = { version = "2" }
-byteorder = { version = "1.5.0", default-features = false }
-bytes = "1.7.1"
-chacha20poly1305 = "0.10.1"
 cargo-generate = "0.21.3"
 cfg-if = "1.0.0"
 clap = "4.5.16"
 clap-cargo = "0.14"
 color-eyre = { version = "0.6", features = ["tracing-error", "color-spantrace"] }
-derivation-path = "0.2.0"
 ed25519-zebra = { version = "4" }
 elliptic-curve = { version = "0.13.8" }
-env_logger = "0.11.5"
 escargot = "0.5.12"
 ethereum-types = { version = "0.14.1", default-features = false }
 failure = "0.1.8"
 fs2 = "0.4"
 futures = "0.3.30"
-futures-timer = "3.0.3"
-futures-util = "0.3.30"
 getrandom = { version = "0.2.15", default-features = false }
 hex = { version = "0.4.3", default-features = false }
-hex-literal = "0.4.1"
 http-body-util = "0.1.2"
 hyper = { version = "1.4.1", default-features = false }
 hyper-util = "0.1.7"
 itertools = "0.13.0"
-jsonrpsee = "0.24.3"
-jsonwebtoken = "9.3.0"
 k256 = { version = "0.13.3", default-features = false }
-lazy_static = "1.5.0"
 libp2p = { version = "0.54", default-features = false }
-libsecp256k1 = "0.7.1"
-linked-hash-map = { version = "0.5.6", default-features = false }
 lock_api = "0.4.12"
 log = "0.4.22"
 multiaddr = { version = "0.18.1", default-features = false }
 nix = { version = "0.29.0", features = ["process", "signal"] }
-num-bigint = "0.4.6"
-p256 = { version = "0.13.2", default-features = false }
 parking_lot = "0.12.3"
-picky-asn1-der = "0.5.0"
-pin-project-lite = "0.2.14"
-postcard = "1.0.9"
-pretty_env_logger = "0.5.0"
 proc-macro2 = "1.0"
 prometheus = { version = "0.13.4", default-features = false }
 quote = "1.0"
-rand = "0.8.5"
-rand_chacha = { version = "0.3.1" }
-rand_core = { version = "0.6", default-features = false }
-rayon = { version = "1.10.0" }
-regex = "1.10.6"
+rand = { version = "0.8.5", default-features = false }
 reqwest = "0.12.7"
-rsa = "0.9.6"
 rustdoc-types = "0.29.1"
 schnorrkel = { version = "0.11.4", default-features = false, features = ["preaudit_deprecated", "getrandom"] }
-scrypt = "0.11.0"
 serde = { version = "1.0.208", default-features = false }
-serde_bytes = { version = "0.11.15", default-features = false }
 serde_json = "1.0"
 sha2 = "0.10.8"
-signature = "2.2.0"
 sqlx = "=0.7.3"
-starknet-crypto = "0.7.1"
 structopt = "0.3.26"
-strum = "0.26"
-substrate-prometheus-endpoint = { version = "0.17.0", default-features = false }
 syn = "2.0.75"
 sysinfo = "0.31.2"
 # TODO: Stop using this fork once https://github.com/dtolnay/thiserror/pull/304 lands
 thiserror = { git = "https://github.com/quartiq/thiserror", branch = "no-std", default-features = false }
 tokio = { version = "1.39.3", default-features = false }
-tokio-rustls = "0.26.0"
-tokio-util = { version = "0.7.11", default-features = false }
 toml = "0.8.19"
 tracing = { version = "0.1", default-features = false }
-tracing-core = { version = "0.1.32", default-features = false }
-tracing-log = { version = "0.2", default-features = false }
 tracing-subscriber = { version = "0.3", default-features = false }
-tracing-wasm = { version = "0.2.1" }
-tree_magic_mini = "3.1.5"
-spec_version = "0.1.0"
 derive_more = { version = "1.0.0", features = ["display"] }
 trybuild = "1.0"
 tsify = "0.4.5"
 typed-builder = "0.19"
 # TODO: Stop using this fork once https://github.com/servo/rust-url/pull/831 lands
 url = { git = "https://github.com/domenukk/rust-url", branch = "no_std", default-features = false }
-uuid = "1.10.0"
 w3f-bls = { version = "0.1.4", default-features = false }
-zeroize = { version = "1", default-features = false, features = ["alloc", "zeroize_derive"] }
 
-anvil = { git = "https://github.com/foundry-rs/foundry.git" }
-foundry-common = { git = "https://github.com/foundry-rs/foundry.git" }
-alloy-chains = "0.1.27"
 alloy-primitives = "0.7.7"
-alloy-dyn-abi = "0.7.7"
 alloy-json-abi = "0.7.7"
 alloy-sol-types = "0.7.7"
-alloy-rlp = "0.3.8"
-alloy-trie = "0.4.1"
 alloy-rpc-types = { version = "0.2.1" }
-alloy-rpc-types-anvil = { version = "0.2.1" }
-alloy-rpc-types-eth = { version = "0.2.1" }
-alloy-rpc-types-trace = { version = "0.2.1" }
-alloy-rpc-types-engine = { version = "0.2.1" }
-alloy-genesis = { version = "0.2.1" }
-alloy-node-bindings = { version = "0.2.1" }
 alloy-provider = { version = "0.2.1", default-features = false, features = ["reqwest", "ws"] }
 alloy-pubsub = { version = "0.2.1" }
-alloy-transport-http = { version = "0.2.1" }
-alloy-eips = { version = "0.2.1", default-features = false }
 alloy-signer = { version = "0.2.1" }
 alloy-signer-local = { version = "0.2.1" }
 alloy-network = { version = "0.2.1" }
-alloy-consensus = { version = "0.2.1" }
 alloy-contract = { version = "0.2.1" }
 alloy-transport = { version = "0.2.1" }
-alloy-transport-ws = { version = "0.2.1" }
-alloy-rpc-client = { version = "0.2.1" }
 
 # WebAssembly
 js-sys = "0.3.70"
 serde-wasm-bindgen = "0.6.5"
-sp-wasm-interface = { version = "21.0.0", default-features = false }
 wasm-bindgen = "0.2.93"
-wasm-bindgen-test = "0.3.43"
 wasm-bindgen-futures = "0.4.43"
-wasmer = { version = "4.3.5", default-features = false }
 wasmtime = { version = "23.0.2", default-features = false }
 wasmtimer = "0.2"
 
diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml
index db2966d96..c4a6f4819 100644
--- a/sdk/Cargo.toml
+++ b/sdk/Cargo.toml
@@ -18,7 +18,7 @@ http-body-util = { workspace = true }
 lock_api = { workspace = true }
 sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite"], optional = true }
 parking_lot = { workspace = true, optional = true }
-rand = { version = "0.8", default-features = false, features = ["alloc"] }
+rand = { workspace = true, features = ["alloc"] }
 thiserror = { workspace = true }
 
 # Keystore deps
diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs
index c2b8704a1..5089985cd 100644
--- a/sdk/src/lib.rs
+++ b/sdk/src/lib.rs
@@ -31,7 +31,7 @@ pub mod logger;
 #[cfg(feature = "std")]
 pub mod metrics;
 #[cfg(any(feature = "std", feature = "wasm"))]
-pub(crate) mod mutex_ext;
+pub mod mutex_ext;
 /// Network Module
 #[cfg(feature = "std")]
 pub mod network;


Test patch:
diff --git a/blueprint-test-utils/src/test_ext.rs b/blueprint-test-utils/src/test_ext.rs
index 4ac6687d5..3f2db1baf 100644
--- a/blueprint-test-utils/src/test_ext.rs
+++ b/blueprint-test-utils/src/test_ext.rs
@@ -30,7 +30,7 @@ use gadget_sdk::tangle_subxt::subxt::{OnlineClient, SubstrateConfig};
 use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types;
 use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::ApprovalPrefrence;
 use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::services::calls::types::register::{Preferences, RegistrationArgs};
-use gadget_sdk::TokioMutexExt;
+use gadget_sdk::mutex_ext::TokioMutexExt;
 use gadget_sdk::Error;
 use libp2p::Multiaddr;
 use sp_application_crypto::ecdsa;
@@ -129,17 +129,16 @@ impl Network for MockNetwork {
                 .peers_tx
                 .get(&peer_id)
                 .ok_or(Error::PeerNotFound { id: peer_id })?;
-            tx.send(message).map_err(|err| Error::NetworkError {
+            tx.send(message).map_err(|err| Error::Network {
                 reason: err.to_string(),
             })?;
         } else {
             // Broadcast to everyone except ourself
             for (peer_id, tx) in self.peers_tx.iter() {
                 if peer_id != &self.my_id {
-                    tx.send(message.clone())
-                        .map_err(|err| Error::NetworkError {
-                            reason: err.to_string(),
-                        })?;
+                    tx.send(message.clone()).map_err(|err| Error::Network {
+                        reason: err.to_string(),
+                    })?;
                 }
             }
         }