Skip to content

Commit

Permalink
Update rust version to 1.81 (#4750)
Browse files Browse the repository at this point in the history
* Update rust version to 1.81

* Cargo clippy & fmt pass

* Cargo clippy & fmt pass 2

* Cargo clippy & fmt pass 3

* Remove commented code
  • Loading branch information
sydhds authored Sep 30, 2024
1 parent da539b1 commit 149a6e1
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions massa-bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -112,3 +110,4 @@ trait BindingReadExact: io::Read {
/// Internal helper
fn set_read_timeout(&mut self, deadline: Option<Duration>) -> Result<(), std::io::Error>;
}
*/
1 change: 1 addition & 0 deletions massa-bootstrap/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub enum BootstrapServerMessage {
},
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for BootstrapServerMessage {
fn to_string(&self) -> String {
match self {
Expand Down
6 changes: 1 addition & 5 deletions massa-bootstrap/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PollEvent, BootstrapError>;
}

/// Abstraction layer over data produced by the listener, and transported
/// over to the worker via a channel
Expand Down
4 changes: 2 additions & 2 deletions massa-bootstrap/src/tests/binders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion massa-bootstrap/src/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions massa-bootstrap/src/tests/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion massa-bootstrap/src/tests/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions massa-client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions massa-consensus-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions massa-consensus-worker/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod stats;
mod tick;
mod verifications;

#[allow(dead_code)]
#[derive(Clone)]
pub struct ConsensusState {
/// Configuration
Expand Down Expand Up @@ -70,7 +71,7 @@ pub struct ConsensusState {
pub new_final_blocks: PreHashSet<BlockId>,
/// Newly stale block mapped to creator and slot
pub new_stale_blocks: PreHashMap<BlockId, (Address, Slot)>,
/// 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)>,
Expand All @@ -80,7 +81,7 @@ pub struct ConsensusState {
pub stale_block_stats: VecDeque<MassaTime>,
/// 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<BlockId, Option<SecuredHeader>>,
Expand Down
1 change: 1 addition & 0 deletions massa-execution-worker/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions massa-execution-worker/src/tests/universe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl ExecutionForeignControllers {
}
}

#[allow(dead_code)]
pub struct ExecutionTestUniverse {
pub module_controller: Box<dyn ExecutionController>,
pub storage: Storage,
Expand Down
2 changes: 0 additions & 2 deletions massa-models/src/clique.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) 2022 MASSA LABS <info@massa.net>

use core::usize;

use massa_serialization::{
Deserializer, SerializeError, Serializer, U32VarIntDeserializer, U32VarIntSerializer,
U64VarIntDeserializer, U64VarIntSerializer,
Expand Down
1 change: 0 additions & 1 deletion massa-models/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
error::ModelsResult as Result,
prehash::{PreHashMap, PreHashSet},
};
use core::usize;
use massa_serialization::{
Deserializer, SerializeError, Serializer, U64VarIntDeserializer, U64VarIntSerializer,
};
Expand Down
2 changes: 2 additions & 0 deletions massa-node/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions massa-protocol-worker/src/handlers/peer_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<JoinHandle<()>>,
Expand Down
1 change: 1 addition & 0 deletions massa-protocol-worker/src/handlers/peer_handler/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ pub enum PeerManagementCmd {
Stop,
}

#[allow(dead_code)]
pub struct PeerManagementChannel {
pub msg_sender: MassaSender<PeerMessageTuple>,
pub command_sender: MassaSender<PeerManagementCmd>,
Expand Down
1 change: 1 addition & 0 deletions massa-protocol-worker/src/tests/universe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn ProtocolController>,
module_manager: Box<dyn ProtocolManager>,
Expand Down
1 change: 1 addition & 0 deletions massa-protocol-worker/src/wrap_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl ActiveConnectionsTrait for SharedActiveConnections<PeerId> {
}
}

#[allow(dead_code)]
#[cfg_attr(test, mockall::automock)]
pub trait NetworkController: Send + Sync {
fn get_active_connections(&self) -> Box<dyn ActiveConnectionsTrait>;
Expand Down
1 change: 1 addition & 0 deletions massa-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion massa-versioning/src/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)| {
Expand Down
1 change: 1 addition & 0 deletions massa-versioning/src/versioning_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ mod test {
}
}

#[allow(dead_code)]
#[derive(Debug)]
enum TestAddress {
V0(TestAddressV0),
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.75.0"
channel = "1.81.0"

0 comments on commit 149a6e1

Please sign in to comment.