diff --git a/.github/workflows/build_binaries.json b/.github/workflows/build_binaries.json index 890347a700..dd7466999b 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-03-01", + "rust": "nightly-2024-07-07", "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 6bd01edbea..94f479296a 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-03-01 + toolchain: nightly-2024-07-07 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 469fbd03cf..73c8dc26f0 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-03-01 + toolchain_default: nightly-2024-07-07 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 e8bce95bc1..621aa77345 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-03-01 + default: nightly-2024-07-07 arch: type: string default: x86-64 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae7363b08b..a91c574a54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ name: CI merge_group: env: - toolchain: nightly-2024-03-01 + toolchain: nightly-2024-07-07 CARGO_HTTP_MULTIPLEXING: false CARGO_TERM_COLOR: always CARGO_UNSTABLE_SPARSE_REGISTRY: true @@ -32,7 +32,7 @@ concurrency: jobs: clippy: name: clippy - runs-on: [ubuntu-20.04] + runs-on: [ubuntu-latest] steps: - name: checkout uses: actions/checkout@v4 @@ -78,7 +78,7 @@ jobs: machete: # Checks for unused dependencies. name: machete - runs-on: [ubuntu-20.04] + runs-on: [ubuntu-latest] steps: - name: checkout uses: actions/checkout@v4 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 78e4b2fa3a..f6761ed720 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,7 +11,7 @@ name: Source Coverage - ci-coverage-* env: - toolchain: nightly-2024-03-01 + toolchain: nightly-2024-07-07 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 921ab950be..25257ff3e5 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-03-01 + toolchain: nightly-2024-07-07 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/Cargo.lock b/Cargo.lock index a235821af8..38a526b1d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3821,6 +3821,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" version = "0.4.2" @@ -6631,12 +6637,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -6651,10 +6658,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] diff --git a/applications/minotari_app_utilities/src/identity_management.rs b/applications/minotari_app_utilities/src/identity_management.rs index 00d7200c64..a5a42a5e61 100644 --- a/applications/minotari_app_utilities/src/identity_management.rs +++ b/applications/minotari_app_utilities/src/identity_management.rs @@ -42,7 +42,7 @@ const REQUIRED_IDENTITY_PERMS: u32 = 0o100600; /// - `identity_file` - Reference to file path /// - `public_address` - Network address of the base node /// - `create_id` - Only applies if the identity_file does not exist or is malformed. If true, a new identity will be -/// created, otherwise the user will be prompted to create a new ID +/// created, otherwise the user will be prompted to create a new ID /// - `peer_features` - Enables features of the base node /// /// # Return diff --git a/applications/minotari_console_wallet/Cargo.toml b/applications/minotari_console_wallet/Cargo.toml index 3943ca02ad..345cd1b111 100644 --- a/applications/minotari_console_wallet/Cargo.toml +++ b/applications/minotari_console_wallet/Cargo.toml @@ -43,7 +43,7 @@ futures = { version = "^0.3.16", default-features = false, features = [ ] } ledger-transport-hid = { git = "https://github.com/Zondax/ledger-rs", rev = "20e2a20", optional = true } log = { version = "0.4.8", features = ["std"] } -log4rs = { version = "1.3.0", default_features = false, features = [ +log4rs = { version = "1.3.0", default-features = false, features = [ "config_parsing", "threshold_filter", "yaml_format", diff --git a/applications/minotari_console_wallet/src/automation/commands.rs b/applications/minotari_console_wallet/src/automation/commands.rs index 78cd86c3f5..c8b6acd6fe 100644 --- a/applications/minotari_console_wallet/src/automation/commands.rs +++ b/applications/minotari_console_wallet/src/automation/commands.rs @@ -409,7 +409,7 @@ pub async fn make_it_rain( // - If a slower rate is requested as what is achievable, transactions will be delayed to match the rate. // - If a faster rate is requested as what is achievable, the maximum rate will be that of the integrated system. // - The default value of 25/s may not be achievable. - let transactions_per_second = transactions_per_second.abs().max(0.01).min(250.0); + let transactions_per_second = transactions_per_second.abs().clamp(0.01, 250.0); // We are spawning this command in parallel, thus not collecting transaction IDs tokio::task::spawn(async move { // Wait until specified test start time diff --git a/applications/minotari_console_wallet/src/notifier/mod.rs b/applications/minotari_console_wallet/src/notifier/mod.rs index a185efe1fe..2d5722f2d2 100644 --- a/applications/minotari_console_wallet/src/notifier/mod.rs +++ b/applications/minotari_console_wallet/src/notifier/mod.rs @@ -49,6 +49,7 @@ pub const CANCELLED: &str = "cancelled"; #[derive(Clone)] // FIXME +#[allow(dead_code)] #[allow(clippy::large_enum_variant)] pub enum WalletEventMessage { Completed { diff --git a/applications/minotari_console_wallet/src/ui/app.rs b/applications/minotari_console_wallet/src/ui/app.rs index 9c124e5137..634d1c19a0 100644 --- a/applications/minotari_console_wallet/src/ui/app.rs +++ b/applications/minotari_console_wallet/src/ui/app.rs @@ -58,6 +58,7 @@ use crate::{ pub const LOG_TARGET: &str = "wallet::ui::app"; pub struct App { + #[allow(dead_code)] pub title: String, pub should_quit: bool, // Cached state this will need to be cleaned up into a threadsafe container 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 1ca1b94003..14edb3619f 100644 --- a/applications/minotari_merge_mining_proxy/src/block_template_data.rs +++ b/applications/minotari_merge_mining_proxy/src/block_template_data.rs @@ -221,6 +221,7 @@ pub struct BlockTemplateData { pub monero_difficulty: u64, pub tari_difficulty: u64, pub tari_merge_mining_hash: FixedHash, + #[allow(dead_code)] pub aux_chain_hashes: Vec, pub new_block_template: grpc::NewBlockTemplate, } diff --git a/applications/minotari_merge_mining_proxy/src/block_template_protocol.rs b/applications/minotari_merge_mining_proxy/src/block_template_protocol.rs index 1afdf5b1ea..ed6fc12446 100644 --- a/applications/minotari_merge_mining_proxy/src/block_template_protocol.rs +++ b/applications/minotari_merge_mining_proxy/src/block_template_protocol.rs @@ -271,7 +271,7 @@ impl BlockTemplateProtocol<'_> { let grpc::NewBlockTemplateResponse { miner_data, new_block_template: template, - initial_sync_achieved, + initial_sync_achieved: _, } = self .base_node_client .get_new_block_template(grpc::NewBlockTemplateRequest { @@ -289,11 +289,7 @@ impl BlockTemplateProtocol<'_> { let miner_data = miner_data.ok_or(MmProxyError::GrpcResponseMissingField("miner_data"))?; let template = template.ok_or(MmProxyError::GrpcResponseMissingField("new_block_template"))?; - Ok(NewBlockTemplateData { - template, - miner_data, - initial_sync_achieved, - }) + Ok(NewBlockTemplateData { template, miner_data }) } /// Check if the height is more than the actual tip. So if still makes sense to compute block for that height. @@ -439,7 +435,6 @@ fn add_monero_data( pub struct NewBlockTemplateData { pub template: grpc::NewBlockTemplate, pub miner_data: grpc::MinerData, - pub initial_sync_achieved: bool, } impl NewBlockTemplateData { diff --git a/applications/minotari_merge_mining_proxy/src/monero_fail.rs b/applications/minotari_merge_mining_proxy/src/monero_fail.rs index 1065ce1c80..fb385b003a 100644 --- a/applications/minotari_merge_mining_proxy/src/monero_fail.rs +++ b/applications/minotari_merge_mining_proxy/src/monero_fail.rs @@ -43,10 +43,13 @@ pub struct MonerodEntry { /// Whether the server is currently up pub up: bool, /// Whether the server is web compatible + #[allow(dead_code)] pub web_compatible: bool, /// The network the server is on (mainnet, stagenet, testnet) + #[allow(dead_code)] pub network: String, /// Time since the server was checked + #[allow(dead_code)] pub last_checked: String, /// The history of the server being up pub up_history: Vec, diff --git a/applications/minotari_merge_mining_proxy/src/proxy.rs b/applications/minotari_merge_mining_proxy/src/proxy.rs index 890333d126..c80ae56267 100644 --- a/applications/minotari_merge_mining_proxy/src/proxy.rs +++ b/applications/minotari_merge_mining_proxy/src/proxy.rs @@ -642,11 +642,12 @@ impl InnerService { }; // Query the list twice before giving up, starting after the last used entry - let pos = if let Some(index) = self.config.monerod_url.iter().position(|x| x == &last_used_url) { - index - } else { - 0 - }; + let pos = self + .config + .monerod_url + .iter() + .position(|x| x == &last_used_url) + .unwrap_or(0); let (left, right) = self.config.monerod_url.split_at(pos); let left = left.to_vec(); let right = right.to_vec(); diff --git a/applications/minotari_miner/Cargo.toml b/applications/minotari_miner/Cargo.toml index 0866e3f7f4..3f56846eb9 100644 --- a/applications/minotari_miner/Cargo.toml +++ b/applications/minotari_miner/Cargo.toml @@ -28,14 +28,14 @@ derivative = "2.2.0" futures = "0.3" hex = "0.4.2" log = { version = "0.4", features = ["std"] } -log4rs = { version = "1.3.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } +log4rs = { version = "1.3.0", default-features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } native-tls = "0.2" num_cpus = "1.13" rand = "0.8" -serde = { version = "1.0", default_features = false, features = ["derive"] } +serde = { version = "1.0", default-features = false, features = ["derive"] } serde_json = "1.0.57" thiserror = "1.0" -tokio = { version = "1.36", default_features = false, features = ["rt-multi-thread"] } +tokio = { version = "1.36", default-features = false, features = ["rt-multi-thread"] } tonic = { version = "0.8.3", features = ["tls", "tls-roots"] } [dev-dependencies] diff --git a/applications/minotari_miner/src/config.rs b/applications/minotari_miner/src/config.rs index dfe1749756..1467e23a4c 100644 --- a/applications/minotari_miner/src/config.rs +++ b/applications/minotari_miner/src/config.rs @@ -22,14 +22,11 @@ // configuration management //! from [tari_common] crate, also extending with few //! specific options: -//! - base_node_grpc_address - is IPv4/IPv6 address including port -//! number, by which Minotari Base Node can be found +//! - base_node_grpc_address - is IPv4/IPv6 address including port number, by which Minotari Base Node can be found //! - num_mining_threads - number of mining threads, defaults to number of cpu cores //! - mine_on_tip_only - will start mining only when node is reporting bootstrapped state -//! - validate_tip_timeout_sec - will check tip with node every N seconds to validate that still -//! mining on a tip -//! All miner options configured under `[miner]` section of -//! Minotari's `config.toml`. +//! - validate_tip_timeout_sec - will check tip with node every N seconds to validate that still mining on a tip All +//! miner options configured under `[miner]` section of Minotari's `config.toml`. use std::{ path::{Path, PathBuf}, diff --git a/applications/minotari_miner/src/miner.rs b/applications/minotari_miner/src/miner.rs index e929d36874..a4591778be 100644 --- a/applications/minotari_miner/src/miner.rs +++ b/applications/minotari_miner/src/miner.rs @@ -56,7 +56,6 @@ pub struct MiningReport { /// Will be set for when mined header is matching required difficulty pub header: Option, pub height: u64, - pub last_nonce: u64, } /// Miner is starting number of mining threads and implements Stream for async reports polling @@ -212,7 +211,6 @@ pub fn mining_task( hashes: hasher.hashes, elapsed: start.elapsed(), height: hasher.height(), - last_nonce: hasher.header.nonce, header: Some(hasher.create_header()), target_difficulty, }) { @@ -235,7 +233,6 @@ pub fn mining_task( hashes: hasher.hashes, elapsed: start.elapsed(), header: None, - last_nonce: hasher.header.nonce, height: hasher.height(), target_difficulty, }); diff --git a/applications/minotari_miner/src/stratum/stratum_types/login_params.rs b/applications/minotari_miner/src/stratum/stratum_types/login_params.rs index 94c45b7747..3bde37bdfb 100644 --- a/applications/minotari_miner/src/stratum/stratum_types/login_params.rs +++ b/applications/minotari_miner/src/stratum/stratum_types/login_params.rs @@ -27,6 +27,7 @@ use serde::{Deserialize, Serialize}; pub struct LoginParams { pub login: String, #[derivative(Debug = "ignore")] + #[allow(dead_code)] #[serde(skip_serializing)] pub pass: String, pub agent: String, diff --git a/applications/minotari_node/Cargo.toml b/applications/minotari_node/Cargo.toml index bd1836453c..21628c0749 100644 --- a/applications/minotari_node/Cargo.toml +++ b/applications/minotari_node/Cargo.toml @@ -41,7 +41,7 @@ futures = { version = "^0.3.16", default-features = false, features = ["alloc"] qrcode = { version = "0.12" } log = { version = "0.4.8", features = ["std"] } log-mdc = "0.1.0" -log4rs = { version = "1.3.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } +log4rs = { version = "1.3.0", default-features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } nom = "7.1" rustyline = "9.0" rustyline-derive = "0.5" diff --git a/applications/minotari_node/src/bootstrap.rs b/applications/minotari_node/src/bootstrap.rs index 43e16a212c..f06ddb37e9 100644 --- a/applications/minotari_node/src/bootstrap.rs +++ b/applications/minotari_node/src/bootstrap.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 std::{ - cmp, - str::FromStr, - sync::{Arc, RwLock}, -}; +use std::{cmp, str::FromStr, sync::Arc}; use log::*; use minotari_app_utilities::{consts, identity_management, identity_management::load_from_json}; @@ -56,7 +52,6 @@ use tari_core::{ mempool::{service::MempoolHandle, Mempool, MempoolServiceInitializer, MempoolSyncInitializer}, proof_of_work::randomx_factory::RandomXFactory, transactions::CryptoFactories, - OutputSmt, }; use tari_p2p::{ auto_update::SoftwareUpdaterService, @@ -86,7 +81,6 @@ pub struct BaseNodeBootstrapper<'a, B> { pub factories: CryptoFactories, pub randomx_factory: RandomXFactory, pub interrupt_signal: ShutdownSignal, - pub smt: Arc>, } impl BaseNodeBootstrapper<'_, B> diff --git a/applications/minotari_node/src/builder.rs b/applications/minotari_node/src/builder.rs index 09d27335c0..171372b04d 100644 --- a/applications/minotari_node/src/builder.rs +++ b/applications/minotari_node/src/builder.rs @@ -265,7 +265,6 @@ async fn build_node_context( factories: factories.clone(), randomx_factory, interrupt_signal: interrupt_signal.clone(), - smt, } .bootstrap() .await?; diff --git a/applications/minotari_node/src/commands/parser.rs b/applications/minotari_node/src/commands/parser.rs index 372c86b499..bbba15894c 100644 --- a/applications/minotari_node/src/commands/parser.rs +++ b/applications/minotari_node/src/commands/parser.rs @@ -36,10 +36,6 @@ use thiserror::Error; use super::command::Command; -#[derive(Debug, Error)] -#[error("invalid format '{0}'")] -pub struct FormatParseError(String); - #[derive(Debug, Display, EnumString)] #[strum(serialize_all = "kebab-case")] pub enum Format { diff --git a/base_layer/chat_ffi/src/error.rs b/base_layer/chat_ffi/src/error.rs index 69d46ce71b..8af8cc8f7a 100644 --- a/base_layer/chat_ffi/src/error.rs +++ b/base_layer/chat_ffi/src/error.rs @@ -47,6 +47,7 @@ pub enum InterfaceError { #[derive(Debug, Clone)] pub struct LibChatError { pub code: i32, + #[allow(dead_code)] pub message: String, } diff --git a/base_layer/contacts/src/contacts_service/service.rs b/base_layer/contacts/src/contacts_service/service.rs index 2e1ab81f0a..006976e877 100644 --- a/base_layer/contacts/src/contacts_service/service.rs +++ b/base_layer/contacts/src/contacts_service/service.rs @@ -224,9 +224,8 @@ where T: ContactsBackend + 'static error!(target: LOG_TARGET, "Error handling request: {:?}", e); e }); - let _result = reply_tx.send(response).map_err(|e| { + let _result = reply_tx.send(response).inspect_err(|_| { error!(target: LOG_TARGET, "Failed to send reply"); - e }); }, diff --git a/base_layer/core/Cargo.toml b/base_layer/core/Cargo.toml index fcce012f01..26cff88baf 100644 --- a/base_layer/core/Cargo.toml +++ b/base_layer/core/Cargo.toml @@ -113,3 +113,6 @@ tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.15" [[bench]] name = "mempool" harness = false + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tari_target_network_mainnet)', 'cfg(tari_target_network_nextnet)', 'cfg(tari_target_network_testnet)'] } diff --git a/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs b/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs index 0db74da2fe..cf35ee93a4 100644 --- a/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs +++ b/base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs @@ -1445,7 +1445,7 @@ impl LMDBDatabase { seed: &[u8], height: u64, ) -> Result<(), ChainStorageError> { - let current_height = lmdb_get(write_txn, &self.monero_seed_height_db, seed)?.unwrap_or(std::u64::MAX); + let current_height = lmdb_get(write_txn, &self.monero_seed_height_db, seed)?.unwrap_or(u64::MAX); if height < current_height { lmdb_replace(write_txn, &self.monero_seed_height_db, seed, &height, None)?; }; diff --git a/base_layer/core/src/common/limited_reader.rs b/base_layer/core/src/common/limited_reader.rs deleted file mode 100644 index be80895a69..0000000000 --- a/base_layer/core/src/common/limited_reader.rs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022, 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 std::{io, io::Read}; - -pub struct LimitedBytesReader { - byte_limit: usize, - num_read: usize, - inner: R, -} - -impl Read for LimitedBytesReader { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - let read = self.inner.read(buf)?; - self.num_read += read; - if self.num_read > self.byte_limit { - return Err(io::Error::new( - io::ErrorKind::InvalidInput, - format!("Read more bytes than the maximum ({})", self.byte_limit), - )); - } - Ok(read) - } -} - -#[cfg(test)] -mod test { - use super::*; - - impl LimitedBytesReader { - pub fn new(byte_limit: usize, reader: R) -> Self { - Self { - byte_limit, - num_read: 0, - inner: reader, - } - } - } - - #[test] - fn read_test() { - // read should work fine in the case of a buffer whose length is within byte_limit - let inner: &[u8] = &[0u8, 1u8, 2u8, 3u8, 4u8]; - let mut reader = LimitedBytesReader::new(3, inner); - let mut buf = [0u8; 3]; - let output = reader.read(&mut buf).unwrap(); - assert_eq!(output, buf.len()); - - // in case of buffer with length strictly bigger than reader byte_limit, the code should throw an error - let mut new_buf = [0u8; 4]; - let output = reader.read(&mut new_buf); - assert!(output.is_err()); - } -} diff --git a/base_layer/core/src/common/mod.rs b/base_layer/core/src/common/mod.rs index 0f447aecd3..52dd52d263 100644 --- a/base_layer/core/src/common/mod.rs +++ b/base_layer/core/src/common/mod.rs @@ -28,7 +28,6 @@ use crate::consensus::DomainSeparatedConsensusHasher; pub mod borsh; pub mod byte_counter; -pub mod limited_reader; pub mod one_sided; #[cfg(feature = "base_node")] diff --git a/base_layer/core/src/consensus/consensus_constants.rs b/base_layer/core/src/consensus/consensus_constants.rs index bb2facfa99..9725db0dc7 100644 --- a/base_layer/core/src/consensus/consensus_constants.rs +++ b/base_layer/core/src/consensus/consensus_constants.rs @@ -919,49 +919,6 @@ mod test { ConsensusConstants::mainnet(); } - // Comment out the feature flag to run this test - #[test] - #[cfg(feature = "schedule_get_constants")] - fn esmeralda_schedule_get_constants() { - let mut esmeralda = ConsensusConstants::esmeralda(); - loop { - let schedule = EmissionSchedule::new( - esmeralda[0].emission_initial, - esmeralda[0].emission_decay, - esmeralda[0].emission_tail, - ); - // No genesis block coinbase - assert_eq!(schedule.block_reward(0), MicroMinotari(0)); - // Coinbases starts at block 1 - let coinbase_offset = 1; - let first_reward = schedule.block_reward(coinbase_offset); - assert_eq!(first_reward, esmeralda[0].emission_initial * uT); - assert_eq!(schedule.supply_at_block(coinbase_offset), first_reward); - // Tail emission starts after block 3,255,552 + coinbase_offset - let mut rewards = schedule - .iter() - .skip(3_255_552 + usize::try_from(coinbase_offset).unwrap()); - let supply = loop { - let (block_num, reward, supply) = rewards.next().unwrap(); - let total_supply = supply + esmeralda[0].faucet_value; - println!( - "Initial: {}, Block: {}, Reward: {}, Supply: {}, Total supply: {}", - esmeralda[0].emission_initial, block_num, reward, supply, total_supply - ); - if reward == esmeralda[0].emission_tail { - break supply; - } - }; - let total_supply_up_to_tail_emission = supply + esmeralda[0].faucet_value; - if total_supply_up_to_tail_emission >= 21_000_000_800_000_000 * uT { - println!("Total supply up to tail emission: {}", total_supply_up_to_tail_emission); - break; - } - esmeralda[0].emission_initial = esmeralda[0].emission_initial + MicroMinotari(1); - } - panic!("\n\nThis test may not pass in CI\n\n"); - } - #[test] fn esmeralda_schedule() { let esmeralda = ConsensusConstants::esmeralda(); diff --git a/base_layer/core/src/iterators/chunk.rs b/base_layer/core/src/iterators/chunk.rs index 92d57ec402..8d771bba5d 100644 --- a/base_layer/core/src/iterators/chunk.rs +++ b/base_layer/core/src/iterators/chunk.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::{cmp, fmt::Display}; +use std::{cmp, convert::TryFrom, fmt::Display}; /// Iterator that produces non-overlapping integer vectors. /// This is similar to `Vec::chunks` except it does not require a complete vector of integers to produce chunks @@ -98,7 +98,10 @@ macro_rules! non_overlapping_iter_impl { if self.current == self.end { return None; } - let size = self.size as $ty; + let size = match <$ty>::try_from(self.size) { + Ok(size) => size, + Err(_) => <$ty>::MAX, + }; match self.current.checked_add(size) { Some(next) => { let next = cmp::min(next, self.end); @@ -128,7 +131,10 @@ macro_rules! non_overlapping_iter_impl { return None; } - let size = self.size as $ty; + let size = match <$ty>::try_from(self.size) { + Ok(size) => size, + Err(_) => <$ty>::MAX, + }; // Is this the first iteration? if self.end == self.current_end { let rem = (self.end - self.current) % size; diff --git a/base_layer/core/src/proof_of_work/difficulty.rs b/base_layer/core/src/proof_of_work/difficulty.rs index dc9ec85baf..db9ef47fda 100644 --- a/base_layer/core/src/proof_of_work/difficulty.rs +++ b/base_layer/core/src/proof_of_work/difficulty.rs @@ -132,32 +132,6 @@ impl CheckedAdd for Difficulty { } } -/// This trait is used to add a type to `CheckedSub`, which greatly simplifies usage in the code. -/// It is implemented for `Difficulty` and `u64`. -pub trait CheckedSub { - fn checked_sub(&self, other: T) -> Option - where Self: Sized; -} - -impl CheckedSub for Difficulty { - fn checked_sub(&self, other: Difficulty) -> Option { - if let Some(val) = self.0.checked_sub(other.0) { - if val < MIN_DIFFICULTY { - return None; - } - Some(Difficulty(val)) - } else { - None - } - } -} - -impl CheckedSub for Difficulty { - fn checked_sub(&self, other: u64) -> Option { - self.checked_sub(Difficulty(other)) - } -} - impl From for u64 { fn from(value: Difficulty) -> Self { value.0 @@ -191,7 +165,7 @@ mod test { use primitive_types::U256; use crate::proof_of_work::{ - difficulty::{CheckedAdd, CheckedSub, MIN_DIFFICULTY}, + difficulty::{CheckedAdd, MIN_DIFFICULTY}, Difficulty, }; #[test] @@ -237,14 +211,6 @@ mod test { assert!(d2.checked_add(1).is_none()); } - #[test] - fn subtraction_does_not_underflow() { - let d1 = Difficulty::from_u64(100).unwrap(); - assert!(d1.checked_sub(1).is_some()); - let d2 = Difficulty::max(); - assert!(d1.checked_sub(d2).is_none()); - } - #[test] fn be_high_target() { let target: &[u8] = &[ diff --git a/base_layer/core/src/transactions/transaction_components/kernel_features.rs b/base_layer/core/src/transactions/transaction_components/kernel_features.rs index 099a07a056..b17521478e 100644 --- a/base_layer/core/src/transactions/transaction_components/kernel_features.rs +++ b/base_layer/core/src/transactions/transaction_components/kernel_features.rs @@ -81,7 +81,7 @@ mod test { ); let x = super::KernelFeatures::from_bits(4); assert_eq!(x, None); - for i in 5..=u8::max_value() { + for i in 5..=u8::MAX { assert_eq!(None, super::KernelFeatures::from_bits(i)); } } diff --git a/base_layer/core/src/transactions/transaction_components/wallet_output_builder.rs b/base_layer/core/src/transactions/transaction_components/wallet_output_builder.rs index b8530684db..be15c61fc8 100644 --- a/base_layer/core/src/transactions/transaction_components/wallet_output_builder.rs +++ b/base_layer/core/src/transactions/transaction_components/wallet_output_builder.rs @@ -228,7 +228,7 @@ impl WalletOutputBuilder { .fold(sender_offset_public_key_self, |acc, x| acc + x); let (ephemeral_private_nonce_id, ephemeral_pubkey_self) = key_manager - .get_next_key(&TransactionKeyManagerBranch::MetadataEphemeralNonce.get_branch_key()) + .get_next_key(TransactionKeyManagerBranch::MetadataEphemeralNonce.get_branch_key()) .await?; let aggregate_ephemeral_pubkey = ephemeral_public_key_shares .iter() diff --git a/base_layer/core/src/transactions/transaction_protocol/recipient.rs b/base_layer/core/src/transactions/transaction_protocol/recipient.rs index 1f20080dd6..87bd5d9182 100644 --- a/base_layer/core/src/transactions/transaction_protocol/recipient.rs +++ b/base_layer/core/src/transactions/transaction_protocol/recipient.rs @@ -25,7 +25,7 @@ use std::fmt; use serde::{Deserialize, Serialize}; use tari_common_types::{ transaction::TxId, - types::{FixedHash, PrivateKey, PublicKey, Signature}, + types::{PrivateKey, PublicKey, Signature}, }; use crate::{ @@ -63,25 +63,6 @@ impl fmt::Display for RecipientState { } } -/// An enum describing the types of information that a recipient can send back to the receiver -#[derive(Debug, Clone, PartialEq)] -pub(super) enum RecipientInfo { - Single(Option>), -} - -#[allow(clippy::derivable_impls)] -impl Default for RecipientInfo { - fn default() -> Self { - RecipientInfo::Single(None) - } -} - -#[derive(Debug, Clone, PartialEq)] -pub(super) struct MultiRecipientInfo { - pub commitment: FixedHash, - pub data: RecipientSignedMessage, -} - /// This is the message containing the public data that the Receiver will send back to the Sender #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RecipientSignedMessage { diff --git a/base_layer/core/src/transactions/transaction_protocol/single_receiver.rs b/base_layer/core/src/transactions/transaction_protocol/single_receiver.rs index e0117d2531..8d43e8ac53 100644 --- a/base_layer/core/src/transactions/transaction_protocol/single_receiver.rs +++ b/base_layer/core/src/transactions/transaction_protocol/single_receiver.rs @@ -38,6 +38,7 @@ use crate::{ /// * Checks the input for validity /// * Constructs his output, range proof and partial signature /// * Constructs the reply +/// /// If any step fails, an error is returned. pub struct SingleReceiverTransactionProtocol {} diff --git a/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs b/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs index 1968050e6c..332f560da3 100644 --- a/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs +++ b/base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs @@ -371,7 +371,7 @@ where KM: TransactionKeyManagerInterface let change_key_id = change_data.change_spending_key_id.clone(); let (sender_offset_key_id, sender_offset_public_key) = self .key_manager - .get_next_key(&TransactionKeyManagerBranch::SenderOffset.get_branch_key()) + .get_next_key(TransactionKeyManagerBranch::SenderOffset.get_branch_key()) .await .map_err(|e| e.to_string())?; let input_data = change_data.change_input_data.clone(); diff --git a/base_layer/core/tests/helpers/nodes.rs b/base_layer/core/tests/helpers/nodes.rs index c33586432d..7b5bcfd0f7 100644 --- a/base_layer/core/tests/helpers/nodes.rs +++ b/base_layer/core/tests/helpers/nodes.rs @@ -78,6 +78,7 @@ use tari_shutdown::Shutdown; use crate::helpers::mock_state_machine::MockBaseNodeStateMachine; /// The NodeInterfaces is used as a container for providing access to all the services and interfaces of a single node. +#[allow(dead_code)] pub struct NodeInterfaces { pub node_identity: Arc, pub outbound_nci: OutboundNodeCommsInterface, 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 1e52342224..1e92eb5d42 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 @@ -58,7 +58,7 @@ impl + C { /// Creates a new sql backend from provided wallet db connection /// * `cipher` is used to encrypt the sensitive fields in the database, a cipher is derived - /// from a provided password, which we enforce for class instantiation + /// * from a provided password, which we enforce for class instantiation fn new(database_connection: TKeyManagerDbConnection, cipher: XChaCha20Poly1305) -> Self { Self { database_connection: Arc::new(database_connection), diff --git a/base_layer/mmr/src/common.rs b/base_layer/mmr/src/common.rs index 80358703dd..b2a74668f1 100644 --- a/base_layer/mmr/src/common.rs +++ b/base_layer/mmr/src/common.rs @@ -30,7 +30,7 @@ use tari_common::DomainDigest; use crate::{error::MerkleMountainRangeError, Hash}; -const ALL_ONES: usize = std::usize::MAX; +const ALL_ONES: usize = usize::MAX; #[derive(Copy, Clone)] pub struct LeafIndex(pub usize); diff --git a/base_layer/mmr/src/lib.rs b/base_layer/mmr/src/lib.rs index db0054bf33..158464e875 100644 --- a/base_layer/mmr/src/lib.rs +++ b/base_layer/mmr/src/lib.rs @@ -112,7 +112,7 @@ //! //! * _All_ indices are numbered starting from zero. //! * MMR nodes refer to all the nodes in the Merkle Mountain Range and are ordered in the canonical mmr ordering -//! described above. +//! * described above. //! * Leaf nodes are numbered counting from zero and increment by one each time a leaf is added. //! //! To illustrate, consider this MMR: diff --git a/base_layer/mmr/src/sparse_merkle_tree/mod.rs b/base_layer/mmr/src/sparse_merkle_tree/mod.rs index 28a367c492..a6ff68c533 100644 --- a/base_layer/mmr/src/sparse_merkle_tree/mod.rs +++ b/base_layer/mmr/src/sparse_merkle_tree/mod.rs @@ -22,8 +22,8 @@ //! * B: 01011111 (95 in decimal) //! * C: 11100000 (224 in decimal) //! * D: 11110000 (240 in decimal) -//! you will notice that they the first two diverge at the first bit, while the first and last pairs differ at the -//! fourth bit. This results in a SMT that looks like this: +//! * you will notice that they the first two diverge at the first bit, while the first and last pairs differ at the +//! * fourth bit. This results in a SMT that looks like this: //! //! r###" ┌──────┐ "### //! r###" ┌─────┤ root ├─────┐ "### diff --git a/base_layer/p2p/examples/gen_node_identity.rs b/base_layer/p2p/examples/gen_node_identity.rs index 52e65086bf..df12b8dce7 100644 --- a/base_layer/p2p/examples/gen_node_identity.rs +++ b/base_layer/p2p/examples/gen_node_identity.rs @@ -40,7 +40,7 @@ use tari_comms::{ use tari_utilities::message_format::MessageFormat; fn random_address() -> Multiaddr { - let port = OsRng.gen_range(9000..std::u16::MAX); + let port = OsRng.gen_range(9000..u16::MAX); let socket_addr: SocketAddr = (Ipv4Addr::LOCALHOST, port).into(); socketaddr_to_multiaddr(&socket_addr) } diff --git a/base_layer/tari_mining_helper_ffi/Cargo.toml b/base_layer/tari_mining_helper_ffi/Cargo.toml index 264d31dd23..dbdf64694c 100644 --- a/base_layer/tari_mining_helper_ffi/Cargo.toml +++ b/base_layer/tari_mining_helper_ffi/Cargo.toml @@ -30,3 +30,6 @@ tari_common = { path = "../../common", features = ["build", "static-application- [lib] crate-type = ["cdylib"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tari_target_network_mainnet)', 'cfg(tari_target_network_nextnet)', 'cfg(tari_target_network_testnet)'] } diff --git a/base_layer/wallet/src/base_node_service/service.rs b/base_layer/wallet/src/base_node_service/service.rs index beb52c877c..d2cdb26cec 100644 --- a/base_layer/wallet/src/base_node_service/service.rs +++ b/base_layer/wallet/src/base_node_service/service.rs @@ -112,9 +112,8 @@ where T: WalletBackend + 'static error!(target: LOG_TARGET, "Error handling request: {:?}", e); e }); - let _result = reply_tx.send(response).map_err(|e| { + let _result = reply_tx.send(response).inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); } diff --git a/base_layer/wallet/src/output_manager_service/service.rs b/base_layer/wallet/src/output_manager_service/service.rs index 47c81ff2b0..81b50eed18 100644 --- a/base_layer/wallet/src/output_manager_service/service.rs +++ b/base_layer/wallet/src/output_manager_service/service.rs @@ -213,9 +213,8 @@ where warn!(target: LOG_TARGET, "Error handling request: {:?}", e); e }); - let _result = reply_tx.send(response).map_err(|e| { + let _result = reply_tx.send(response).inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); }, _ = shutdown.wait() => { @@ -1119,7 +1118,7 @@ where let (sender_offset_key_id, _) = self .resources .key_manager - .get_next_key(&TransactionKeyManagerBranch::SenderOffset.get_branch_key()) + .get_next_key(TransactionKeyManagerBranch::SenderOffset.get_branch_key()) .await?; wallet_output = wallet_output .sign_as_sender_and_receiver(&self.resources.key_manager, &sender_offset_key_id) @@ -2230,7 +2229,7 @@ where let (sender_offset_key_id, sender_offset_public_key) = self .resources .key_manager - .get_next_key(&TransactionKeyManagerBranch::SenderOffset.get_branch_key()) + .get_next_key(TransactionKeyManagerBranch::SenderOffset.get_branch_key()) .await?; let metadata_signature = self .resources diff --git a/base_layer/wallet/src/transaction_service/protocols/transaction_send_protocol.rs b/base_layer/wallet/src/transaction_service/protocols/transaction_send_protocol.rs index 2c088cec6c..a0174d009a 100644 --- a/base_layer/wallet/src/transaction_service/protocols/transaction_send_protocol.rs +++ b/base_layer/wallet/src/transaction_service/protocols/transaction_send_protocol.rs @@ -234,9 +234,8 @@ where Ok(sp) => { let _result = service_reply_channel .send(Ok(TransactionServiceResponse::TransactionSent(self.id))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send service reply"); - e }); Ok(sp) }, @@ -244,9 +243,8 @@ where let error_string = e.to_string(); let _size = service_reply_channel .send(Err(TransactionServiceError::from(e))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send service reply"); - e }); Err(TransactionServiceProtocolError::new( self.id, diff --git a/base_layer/wallet/src/transaction_service/service.rs b/base_layer/wallet/src/transaction_service/service.rs index bf354cb216..cd03ce778c 100644 --- a/base_layer/wallet/src/transaction_service/service.rs +++ b/base_layer/wallet/src/transaction_service/service.rs @@ -952,9 +952,8 @@ where // If the individual handlers did not already send the API response then do it here. if let Some(rp) = reply_channel { - let _result = rp.send(response).map_err(|e| { + let _result = rp.send(response).inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); } Ok(()) @@ -1031,10 +1030,7 @@ where if let OutputManagerEvent::TxoValidationSuccess(_) = (*event).clone() { let db = self.db.clone(); let output_manager_handle = self.resources.output_manager_service.clone(); - let metadata = match self.wallet_db.get_chain_metadata() { - Ok(data) => data, - Err(_) => None, - }; + let metadata = self.wallet_db.get_chain_metadata().unwrap_or_default(); let tip_height = match metadata { Some(val) => val.best_block_height(), None => 0u64, @@ -1075,9 +1071,8 @@ where if destination.network() != self.resources.wallet_identity.address.network() { let _result = reply_channel .send(Err(TransactionServiceError::InvalidNetwork)) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send service reply"); - e }); return Err(TransactionServiceError::InvalidNetwork); } @@ -1121,9 +1116,8 @@ where let _result = reply_channel .send(Ok(TransactionServiceResponse::TransactionSent(tx_id))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send service reply"); - e }); return Ok(()); diff --git a/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs b/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs index 67baa0ca07..4f0579491f 100644 --- a/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs +++ b/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs @@ -50,10 +50,7 @@ pub async fn check_detected_transactions ) { // Reorged faux transactions cannot be detected by excess signature, thus use last known confirmed transaction // height or current tip height with safety margin to determine if these should be returned - let last_mined_transaction = match db.fetch_last_mined_transaction() { - Ok(tx) => tx, - Err(_) => None, - }; + let last_mined_transaction = db.fetch_last_mined_transaction().unwrap_or_default(); let height_with_margin = tip_height.saturating_sub(SAFETY_HEIGHT_MARGIN); let check_height = if let Some(tx) = last_mined_transaction { diff --git a/base_layer/wallet/src/transaction_service/utc.rs b/base_layer/wallet/src/transaction_service/utc.rs index 8b172c03ba..c9d445b876 100644 --- a/base_layer/wallet/src/transaction_service/utc.rs +++ b/base_layer/wallet/src/transaction_service/utc.rs @@ -13,14 +13,11 @@ pub struct NegativeDurationError { } /// The function compared two non-leap UTC timestamps. -/// 1. `chrono` uses `SystemTime` and will never -/// produce leap-seconds. -/// 2. `chrono` supports leap seconds that can be read from -/// the string format (as `60` second), because it's required by the standard (ISO 8601). -/// 3. Leap-second handled automatically by NTP and we -/// could ignore it as soon as `chrono` doesn't handle -/// them accurately. No guarantees and only the one -/// second handeled. +/// 1. `chrono` uses `SystemTime` and will never produce leap-seconds. +/// 2. `chrono` supports leap seconds that can be read from the string format (as `60` second), because it's required by +/// the standard (ISO 8601). +/// 3. Leap-second handled automatically by NTP and we could ignore it as soon as `chrono` doesn't handle them +/// accurately. No guarantees and only the one second handeled. pub fn utc_duration_since(since: &NaiveDateTime) -> Result { let now_ms = Utc::now().naive_utc().timestamp_millis(); let since_ms = since.timestamp_millis(); diff --git a/base_layer/wallet/src/wallet.rs b/base_layer/wallet/src/wallet.rs index 156359753b..f69fab4415 100644 --- a/base_layer/wallet/src/wallet.rs +++ b/base_layer/wallet/src/wallet.rs @@ -357,8 +357,6 @@ where db: wallet_database, output_db: output_manager_database, factories, - #[cfg(feature = "test_harness")] - transaction_backend: transaction_backend_handle, _u: PhantomData, _v: PhantomData, _w: PhantomData, diff --git a/base_layer/wallet/tests/support/comms_rpc.rs b/base_layer/wallet/tests/support/comms_rpc.rs index 351c9c692b..3e554df074 100644 --- a/base_layer/wallet/tests/support/comms_rpc.rs +++ b/base_layer/wallet/tests/support/comms_rpc.rs @@ -149,7 +149,7 @@ impl BaseNodeWalletRpcMockState { })), tip_info_response: Arc::new(Mutex::new(TipInfoResponse { metadata: Some(ChainMetadataProto { - best_block_height: std::i64::MAX as u64, + best_block_height: i64::MAX as u64, best_block_hash: FixedHash::zero().to_vec(), accumulated_difficulty: Vec::new(), pruned_height: 0, diff --git a/base_layer/wallet/tests/support/output_manager_service_mock.rs b/base_layer/wallet/tests/support/output_manager_service_mock.rs index 9f9e6ea3fc..071be4bb64 100644 --- a/base_layer/wallet/tests/support/output_manager_service_mock.rs +++ b/base_layer/wallet/tests/support/output_manager_service_mock.rs @@ -117,9 +117,8 @@ impl OutputManagerServiceMock { let _result = reply_tx .send(Ok(OutputManagerResponse::RewoundOutputs(outputs))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); }, OutputManagerRequest::ScanOutputs(requested_outputs) => { @@ -141,9 +140,8 @@ impl OutputManagerServiceMock { .collect(); let _result = reply_tx .send(Ok(OutputManagerResponse::ScanOutputs(outputs))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); }, OutputManagerRequest::ValidateUtxos => {}, diff --git a/base_layer/wallet/tests/support/transaction_service_mock.rs b/base_layer/wallet/tests/support/transaction_service_mock.rs index 59cdba9e91..5b19a8d771 100644 --- a/base_layer/wallet/tests/support/transaction_service_mock.rs +++ b/base_layer/wallet/tests/support/transaction_service_mock.rs @@ -105,9 +105,8 @@ impl TransactionServiceMock { TransactionServiceRequest::ImportUtxoWithStatus { .. } => { let _result = reply_tx .send(Ok(TransactionServiceResponse::UtxoImported(TxId::from(42u64)))) - .map_err(|e| { + .inspect_err(|_| { warn!(target: LOG_TARGET, "Failed to send reply"); - e }); }, TransactionServiceRequest::ValidateTransactions => {}, diff --git a/base_layer/wallet/tests/transaction_service_tests/service.rs b/base_layer/wallet/tests/transaction_service_tests/service.rs index 47b833cc73..d238f9db23 100644 --- a/base_layer/wallet/tests/transaction_service_tests/service.rs +++ b/base_layer/wallet/tests/transaction_service_tests/service.rs @@ -209,7 +209,7 @@ async fn setup_transaction_service>( let passphrase = SafePassword::from("My lovely secret passphrase"); let db = WalletDatabase::new(WalletSqliteDatabase::new(db_connection.clone(), passphrase).unwrap()); - let metadata = ChainMetadata::new(std::i64::MAX as u64, FixedHash::zero(), 0, 0, 1.into(), 0).unwrap(); + let metadata = ChainMetadata::new(i64::MAX as u64, FixedHash::zero(), 0, 0, 1.into(), 0).unwrap(); db.set_chain_metadata(metadata).unwrap(); @@ -500,18 +500,16 @@ fn try_decode_transaction_reply_message(bytes: Vec) -> Option) -> Option { let envelope_body = EnvelopeBody::decode(&mut bytes.as_slice()).unwrap(); - match envelope_body.decode_part::(1) { - Err(_) => None, - Ok(d) => d, - } + envelope_body + .decode_part::(1) + .unwrap_or_default() } fn try_decode_transaction_cancelled_message(bytes: Vec) -> Option { let envelope_body = EnvelopeBody::decode(&mut bytes.as_slice()).unwrap(); - match envelope_body.decode_part::(1) { - Err(_) => None, - Ok(d) => d, - } + envelope_body + .decode_part::(1) + .unwrap_or_default() } #[tokio::test(flavor = "multi_thread", worker_threads = 1)] diff --git a/base_layer/wallet_ffi/Cargo.toml b/base_layer/wallet_ffi/Cargo.toml index 86b2f82cd6..06c53a44f5 100644 --- a/base_layer/wallet_ffi/Cargo.toml +++ b/base_layer/wallet_ffi/Cargo.toml @@ -56,3 +56,6 @@ env_logger = "0.7.1" cbindgen = "0.24.3" tari_common = { path = "../../common", features = ["build", "static-application-info"] } tari_features = { path = "../../common/tari_features", version = "1.0.0-pre.15" } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tari_target_network_mainnet)', 'cfg(tari_target_network_nextnet)', 'cfg(tari_target_network_testnet)'] } diff --git a/base_layer/wallet_ffi/README.md b/base_layer/wallet_ffi/README.md index b00fecb5ee..a58ca97ab4 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-03-01 -rustup default nightly-2024-03-01 +rustup toolchain add nightly-2024-07-07 +rustup default nightly-2024-07-07 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/error.rs b/base_layer/wallet_ffi/src/error.rs index 4ebef20914..93f91a431e 100644 --- a/base_layer/wallet_ffi/src/error.rs +++ b/base_layer/wallet_ffi/src/error.rs @@ -63,6 +63,7 @@ pub enum InterfaceError { #[derive(Debug, Clone)] pub struct LibWalletError { pub code: i32, + #[allow(dead_code)] pub message: String, } diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index 4c8282ef21..fceedba2ad 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -6046,9 +6046,9 @@ pub unsafe extern "C" fn wallet_get_balance(wallet: *mut TariWallet, error_out: /// * `page_size` - A number of items per page, /// * `sorting` - An enum representing desired sorting, /// * `dust_threshold` - A value filtering threshold. Outputs whose values are <= `dust_threshold` are not listed in the -/// result. +/// result. /// * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. -/// Functions as an out parameter. +/// Functions as an out parameter. /// /// ## Returns /// `*mut TariVector` - Returns a struct with an array pointer, length and capacity (needed for proper destruction @@ -6135,11 +6135,11 @@ pub unsafe extern "C" fn wallet_get_utxos( /// ## Arguments /// * `wallet` - The TariWallet pointer, /// * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. -/// Functions as an out parameter. +/// Functions as an out parameter. /// /// ## Returns /// `*mut TariVector` - Returns a struct with an array pointer, length and capacity (needed for proper destruction -/// after use). +/// after use). /// /// ## States /// 0 - Unspent @@ -6209,7 +6209,7 @@ pub unsafe extern "C" fn wallet_get_all_utxos(wallet: *mut TariWallet, error_ptr /// * `number_of_splits` - The number of times to split the amount /// * `fee_per_gram` - The transaction fee /// * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. -/// Functions as an out parameter. +/// Functions as an out parameter. /// /// ## Returns /// `c_ulonglong` - Returns the transaction id. @@ -6279,7 +6279,7 @@ pub unsafe extern "C" fn wallet_coin_split( /// (see `Commitment::to_hex()`) /// * `fee_per_gram` - The transaction fee /// * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. -/// Functions as an out parameter. +/// Functions as an out parameter. /// /// ## Returns /// `TariVector` - Returns the transaction id. diff --git a/base_layer/wallet_ffi/wallet.h b/base_layer/wallet_ffi/wallet.h index aa0ddd9cdc..ce9aa84e20 100644 --- a/base_layer/wallet_ffi/wallet.h +++ b/base_layer/wallet_ffi/wallet.h @@ -779,6 +779,40 @@ char *tari_address_to_emoji_id(TariWalletAddress *address, char *tari_address_network(TariWalletAddress *address, int *error_out); +/** + * Returns the u8 representation of a TariWalletAddress's network + * + * ## Arguments + * `address` - The pointer to a TariWalletAddress + * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. Functions + * as an out parameter. + * + * ## Returns + * `u8` - Returns u8 representing the network. On failure, returns 0. This may be valid so always check the error out + * + * # Safety + * The ```string_destroy``` method must be called when finished with a string from rust to prevent a memory leak + */ +uint8_t tari_address_network_u8(TariWalletAddress *address, + int *error_out); + +/** + * Returns the u8 representation of a TariWalletAddress's checksum + * + * ## Arguments + * `address` - The pointer to a TariWalletAddress + * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. Functions + * as an out parameter. + * + * ## Returns + * `u8` - Returns u8 representing the checksum.. On failure, returns 0. This may be valid so always check the error out + * + * # Safety + * The ```string_destroy``` method must be called when finished with a string from rust to prevent a memory leak + */ +uint8_t tari_address_checksum_u8(TariWalletAddress *address, + int *error_out); + /** * Creates a char array from a TariWalletAddress's features * @@ -2656,7 +2690,6 @@ void transport_config_destroy(TariTransportConfig *transport); * `database_path` - The database path char array pointer which. This is the folder path where the * database files will be created and the application has write access to * `discovery_timeout_in_secs`: specify how long the Discovery Timeout for the wallet is. - * `network`: name of network to connect to. Valid values are: esmeralda, dibbler, igor, localnet, mainnet, stagenet * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. Functions * as an out parameter. * @@ -2932,9 +2965,9 @@ TariBalance *wallet_get_balance(struct TariWallet *wallet, * * `page_size` - A number of items per page, * * `sorting` - An enum representing desired sorting, * * `dust_threshold` - A value filtering threshold. Outputs whose values are <= `dust_threshold` are not listed in the - * result. + * result. * * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. - * Functions as an out parameter. + * Functions as an out parameter. * * ## Returns * `*mut TariVector` - Returns a struct with an array pointer, length and capacity (needed for proper destruction @@ -2959,11 +2992,11 @@ struct TariVector *wallet_get_utxos(struct TariWallet *wallet, * ## Arguments * * `wallet` - The TariWallet pointer, * * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. - * Functions as an out parameter. + * Functions as an out parameter. * * ## Returns * `*mut TariVector` - Returns a struct with an array pointer, length and capacity (needed for proper destruction - * after use). + * after use). * * ## States * 0 - Unspent @@ -2997,7 +3030,7 @@ struct TariVector *wallet_get_all_utxos(struct TariWallet *wallet, * * `number_of_splits` - The number of times to split the amount * * `fee_per_gram` - The transaction fee * * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. - * Functions as an out parameter. + * Functions as an out parameter. * * ## Returns * `c_ulonglong` - Returns the transaction id. @@ -3021,7 +3054,7 @@ uint64_t wallet_coin_split(struct TariWallet *wallet, * (see `Commitment::to_hex()`) * * `fee_per_gram` - The transaction fee * * `error_out` - Pointer to an int which will be modified to an error code should one occur, may not be null. - * Functions as an out parameter. + * Functions as an out parameter. * * ## Returns * `TariVector` - Returns the transaction id. diff --git a/buildtools/docker/base_node.Dockerfile b/buildtools/docker/base_node.Dockerfile index 4af0b7e43b..79635730cf 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-03-01 as builder +FROM quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-07-07 as builder # Copy the dependency lists #ADD Cargo.toml ./ ADD . /minotari_node WORKDIR /minotari_node -# RUN rustup component add rustfmt --toolchain nightly-2024-03-01-x86_64-unknown-linux-gnu +# RUN rustup component add rustfmt --toolchain nightly-2024-07-07-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 787dc0ac17..12bae58f20 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -19,19 +19,19 @@ tari_features = { path = "./tari_features", version = "1.0.0-pre.15"} anyhow = "1.0.53" blake2 = "0.10" -config = { version = "0.14.0", default_features = false, features = ["toml"] } +config = { version = "0.14.0", default-features = false, features = ["toml"] } dirs-next = "1.0.2" -git2 = { version = "0.18", default_features = false, optional = true } +git2 = { version = "0.18", default-features = false, optional = true } log = "0.4.8" -log4rs = { version = "1.3.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format"] } +log4rs = { version = "1.3.0", default-features = false, features = ["config_parsing", "threshold_filter", "yaml_format"] } multiaddr = { version = "0.14.0" } path-clean = "0.1.0" prost-build = { version = "0.11.9", optional = true } -serde = { version = "1.0.106", default_features = false } +serde = { version = "1.0.106", default-features = false } serde_json = "1.0.51" serde_yaml = "0.9.17" sha2 = "0.10" -structopt = { version = "0.3.13", default_features = false } +structopt = { version = "0.3.13", default-features = false } tempfile = "3.1.0" thiserror = "1.0.29" toml = { version = "0.5", optional = true } @@ -42,3 +42,6 @@ toml = "0.5.8" [build-dependencies] tari_features = { path = "./tari_features", version = "1.0.0-pre.15" } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tari_target_network_mainnet)', 'cfg(tari_target_network_nextnet)'] } diff --git a/common/src/configuration/loader.rs b/common/src/configuration/loader.rs index 3e82b495be..0d42499e5b 100644 --- a/common/src/configuration/loader.rs +++ b/common/src/configuration/loader.rs @@ -217,12 +217,12 @@ impl ConfigPath for C { /// ``` pub trait ConfigLoader: ConfigPath + Sized { /// Try to load configuration from supplied Config by `main_key_prefix()` - /// with values overloaded from `overload_key_prefix()`. + /// with values overloaded from `overload_key_prefix()`. For automated inheritance of Default values use + /// DefaultConfigLoader /// /// Default values will be taken from /// - `#[serde(default="value")]` field attribute /// - value defined in Config::set_default() - /// For automated inheritance of Default values use DefaultConfigLoader. fn load_from(config: &Config) -> Result; } @@ -367,6 +367,7 @@ mod test { use super::*; // test SubConfigPath both with Default and without Default + #[allow(dead_code)] #[derive(Serialize, Deserialize)] struct SubTari { monero: String, @@ -378,6 +379,8 @@ mod test { } } } + + #[allow(dead_code)] #[derive(Default, Serialize, Deserialize)] struct SuperTari { #[serde(flatten)] @@ -386,6 +389,7 @@ mod test { #[serde(default = "serde_default_string")] bitcoin: String, } + #[allow(dead_code)] fn serde_default_string() -> String { "ispublic".into() } diff --git a/comms/core/examples/stress/node.rs b/comms/core/examples/stress/node.rs index 28c871b4ac..6c651c26aa 100644 --- a/comms/core/examples/stress/node.rs +++ b/comms/core/examples/stress/node.rs @@ -90,9 +90,8 @@ pub async fn create( .parse::() .unwrap(); let node_identity = node_identity - .map(|ni| { + .inspect(|ni| { ni.add_public_address(public_addr.clone()); - ni }) .unwrap_or_else(|| Arc::new(NodeIdentity::random(&mut OsRng, public_addr, Default::default()))); diff --git a/comms/core/examples/tor.rs b/comms/core/examples/tor.rs index cf3b6ef1d9..202072f993 100644 --- a/comms/core/examples/tor.rs +++ b/comms/core/examples/tor.rs @@ -253,9 +253,8 @@ async fn start_ping_ponger( id.parse::() .ok() .and_then(|id_num| inflight_pings.remove(&id_num)) - .map(|latency| { + .inspect(|&latency| { println!("Latency: {}ms", latency); - latency }); println!("-----------------------------------"); diff --git a/comms/core/src/memsocket/mod.rs b/comms/core/src/memsocket/mod.rs index 9e408666a7..62fc050081 100644 --- a/comms/core/src/memsocket/mod.rs +++ b/comms/core/src/memsocket/mod.rs @@ -70,13 +70,13 @@ pub fn acquire_next_memsocket_port() -> NonZeroU16 { // The switchboard is full and all ports are in use assert!( - switchboard.0.len() != (std::u16::MAX - 1) as usize, + switchboard.0.len() != (u16::MAX - 1) as usize, "All memsocket addresses in use!" ); // Instead of overflowing to 0, resume searching at port 1 since port 0 isn't a // valid port to bind to. - if switchboard.1 == std::u16::MAX { + if switchboard.1 == u16::MAX { switchboard.1 = 1; } else { switchboard.1 += 1; @@ -191,13 +191,13 @@ impl MemoryListener { let port = NonZeroU16::new(switchboard.1).unwrap_or_else(|| unreachable!()); // The switchboard is full and all ports are in use - if switchboard.0.len() == (std::u16::MAX - 1) as usize { + if switchboard.0.len() == (u16::MAX - 1) as usize { return Err(ErrorKind::AddrInUse.into()); } // Instead of overflowing to 0, resume searching at port 1 since port 0 isn't a // valid port to bind to. - if switchboard.1 == std::u16::MAX { + if switchboard.1 == u16::MAX { switchboard.1 = 1; } else { switchboard.1 += 1; diff --git a/comms/core/src/peer_manager/peer.rs b/comms/core/src/peer_manager/peer.rs index 329a4fb74f..2123a6c3b6 100644 --- a/comms/core/src/peer_manager/peer.rs +++ b/comms/core/src/peer_manager/peer.rs @@ -375,7 +375,7 @@ mod test { Default::default(), ); assert!(!peer.is_banned()); - peer.ban_for(Duration::from_millis(std::u64::MAX), "Very long manual ban".to_string()); + peer.ban_for(Duration::from_millis(u64::MAX), "Very long manual ban".to_string()); assert_eq!(peer.reason_banned(), &"Very long manual ban".to_string()); assert!(peer.is_banned()); peer.ban_for(Duration::from_millis(0), "".to_string()); diff --git a/comms/core/src/protocol/error.rs b/comms/core/src/protocol/error.rs index e702aa9a35..3474e0b687 100644 --- a/comms/core/src/protocol/error.rs +++ b/comms/core/src/protocol/error.rs @@ -31,7 +31,7 @@ pub enum ProtocolError { IoError(#[from] io::Error), #[error("Invalid flag: {0}")] InvalidFlag(String), - #[error("The ProtocolId was longer than {}", u8::max_value())] + #[error("The ProtocolId was longer than {}", u8::MAX)] ProtocolIdTooLong, #[error("Protocol negotiation failed because the peer did not accept any of the given protocols: {protocols}")] ProtocolOutboundNegotiationFailed { protocols: String }, diff --git a/comms/dht/src/dedup/dedup_cache.rs b/comms/dht/src/dedup/dedup_cache.rs index c18034af09..f7ebe72180 100644 --- a/comms/dht/src/dedup/dedup_cache.rs +++ b/comms/dht/src/dedup/dedup_cache.rs @@ -33,6 +33,7 @@ use crate::{ const LOG_TARGET: &str = "comms::dht::dedup_cache"; +#[allow(dead_code)] #[derive(Queryable, PartialEq, Eq, Debug)] struct DedupCacheEntry { body_hash: String, diff --git a/comms/dht/src/discovery/mod.rs b/comms/dht/src/discovery/mod.rs index f412c66d3b..521ff24a03 100644 --- a/comms/dht/src/discovery/mod.rs +++ b/comms/dht/src/discovery/mod.rs @@ -28,9 +28,8 @@ //! //! The protocol functions as follows: //! 1. Broadcast an encrypted [Discovery](crate::envelope::DhtMessageType) message destined for the peer containing the -//! necessary details to connect to this peer. -//! 1. If the peer is online, it may decrypt the message and view the peer -//! connection details. +//! necessary details to connect to this peer. +//! 1. If the peer is online, it may decrypt the message and view the peer connection details. //! 1. The peer may then add the peer and attempt to connect to it. //! 1. Once a direct connection is established, the discovery is complete. diff --git a/comms/dht/src/discovery/requester.rs b/comms/dht/src/discovery/requester.rs index 846baab03b..3313943162 100644 --- a/comms/dht/src/discovery/requester.rs +++ b/comms/dht/src/discovery/requester.rs @@ -74,7 +74,7 @@ impl DhtDiscoveryRequester { /// /// ## Arguments /// - `dest_public_key` - The public key of the recipient used to create a shared ECDH key which in turn is used to - /// encrypt the discovery message + /// encrypt the discovery message /// - `destination` - The `NodeDestination` to use in the DhtHeader when sending a discovery message. /// - `Unknown` destination will maintain complete privacy, the trade off is that discovery needs to propagate /// the entire network to reach the destination and so may take longer diff --git a/comms/dht/src/store_forward/store.rs b/comms/dht/src/store_forward/store.rs index 16283bede2..d41df26e6c 100644 --- a/comms/dht/src/store_forward/store.rs +++ b/comms/dht/src/store_forward/store.rs @@ -183,9 +183,9 @@ where S: Service + Se /// 1. Messages MUST have a message origin set and be encrypted (Join messages are the exception) /// 1. Unencrypted Join messages - this increases the knowledge the network has of peers (Low priority) /// 1. Encrypted Discovery messages - so that nodes are aware of other nodes that are looking for them (High - /// priority) 1. Encrypted messages addressed to the neighbourhood - some node in the neighbourhood may be - /// interested in this message (High priority) 1. Encrypted messages addressed to a particular public key or - /// node id that this node knows about + /// priority) 1. Encrypted messages addressed to the neighbourhood - some node in the neighbourhood may be + /// interested in this message (High priority) 1. Encrypted messages addressed to a particular public key or node + /// id that this node knows about async fn handle(mut self, mut message: DecryptedDhtMessage) -> Result<(), PipelineError> { if !self.node_identity.features().contains(PeerFeatures::DHT_STORE_FORWARD) { trace!( diff --git a/comms/dht/tests/harness.rs b/comms/dht/tests/harness.rs index ab1b0aa7ea..2b0414f6ac 100644 --- a/comms/dht/tests/harness.rs +++ b/comms/dht/tests/harness.rs @@ -55,6 +55,7 @@ pub struct TestNode { pub comms: CommsNode, pub dht: Dht, pub inbound_messages: mpsc::Receiver, + #[allow(dead_code)] pub messaging_events: broadcast::Sender, pub shutdown: Shutdown, } diff --git a/comms/rpc_macros/src/options.rs b/comms/rpc_macros/src/options.rs index 9a8c1fb56b..f2868d3f9d 100644 --- a/comms/rpc_macros/src/options.rs +++ b/comms/rpc_macros/src/options.rs @@ -28,6 +28,7 @@ use syn::{ Token, }; +#[allow(dead_code)] #[derive(Debug)] pub struct RpcTraitOptions { pub protocol_name: syn::LitByteStr, diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 4858c0ce17..f0e28f62ae 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -47,7 +47,7 @@ reqwest = "0.11.11" serde_json = "1.0.64" tempfile = "3.3.0" thiserror = "^1.0.20" -time = "0.3.15" +time = "0.3.36" tokio = { version = "1.36", features = ["macros", "time", "sync", "rt-multi-thread"] } tonic = "0.8.3" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9f32d3d93a..d186e7d294 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-03-01" +channel = "nightly-2024-07-07" diff --git a/scripts/test_in_docker.sh b/scripts/test_in_docker.sh index 6876c17b10..bf49bb4498 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-03-01 -TOOLCHAIN_VERSION=nightly-2024-03-01 +IMAGE=quay.io/tarilabs/rust_tari-build-with-deps:nightly-2024-07-07 +TOOLCHAIN_VERSION=nightly-2024-07-07 CONTAINER=tari_test echo "Deleting old container"