Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rust to 1.81 #4749

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.74.1
toolchain: 1.81.0
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v2
Expand Down
14 changes: 7 additions & 7 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.74.1
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.74.1
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.74.1
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.74.1
toolchain: 1.81.0
override: true
- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -205,7 +205,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: install
args: cargo-nextest --locked
args: cargo-nextest
- uses: actions-rs/cargo@v1
with:
command: nextest
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.74.1
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.74.1
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.

2 changes: 1 addition & 1 deletion massa-api/src/tests/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ async fn get_datastore_entries() {
.await
.unwrap();

let entry = response.get(0).unwrap();
let entry = response.first().unwrap();

assert_eq!(
entry.candidate_value.as_ref().unwrap(),
Expand Down
1 change: 0 additions & 1 deletion massa-async-pool/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ mod bootstrap;
mod config;

pub use bootstrap::*;
pub use config::*;
4 changes: 2 additions & 2 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 @@ -66,6 +64,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 +111,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
4 changes: 4 additions & 0 deletions massa-bootstrap/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ 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
10 changes: 5 additions & 5 deletions massa-client/src/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ impl Command {
if let Ok(addresses_info) =
client.public.get_addresses(vec![addr]).await
{
match addresses_info.get(0) {
match addresses_info.first() {
Some(info) => {
if info.candidate_balance < total {
client_warning!("this operation may be rejected due to insufficient balance");
Expand Down Expand Up @@ -911,7 +911,7 @@ impl Command {

if !json {
if let Ok(addresses_info) = client.public.get_addresses(vec![addr]).await {
match addresses_info.get(0) {
match addresses_info.first() {
Some(info) => {
if info.candidate_balance < fee
|| roll_count > info.candidate_roll_count
Expand Down Expand Up @@ -948,7 +948,7 @@ impl Command {

if !json {
if let Ok(addresses_info) = client.public.get_addresses(vec![addr]).await {
match addresses_info.get(0) {
match addresses_info.first() {
Some(info) => {
if info.candidate_balance < fee {
client_warning!("this operation may be rejected due to insufficient balance");
Expand Down Expand Up @@ -994,7 +994,7 @@ impl Command {
let fee = parameters[4].parse::<Amount>()?;
if !json {
if let Ok(addresses_info) = client.public.get_addresses(vec![addr]).await {
match addresses_info.get(0) {
match addresses_info.first() {
Some(info) => {
if info.candidate_balance < fee.saturating_add(max_coins) {
client_warning!("this operation may be rejected due to insufficient balance");
Expand Down Expand Up @@ -1052,7 +1052,7 @@ impl Command {
if let Ok(addresses_info) =
client.public.get_addresses(vec![target_addr]).await
{
match addresses_info.get(0) {
match addresses_info.first() {
Some(info) => {
if info.candidate_balance < total {
client_warning!("this operation may be rejected due to insufficient balance");
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
2 changes: 0 additions & 2 deletions massa-consensus-exports/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Copyright (c) 2022 MASSA LABS <[email protected]>

mod config;

pub use config::*;
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
1 change: 1 addition & 0 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
1 change: 0 additions & 1 deletion massa-execution-exports/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
//! with an execution worker within tests.

mod config;
pub use config::*;
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
4 changes: 2 additions & 2 deletions massa-execution-worker/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl ExecutionController for ExecutionControllerImpl {
ExecutionQueryRequestItem::OpExecutionStatusCandidate(id) => {
let (speculative_v, _final_v) = execution_lock
.get_ops_exec_status(&[id])
.get(0)
.first()
.map(|(s_v, f_v)| (*s_v, *f_v))
.expect("expected one return value");
match speculative_v {
Expand All @@ -254,7 +254,7 @@ impl ExecutionController for ExecutionControllerImpl {
ExecutionQueryRequestItem::OpExecutionStatusFinal(id) => {
let (_speculative_v, final_v) = execution_lock
.get_ops_exec_status(&[id])
.get(0)
.first()
.map(|(s_v, f_v)| (*s_v, *f_v))
.expect("expected one return value");
match final_v {
Expand Down
6 changes: 3 additions & 3 deletions massa-execution-worker/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ impl ExecutionState {
let call_stack_addr = context.get_call_stack();

// transfer fee
if let (Some(fee), Some(addr)) = (req.fee, call_stack_addr.get(0)) {
if let (Some(fee), Some(addr)) = (req.fee, call_stack_addr.first()) {
context.transfer_coins(Some(*addr), None, fee, false)?;
}
}
Expand Down Expand Up @@ -1823,13 +1823,13 @@ impl ExecutionState {
let call_stack_addr = context.get_call_stack();

// transfer fee
if let (Some(fee), Some(addr)) = (req.fee, call_stack_addr.get(0)) {
if let (Some(fee), Some(addr)) = (req.fee, call_stack_addr.first()) {
context.transfer_coins(Some(*addr), None, fee, false)?;
}

// transfer coins
if let (Some(coins), Some(from), Some(to)) =
(req.coins, call_stack_addr.get(0), call_stack_addr.get(1))
(req.coins, call_stack_addr.first(), call_stack_addr.get(1))
{
context.transfer_coins(Some(*from), Some(*to), coins, false)?;
}
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
1 change: 0 additions & 1 deletion massa-factory-exports/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
mod config;
mod tools;

pub use config::*;
pub use tools::*;
1 change: 0 additions & 1 deletion massa-final-state/src/test_exports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
mod config;
mod mock;

pub use config::*;
pub use mock::*;
Loading
Loading