Skip to content

Commit

Permalink
chore: Bump rust version to 1.79
Browse files Browse the repository at this point in the history
  • Loading branch information
DSharifi committed Jun 17, 2024
1 parent 1a04357 commit da02705
Show file tree
Hide file tree
Showing 53 changed files with 127 additions and 240 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "dfinity/ic-build:6a9881fdfa12f296e929847c076dd50d485ed595e7a83ef552359fdd803b6873",
"image": "dfinity/ic-build:b4086a27b58281b34b3c1a5833567256c11b2140d9504c9e819c40f483d72c6a",
"remoteUser": "ubuntu",
"privileged": true,
"runArgs": [
Expand Down
2 changes: 1 addition & 1 deletion Cargo.Bazel.Fuzzing.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "0a0737c6184a4b510d6d62f6250400fa2ddc792599460c20f75fb2190be7d22b",
"checksum": "392e801f10b34862e7c0dfc76674c3af4f16a69d9e1a199b75d3c3aafe3d1bae",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "1ccb9c843add6b991c9688312438e7d031ee3665c12fb0d1e38b0ac7fa548cd1",
"checksum": "6cfb35a716bef67cd51c6626c3d5b24e4fe86f83c3883d1130dc3f5bdae60e7f",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ rust_register_toolchains(
# The nightly version is required to compile fuzz tests from Bazel.
# The version below is chosen so that it is in sync with the non-nightly version.
versions = [
"1.78.0",
"nightly/2024-03-14",
"1.79.0",
"nightly/2024-04-25",
],
)

Expand Down
2 changes: 1 addition & 1 deletion gitlab-ci/config/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default:
expire_in: 3 days
when: always
image:
name: "registry.gitlab.com/dfinity-lab/core/docker/ic-build:6a9881fdfa12f296e929847c076dd50d485ed595e7a83ef552359fdd803b6873"
name: "registry.gitlab.com/dfinity-lab/core/docker/ic-build:b4086a27b58281b34b3c1a5833567256c11b2140d9504c9e819c40f483d72c6a"
tags:
- dfinity-ic

Expand Down
2 changes: 1 addition & 1 deletion gitlab-ci/config/zz-generated-gitlab-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ default:
expire_in: 3 days
when: always
image:
name: registry.gitlab.com/dfinity-lab/core/docker/ic-build:6a9881fdfa12f296e929847c076dd50d485ed595e7a83ef552359fdd803b6873
name: registry.gitlab.com/dfinity-lab/core/docker/ic-build:b4086a27b58281b34b3c1a5833567256c11b2140d9504c9e819c40f483d72c6a
interruptible: true
retry:
max: 2
Expand Down
2 changes: 1 addition & 1 deletion gitlab-ci/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ENV PYTHONPATH=/ic/gitlab-ci/src:/ic/gitlab-ci/src/dependencies:$PYTHONPATH
RUN cd /tmp/bazel && bazel version

# Add Rust/Cargo support
ARG RUST_VERSION=1.78.0
ARG RUST_VERSION=1.79.0
RUN curl --fail https://sh.rustup.rs -sSf \
| sh -s -- -y --default-toolchain ${RUST_VERSION}-x86_64-unknown-linux-gnu --no-modify-path && \
rustup default ${RUST_VERSION}-x86_64-unknown-linux-gnu && \
Expand Down
2 changes: 1 addition & 1 deletion gitlab-ci/container/TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6a9881fdfa12f296e929847c076dd50d485ed595e7a83ef552359fdd803b6873
b4086a27b58281b34b3c1a5833567256c11b2140d9504c9e819c40f483d72c6a
2 changes: 1 addition & 1 deletion rs/artifact_pool/src/inmemory_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ pub mod test {
|| {
let mut pool = InMemoryPoolSection::new();
let min = Height::from(1);
let max = Height::from(std::u64::MAX);
let max = Height::from(u64::MAX);
pool.insert(make_artifact(fake_random_beacon(min)));
pool.insert(make_artifact(fake_random_beacon(max)));

Expand Down
8 changes: 6 additions & 2 deletions rs/artifact_pool/src/lmdb_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ impl<'a, F> LMDBEcdsaIterator<'a, F> {
let mut cursor: RoCursor<'_> =
unsafe { std::mem::transmute(tx.open_ro_cursor(db).unwrap()) };
let iter: Iter<'_> = match start_pos {
Some(id_key) => unsafe { std::mem::transmute(cursor.iter_from(id_key)) },
None => unsafe { std::mem::transmute(cursor.iter_start()) },
Some(id_key) => unsafe {
std::mem::transmute::<lmdb::Iter<'_>, lmdb::Iter<'_>>(cursor.iter_from(id_key))
},
None => unsafe {
std::mem::transmute::<lmdb::Iter<'_>, lmdb::Iter<'_>>(cursor.iter_start())
},
};
Self {
log,
Expand Down
4 changes: 4 additions & 0 deletions rs/bitcoin/adapter/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct ConnectionConfig {
pub enum ConnectionState {
/// This variant represents that the connection has not yet been connected.
Initializing {
#[allow(dead_code)]
/// This field represents when the connection state was changed to this value.
timestamp: SystemTime,
},
Expand All @@ -50,17 +51,20 @@ pub enum ConnectionState {
},
/// This variant represents that the version handshake has been completed.
HandshakeComplete {
#[allow(dead_code)]
/// This field represents when the connection state was changed to this value.
timestamp: SystemTime,
},
/// This variant represents that the adapter has discarded the connection
/// due to bad behavior.
AdapterDiscarded {
#[allow(dead_code)]
/// This field represents when the connection state was changed to this value.
timestamp: SystemTime,
},
/// This variant represents that the connection has been dropped.
NodeDisconnected {
#[allow(dead_code)]
/// This field represents when the connection state was changed to this value.
timestamp: SystemTime,
},
Expand Down
2 changes: 2 additions & 0 deletions rs/boundary_node/ic_boundary/src/acme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pub struct OrderHandle(instant_acme::Order);

#[derive(Debug)]
pub struct ChallengeResponse {
#[allow(dead_code)]
pub token: String,
#[allow(dead_code)]
pub key_authorization: String,
}

Expand Down
2 changes: 0 additions & 2 deletions rs/boundary_node/ic_boundary/src/check/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub fn generate_custom_registry_snapshot(
tls_certificate: valid_tls_certificate_and_validation_time()
.0
.certificate_der,
replica_version: "7742d96ddd30aa6b607c9d2d4093a7b714f5b25b".to_string(),
};
let node = Arc::new(node);

Expand All @@ -80,7 +79,6 @@ pub fn generate_custom_registry_snapshot(
RegistrySnapshot {
version: 1,
timestamp: 123,
nns_subnet_id: subnet_test_id(0).get().0,
nns_public_key: vec![],
subnets,
nodes: nodes_hash,
Expand Down
1 change: 0 additions & 1 deletion rs/boundary_node/ic_boundary/src/persist/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub fn node(i: u64, subnet_id: Principal) -> Arc<Node> {
tls_certificate: valid_tls_certificate_and_validation_time()
.0
.certificate_der,
replica_version: "7742d96ddd30aa6b607c9d2d4093a7b714f5b25b".to_string(),
})
}

Expand Down
6 changes: 0 additions & 6 deletions rs/boundary_node/ic_boundary/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub struct Node {
pub addr: IpAddr,
pub port: u16,
pub tls_certificate: Vec<u8>,
pub replica_version: String,
}

// Lightweight Eq, just compare principals
Expand Down Expand Up @@ -132,7 +131,6 @@ pub trait Snapshot: Send + Sync {
pub struct RegistrySnapshot {
pub version: u64,
pub timestamp: u64,
pub nns_subnet_id: Principal,
pub nns_public_key: Vec<u8>,
pub subnets: Vec<Subnet>,
pub nodes: HashMap<String, Arc<Node>>,
Expand Down Expand Up @@ -295,7 +293,6 @@ impl Snapshotter {
.context("unable to parse IP address")?,
port: http_endpoint.port as u16, // Port is u16 anyway
tls_certificate: cert.certificate_der,
replica_version: replica_version.to_string(),
};
let node = Arc::new(node);

Expand Down Expand Up @@ -331,7 +328,6 @@ impl Snapshotter {
Ok(RegistrySnapshot {
version: version.get(),
timestamp,
nns_subnet_id: nns_subnet_id.get().0,
nns_public_key: nns_key_with_prefix,
subnets,
nodes: nodes_map,
Expand Down Expand Up @@ -458,7 +454,6 @@ pub fn generate_stub_snapshot(subnets: Vec<Subnet>) -> RegistrySnapshot {
RegistrySnapshot {
version: 0,
timestamp: 0,
nns_subnet_id: subnet_test_id(666).get().0,
nns_public_key: vec![],
subnets,
nodes,
Expand All @@ -479,7 +474,6 @@ pub fn generate_stub_subnet(nodes: Vec<SocketAddr>) -> Subnet {
addr: x.ip(),
port: x.port(),
tls_certificate: vec![],
replica_version: "".into(),
})
})
.collect::<Vec<_>>();
Expand Down
9 changes: 4 additions & 5 deletions rs/boundary_node/prober/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
cmp::{max, min},
collections::HashMap,
fs::{self, File},
net::SocketAddr,
Expand Down Expand Up @@ -327,10 +326,10 @@ where
.with_context(_ctx.clone())
.await;

tokio::time::sleep(max(
Duration::ZERO,
min(self.probe_interval, end_time - Instant::now()),
))
tokio::time::sleep(
self.probe_interval
.clamp(Duration::ZERO, end_time - Instant::now()),
)
.await;

if Instant::now() > end_time {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ fn test_scalar_from_node_index_returns_correct_value() {
let mut i: NodeIndex = 0;
loop {
assert_eq!(Scalar::from_node_index(i), x);
if i == NodeIndex::max_value() {
if i == NodeIndex::MAX {
break;
}
i = i * 2 + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn number_of_receivers(
message: format!(
"Unsupported number of receivers:\n Num receivers: {}\n Max: {}",
receiver_keys.len(),
NodeIndex::max_value()
NodeIndex::MAX
),
})?;
Ok(NumberOfNodes::from(size))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use ic_crypto_test_utils_reproducible_rng::reproducible_rng;
use rand::Rng;
use std::convert::{TryFrom, TryInto};

#[allow(dead_code)]
mod test_utils;

use crate::test_utils::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// TODO: This #![allow(dead_code)] is needed because each file in the tests directory is
// also compiled as its own separate crate.
// The easiest way to solve this is to move tests/test_utils.rs to tests/test_utils/mod.rs,
// because files in subdirectories of the tests directory don’t get compiled as separate crates.
#![allow(dead_code)]

use assert_matches::assert_matches;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,7 @@ impl ProtoSecretKeyStore {
}
}
};
match proto_file {
Some(sks_proto) => sks_proto,
None => SecretKeys::new(),
}
proto_file.unwrap_or_default()
}

fn migrate_to_current_version(sks_proto: pb::SecretKeyStore) -> SecretKeys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ impl MockNetwork {
pub struct MockDkgConfig {
pub algorithm_id: AlgorithmId,
pub dkg_id: NiDkgId,
pub max_corrupt_dealers: NumberOfNodes,
pub dealers: NiDkgDealers,
pub max_corrupt_receivers: NumberOfNodes,
pub receivers: NiDkgReceivers,
pub receiver_keys: BTreeMap<NodeIndex, CspFsEncryptionPublicKey>,
pub threshold: NiDkgThreshold,
Expand Down Expand Up @@ -215,9 +213,6 @@ impl MockDkgConfig {
let dkg_id = random_ni_dkg_id(rng);
let max_corrupt_dealers = rng.gen_range(0..num_dealers); // Need at least one honest dealer.
let threshold = rng.gen_range(min_threshold..=num_receivers); // threshold <= num_receivers
let max_corrupt_receivers =
rng.gen_range(0..std::cmp::min(num_receivers + 1 - threshold, threshold)); // (max_corrupt_receivers <= num_receivers - threshold) &&
// (max_corrupt_receivers < threshold)
let epoch = Epoch::from(rng.gen::<u32>());

let receiver_keys: BTreeMap<NodeIndex, CspFsEncryptionPublicKey> = receivers
Expand All @@ -229,9 +224,7 @@ impl MockDkgConfig {
MockDkgConfig {
algorithm_id,
dkg_id,
max_corrupt_dealers: NumberOfNodes::from(max_corrupt_dealers as NodeIndex),
dealers,
max_corrupt_receivers: NumberOfNodes::from(max_corrupt_receivers as NodeIndex),
receivers,
receiver_keys,
threshold: NiDkgThreshold::new(NumberOfNodes::from(threshold as NodeIndex))
Expand Down
4 changes: 2 additions & 2 deletions rs/cycles_account_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,8 +1200,8 @@ mod tests {

// Check overflow case.
assert_eq!(
cam.scale_cost(Cycles::new(std::u128::MAX), 1_000_000),
Cycles::new(std::u128::MAX) / reference_subnet_size
cam.scale_cost(Cycles::new(u128::MAX), 1_000_000),
Cycles::new(u128::MAX) / reference_subnet_size
);
}

Expand Down
4 changes: 2 additions & 2 deletions rs/cycles_account_manager/tests/cycles_account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ fn charging_removes_canisters_with_insufficient_balance() {
let mut canister = new_canister_state(
canister_test_id(1),
canister_test_id(11).get(),
Cycles::from(std::u128::MAX),
Cycles::from(u128::MAX),
NumSeconds::from(0),
);
canister.scheduler_state.compute_allocation = ComputeAllocation::try_from(50).unwrap();
Expand Down Expand Up @@ -538,7 +538,7 @@ fn cycles_withdraw_for_execution() {
let message_memory_usage = NumBytes::from(8 * 1024 * 1024);
let compute_allocation = ComputeAllocation::try_from(90).unwrap();

let initial_amount = std::u128::MAX;
let initial_amount = u128::MAX;
let initial_cycles = Cycles::from(initial_amount);
let freeze_threshold = NumSeconds::from(10);
let canister_id = canister_test_id(1);
Expand Down
7 changes: 3 additions & 4 deletions rs/drun/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(crate) enum Message {
#[derive(Debug)]
pub enum LineIteratorError {
IoError(io::Error),
BufferLengthExceeded(Vec<u8>),
BufferLengthExceeded,
FromUtf8Error(FromUtf8Error),
}

Expand All @@ -40,7 +40,7 @@ impl fmt::Display for LineIteratorError {

match self {
IoError(e) => write!(f, "IO error: {}", e),
BufferLengthExceeded(_) => write!(f, "Line length exceeds buffer length"),
BufferLengthExceeded => write!(f, "Line length exceeds buffer length"),
FromUtf8Error(e) => write!(f, "UTF-8 conversion error: {}", e),
}
}
Expand Down Expand Up @@ -114,9 +114,8 @@ impl<R: Read> Iterator for LineIterator<R> {
Ok(_) => match self.split_line() {
Some(line) => return Some(line),
None if self.buffer.len() == LINE_ITERATOR_BUFFER_SIZE => {
let bytes = self.buffer.clone();
self.buffer.clear();
return Some(Err(LineIteratorError::BufferLengthExceeded(bytes)));
return Some(Err(LineIteratorError::BufferLengthExceeded));
}
None => continue,
},
Expand Down
5 changes: 5 additions & 0 deletions rs/embedders/fuzz/fuzz_targets/ic_wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ use wasmparser::*;
#[derive(Debug)]
pub struct ICWasmModule {
pub module: Module,
// TODO: Create a config for fuzzing
// for clippy to not complain.
#[allow(dead_code)]
pub config: Config,
#[allow(dead_code)]
pub exoported_globals: Vec<Global>,
#[allow(dead_code)]
pub exported_functions: BTreeSet<WasmMethod>,
}

Expand Down
2 changes: 1 addition & 1 deletion rs/execution_environment/benches/lib/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ where
MAX_NUM_INSTRUCTIONS,
MAX_NUM_INSTRUCTIONS,
),
canister_memory_limit: canister_state.memory_limit(NumBytes::new(std::u64::MAX)),
canister_memory_limit: canister_state.memory_limit(NumBytes::new(u64::MAX)),
wasm_memory_limit: None,
memory_allocation: canister_state.memory_allocation(),
compute_allocation: canister_state.compute_allocation(),
Expand Down
Loading

0 comments on commit da02705

Please sign in to comment.