diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2bf58277123..8aa01264e3d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -55,7 +55,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 target: ${{ matrix.target }} override: true - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da2415cf039..a670405614b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 components: rustfmt override: true - uses: Swatinem/rust-cache@v2 @@ -57,7 +57,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 - uses: Swatinem/rust-cache@v2 with: shared-key: "check" @@ -82,7 +82,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 components: clippy override: true - uses: Swatinem/rust-cache@v2 @@ -191,7 +191,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 override: true - uses: Swatinem/rust-cache@v2 with: @@ -239,7 +239,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 components: rustfmt override: true - uses: actions/checkout@v3 @@ -274,7 +274,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.75.0 + toolchain: 1.81.0 components: rustfmt override: true - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 1816c95bf4a..281d0ccb854 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -11,11 +11,11 @@ jobs: markdown-link-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: '18' + node-version: 18 - name: Install markdown-link-check run: npm install -g markdown-link-check - name: Check links in markdown files diff --git a/Cargo.lock b/Cargo.lock index f2615370c73..a6a4a86c860 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3765,6 +3765,12 @@ dependencies = [ "serde", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -5525,12 +5531,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -5545,10 +5552,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] diff --git a/massa-bootstrap/src/lib.rs b/massa-bootstrap/src/lib.rs index 62bb3109a4e..2251aa13185 100644 --- a/massa-bootstrap/src/lib.rs +++ b/massa-bootstrap/src/lib.rs @@ -15,9 +15,7 @@ use massa_consensus_exports::bootstrapable_graph::BootstrapableGraph; use massa_final_state::FinalStateController; use massa_protocol_exports::BootstrapPeers; use parking_lot::RwLock; -use std::io::{self, ErrorKind}; use std::sync::Arc; -use std::time::{Duration, Instant}; mod bindings; mod client; @@ -65,7 +63,7 @@ impl GlobalBootstrapState { } } } - +/* trait BindingReadExact: io::Read { /// similar to std::io::Read::read_exact, but with a timeout that is function-global instead of per-individual-read fn read_exact_timeout( @@ -112,3 +110,4 @@ trait BindingReadExact: io::Read { /// Internal helper fn set_read_timeout(&mut self, deadline: Option) -> Result<(), std::io::Error>; } +*/ diff --git a/massa-bootstrap/src/messages.rs b/massa-bootstrap/src/messages.rs index 039de714134..e0cc2fa5669 100644 --- a/massa-bootstrap/src/messages.rs +++ b/massa-bootstrap/src/messages.rs @@ -84,6 +84,7 @@ pub enum BootstrapServerMessage { }, } +#[allow(clippy::to_string_trait_impl)] impl ToString for BootstrapServerMessage { fn to_string(&self) -> String { match self { diff --git a/massa-bootstrap/src/server.rs b/massa-bootstrap/src/server.rs index af51016d1d7..c5d462c3abb 100644 --- a/massa-bootstrap/src/server.rs +++ b/massa-bootstrap/src/server.rs @@ -63,11 +63,7 @@ use crate::{ white_black_list::SharedWhiteBlackList, BootstrapConfig, }; -/// Specifies a common interface that can be used by standard, or mockers -#[cfg_attr(test, mockall::automock)] -pub trait BSEventPoller { - fn poll(&mut self) -> Result; -} + /// Abstraction layer over data produced by the listener, and transported /// over to the worker via a channel diff --git a/massa-bootstrap/src/tests/binders.rs b/massa-bootstrap/src/tests/binders.rs index e52b6c118e1..46ef5b1c699 100644 --- a/massa-bootstrap/src/tests/binders.rs +++ b/massa-bootstrap/src/tests/binders.rs @@ -59,7 +59,7 @@ impl BootstrapClientBinder { } pub(crate) fn test_default_config() -> BootstrapClientConfig { BootstrapClientConfig { - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, max_listeners_per_peer: MAX_LISTENERS_PER_PEER as u32, endorsement_count: ENDORSEMENT_COUNT, max_advertise_length: MAX_ADVERTISE_LENGTH, @@ -131,7 +131,7 @@ fn init_server_client_pair() -> (BootstrapServerBinder, BootstrapClientBinder) { server.0, server_keypair.clone(), BootstrapSrvBindCfg { - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, thread_count: THREAD_COUNT, max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH, randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES, diff --git a/massa-bootstrap/src/tests/config.rs b/massa-bootstrap/src/tests/config.rs index a443ed1777a..027e07637d7 100644 --- a/massa-bootstrap/src/tests/config.rs +++ b/massa-bootstrap/src/tests/config.rs @@ -48,7 +48,7 @@ impl Default for BootstrapConfig { max_simultaneous_bootstraps: 2, ip_list_max_size: 10, per_ip_min_interval: MassaTime::from_millis(10000), - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH, randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES, thread_count: THREAD_COUNT, diff --git a/massa-bootstrap/src/tests/messages.rs b/massa-bootstrap/src/tests/messages.rs index 950f3101e88..bccd65fe8db 100644 --- a/massa-bootstrap/src/tests/messages.rs +++ b/massa-bootstrap/src/tests/messages.rs @@ -14,7 +14,7 @@ use massa_serialization::{DeserializeError, Deserializer, Serializer}; #[test] fn test_serialize_bootstrap_server_message() { let config = BootstrapClientConfig { - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, max_listeners_per_peer: MAX_LISTENERS_PER_PEER as u32, endorsement_count: ENDORSEMENT_COUNT, max_advertise_length: MAX_ADVERTISE_LENGTH, @@ -147,7 +147,7 @@ fn test_serialize_error_cases_clientmsg() { #[test] fn test_serialize_error_cases_servermsg() { let config = BootstrapClientConfig { - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, max_listeners_per_peer: MAX_LISTENERS_PER_PEER as u32, endorsement_count: ENDORSEMENT_COUNT, max_advertise_length: MAX_ADVERTISE_LENGTH, diff --git a/massa-bootstrap/src/tests/tools.rs b/massa-bootstrap/src/tests/tools.rs index ddfabd23734..f4615ebbda6 100644 --- a/massa-bootstrap/src/tests/tools.rs +++ b/massa-bootstrap/src/tests/tools.rs @@ -353,7 +353,7 @@ pub fn get_bootstrap_config(bootstrap_public_key: NodeId) -> BootstrapConfig { max_simultaneous_bootstraps: 2, ip_list_max_size: 10, per_ip_min_interval: MassaTime::from_millis(10000), - rate_limit: std::u64::MAX, + rate_limit: u64::MAX, max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH, randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES, thread_count: THREAD_COUNT, diff --git a/massa-client/src/settings.rs b/massa-client/src/settings.rs index cd177d7cf88..541a5f52004 100644 --- a/massa-client/src/settings.rs +++ b/massa-client/src/settings.rs @@ -10,6 +10,7 @@ lazy_static::lazy_static! { pub static ref SETTINGS: Settings = build_massa_settings("massa-client", "MASSA_CLIENT"); } +#[allow(dead_code)] #[derive(Debug, Deserialize, Clone)] pub struct Settings { pub default_node: DefaultNode, diff --git a/massa-consensus-worker/src/lib.rs b/massa-consensus-worker/src/lib.rs index 7074c71d037..48e617a34c2 100644 --- a/massa-consensus-worker/src/lib.rs +++ b/massa-consensus-worker/src/lib.rs @@ -22,6 +22,7 @@ //! * If the dependencies are already available, the module checks if it can validate the block and add it to a clique. //! * If it's the second block received for the same slot we save it in order to denounce the creator in the future. //! * If it's the third or more we ignore the block unless we asked for it explicitly as a dependency. +//! //! If a queued block reaches the slot time at which it should be processed, the worker wakes up to check it and trigger, if necessary, the consensus algorithm. //! It then prunes the block graph and the caches. diff --git a/massa-consensus-worker/src/state/mod.rs b/massa-consensus-worker/src/state/mod.rs index 23560ae91cd..07dee3ce7a4 100644 --- a/massa-consensus-worker/src/state/mod.rs +++ b/massa-consensus-worker/src/state/mod.rs @@ -37,6 +37,7 @@ mod stats; mod tick; mod verifications; +#[allow(dead_code)] #[derive(Clone)] pub struct ConsensusState { /// Configuration @@ -70,7 +71,7 @@ pub struct ConsensusState { pub new_final_blocks: PreHashSet, /// Newly stale block mapped to creator and slot pub new_stale_blocks: PreHashMap, - /// time at which the node was launched (used for desynchronization detection) + /// time at which the node was launched (used for de-synchronization detection) pub launch_time: MassaTime, /// Final block stats `(time, creator, is_from_protocol)` pub final_block_stats: VecDeque<(MassaTime, Address, bool)>, @@ -80,7 +81,7 @@ pub struct ConsensusState { pub stale_block_stats: VecDeque, /// the time span considered for stats pub stats_history_timespan: MassaTime, - /// the time span considered for desynchronization detection + /// the time span considered for de-synchronization detection pub stats_desync_detection_timespan: MassaTime, /// blocks we want pub wishlist: PreHashMap>, diff --git a/massa-execution-worker/src/context.rs b/massa-execution-worker/src/context.rs index 18e545d3dde..9039cef4994 100644 --- a/massa-execution-worker/src/context.rs +++ b/massa-execution-worker/src/context.rs @@ -189,6 +189,7 @@ impl ExecutionContext { /// /// # arguments /// * `final_state`: thread-safe access to the final state. + /// /// Note that this will be used only for reading, never for writing /// /// # returns diff --git a/massa-execution-worker/src/tests/universe.rs b/massa-execution-worker/src/tests/universe.rs index 85b98a0846e..8c1ac11a918 100644 --- a/massa-execution-worker/src/tests/universe.rs +++ b/massa-execution-worker/src/tests/universe.rs @@ -79,6 +79,7 @@ impl ExecutionForeignControllers { } } +#[allow(dead_code)] pub struct ExecutionTestUniverse { pub module_controller: Box, pub storage: Storage, diff --git a/massa-models/src/clique.rs b/massa-models/src/clique.rs index 3fa76c31849..f60ef64b8f5 100644 --- a/massa-models/src/clique.rs +++ b/massa-models/src/clique.rs @@ -1,7 +1,5 @@ // Copyright (c) 2022 MASSA LABS -use core::usize; - use massa_serialization::{ Deserializer, SerializeError, Serializer, U32VarIntDeserializer, U32VarIntSerializer, U64VarIntDeserializer, U64VarIntSerializer, diff --git a/massa-models/src/ledger.rs b/massa-models/src/ledger.rs index f6875eb1b6a..95e85f1c44e 100644 --- a/massa-models/src/ledger.rs +++ b/massa-models/src/ledger.rs @@ -7,7 +7,6 @@ use crate::{ error::ModelsResult as Result, prehash::{PreHashMap, PreHashSet}, }; -use core::usize; use massa_serialization::{ Deserializer, SerializeError, Serializer, U64VarIntDeserializer, U64VarIntSerializer, }; diff --git a/massa-node/src/settings.rs b/massa-node/src/settings.rs index 3ee8de250e2..4d1d443dd39 100644 --- a/massa-node/src/settings.rs +++ b/massa-node/src/settings.rs @@ -91,6 +91,7 @@ pub struct FactorySettings { } /// Pool configuration, read from a file configuration +#[allow(dead_code)] #[derive(Debug, Deserialize, Clone)] pub struct PoolSettings { pub max_operation_pool_size: usize, @@ -194,6 +195,7 @@ pub struct MetricsSettings { } /// Protocol Configuration, read from toml user configuration file +#[allow(dead_code)] #[derive(Debug, Deserialize, Clone)] pub struct ProtocolSettings { /// after `ask_block_timeout` milliseconds we try to ask a block to another node diff --git a/massa-protocol-worker/src/handlers/peer_handler/mod.rs b/massa-protocol-worker/src/handlers/peer_handler/mod.rs index bc531327bbb..7b583e5a3aa 100644 --- a/massa-protocol-worker/src/handlers/peer_handler/mod.rs +++ b/massa-protocol-worker/src/handlers/peer_handler/mod.rs @@ -56,6 +56,7 @@ mod tester; pub(crate) use messages::{PeerManagementMessage, PeerManagementMessageSerializer}; +#[allow(dead_code)] pub struct PeerManagementHandler { pub peer_db: SharedPeerDB, pub thread_join: Option>, diff --git a/massa-protocol-worker/src/handlers/peer_handler/models.rs b/massa-protocol-worker/src/handlers/peer_handler/models.rs index 1bf6209458d..7e3c05f44c8 100644 --- a/massa-protocol-worker/src/handlers/peer_handler/models.rs +++ b/massa-protocol-worker/src/handlers/peer_handler/models.rs @@ -186,6 +186,7 @@ pub enum PeerManagementCmd { Stop, } +#[allow(dead_code)] pub struct PeerManagementChannel { pub msg_sender: MassaSender, pub command_sender: MassaSender, diff --git a/massa-protocol-worker/src/tests/universe.rs b/massa-protocol-worker/src/tests/universe.rs index 96c687434d1..2ae3ce16ffc 100644 --- a/massa-protocol-worker/src/tests/universe.rs +++ b/massa-protocol-worker/src/tests/universe.rs @@ -39,6 +39,7 @@ use num::rational::Ratio; use std::ops::Bound::Included; use tracing::{debug, log::warn}; +#[allow(dead_code)] pub struct ProtocolTestUniverse { pub module_controller: Box, module_manager: Box, diff --git a/massa-protocol-worker/src/wrap_network.rs b/massa-protocol-worker/src/wrap_network.rs index b69d3e8b971..d81f73e05bd 100644 --- a/massa-protocol-worker/src/wrap_network.rs +++ b/massa-protocol-worker/src/wrap_network.rs @@ -118,6 +118,7 @@ impl ActiveConnectionsTrait for SharedActiveConnections { } } +#[allow(dead_code)] #[cfg_attr(test, mockall::automock)] pub trait NetworkController: Send + Sync { fn get_active_connections(&self) -> Box; diff --git a/massa-storage/src/lib.rs b/massa-storage/src/lib.rs index d05490dcb64..62744fb121f 100644 --- a/massa-storage/src/lib.rs +++ b/massa-storage/src/lib.rs @@ -95,6 +95,7 @@ impl Storage { /// Creates a new `Storage` instance. Must be called only one time in the execution: /// - In the main for the node /// - At the top of the test in tests + /// /// All others instances of Storage must be cloned from this one using `clone()` or `clone_without_refs()`. pub fn create_root() -> Storage { Storage { diff --git a/massa-versioning/src/versioning.rs b/massa-versioning/src/versioning.rs index 2c73ef54941..3ad72745524 100644 --- a/massa-versioning/src/versioning.rs +++ b/massa-versioning/src/versioning.rs @@ -1123,7 +1123,7 @@ impl MipStoreRaw { .iter() .rev() .filter(|(mi, ms)| { - mi.components.get(component).is_some() + mi.components.contains_key(component) && matches!(ms.state, ComponentState::Active(_)) }) .find_map(|(mi, ms)| { diff --git a/massa-versioning/src/versioning_factory.rs b/massa-versioning/src/versioning_factory.rs index 8897226d36d..33a71989840 100644 --- a/massa-versioning/src/versioning_factory.rs +++ b/massa-versioning/src/versioning_factory.rs @@ -144,6 +144,7 @@ mod test { } } + #[allow(dead_code)] #[derive(Debug)] enum TestAddress { V0(TestAddressV0), diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7897a24d1a1..1de01fa45c4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.75.0" +channel = "1.81.0"