diff --git a/.github/workflows/build_binaries.json b/.github/workflows/build_binaries.json index fccad6ed3a..7d98da987f 100644 --- a/.github/workflows/build_binaries.json +++ b/.github/workflows/build_binaries.json @@ -2,7 +2,7 @@ { "name": "linux-x86_64", "runs-on": "ubuntu-20.04", - "rust": "nightly-2024-02-04", + "rust": "nightly-2024-03-01", "target": "x86_64-unknown-linux-gnu", "cross": false, "build_metric": true diff --git a/.github/workflows/build_binaries.yml b/.github/workflows/build_binaries.yml index 810bc5ac1b..51fd48104c 100644 --- a/.github/workflows/build_binaries.yml +++ b/.github/workflows/build_binaries.yml @@ -26,7 +26,7 @@ env: TS_FEATURES: "default, safe" TS_LIBRARIES: "minotari_mining_helper_ffi" TARI_NETWORK_DIR: testnet - toolchain: nightly-2024-02-04 + toolchain: nightly-2024-03-01 matrix-json-file: ".github/workflows/build_binaries.json" CARGO_HTTP_MULTIPLEXING: false CARGO_UNSTABLE_SPARSE_REGISTRY: true diff --git a/.github/workflows/build_dockers.yml b/.github/workflows/build_dockers.yml index 001881331b..fea6947570 100644 --- a/.github/workflows/build_dockers.yml +++ b/.github/workflows/build_dockers.yml @@ -48,7 +48,7 @@ name: Build docker images - xmrig env: - toolchain_default: nightly-2024-02-04 + toolchain_default: nightly-2024-03-01 concurrency: # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix diff --git a/.github/workflows/build_dockers_workflow.yml b/.github/workflows/build_dockers_workflow.yml index c24e98e779..b6d5bbc8f4 100644 --- a/.github/workflows/build_dockers_workflow.yml +++ b/.github/workflows/build_dockers_workflow.yml @@ -14,7 +14,7 @@ name: Build docker images - workflow_call/on-demand toolchain: type: string description: 'Rust toolchain' - default: nightly-2024-02-04 + default: nightly-2024-03-01 arch: type: string default: x86-64 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 166f8d432c..70b3fc8678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ name: CI merge_group: env: - toolchain: nightly-2024-02-04 + toolchain: nightly-2024-03-01 CARGO_HTTP_MULTIPLEXING: false CARGO_TERM_COLOR: always CARGO_UNSTABLE_SPARSE_REGISTRY: true diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 39ad2e4b91..78e4b2fa3a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,7 +11,7 @@ name: Source Coverage - ci-coverage-* env: - toolchain: nightly-2024-02-04 + toolchain: nightly-2024-03-01 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 57ff669092..921ab950be 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -27,7 +27,7 @@ name: Integration tests type: string env: - toolchain: nightly-2024-02-04 + toolchain: nightly-2024-03-01 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/Cargo.lock b/Cargo.lock index 8efb6dbfb4..9de934274e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1375,17 +1375,20 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", - "fiat-crypto 0.2.2", + "fiat-crypto", + "group", "platforms", + "rand_core", "rustc_version", + "serde", "subtle", "zeroize", ] @@ -1911,12 +1914,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "fiat-crypto" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" - [[package]] name = "fiat-crypto" version = "0.2.2" @@ -2723,15 +2720,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "itertools" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.5" @@ -3341,7 +3329,7 @@ version = "1.0.0-pre.13" dependencies = [ "ledger-transport 0.10.0 (git+https://github.com/Zondax/ledger-rs?rev=20e2a20)", "ledger-transport-hid", - "num-derive 0.3.3", + "num-derive", "num-traits", "serde", "tari_common", @@ -3828,20 +3816,9 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "num-derive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", @@ -4292,7 +4269,7 @@ dependencies = [ "md-5", "nom", "num-bigint-dig", - "num-derive 0.4.1", + "num-derive", "num-traits", "p256", "p384", @@ -5897,24 +5874,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "tari-curve25519-dalek" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b8e2644aae57a832e475ebc31199ab1114ebd7fe4d2621e67e89bdd9c8ac38" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "fiat-crypto 0.1.20", - "platforms", - "rand_core", - "rustc_version", - "serde", - "subtle", - "zeroize", -] - [[package]] name = "tari-tiny-keccak" version = "2.0.2" @@ -5927,24 +5886,22 @@ dependencies = [ [[package]] name = "tari_bulletproofs_plus" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9abc9cbebffb1149112a80d6955498ed891f9b786e89c50e07de4b4f16290fd8" +checksum = "8eac57729e3b003c18e822c64c8c4977770102b2eaea920a7c40bca5caf12c54" dependencies = [ "blake2", "byteorder", - "derivative", - "derive_more", + "curve25519-dalek", "digest 0.10.7", - "itertools 0.6.5", - "lazy_static", + "ff", + "itertools 0.12.1", "merlin", - "rand", + "once_cell", "rand_core", "serde", "sha3", - "tari-curve25519-dalek", - "thiserror", + "thiserror-no-std", "zeroize", ] @@ -6155,7 +6112,7 @@ dependencies = [ "diesel_migrations", "futures 0.3.29", "log", - "num-derive 0.3.3", + "num-derive", "num-traits", "prost", "rand", @@ -6208,7 +6165,7 @@ dependencies = [ "minotari_ledger_wallet_comms", "monero", "newtype-ops", - "num-derive 0.3.3", + "num-derive", "num-format", "num-traits", "once_cell", @@ -6224,7 +6181,6 @@ dependencies = [ "sha3", "strum", "strum_macros", - "tari-curve25519-dalek", "tari-tiny-keccak", "tari_common", "tari_common_sqlite", @@ -6255,21 +6211,23 @@ dependencies = [ [[package]] name = "tari_crypto" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63a3ed2c551101eb42b7f9386c207e28d53e6816f7b4c9a0883548922f317b3e" +checksum = "40833db37f54c3b176da3d07199c76ec7a062b19fbf74bf270d614804114ee58" dependencies = [ "blake2", "borsh", + "curve25519-dalek", "digest 0.10.7", "log", + "merlin", "once_cell", "rand_chacha", "rand_core", "serde", "sha3", "snafu", - "tari-curve25519-dalek", + "subtle", "tari_bulletproofs_plus", "tari_utilities", "zeroize", @@ -6627,6 +6585,26 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "thiserror-impl-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "thiserror-no-std" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" +dependencies = [ + "thiserror-impl-no-std", +] + [[package]] name = "thread-id" version = "4.2.1" diff --git a/applications/minotari_app_grpc/Cargo.toml b/applications/minotari_app_grpc/Cargo.toml index 5ae9d5d8ed..8943ce5f81 100644 --- a/applications/minotari_app_grpc/Cargo.toml +++ b/applications/minotari_app_grpc/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_core = { path = "../../base_layer/core" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_script = { path = "../../infrastructure/tari_script" } tari_utilities = { version = "0.7" } diff --git a/applications/minotari_app_grpc/src/authentication/basic_auth.rs b/applications/minotari_app_grpc/src/authentication/basic_auth.rs index 20d23eb7fa..d1d148e21b 100644 --- a/applications/minotari_app_grpc/src/authentication/basic_auth.rs +++ b/applications/minotari_app_grpc/src/authentication/basic_auth.rs @@ -227,13 +227,9 @@ mod tests { } mod validate { - use std::{ - cmp::{max, min}, - thread::sleep, - }; + use std::{cmp::max, thread::sleep}; - use rand::RngCore; - use tari_utilities::{hex::Hex, ByteArray}; + use tari_utilities::hex::Hex; use super::*; use crate::authentication::salted_password::create_salted_hashed_password; diff --git a/applications/minotari_console_wallet/Cargo.toml b/applications/minotari_console_wallet/Cargo.toml index 87a2b3edde..8b7e4f6c6b 100644 --- a/applications/minotari_console_wallet/Cargo.toml +++ b/applications/minotari_console_wallet/Cargo.toml @@ -14,7 +14,7 @@ tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } tari_comms_dht = { path = "../../comms/dht" } tari_contacts = { path = "../../base_layer/contacts" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_key_manager = { path = "../../base_layer/key_manager" } tari_libtor = { path = "../../infrastructure/libtor", optional = true } tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } diff --git a/applications/minotari_ledger_wallet/comms/Cargo.toml b/applications/minotari_ledger_wallet/comms/Cargo.toml index a2282b4974..d2146a9d20 100644 --- a/applications/minotari_ledger_wallet/comms/Cargo.toml +++ b/applications/minotari_ledger_wallet/comms/Cargo.toml @@ -11,7 +11,7 @@ tari_common = { path = "../../../common", version = "1.0.0-pre.12" } ledger-transport = { git = "https://github.com/Zondax/ledger-rs", rev = "20e2a20" } ledger-transport-hid = { git = "https://github.com/Zondax/ledger-rs", rev = "20e2a20" } -num-derive = "0.3.3" +num-derive = "0.4.2" num-traits = "0.2.15" serde = { version = "1.0.106", features = ["derive"] } thiserror = "1.0.26" \ No newline at end of file diff --git a/applications/minotari_merge_mining_proxy/src/block_template_data.rs b/applications/minotari_merge_mining_proxy/src/block_template_data.rs index fa90b116e2..1ca1b94003 100644 --- a/applications/minotari_merge_mining_proxy/src/block_template_data.rs +++ b/applications/minotari_merge_mining_proxy/src/block_template_data.rs @@ -26,7 +26,7 @@ use std::{collections::HashMap, convert::TryFrom, sync::Arc}; #[cfg(not(test))] use chrono::Duration; -use chrono::{self, DateTime, Utc}; +use chrono::{DateTime, Utc}; use minotari_node_grpc_client::grpc; use tari_common_types::types::FixedHash; use tari_core::proof_of_work::monero_rx::FixedByteArray; diff --git a/applications/minotari_miner/Cargo.toml b/applications/minotari_miner/Cargo.toml index 80358b4bbc..3237172ad0 100644 --- a/applications/minotari_miner/Cargo.toml +++ b/applications/minotari_miner/Cargo.toml @@ -14,7 +14,7 @@ tari_common_types = { path = "../../base_layer/common_types" } tari_comms = { path = "../../comms/core" } minotari_app_utilities = { path = "../minotari_app_utilities", features = ["miner_input"] } minotari_app_grpc = { path = "../minotari_app_grpc" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_utilities = { version = "0.7" } base64 = "0.13.0" diff --git a/applications/minotari_miner/src/stratum/controller.rs b/applications/minotari_miner/src/stratum/controller.rs index e569253b5e..24fe288151 100644 --- a/applications/minotari_miner/src/stratum/controller.rs +++ b/applications/minotari_miner/src/stratum/controller.rs @@ -21,7 +21,6 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // use std::{ - self, io::{BufRead, ErrorKind, Write}, sync::mpsc, thread, diff --git a/applications/minotari_miner/src/stratum/stratum_controller/controller.rs b/applications/minotari_miner/src/stratum/stratum_controller/controller.rs index 6abe804d5c..a9e8670b79 100644 --- a/applications/minotari_miner/src/stratum/stratum_controller/controller.rs +++ b/applications/minotari_miner/src/stratum/stratum_controller/controller.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -use std::{self, convert::TryFrom, sync::mpsc, thread, time::SystemTime}; +use std::{convert::TryFrom, sync::mpsc, thread, time::SystemTime}; use borsh::BorshDeserialize; use futures::stream::StreamExt; diff --git a/applications/minotari_miner/src/stratum/stream.rs b/applications/minotari_miner/src/stratum/stream.rs index 9ce8879055..aec0afa28d 100644 --- a/applications/minotari_miner/src/stratum/stream.rs +++ b/applications/minotari_miner/src/stratum/stream.rs @@ -21,7 +21,6 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // use std::{ - self, io::{self, BufRead, Read, Write}, net::TcpStream, }; diff --git a/applications/minotari_node/Cargo.toml b/applications/minotari_node/Cargo.toml index 984f945584..1c325896ed 100644 --- a/applications/minotari_node/Cargo.toml +++ b/applications/minotari_node/Cargo.toml @@ -15,7 +15,7 @@ tari_comms = { path = "../../comms/core", features = ["rpc"] } tari_common_types = { path = "../../base_layer/common_types" } tari_comms_dht = { path = "../../comms/dht" } tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_libtor = { path = "../../infrastructure/libtor", optional = true } tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } tari_storage = {path="../../infrastructure/storage"} diff --git a/base_layer/chat_ffi/Cargo.toml b/base_layer/chat_ffi/Cargo.toml index b33b76cdd8..df87142112 100644 --- a/base_layer/chat_ffi/Cargo.toml +++ b/base_layer/chat_ffi/Cargo.toml @@ -32,7 +32,7 @@ crate-type = ["staticlib","cdylib"] [dev-dependencies] chrono = { version = "0.4.19", default-features = false } rand = "0.8" -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } [build-dependencies] cbindgen = "0.24.3" diff --git a/base_layer/chat_ffi/src/contacts_liveness_data.rs b/base_layer/chat_ffi/src/contacts_liveness_data.rs index c1bb9b305a..45f98e87c9 100644 --- a/base_layer/chat_ffi/src/contacts_liveness_data.rs +++ b/base_layer/chat_ffi/src/contacts_liveness_data.rs @@ -147,8 +147,6 @@ pub unsafe extern "C" fn destroy_contacts_liveness_data(ptr: *mut ContactsLivene #[cfg(test)] mod test { - use std::convert::TryFrom; - use chrono::NaiveDateTime; use tari_contacts::contacts_service::service::{ContactMessageType, ContactOnlineStatus}; use tari_utilities::epoch_time::EpochTime; diff --git a/base_layer/chat_ffi/src/message.rs b/base_layer/chat_ffi/src/message.rs index 859ca1a76f..99eba1d2e1 100644 --- a/base_layer/chat_ffi/src/message.rs +++ b/base_layer/chat_ffi/src/message.rs @@ -452,13 +452,12 @@ pub unsafe extern "C" fn read_chat_message_id(message: *mut Message, error_out: #[cfg(test)] mod test { - use tari_contacts::contacts_service::types::{Direction, MessageBuilder}; + use tari_contacts::contacts_service::types::Direction; use tari_utilities::epoch_time::EpochTime; use super::*; use crate::{ byte_vector::{chat_byte_vector_destroy, chat_byte_vector_get_at, chat_byte_vector_get_length}, - message::read_chat_message_id, tari_address::destroy_tari_address, }; diff --git a/base_layer/chat_ffi/src/message_metadata.rs b/base_layer/chat_ffi/src/message_metadata.rs index c93d4a6398..b5a7b77611 100644 --- a/base_layer/chat_ffi/src/message_metadata.rs +++ b/base_layer/chat_ffi/src/message_metadata.rs @@ -169,20 +169,12 @@ pub unsafe extern "C" fn destroy_chat_message_metadata(ptr: *mut MessageMetadata #[cfg(test)] mod test { - use std::convert::TryFrom; - - use libc::c_uint; use tari_common_types::tari_address::TariAddress; use tari_contacts::contacts_service::types::MessageBuilder; use super::*; use crate::{ - byte_vector::{ - chat_byte_vector_create, - chat_byte_vector_destroy, - chat_byte_vector_get_at, - chat_byte_vector_get_length, - }, + byte_vector::{chat_byte_vector_destroy, chat_byte_vector_get_at, chat_byte_vector_get_length}, message::{chat_metadata_get_at, destroy_chat_message}, }; diff --git a/base_layer/common_types/Cargo.toml b/base_layer/common_types/Cargo.toml index 11430f5ed5..54b2f2fb95 100644 --- a/base_layer/common_types/Cargo.toml +++ b/base_layer/common_types/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] minotari_ledger_wallet_comms = { path = "../../applications/minotari_ledger_wallet/comms", version = "1.0.0-pre.13" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_utilities = { version = "0.7" } tari_common = { path = "../../common", version = "1.0.0-pre.13" } diff --git a/base_layer/common_types/src/encryption.rs b/base_layer/common_types/src/encryption.rs index 7de8e7bd90..68533e8ff0 100644 --- a/base_layer/common_types/src/encryption.rs +++ b/base_layer/common_types/src/encryption.rs @@ -109,11 +109,7 @@ pub fn encrypt_bytes_integral_nonce( #[cfg(test)] mod test { - use std::mem::size_of; - - use chacha20poly1305::{Key, KeyInit, Tag, XChaCha20Poly1305, XNonce}; - use rand::{rngs::OsRng, RngCore}; - use tari_utilities::{ByteArray, Hidden}; + use chacha20poly1305::{Key, KeyInit}; use super::*; diff --git a/base_layer/contacts/Cargo.toml b/base_layer/contacts/Cargo.toml index bf7ce96c2e..afbc69a6bc 100644 --- a/base_layer/contacts/Cargo.toml +++ b/base_layer/contacts/Cargo.toml @@ -12,7 +12,7 @@ tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-pre.13" } tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-pre.13" } tari_comms = { path = "../../comms/core", version = "1.0.0-pre.13" } tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-pre.13" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_p2p = { path = "../p2p", features = ["auto-update"], version = "1.0.0-pre.13" } tari_service_framework = { path = "../service_framework", version = "1.0.0-pre.13" } tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-pre.13" } @@ -23,7 +23,7 @@ diesel = { version = "2.0.3", features = ["sqlite", "serde_json", "chrono", "64- diesel_migrations = "2.0.0" futures = { version = "^0.3.1", features = ["compat", "std"] } log = "0.4.6" -num-derive = "0.3.3" +num-derive = "0.4.2" num-traits = "0.2.15" prost = "0.11.9" rand = "0.8" diff --git a/base_layer/contacts/src/contacts_service/storage/sqlite_db.rs b/base_layer/contacts/src/contacts_service/storage/sqlite_db.rs index 40f9bf5e50..e3c4b1ad67 100644 --- a/base_layer/contacts/src/contacts_service/storage/sqlite_db.rs +++ b/base_layer/contacts/src/contacts_service/storage/sqlite_db.rs @@ -221,23 +221,16 @@ where TContactServiceDbConnection: PooledDbConnection) -> SyncPeer { diff --git a/base_layer/core/src/blocks/genesis_block.rs b/base_layer/core/src/blocks/genesis_block.rs index c5fcb9ed57..aba2019421 100644 --- a/base_layer/core/src/blocks/genesis_block.rs +++ b/base_layer/core/src/blocks/genesis_block.rs @@ -401,8 +401,6 @@ mod test { use std::convert::TryFrom; use tari_common_types::{epoch::VnEpoch, types::Commitment}; - use tari_utilities::ByteArray; - use Network; use super::*; use crate::{ diff --git a/base_layer/core/src/chain_storage/blockchain_database.rs b/base_layer/core/src/chain_storage/blockchain_database.rs index f869ce5a77..b8308e2a8f 100644 --- a/base_layer/core/src/chain_storage/blockchain_database.rs +++ b/base_layer/core/src/chain_storage/blockchain_database.rs @@ -2608,7 +2608,6 @@ mod test { chain_strength_comparer::strongest_chain, consensus_constants::PowAlgorithmConstants, ConsensusConstantsBuilder, - ConsensusManager, }, proof_of_work::Difficulty, test_helpers::{ @@ -2912,7 +2911,6 @@ mod test { mod handle_possible_reorg { use super::*; - use crate::test_helpers::blockchain::update_block_and_smt; #[ignore] #[tokio::test] diff --git a/base_layer/core/src/common/limited_reader.rs b/base_layer/core/src/common/limited_reader.rs index a5c21fd76e..be80895a69 100644 --- a/base_layer/core/src/common/limited_reader.rs +++ b/base_layer/core/src/common/limited_reader.rs @@ -44,8 +44,6 @@ impl Read for LimitedBytesReader { #[cfg(test)] mod test { - use std::io::Read; - use super::*; impl LimitedBytesReader { diff --git a/base_layer/core/src/common/one_sided.rs b/base_layer/core/src/common/one_sided.rs index 3d5740ee08..cccbf37036 100644 --- a/base_layer/core/src/common/one_sided.rs +++ b/base_layer/core/src/common/one_sided.rs @@ -20,8 +20,6 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::result::Result; - use blake2::Blake2b; use digest::consts::U64; use tari_common_types::types::{PrivateKey, PublicKey, WalletHasher}; diff --git a/base_layer/core/src/consensus/consensus_encoding/hashing.rs b/base_layer/core/src/consensus/consensus_encoding/hashing.rs index 1eb42a460a..b3c4eacb91 100644 --- a/base_layer/core/src/consensus/consensus_encoding/hashing.rs +++ b/base_layer/core/src/consensus/consensus_encoding/hashing.rs @@ -71,7 +71,6 @@ impl Default for DomainSeparatedConsen mod tests { use blake2::Blake2b; use digest::consts::U32; - use tari_common::configuration::Network; use tari_crypto::hash_domain; use tari_script::script; diff --git a/base_layer/core/src/covenants/fields.rs b/base_layer/core/src/covenants/fields.rs index 480dd0a6b4..12e80b172d 100644 --- a/base_layer/core/src/covenants/fields.rs +++ b/base_layer/core/src/covenants/fields.rs @@ -565,9 +565,7 @@ mod test { use crate::transactions::key_manager::create_memory_db_key_manager; mod construct_challenge_from { - use blake2::Digest; use digest::Update; - use tari_crypto::hashing::DomainSeparation; use super::*; use crate::transactions::{tari_amount::MicroMinotari, transaction_components::RangeProofType}; @@ -618,11 +616,7 @@ mod test { mod get_field_value_ref { use super::*; - use crate::transactions::{ - key_manager::create_memory_db_key_manager, - tari_amount::MicroMinotari, - transaction_components::RangeProofType, - }; + use crate::transactions::{tari_amount::MicroMinotari, transaction_components::RangeProofType}; #[tokio::test] async fn it_retrieves_the_value_as_ref() { diff --git a/base_layer/core/src/proof_of_work/monero_rx/helpers.rs b/base_layer/core/src/proof_of_work/monero_rx/helpers.rs index 17c1f46d40..d56d5c53af 100644 --- a/base_layer/core/src/proof_of_work/monero_rx/helpers.rs +++ b/base_layer/core/src/proof_of_work/monero_rx/helpers.rs @@ -382,9 +382,8 @@ mod test { use borsh::BorshSerialize; use monero::{ - blockdata::transaction::{ExtraField, TxOutTarget}, + blockdata::transaction::TxOutTarget, consensus::deserialize, - cryptonote::hash::Hashable, util::ringct::{RctSig, RctSigBase, RctType}, Hash, PublicKey, @@ -394,7 +393,6 @@ mod test { TxOut, }; use tari_common::configuration::Network; - use tari_common_types::types::FixedHash; use tari_test_utils::unpack_enum; use tari_utilities::{ epoch_time::EpochTime, @@ -403,7 +401,7 @@ mod test { }; use super::*; - use crate::proof_of_work::{monero_rx::fixed_array::FixedByteArray, PowAlgorithm, ProofOfWork}; + use crate::proof_of_work::{PowAlgorithm, ProofOfWork}; // This tests checks the hash of monero-rs #[test] diff --git a/base_layer/core/src/proof_of_work/proof_of_work.rs b/base_layer/core/src/proof_of_work/proof_of_work.rs index 036a9be61e..963b0b6682 100644 --- a/base_layer/core/src/proof_of_work/proof_of_work.rs +++ b/base_layer/core/src/proof_of_work/proof_of_work.rs @@ -29,6 +29,7 @@ use tari_utilities::hex::Hex; use crate::proof_of_work::PowAlgorithm; +#[allow(dead_code)] pub trait AchievedDifficulty {} /// The proof of work data structure that is included in the block header. There's some non-Rustlike redundancy here diff --git a/base_layer/core/src/transactions/aggregated_body.rs b/base_layer/core/src/transactions/aggregated_body.rs index 47148fb116..203b43a3d7 100644 --- a/base_layer/core/src/transactions/aggregated_body.rs +++ b/base_layer/core/src/transactions/aggregated_body.rs @@ -429,7 +429,7 @@ impl Display for AggregateBody { #[cfg(test)] mod test { - use tari_common_types::types::{ComAndPubSignature, Commitment, FixedHash, PublicKey, Signature}; + use tari_common_types::types::{ComAndPubSignature, FixedHash, PublicKey, Signature}; use tari_script::{ExecutionStack, TariScript}; use super::*; diff --git a/base_layer/core/src/transactions/tari_amount.rs b/base_layer/core/src/transactions/tari_amount.rs index 4110f016fb..b48451aab5 100644 --- a/base_layer/core/src/transactions/tari_amount.rs +++ b/base_layer/core/src/transactions/tari_amount.rs @@ -395,8 +395,6 @@ impl DivAssign for Minotari { #[cfg(test)] mod test { - use std::{convert::TryFrom, str::FromStr}; - use super::*; #[test] diff --git a/base_layer/core/src/transactions/transaction_components/encrypted_data.rs b/base_layer/core/src/transactions/transaction_components/encrypted_data.rs index f3df4a9ef2..f2cd2e52d4 100644 --- a/base_layer/core/src/transactions/transaction_components/encrypted_data.rs +++ b/base_layer/core/src/transactions/transaction_components/encrypted_data.rs @@ -243,9 +243,8 @@ fn kdf_aead(encryption_key: &PrivateKey, commitment: &Commitment) -> EncryptedDa #[cfg(test)] mod test { - use rand::rngs::OsRng; - use tari_common_types::types::{CommitmentFactory, PrivateKey}; - use tari_crypto::{commitment::HomomorphicCommitmentFactory, keys::SecretKey}; + use tari_common_types::types::CommitmentFactory; + use tari_crypto::commitment::HomomorphicCommitmentFactory; use super::*; diff --git a/base_layer/core/src/transactions/transaction_components/test.rs b/base_layer/core/src/transactions/transaction_components/test.rs index 067ca86aef..3777128d7f 100644 --- a/base_layer/core/src/transactions/transaction_components/test.rs +++ b/base_layer/core/src/transactions/transaction_components/test.rs @@ -20,8 +20,8 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use rand::{self, rngs::OsRng}; -use tari_common_types::types::{ComAndPubSignature, PrivateKey, PublicKey, Signature}; +use rand::rngs::OsRng; +use tari_common_types::types::{PrivateKey, Signature}; use tari_crypto::{ commitment::HomomorphicCommitmentFactory, keys::SecretKey as SecretKeyTrait, @@ -42,10 +42,10 @@ use crate::{ create_memory_db_key_manager_with_range_proof_size, TransactionKeyManagerInterface, }, - tari_amount::{uT, MicroMinotari, T}, + tari_amount::{uT, T}, test_helpers, test_helpers::{TestParams, UtxoTestParams}, - transaction_components::{transaction_output::batch_verify_range_proofs, EncryptedData, OutputFeatures}, + transaction_components::{transaction_output::batch_verify_range_proofs, OutputFeatures}, transaction_protocol::TransactionProtocolError, CryptoFactories, }, @@ -567,16 +567,14 @@ async fn test_output_recover_openings() { mod validate_internal_consistency { - use blake2::Blake2b; - use digest::{consts::U32, Digest}; - use tari_common_types::types::FixedHash; + use digest::Digest; use tari_crypto::hashing::DomainSeparation; use super::*; use crate::{ covenants::{BaseLayerCovenantsDomain, COVENANTS_FIELD_HASHER_LABEL}, transactions::{ - key_manager::{create_memory_db_key_manager, MemoryDbKeyManager}, + key_manager::MemoryDbKeyManager, test_helpers::{create_transaction_with, create_wallet_outputs}, }, }; diff --git a/base_layer/core/src/validation/block_body/test.rs b/base_layer/core/src/validation/block_body/test.rs index a8fa2290e7..2a689f350e 100644 --- a/base_layer/core/src/validation/block_body/test.rs +++ b/base_layer/core/src/validation/block_body/test.rs @@ -468,7 +468,6 @@ async fn it_rejects_zero_conf_double_spends() { mod body_only { use super::*; - use crate::validation::block_body::BlockBodyFullValidator; #[tokio::test] async fn it_rejects_invalid_input_metadata() { @@ -507,7 +506,7 @@ mod body_only { mod orphan_validator { use super::*; use crate::{ - transactions::transaction_components::{OutputType, RangeProofType}, + transactions::transaction_components::OutputType, txn_schema, validation::block_body::BlockBodyInternalConsistencyValidator, }; diff --git a/base_layer/key_manager/Cargo.toml b/base_layer/key_manager/Cargo.toml index 72529b6188..3eb73b7b4c 100644 --- a/base_layer/key_manager/Cargo.toml +++ b/base_layer/key_manager/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" crate-type = ["lib", "cdylib"] [dependencies] -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_utilities = { version = "0.7" } tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-pre.13" } tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-pre.13"} diff --git a/base_layer/key_manager/src/cipher_seed.rs b/base_layer/key_manager/src/cipher_seed.rs index 997a6fc234..469b765417 100644 --- a/base_layer/key_manager/src/cipher_seed.rs +++ b/base_layer/key_manager/src/cipher_seed.rs @@ -20,9 +20,8 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::{convert::TryFrom, mem::size_of, str::FromStr}; +use std::{mem::size_of, str::FromStr}; -use argon2; use blake2::Blake2b; use chacha20::{ cipher::{NewCipher, StreamCipher}, diff --git a/base_layer/key_manager/src/key_manager.rs b/base_layer/key_manager/src/key_manager.rs index 3d2067f0e2..58c27d6838 100644 --- a/base_layer/key_manager/src/key_manager.rs +++ b/base_layer/key_manager/src/key_manager.rs @@ -174,7 +174,6 @@ where #[cfg(test)] mod test { use blake2::Blake2b; - use digest::consts::U64; use tari_crypto::ristretto::RistrettoPublicKey; use crate::key_manager::*; diff --git a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/imported_keys.rs b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/imported_keys.rs index 066bec86b8..2a2ad7fa03 100644 --- a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/imported_keys.rs +++ b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/imported_keys.rs @@ -21,7 +21,7 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use chacha20poly1305::XChaCha20Poly1305; use chrono::{NaiveDateTime, Utc}; -use diesel::{prelude::*, SqliteConnection}; +use diesel::prelude::*; use tari_common_types::encryption::{decrypt_bytes_integral_nonce, encrypt_bytes_integral_nonce}; use tari_crypto::keys::PublicKey; use tari_utilities::{hex::Hex, ByteArray, Hidden}; diff --git a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/key_manager_state.rs b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/key_manager_state.rs index be569018c5..c6c64894df 100644 --- a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/key_manager_state.rs +++ b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/key_manager_state.rs @@ -20,11 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::convert::TryFrom; - use chacha20poly1305::XChaCha20Poly1305; use chrono::{NaiveDateTime, Utc}; -use diesel::{prelude::*, SqliteConnection}; +use diesel::prelude::*; use tari_common_sqlite::util::diesel_ext::ExpectedRowsExtension; use tari_common_types::encryption::{decrypt_bytes_integral_nonce, encrypt_bytes_integral_nonce}; use tari_utilities::{ByteArray, Hidden}; diff --git a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/mod.rs b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/mod.rs index 4da82737fc..ed8249a627 100644 --- a/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/mod.rs +++ b/base_layer/key_manager/src/key_manager_service/storage/sqlite_db/mod.rs @@ -20,10 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::{ - convert::TryFrom, - sync::{Arc, RwLock}, -}; +use std::sync::{Arc, RwLock}; use chacha20poly1305::XChaCha20Poly1305; use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; @@ -259,14 +256,10 @@ where #[cfg(test)] mod test { - use std::convert::TryFrom; - use diesel::{sql_query, Connection, RunQueryDsl, SqliteConnection}; - use diesel_migrations::{EmbeddedMigrations, MigrationHarness}; use tempfile::tempdir; use super::*; - use crate::key_manager_service::storage::sqlite_db::{KeyManagerState, KeyManagerStateSql, NewKeyManagerStateSql}; #[test] fn test_key_manager_crud() { diff --git a/base_layer/key_manager/src/mnemonic.rs b/base_layer/key_manager/src/mnemonic.rs index eb99b57a1b..9a783bf5aa 100644 --- a/base_layer/key_manager/src/mnemonic.rs +++ b/base_layer/key_manager/src/mnemonic.rs @@ -282,7 +282,7 @@ pub trait Mnemonic { mod test { use std::str::FromStr; - use rand::{self, rngs::OsRng}; + use rand::rngs::OsRng; use tari_crypto::{keys::SecretKey, ristretto::RistrettoSecretKey, tari_utilities::byte_array::ByteArray}; use super::*; diff --git a/base_layer/mmr/Cargo.toml b/base_layer/mmr/Cargo.toml index 0d5b394502..c2346b9e2b 100644 --- a/base_layer/mmr/Cargo.toml +++ b/base_layer/mmr/Cargo.toml @@ -12,7 +12,7 @@ default = [] [dependencies] tari_utilities = { version = "0.7" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_common = { path = "../../common", version = "1.0.0-pre.13" } thiserror = "1.0" borsh = "1.2" diff --git a/base_layer/mmr/src/merkle_mountain_range.rs b/base_layer/mmr/src/merkle_mountain_range.rs index 0eef7fee65..8aa3338ea1 100644 --- a/base_layer/mmr/src/merkle_mountain_range.rs +++ b/base_layer/mmr/src/merkle_mountain_range.rs @@ -23,7 +23,6 @@ use std::{ cmp::{max, min}, convert::TryInto, - iter::IntoIterator, marker::PhantomData, }; diff --git a/base_layer/mmr/src/sparse_merkle_tree/bit_utils.rs b/base_layer/mmr/src/sparse_merkle_tree/bit_utils.rs index d5b8bbc5ff..0aa5ed472c 100644 --- a/base_layer/mmr/src/sparse_merkle_tree/bit_utils.rs +++ b/base_layer/mmr/src/sparse_merkle_tree/bit_utils.rs @@ -99,7 +99,6 @@ pub fn traverse_direction( #[cfg(test)] mod test { use super::*; - use crate::sparse_merkle_tree::{bit_utils::count_common_prefix, NodeKey}; #[test] fn test_common_prefix() { diff --git a/base_layer/mmr/src/sparse_merkle_tree/node.rs b/base_layer/mmr/src/sparse_merkle_tree/node.rs index 6ac8be86c8..6d17a1426f 100644 --- a/base_layer/mmr/src/sparse_merkle_tree/node.rs +++ b/base_layer/mmr/src/sparse_merkle_tree/node.rs @@ -510,8 +510,7 @@ impl> BranchNode { #[cfg(test)] mod test { use blake2::Blake2b; - use digest::consts::U32; - use rand::{self, RngCore}; + use rand::RngCore; use super::*; use crate::sparse_merkle_tree::bit_utils::TraverseDirection::{Left, Right}; diff --git a/base_layer/mmr/src/sparse_merkle_tree/proofs.rs b/base_layer/mmr/src/sparse_merkle_tree/proofs.rs index 0cd10a9c04..1d3203fa04 100644 --- a/base_layer/mmr/src/sparse_merkle_tree/proofs.rs +++ b/base_layer/mmr/src/sparse_merkle_tree/proofs.rs @@ -227,7 +227,6 @@ impl> MerkleProofDigest for ExclusionProof { #[cfg(test)] mod test { use blake2::Blake2b; - use digest::consts::U32; use super::*; diff --git a/base_layer/mmr/tests/tests/with_blake512_hash.rs b/base_layer/mmr/tests/tests/with_blake512_hash.rs index 48488cf080..393ee30544 100644 --- a/base_layer/mmr/tests/tests/with_blake512_hash.rs +++ b/base_layer/mmr/tests/tests/with_blake512_hash.rs @@ -20,8 +20,6 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::string::ToString; - use blake2::Blake2b; use digest::consts::U64; use tari_crypto::{hash_domain, hashing::DomainSeparatedHasher}; diff --git a/base_layer/p2p/Cargo.toml b/base_layer/p2p/Cargo.toml index e7e4003abd..879f5e16e8 100644 --- a/base_layer/p2p/Cargo.toml +++ b/base_layer/p2p/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" tari_comms = { path = "../../comms/core", version = "1.0.0-pre.13" } tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-pre.13" } tari_common = { path = "../../common", version = "1.0.0-pre.13" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_service_framework = { path = "../service_framework", version = "1.0.0-pre.13" } tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-pre.13" } tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-pre.13" } diff --git a/base_layer/p2p/src/auto_update/mod.rs b/base_layer/p2p/src/auto_update/mod.rs index 97c28a4acb..dc9e52614e 100644 --- a/base_layer/p2p/src/auto_update/mod.rs +++ b/base_layer/p2p/src/auto_update/mod.rs @@ -213,7 +213,6 @@ fn maintainers() -> impl Iterator { #[cfg(test)] mod test { - use config; use tari_common::DefaultConfigLoader; use super::*; diff --git a/base_layer/p2p/src/comms_connector/inbound_connector.rs b/base_layer/p2p/src/comms_connector/inbound_connector.rs index bc31992d93..e56367c499 100644 --- a/base_layer/p2p/src/comms_connector/inbound_connector.rs +++ b/base_layer/p2p/src/comms_connector/inbound_connector.rs @@ -110,8 +110,6 @@ impl InboundDomainConnector { mod test { use futures::executor::block_on; use tari_comms::{message::MessageExt, wrap_in_envelope_body}; - use tari_comms_dht::domain_message::MessageHeader; - use tokio::sync::mpsc; use tower::ServiceExt; use super::*; diff --git a/base_layer/p2p/src/dns/client.rs b/base_layer/p2p/src/dns/client.rs index cd889fd034..50e4a61829 100644 --- a/base_layer/p2p/src/dns/client.rs +++ b/base_layer/p2p/src/dns/client.rs @@ -204,13 +204,7 @@ fn default_client_config() -> Arc { #[cfg(test)] mod mock { - use std::sync::Arc; - - use tari_shutdown::Shutdown; - use trust_dns_client::proto::error::ProtoError; - use super::*; - use crate::dns::mock::{DefaultOnSend, MockClientHandle}; impl Client> { pub async fn connect_mock(messages: Vec>) -> Result { diff --git a/base_layer/p2p/src/dns/mock.rs b/base_layer/p2p/src/dns/mock.rs index e4ee81a4a7..953f10e653 100644 --- a/base_layer/p2p/src/dns/mock.rs +++ b/base_layer/p2p/src/dns/mock.rs @@ -87,6 +87,7 @@ pub fn message(query: Query, answers: Vec, name_servers: Vec, ad } pub trait OnSend: Clone + Send + Sync + 'static { + #[allow(dead_code)] fn on_send( &mut self, response: Result, diff --git a/base_layer/p2p/src/domain_message.rs b/base_layer/p2p/src/domain_message.rs index 4217fb5de9..60a7b151a0 100644 --- a/base_layer/p2p/src/domain_message.rs +++ b/base_layer/p2p/src/domain_message.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::convert::{From, TryFrom}; +use std::convert::TryFrom; use tari_comms::{peer_manager::Peer, types::CommsPublicKey}; use tari_comms_dht::envelope::DhtMessageHeader; diff --git a/base_layer/p2p/src/peer_seeds.rs b/base_layer/p2p/src/peer_seeds.rs index b55feeac2f..0e1311e431 100644 --- a/base_layer/p2p/src/peer_seeds.rs +++ b/base_layer/p2p/src/peer_seeds.rs @@ -160,8 +160,6 @@ impl From for Peer { #[cfg(test)] mod test { - use tari_utilities::hex::Hex; - use super::*; const TEST_NAME: &str = "test.local."; diff --git a/base_layer/p2p/src/services/liveness/service.rs b/base_layer/p2p/src/services/liveness/service.rs index 033b0d0bb0..b3e02e82c6 100644 --- a/base_layer/p2p/src/services/liveness/service.rs +++ b/base_layer/p2p/src/services/liveness/service.rs @@ -395,7 +395,7 @@ mod test { use tari_comms::{ message::MessageTag, net_address::MultiaddressesWithStats, - peer_manager::{NodeId, Peer, PeerFeatures, PeerFlags}, + peer_manager::{Peer, PeerFeatures, PeerFlags}, test_utils::mocks::create_connectivity_mock, types::CommsDatabase, }; diff --git a/base_layer/p2p/src/services/liveness/state.rs b/base_layer/p2p/src/services/liveness/state.rs index 0c2282811b..0c29d20d31 100644 --- a/base_layer/p2p/src/services/liveness/state.rs +++ b/base_layer/p2p/src/services/liveness/state.rs @@ -162,7 +162,7 @@ impl LivenessState { /// Returns true if the nonce is inflight, otherwise false pub fn is_inflight(&self, nonce: u64) -> bool { - self.inflight_pings.get(&nonce).is_some() + self.inflight_pings.contains_key(&nonce) } /// Records a pong. Specifically, the pong counter is incremented and @@ -345,8 +345,8 @@ mod test { state.add_inflight_ping(2, peer2.clone()); state.add_inflight_ping(3, peer2.clone()); - assert!(state.failed_pings.get(&peer1).is_none()); - assert!(state.failed_pings.get(&peer2).is_none()); + assert!(!state.failed_pings.contains_key(&peer1)); + assert!(!state.failed_pings.contains_key(&peer2)); // MAX_INFLIGHT_TTL passes for n in [1, 2, 3] { @@ -363,6 +363,6 @@ mod test { assert!(state.record_pong(2, &peer2).is_none()); let n = state.failed_pings.get(&peer1).unwrap(); assert_eq!(*n, 1); - assert!(state.failed_pings.get(&peer2).is_none()); + assert!(!state.failed_pings.contains_key(&peer2)); } } diff --git a/base_layer/service_framework/src/context/handles.rs b/base_layer/service_framework/src/context/handles.rs index 2042c8f4e8..1eb4bfce10 100644 --- a/base_layer/service_framework/src/context/handles.rs +++ b/base_layer/service_framework/src/context/handles.rs @@ -208,8 +208,6 @@ impl ServiceHandles { #[cfg(test)] mod test { - use tari_shutdown::Shutdown; - use super::*; #[test] diff --git a/base_layer/service_framework/src/context/lazy_service.rs b/base_layer/service_framework/src/context/lazy_service.rs index 313558f94d..c018ea1305 100644 --- a/base_layer/service_framework/src/context/lazy_service.rs +++ b/base_layer/service_framework/src/context/lazy_service.rs @@ -95,12 +95,9 @@ where #[cfg(test)] mod test { - use std::{ - sync::{ - atomic::{AtomicBool, Ordering}, - Arc, - }, - task::Poll, + use std::sync::{ + atomic::{AtomicBool, Ordering}, + Arc, }; use futures::future::{self, poll_fn}; diff --git a/base_layer/service_framework/src/stack.rs b/base_layer/service_framework/src/stack.rs index 34bb819a38..83eaf20a76 100644 --- a/base_layer/service_framework/src/stack.rs +++ b/base_layer/service_framework/src/stack.rs @@ -97,12 +97,11 @@ mod test { }; use async_trait::async_trait; - use futures::{executor::block_on, future}; + use futures::executor::block_on; use tari_shutdown::Shutdown; use tower::service_fn; use super::*; - use crate::{initializer::ServiceInitializer, ServiceInitializerContext}; #[tokio::test] async fn service_defn_simple() { diff --git a/base_layer/service_framework/src/tower/service_ext.rs b/base_layer/service_framework/src/tower/service_ext.rs index 6c0a506792..cd52890f5f 100644 --- a/base_layer/service_framework/src/tower/service_ext.rs +++ b/base_layer/service_framework/src/tower/service_ext.rs @@ -93,7 +93,7 @@ mod test { Arc, }; - use futures::{future, FutureExt}; + use futures::future; use futures_test::task::panic_context; use tower::service_fn; diff --git a/base_layer/tari_mining_helper_ffi/Cargo.toml b/base_layer/tari_mining_helper_ffi/Cargo.toml index 82aa76744e..7eef291bfe 100644 --- a/base_layer/tari_mining_helper_ffi/Cargo.toml +++ b/base_layer/tari_mining_helper_ffi/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] tari_comms = { path = "../../comms/core" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_common = { path = "../../common" } tari_core = { path = "../core", default-features = false, features = ["transactions", "base_node_proto", "base_node"] } tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-pre.13" } diff --git a/base_layer/tari_mining_helper_ffi/src/lib.rs b/base_layer/tari_mining_helper_ffi/src/lib.rs index 8888fb8e52..ede36a6464 100644 --- a/base_layer/tari_mining_helper_ffi/src/lib.rs +++ b/base_layer/tari_mining_helper_ffi/src/lib.rs @@ -566,8 +566,6 @@ pub unsafe extern "C" fn share_validate( #[cfg(test)] mod tests { - use libc::c_int; - use tari_common::configuration::Network; use tari_core::{ blocks::{genesis_block::get_genesis_block, Block}, proof_of_work::Difficulty, @@ -575,7 +573,6 @@ mod tests { }; use super::*; - use crate::{inject_nonce, public_key_hex_validate, share_difficulty, share_validate}; fn min_difficulty() -> Difficulty { Difficulty::from_u64(1000).expect("Failed to create difficulty") diff --git a/base_layer/wallet/Cargo.toml b/base_layer/wallet/Cargo.toml index e6f7c9ab94..f97f3a76fa 100644 --- a/base_layer/wallet/Cargo.toml +++ b/base_layer/wallet/Cargo.toml @@ -12,7 +12,7 @@ tari_common = { path = "../../common", version = "1.0.0-pre.13" } tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-pre.13" } tari_comms = { path = "../../comms/core", version = "1.0.0-pre.13" } tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-pre.13" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_key_manager = { path = "../key_manager", features = ["key_manager_service"], version = "1.0.0-pre.13" } tari_p2p = { path = "../p2p", features = ["auto-update"], version = "1.0.0-pre.13"} tari_script = { path = "../../infrastructure/tari_script", version = "1.0.0-pre.13" } diff --git a/base_layer/wallet/src/lib.rs b/base_layer/wallet/src/lib.rs index 5550b7e529..8c550aec9d 100644 --- a/base_layer/wallet/src/lib.rs +++ b/base_layer/wallet/src/lib.rs @@ -17,7 +17,6 @@ pub mod output_manager_service; pub mod storage; pub mod test_utils; pub mod transaction_service; -pub mod types; pub use tari_common_types::types::WalletHasher; pub mod util; diff --git a/base_layer/wallet/src/output_manager_service/storage/output_source.rs b/base_layer/wallet/src/output_manager_service/storage/output_source.rs index d64b7f8d26..19d178f0df 100644 --- a/base_layer/wallet/src/output_manager_service/storage/output_source.rs +++ b/base_layer/wallet/src/output_manager_service/storage/output_source.rs @@ -19,13 +19,7 @@ // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::{ - convert::TryFrom, - result::{ - Result, - Result::{Err, Ok}, - }, -}; +use core::convert::TryFrom; use strum_macros::Display; diff --git a/base_layer/wallet/src/output_manager_service/storage/output_status.rs b/base_layer/wallet/src/output_manager_service/storage/output_status.rs index 495cc72e37..76e4ecf1ab 100644 --- a/base_layer/wallet/src/output_manager_service/storage/output_status.rs +++ b/base_layer/wallet/src/output_manager_service/storage/output_status.rs @@ -19,13 +19,7 @@ // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::{ - convert::TryFrom, - result::{ - Result, - Result::{Err, Ok}, - }, -}; +use core::convert::TryFrom; use strum_macros::Display; diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs index 8e0018044d..35d937adfa 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs @@ -29,7 +29,6 @@ use diesel::{ prelude::*, r2d2::{ConnectionManager, PooledConnection}, result::Error as DieselError, - SqliteConnection, }; use log::*; pub use new_output_sql::NewOutputSql; diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs index 634ec87098..b6f03d9fb9 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/new_output_sql.rs @@ -22,7 +22,7 @@ use borsh::BorshSerialize; // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. use derivative::Derivative; -use diesel::{prelude::*, SqliteConnection}; +use diesel::prelude::*; use tari_common_types::transaction::TxId; use tari_utilities::ByteArray; diff --git a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs index 83d7d2478c..95e6449ef3 100644 --- a/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs +++ b/base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs @@ -28,7 +28,7 @@ use std::{ use borsh::BorshDeserialize; use chrono::NaiveDateTime; use derivative::Derivative; -use diesel::{prelude::*, sql_query, SqliteConnection}; +use diesel::{prelude::*, sql_query}; use log::*; use tari_common_sqlite::util::diesel_ext::ExpectedRowsExtension; use tari_common_types::{ diff --git a/base_layer/wallet/src/storage/sqlite_db/wallet.rs b/base_layer/wallet/src/storage/sqlite_db/wallet.rs index 74b073b711..962a6bb744 100644 --- a/base_layer/wallet/src/storage/sqlite_db/wallet.rs +++ b/base_layer/wallet/src/storage/sqlite_db/wallet.rs @@ -34,7 +34,7 @@ use argon2::password_hash::{ use blake2::Blake2b; use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305}; use chrono::NaiveDateTime; -use diesel::{prelude::*, result::Error, SqliteConnection}; +use diesel::{prelude::*, result::Error}; use digest::{consts::U32, generic_array::GenericArray, FixedOutput}; use itertools::Itertools; use log::*; diff --git a/base_layer/wallet/src/transaction_service/service.rs b/base_layer/wallet/src/transaction_service/service.rs index c187c1cf10..3054de0136 100644 --- a/base_layer/wallet/src/transaction_service/service.rs +++ b/base_layer/wallet/src/transaction_service/service.rs @@ -2996,7 +2996,7 @@ pub struct TransactionSendResult { #[cfg(test)] mod tests { use tari_crypto::ristretto::RistrettoSecretKey; - use tari_script::{stealth_payment_script, Opcode}; + use tari_script::Opcode; use super::*; diff --git a/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs b/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs index 010b35d342..74e18145ed 100644 --- a/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs +++ b/base_layer/wallet/src/transaction_service/storage/sqlite_db.rs @@ -28,7 +28,7 @@ use std::{ use chacha20poly1305::XChaCha20Poly1305; use chrono::{NaiveDateTime, Utc}; -use diesel::{prelude::*, result::Error as DieselError, SqliteConnection}; +use diesel::{prelude::*, result::Error as DieselError}; use log::*; use tari_common_sqlite::{sqlite_connection_pool::PooledDbConnection, util::diesel_ext::ExpectedRowsExtension}; use tari_common_types::{ @@ -2155,7 +2155,7 @@ impl UnconfirmedTransactionInfoSql { #[cfg(test)] mod test { - use std::{default::Default, mem::size_of, time::Duration}; + use std::{mem::size_of, time::Duration}; use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305}; use chrono::Utc; diff --git a/base_layer/wallet/src/types.rs b/base_layer/wallet/src/types.rs deleted file mode 100644 index 97ad8c685e..0000000000 --- a/base_layer/wallet/src/types.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019. The Tari Project -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -// following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following -// disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the -// following disclaimer in the documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use tari_common_types::types::PublicKey; - -use crate::error::WalletError; - -pub(crate) trait PersistentKeyManager { - fn create_and_store_new(&mut self) -> Result; -} diff --git a/base_layer/wallet/tests/transaction_service_tests/storage.rs b/base_layer/wallet/tests/transaction_service_tests/storage.rs index 19a0cc1004..69f749ffda 100644 --- a/base_layer/wallet/tests/transaction_service_tests/storage.rs +++ b/base_layer/wallet/tests/transaction_service_tests/storage.rs @@ -20,7 +20,6 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::default::Default; use std::mem::size_of; use chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305}; diff --git a/base_layer/wallet_ffi/Cargo.toml b/base_layer/wallet_ffi/Cargo.toml index d9cc9cab7a..6b32e25f71 100644 --- a/base_layer/wallet_ffi/Cargo.toml +++ b/base_layer/wallet_ffi/Cargo.toml @@ -12,7 +12,7 @@ tari_common = { path="../../common" } tari_common_types = { path="../common_types" } tari_comms = { path = "../../comms/core", features = ["c_integration"]} tari_comms_dht = { path = "../../comms/dht", default-features = false } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_key_manager = { path = "../key_manager" } tari_p2p = { path = "../p2p" } tari_script = { path = "../../infrastructure/tari_script" } diff --git a/base_layer/wallet_ffi/README.md b/base_layer/wallet_ffi/README.md index f00bdf193a..b00fecb5ee 100644 --- a/base_layer/wallet_ffi/README.md +++ b/base_layer/wallet_ffi/README.md @@ -132,8 +132,8 @@ Install [Rust](https://www.rust-lang.org/tools/install) Install the following tools and system images ```Shell Script -rustup toolchain add nightly-2024-02-04 -rustup default nightly-2024-02-04 +rustup toolchain add nightly-2024-03-01 +rustup default nightly-2024-03-01 rustup component add rustfmt --toolchain nightly rustup component add clippy rustup target add x86_64-apple-ios aarch64-apple-ios # iPhone and emulator cross compiling diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index 4644556039..f1017f8dda 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -49,7 +49,6 @@ use core::ptr; use std::{ - boxed::Box, convert::{TryFrom, TryInto}, ffi::{CStr, CString}, fmt::{Display, Formatter}, @@ -67,7 +66,7 @@ use error::LibWalletError; use ffi_basenode_state::TariBaseNodeState; use itertools::Itertools; use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_ushort, c_void}; -use log::{LevelFilter, *}; +use log::*; use log4rs::{ append::{ file::FileAppender, @@ -8749,20 +8748,14 @@ pub unsafe extern "C" fn contacts_handle_destroy(contacts_handle: *mut ContactsS /// ------------------------------------------------------------------------------------------ /// #[cfg(test)] mod test { - use std::{ - ffi::CString, - path::Path, - str::{from_utf8, FromStr}, - sync::Mutex, - }; + use std::{path::Path, str::from_utf8, sync::Mutex}; - use libc::{c_char, c_uchar, c_uint}; use minotari_wallet::{ storage::sqlite_utilities::run_migration_and_create_sqlite_connection, transaction_service::handle::TransactionSendStatus, }; use once_cell::sync::Lazy; - use tari_common_types::{emoji, transaction::TransactionStatus, types::PrivateKey}; + use tari_common_types::emoji; use tari_comms::peer_manager::PeerFeatures; use tari_contacts::contacts_service::types::{Direction, Message, MessageMetadata}; use tari_core::{ @@ -8772,7 +8765,7 @@ mod test { test_helpers::{create_test_input, create_wallet_output_with_data, TestParams}, }, }; - use tari_key_manager::{mnemonic::MnemonicLanguage, mnemonic_wordlists}; + use tari_key_manager::mnemonic_wordlists; use tari_p2p::initialization::MESSAGING_PROTOCOL_ID; use tari_script::script; use tari_test_utils::random; @@ -9328,6 +9321,8 @@ mod test { #[test] fn test_encrypted_data_filled() { + use tari_common_types::types::PrivateKey; + unsafe { let mut error = 0; let error_ptr = &mut error as *mut c_int; diff --git a/buildtools/docker/base_node.Dockerfile b/buildtools/docker/base_node.Dockerfile index e5aae31e56..4af0b7e43b 100644 --- a/buildtools/docker/base_node.Dockerfile +++ b/buildtools/docker/base_node.Dockerfile @@ -1,13 +1,13 @@ # syntax=docker/dockerfile:1 #FROM rust:1.42.0 as builder -FROM quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-02-04 as builder +FROM quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-03-01 as builder # Copy the dependency lists #ADD Cargo.toml ./ ADD . /minotari_node WORKDIR /minotari_node -# RUN rustup component add rustfmt --toolchain nightly-2024-02-04-x86_64-unknown-linux-gnu +# RUN rustup component add rustfmt --toolchain nightly-2024-03-01-x86_64-unknown-linux-gnu #ARG TBN_ARCH=native ARG TBN_ARCH=x86-64 #ARG TBN_FEATURES=avx2 diff --git a/common/Cargo.toml b/common/Cargo.toml index a806042026..73133a8e09 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -14,7 +14,7 @@ build = ["toml", "prost-build"] static-application-info = ["git2"] [dependencies] -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_features = { path = "./tari_features", version = "1.0.0-pre.13"} anyhow = "1.0.53" diff --git a/common/src/configuration/name_server.rs b/common/src/configuration/name_server.rs index 55fff6b575..d432d0c405 100644 --- a/common/src/configuration/name_server.rs +++ b/common/src/configuration/name_server.rs @@ -63,7 +63,7 @@ impl FromStr for DnsNameServer { #[cfg(test)] mod test { - use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use std::net::{IpAddr, Ipv4Addr}; use super::*; diff --git a/common_sqlite/src/connection_options.rs b/common_sqlite/src/connection_options.rs index 5fdbb3f98b..e80e027302 100644 --- a/common_sqlite/src/connection_options.rs +++ b/common_sqlite/src/connection_options.rs @@ -20,11 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::{ - option::{Option, Option::Some}, - result::{Result, Result::Ok}, - time::Duration, -}; +use core::time::Duration; use diesel::{connection::SimpleConnection, SqliteConnection}; diff --git a/common_sqlite/src/error.rs b/common_sqlite/src/error.rs index 7bf0d6f9e8..de5875786b 100644 --- a/common_sqlite/src/error.rs +++ b/common_sqlite/src/error.rs @@ -22,7 +22,7 @@ use std::num::TryFromIntError; -use diesel::{self, r2d2}; +use diesel::r2d2; use tari_utilities::message_format::MessageFormatError; use thiserror::Error; use tokio::task; diff --git a/common_sqlite/src/sqlite_connection_pool.rs b/common_sqlite/src/sqlite_connection_pool.rs index 1c70fbca93..95ecf1b246 100644 --- a/common_sqlite/src/sqlite_connection_pool.rs +++ b/common_sqlite/src/sqlite_connection_pool.rs @@ -20,14 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use core::{ - option::Option::{None, Some}, - result::{ - Result, - Result::{Err, Ok}, - }, - time::Duration, -}; +use core::time::Duration; use std::convert::TryFrom; use diesel::{ diff --git a/comms/core/Cargo.toml b/comms/core/Cargo.toml index 841c5a8b1b..d3af33203b 100644 --- a/comms/core/Cargo.toml +++ b/comms/core/Cargo.toml @@ -10,7 +10,7 @@ version = "1.0.0-pre.13" edition = "2018" [dependencies] -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_metrics = { path = "../../infrastructure/metrics", optional = true, version = "1.0.0-pre.13" } tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-pre.13" } tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-pre.13" } diff --git a/comms/core/src/bounded_executor.rs b/comms/core/src/bounded_executor.rs index 2ce811083d..492d128913 100644 --- a/comms/core/src/bounded_executor.rs +++ b/comms/core/src/bounded_executor.rs @@ -156,10 +156,7 @@ impl BoundedExecutor { #[cfg(test)] mod test { use std::{ - sync::{ - atomic::{AtomicBool, Ordering}, - Arc, - }, + sync::atomic::{AtomicBool, Ordering}, time::Duration, }; diff --git a/comms/core/src/connection_manager/dialer.rs b/comms/core/src/connection_manager/dialer.rs index f4ad9a2b70..0451d8b5b4 100644 --- a/comms/core/src/connection_manager/dialer.rs +++ b/comms/core/src/connection_manager/dialer.rs @@ -39,7 +39,7 @@ use tokio::{ time, }; use tokio_stream::StreamExt; -use tracing::{self, span, Instrument, Level}; +use tracing::{span, Instrument, Level}; use super::{direction::ConnectionDirection, error::ConnectionManagerError, peer_connection::PeerConnection}; #[cfg(feature = "metrics")] diff --git a/comms/core/src/connection_manager/peer_connection.rs b/comms/core/src/connection_manager/peer_connection.rs index 4c23a7ef1f..01fe95c3e8 100644 --- a/comms/core/src/connection_manager/peer_connection.rs +++ b/comms/core/src/connection_manager/peer_connection.rs @@ -38,7 +38,7 @@ use tokio::{ time, }; use tokio_stream::StreamExt; -use tracing::{self, span, Instrument, Level}; +use tracing::{span, Instrument, Level}; use super::{direction::ConnectionDirection, error::PeerConnectionError, manager::ConnectionManagerEvent}; #[cfg(feature = "rpc")] diff --git a/comms/core/src/connection_manager/self_liveness.rs b/comms/core/src/connection_manager/self_liveness.rs index aaebdae860..77ccd34b62 100644 --- a/comms/core/src/connection_manager/self_liveness.rs +++ b/comms/core/src/connection_manager/self_liveness.rs @@ -190,8 +190,6 @@ where #[cfg(test)] mod test { - use futures::SinkExt; - use tokio::{time, time::Duration}; use tokio_stream::StreamExt; use super::*; diff --git a/comms/core/src/multiplexing/yamux.rs b/comms/core/src/multiplexing/yamux.rs index 0730809b5a..6c7f58aba3 100644 --- a/comms/core/src/multiplexing/yamux.rs +++ b/comms/core/src/multiplexing/yamux.rs @@ -28,7 +28,7 @@ use tokio::{ sync::mpsc, }; use tokio_util::compat::{Compat, FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt}; -use tracing::{self, debug, error, warn}; +use tracing::{debug, error, warn}; // Reexport pub use yamux::ConnectionError; use yamux::Mode; diff --git a/comms/core/src/net_address/multiaddr_with_stats.rs b/comms/core/src/net_address/multiaddr_with_stats.rs index fc5d3345e5..24a24823b6 100644 --- a/comms/core/src/net_address/multiaddr_with_stats.rs +++ b/comms/core/src/net_address/multiaddr_with_stats.rs @@ -3,7 +3,7 @@ use std::{ cmp, - cmp::{Ord, Ordering}, + cmp::Ordering, convert::{TryFrom, TryInto}, fmt, fmt::{Display, Formatter}, @@ -422,8 +422,6 @@ impl PartialEq for PeerAddressSource { } #[cfg(test)] mod test { - use std::time::Duration; - use super::*; #[test] diff --git a/comms/core/src/net_address/mutliaddresses_with_stats.rs b/comms/core/src/net_address/mutliaddresses_with_stats.rs index 6aad909315..9e8b21a61f 100644 --- a/comms/core/src/net_address/mutliaddresses_with_stats.rs +++ b/comms/core/src/net_address/mutliaddresses_with_stats.rs @@ -308,8 +308,6 @@ impl Display for MultiaddressesWithStats { #[cfg(test)] mod test { - use multiaddr::Multiaddr; - use super::*; #[test] diff --git a/comms/core/src/noise/config.rs b/comms/core/src/noise/config.rs index 1310dfdb89..a18ab1af50 100644 --- a/comms/core/src/noise/config.rs +++ b/comms/core/src/noise/config.rs @@ -25,7 +25,7 @@ use std::{sync::Arc, time::Duration}; use log::*; -use snow::{self, params::NoiseParams}; +use snow::params::NoiseParams; use tari_utilities::ByteArray; use tokio::io::{AsyncRead, AsyncWrite}; diff --git a/comms/core/src/noise/socket.rs b/comms/core/src/noise/socket.rs index fefeb50fcd..bbe3be4b1f 100644 --- a/comms/core/src/noise/socket.rs +++ b/comms/core/src/noise/socket.rs @@ -662,8 +662,6 @@ impl From for NoiseState { #[cfg(test)] mod test { - use std::io; - use futures::future::join; use snow::{params::NoiseParams, Builder, Error, Keypair}; diff --git a/comms/core/src/peer_manager/manager.rs b/comms/core/src/peer_manager/manager.rs index c4c962c7d0..c1e5efc2f0 100644 --- a/comms/core/src/peer_manager/manager.rs +++ b/comms/core/src/peer_manager/manager.rs @@ -374,14 +374,6 @@ mod test { use tari_storage::HashmapDatabase; use super::*; - use crate::{ - net_address::MultiaddressesWithStats, - peer_manager::{ - node_id::NodeId, - peer::{Peer, PeerFlags}, - PeerFeatures, - }, - }; fn create_test_peer(ban_flag: bool, features: PeerFeatures) -> Peer { let (_sk, pk) = RistrettoPublicKey::random_keypair(&mut OsRng); diff --git a/comms/core/src/peer_manager/node_id.rs b/comms/core/src/peer_manager/node_id.rs index f6eca4fc68..378847bdcb 100644 --- a/comms/core/src/peer_manager/node_id.rs +++ b/comms/core/src/peer_manager/node_id.rs @@ -265,13 +265,10 @@ where D: Deserializer<'de> { #[cfg(test)] mod test { - use tari_crypto::{ - keys::{PublicKey, SecretKey}, - tari_utilities::byte_array::ByteArray, - }; + use tari_crypto::keys::{PublicKey, SecretKey}; use super::*; - use crate::types::{CommsPublicKey, CommsSecretKey}; + use crate::types::CommsSecretKey; #[test] fn display() { diff --git a/comms/core/src/peer_manager/peer.rs b/comms/core/src/peer_manager/peer.rs index 657722deb4..329a4fb74f 100644 --- a/comms/core/src/peer_manager/peer.rs +++ b/comms/core/src/peer_manager/peer.rs @@ -355,7 +355,6 @@ mod test { }; use super::*; - use crate::{net_address::MultiaddressesWithStats, peer_manager::NodeId, types::CommsPublicKey}; #[test] fn test_is_banned_and_ban_for() { diff --git a/comms/core/src/peer_manager/peer_query.rs b/comms/core/src/peer_manager/peer_query.rs index fe049e7e37..9f37a9af15 100644 --- a/comms/core/src/peer_manager/peer_query.rs +++ b/comms/core/src/peer_manager/peer_query.rs @@ -215,11 +215,7 @@ mod test { use super::*; use crate::{ net_address::{MultiaddressesWithStats, PeerAddressSource}, - peer_manager::{ - node_id::NodeId, - peer::{Peer, PeerFlags}, - PeerFeatures, - }, + peer_manager::{peer::PeerFlags, PeerFeatures}, }; fn create_test_peer(ban_flag: bool) -> Peer { diff --git a/comms/core/src/peer_manager/peer_storage.rs b/comms/core/src/peer_manager/peer_storage.rs index 760d823cf3..43e462968a 100644 --- a/comms/core/src/peer_manager/peer_storage.rs +++ b/comms/core/src/peer_manager/peer_storage.rs @@ -538,7 +538,7 @@ mod test { use super::*; use crate::{ net_address::{MultiaddrWithStats, MultiaddressesWithStats, PeerAddressSource}, - peer_manager::{peer::PeerFlags, PeerFeatures}, + peer_manager::peer::PeerFlags, }; #[test] diff --git a/comms/core/src/peer_validator/helpers.rs b/comms/core/src/peer_validator/helpers.rs index 99e1eaa386..4b6b47f910 100644 --- a/comms/core/src/peer_validator/helpers.rs +++ b/comms/core/src/peer_validator/helpers.rs @@ -200,7 +200,6 @@ mod test { use multiaddr::multiaddr; use super::*; - use crate::peer_validator::error::PeerValidatorError; #[test] fn validate_address_strict() { diff --git a/comms/core/src/pipeline/inbound.rs b/comms/core/src/pipeline/inbound.rs index 6b0149b12e..12ed95aa7f 100644 --- a/comms/core/src/pipeline/inbound.rs +++ b/comms/core/src/pipeline/inbound.rs @@ -137,12 +137,9 @@ where #[cfg(test)] mod test { - use std::time::Duration; - use futures::future; use tari_shutdown::Shutdown; use tari_test_utils::collect_recv; - use tokio::{sync::mpsc, time}; use tower::service_fn; use super::*; diff --git a/comms/core/src/pipeline/outbound.rs b/comms/core/src/pipeline/outbound.rs index 6a8730689f..1141ca8bfe 100644 --- a/comms/core/src/pipeline/outbound.rs +++ b/comms/core/src/pipeline/outbound.rs @@ -119,11 +119,9 @@ where #[cfg(test)] mod test { - use std::time::Duration; - use bytes::Bytes; use tari_test_utils::collect_recv; - use tokio::{sync::mpsc, time}; + use tokio::sync::mpsc; use super::*; use crate::{message::OutboundMessage, pipeline::SinkService, utils}; diff --git a/comms/core/src/tor/control_client/client.rs b/comms/core/src/tor/control_client/client.rs index f9ce4f0e29..ce35453b5c 100644 --- a/comms/core/src/tor/control_client/client.rs +++ b/comms/core/src/tor/control_client/client.rs @@ -279,7 +279,7 @@ mod test { use tokio_stream::StreamExt; use super::*; - use crate::tor::control_client::{test_server, test_server::canned_responses, types::PrivateKey}; + use crate::tor::control_client::{test_server, test_server::canned_responses}; async fn setup_test() -> (TorControlPortClient, test_server::State) { let (_, mock_state, socket) = test_server::spawn().await; diff --git a/comms/dht/Cargo.toml b/comms/dht/Cargo.toml index 5aa685c64d..c4969da68e 100644 --- a/comms/dht/Cargo.toml +++ b/comms/dht/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" tari_comms = { path = "../core", features = ["rpc"], version = "1.0.0-pre.13" } tari_common = { path = "../../common", version = "1.0.0-pre.13" } tari_comms_rpc_macros = { path = "../rpc_macros" , version = "1.0.0-pre.13"} -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_utilities = { version = "0.7" } tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-pre.13" } tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-pre.13" } diff --git a/comms/dht/examples/graphing_utilities/utilities.rs b/comms/dht/examples/graphing_utilities/utilities.rs index 1e3b63a047..bffb93b2b5 100644 --- a/comms/dht/examples/graphing_utilities/utilities.rs +++ b/comms/dht/examples/graphing_utilities/utilities.rs @@ -43,7 +43,7 @@ static GRAPH_FRAME_NUM: Lazy>> = Lazy::new(|| Mutex fn get_next_frame_num(name: &str) -> usize { let mut map = GRAPH_FRAME_NUM.lock().unwrap(); let current: usize; - match (*map).get_mut(&name.to_string()) { + match (*map).get_mut(name) { None => { current = 0; (*map).insert(name.to_string(), 1); diff --git a/comms/dht/src/actor.rs b/comms/dht/src/actor.rs index 819cf7075b..6f86bf3df3 100644 --- a/comms/dht/src/actor.rs +++ b/comms/dht/src/actor.rs @@ -879,7 +879,6 @@ impl DiscoveryDialTask { mod test { use std::{convert::TryFrom, time::Duration}; - use chrono::{DateTime, Utc}; use tari_comms::test_utils::mocks::{ create_connectivity_mock, create_peer_connection_mock_pair, @@ -890,7 +889,6 @@ mod test { use super::*; use crate::{ - broadcast_strategy::BroadcastClosestRequest, envelope::NodeDestination, test_utils::{ build_peer_manager, diff --git a/comms/dht/src/crypt.rs b/comms/dht/src/crypt.rs index 4530ef771d..2f5196e013 100644 --- a/comms/dht/src/crypt.rs +++ b/comms/dht/src/crypt.rs @@ -283,7 +283,6 @@ pub fn create_message_domain_separated_hash_parts( mod test { use prost::Message; use rand::rngs::OsRng; - use tari_comms::message::MessageExt; use tari_crypto::keys::PublicKey; use super::*; diff --git a/comms/dht/src/dht.rs b/comms/dht/src/dht.rs index 62f2d5a0f7..3866ade9f6 100644 --- a/comms/dht/src/dht.rs +++ b/comms/dht/src/dht.rs @@ -452,7 +452,7 @@ fn discard_expired_messages(msg: &DhtInboundMessage) -> bool { #[cfg(test)] mod test { - use std::{sync::Arc, time::Duration}; + use std::time::Duration; use tari_comms::{ message::{MessageExt, MessageTag}, @@ -462,15 +462,13 @@ mod test { wrap_in_envelope_body, }; use tari_shutdown::Shutdown; - use tokio::{sync::mpsc, task, time}; - use tower::{layer::Layer, Service}; + use tokio::{task, time}; use super::*; use crate::{ crypt, envelope::DhtMessageFlags, outbound::mock::create_outbound_service_mock, - proto::envelope::DhtMessageType, test_utils::{ build_peer_manager, make_client_identity, diff --git a/comms/dht/src/outbound/broadcast.rs b/comms/dht/src/outbound/broadcast.rs index 5a06922866..b87d00a1e3 100644 --- a/comms/dht/src/outbound/broadcast.rs +++ b/comms/dht/src/outbound/broadcast.rs @@ -559,16 +559,13 @@ where S: Service mod test { use std::time::Duration; - use rand::rngs::OsRng; use tari_comms::{ multiaddr::Multiaddr, net_address::{MultiaddressesWithStats, PeerAddressSource}, - peer_manager::{NodeId, Peer, PeerFeatures, PeerFlags}, - types::CommsPublicKey, + peer_manager::{PeerFeatures, PeerFlags}, }; - use tari_crypto::keys::PublicKey; use tari_test_utils::unpack_enum; - use tokio::{sync::oneshot, task}; + use tokio::task; use super::*; use crate::{ diff --git a/comms/dht/src/peer_validator.rs b/comms/dht/src/peer_validator.rs index 375a5cbe8d..21522b6875 100644 --- a/comms/dht/src/peer_validator.rs +++ b/comms/dht/src/peer_validator.rs @@ -133,7 +133,6 @@ mod tests { use tari_comms::{ multiaddr::Multiaddr, - net_address::MultiaddressesWithStats, peer_manager::{IdentitySignature, PeerFeatures, PeerIdentityClaim}, types::Signature, }; diff --git a/comms/dht/src/rpc/test.rs b/comms/dht/src/rpc/test.rs index 5d245586cf..0b147fddeb 100644 --- a/comms/dht/src/rpc/test.rs +++ b/comms/dht/src/rpc/test.rs @@ -191,7 +191,7 @@ mod get_closer_peers { } mod get_peers { - use std::{borrow::BorrowMut, time::Duration}; + use std::borrow::BorrowMut; use tari_comms::test_utils::node_identity::build_many_node_identities; diff --git a/comms/dht/src/store_forward/saf_handler/task.rs b/comms/dht/src/store_forward/saf_handler/task.rs index 6afe6bcc62..82a01ea790 100644 --- a/comms/dht/src/store_forward/saf_handler/task.rs +++ b/comms/dht/src/store_forward/saf_handler/task.rs @@ -753,11 +753,11 @@ where S: Service mod test { use std::time::Duration; - use chrono::{Timelike, Utc}; + use chrono::Timelike; use tari_comms::{message::MessageExt, wrap_in_envelope_body}; use tari_test_utils::collect_recv; use tari_utilities::{hex, hex::Hex}; - use tokio::{sync::mpsc, task, time::sleep}; + use tokio::{task, time::sleep}; use super::*; use crate::{ diff --git a/hashing/Cargo.toml b/hashing/Cargo.toml index 85b1aaa9fc..5c19e64a42 100644 --- a/hashing/Cargo.toml +++ b/hashing/Cargo.toml @@ -12,7 +12,7 @@ license = "BSD-3-Clause" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_crypto = "0.20.0" +tari_crypto = { version = "0.20.1" } digest = "0.10" borsh = "1.2" diff --git a/infrastructure/tari_script/Cargo.toml b/infrastructure/tari_script/Cargo.toml index b6af7372fb..7f121e6350 100644 --- a/infrastructure/tari_script/Cargo.toml +++ b/infrastructure/tari_script/Cargo.toml @@ -11,7 +11,7 @@ readme = "README.md" license = "BSD-3-Clause" [dependencies] -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_utilities = { version = "0.7" } blake2 = "0.10" diff --git a/infrastructure/tari_script/src/op_codes.rs b/infrastructure/tari_script/src/op_codes.rs index 5e91c529fd..8fe2f96b64 100644 --- a/infrastructure/tari_script/src/op_codes.rs +++ b/infrastructure/tari_script/src/op_codes.rs @@ -642,7 +642,7 @@ pub enum OpcodeVersion { #[cfg(test)] mod test { - use crate::{op_codes::*, Opcode, ScriptError}; + use crate::op_codes::*; #[test] fn empty_script() { diff --git a/infrastructure/tari_script/src/script.rs b/infrastructure/tari_script/src/script.rs index 091c03b973..ab07a14323 100644 --- a/infrastructure/tari_script/src/script.rs +++ b/infrastructure/tari_script/src/script.rs @@ -16,7 +16,7 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // pending updates to Dalek/Digest -use std::{cmp::Ordering, collections::HashSet, convert::TryFrom, fmt, io, ops::Deref}; +use std::{cmp::Ordering, collections::HashSet, fmt, io, ops::Deref}; use blake2::Blake2b; use borsh::{BorshDeserialize, BorshSerialize}; diff --git a/infrastructure/tari_script/src/stack.rs b/infrastructure/tari_script/src/stack.rs index 38185e4c89..111cfb4e50 100644 --- a/infrastructure/tari_script/src/stack.rs +++ b/infrastructure/tari_script/src/stack.rs @@ -15,7 +15,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::{convert::TryFrom, io}; +use std::io; use borsh::{BorshDeserialize, BorshSerialize}; use integer_encoding::{VarIntReader, VarIntWriter}; diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 95022046d5..765c6a3b91 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -13,7 +13,7 @@ minotari_node = { path = "../applications/minotari_node", features = ["metrics"] minotari_node_grpc_client = { path = "../clients/rust/base_node_grpc_client" } tari_chat_client = { path = "../base_layer/contacts/src/chat_client" } minotari_chat_ffi = { path = "../base_layer/chat_ffi" } -tari_crypto = { version = "0.20" } +tari_crypto = { version = "0.20.1" } tari_common = { path = "../common" } tari_common_types = { path = "../base_layer/common_types" } tari_comms = { path = "../comms/core" } diff --git a/integration_tests/src/base_node_process.rs b/integration_tests/src/base_node_process.rs index 675bee11ff..83c14f7908 100644 --- a/integration_tests/src/base_node_process.rs +++ b/integration_tests/src/base_node_process.rs @@ -21,7 +21,6 @@ // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use std::{ - default::Default, fmt::{Debug, Formatter}, path::PathBuf, str::FromStr, diff --git a/integration_tests/src/transaction.rs b/integration_tests/src/transaction.rs index d358d9f63b..051ffb9d29 100644 --- a/integration_tests/src/transaction.rs +++ b/integration_tests/src/transaction.rs @@ -20,8 +20,6 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::default::Default; - use tari_core::{ borsh::SerializedSize, covenants::Covenant, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4b396a926c..9f32d3d93a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -13,4 +13,4 @@ # - the CI files in .github folder # - the Makefile in base_layer/key_manager/Makefile [toolchain] -channel = "nightly-2024-02-04" +channel = "nightly-2024-03-01" diff --git a/scripts/test_in_docker.sh b/scripts/test_in_docker.sh index 8717674b52..6876c17b10 100755 --- a/scripts/test_in_docker.sh +++ b/scripts/test_in_docker.sh @@ -2,8 +2,8 @@ # Run the Tari test suite locally inside a suitable docker container -IMAGE=quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-02-04 -TOOLCHAIN_VERSION=nightly-2024-02-04 +IMAGE=quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-03-01 +TOOLCHAIN_VERSION=nightly-2024-03-01 CONTAINER=tari_test echo "Deleting old container"