From 629ea895437bc356ddb784a6a00c720eb109e031 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 10 Dec 2024 15:09:27 +0200 Subject: [PATCH] Update Rust to `nightly-2024-12-22` --- crates/sc-subspace-block-relay/src/consensus/relay.rs | 2 +- crates/sp-domains-fraud-proof/src/lib.rs | 5 +++++ crates/subspace-archiving/src/archiver.rs | 4 ++-- crates/subspace-core-primitives/src/pieces.rs | 4 ++-- crates/subspace-core-primitives/src/sectors.rs | 2 +- crates/subspace-core-primitives/src/segments.rs | 2 +- crates/subspace-farmer/src/cluster/controller/caches.rs | 2 +- crates/subspace-proof-of-space/src/chiapos/table/types.rs | 4 ++-- crates/subspace-runtime/src/lib.rs | 5 +++++ crates/subspace-verification/src/lib.rs | 5 +++++ docker/bootstrap-node.Dockerfile | 2 +- docker/farmer.Dockerfile | 2 +- docker/gateway.Dockerfile | 2 +- docker/node.Dockerfile | 2 +- docker/runtime.Dockerfile | 2 +- domains/client/domain-operator/src/fraud_proof.rs | 2 +- domains/pallets/auto-id/src/lib.rs | 6 +++--- rust-toolchain.toml | 2 +- test/subspace-test-runtime/src/lib.rs | 5 +++++ 19 files changed, 40 insertions(+), 20 deletions(-) diff --git a/crates/sc-subspace-block-relay/src/consensus/relay.rs b/crates/sc-subspace-block-relay/src/consensus/relay.rs index 704c7a9a5a..9a8cc94a32 100644 --- a/crates/sc-subspace-block-relay/src/consensus/relay.rs +++ b/crates/sc-subspace-block-relay/src/consensus/relay.rs @@ -246,7 +246,7 @@ where who: PeerId, request: BlockRequest, ) -> Result, ProtocolName), RequestFailure>, oneshot::Canceled> { - let full_download = request.max.map_or(false, |max_blocks| max_blocks > 1); + let full_download = request.max.is_some_and(|max_blocks| max_blocks > 1); let ret = if full_download { self.full_download(who, request.clone()).await } else { diff --git a/crates/sp-domains-fraud-proof/src/lib.rs b/crates/sp-domains-fraud-proof/src/lib.rs index 7139e1252f..e62b88e220 100644 --- a/crates/sp-domains-fraud-proof/src/lib.rs +++ b/crates/sp-domains-fraud-proof/src/lib.rs @@ -16,6 +16,11 @@ //! Subspace fraud proof primitives for consensus chain. #![cfg_attr(not(feature = "std"), no_std)] +// `generic_const_exprs` is an incomplete feature +#![allow(incomplete_features)] +// TODO: This feature is not actually used in this crate, but is added as a workaround for +// https://github.com/rust-lang/rust/issues/133199 +#![feature(generic_const_exprs)] #![feature(associated_type_defaults)] #[cfg(feature = "std")] diff --git a/crates/subspace-archiving/src/archiver.rs b/crates/subspace-archiving/src/archiver.rs index 833975ce96..923ea8cf0b 100644 --- a/crates/subspace-archiving/src/archiver.rs +++ b/crates/subspace-archiving/src/archiver.rs @@ -527,7 +527,7 @@ impl Archiver { let continuation_object_mapping = BlockObjectMapping::V0 { objects: object_mapping .objects_mut() - .extract_if(|block_object: &mut BlockObject| { + .extract_if(.., |block_object: &mut BlockObject| { if block_object.offset >= split_point as u32 { block_object.offset -= split_point as u32; true @@ -570,7 +570,7 @@ impl Archiver { let continuation_object_mapping = BlockObjectMapping::V0 { objects: object_mapping .objects_mut() - .extract_if(|block_object: &mut BlockObject| { + .extract_if(.., |block_object: &mut BlockObject| { if block_object.offset >= split_point as u32 { block_object.offset -= split_point as u32; true diff --git a/crates/subspace-core-primitives/src/pieces.rs b/crates/subspace-core-primitives/src/pieces.rs index 556ff0b0e0..e8240e8695 100644 --- a/crates/subspace-core-primitives/src/pieces.rs +++ b/crates/subspace-core-primitives/src/pieces.rs @@ -63,7 +63,7 @@ pub struct PieceIndex(u64); impl Step for PieceIndex { #[inline] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u64::steps_between(&start.0, &end.0) } @@ -206,7 +206,7 @@ pub struct PieceOffset(u16); impl Step for PieceOffset { #[inline] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u16::steps_between(&start.0, &end.0) } diff --git a/crates/subspace-core-primitives/src/sectors.rs b/crates/subspace-core-primitives/src/sectors.rs index 79dd99b246..c62643c37f 100644 --- a/crates/subspace-core-primitives/src/sectors.rs +++ b/crates/subspace-core-primitives/src/sectors.rs @@ -198,7 +198,7 @@ pub struct SBucket(u16); impl Step for SBucket { #[inline] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u16::steps_between(&start.0, &end.0) } diff --git a/crates/subspace-core-primitives/src/segments.rs b/crates/subspace-core-primitives/src/segments.rs index bb4957695c..5fa26cf3b7 100644 --- a/crates/subspace-core-primitives/src/segments.rs +++ b/crates/subspace-core-primitives/src/segments.rs @@ -58,7 +58,7 @@ pub struct SegmentIndex(u64); impl Step for SegmentIndex { #[inline] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u64::steps_between(&start.0, &end.0) } diff --git a/crates/subspace-farmer/src/cluster/controller/caches.rs b/crates/subspace-farmer/src/cluster/controller/caches.rs index 17a8526ba2..5eecf861b2 100644 --- a/crates/subspace-farmer/src/cluster/controller/caches.rs +++ b/crates/subspace-farmer/src/cluster/controller/caches.rs @@ -84,7 +84,7 @@ impl KnownCaches { } fn remove_expired(&mut self) -> impl Iterator + '_ { - self.known_caches.extract_if(|known_cache| { + self.known_caches.extract_if(.., |known_cache| { known_cache.last_identification.elapsed() > self.identification_broadcast_interval * 2 }) } diff --git a/crates/subspace-proof-of-space/src/chiapos/table/types.rs b/crates/subspace-proof-of-space/src/chiapos/table/types.rs index 2c567d6e6d..a4e0cd7c23 100644 --- a/crates/subspace-proof-of-space/src/chiapos/table/types.rs +++ b/crates/subspace-proof-of-space/src/chiapos/table/types.rs @@ -13,7 +13,7 @@ pub(in super::super) struct X(u32); impl Step for X { #[inline(always)] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u32::steps_between(&start.0, &end.0) } @@ -89,7 +89,7 @@ pub(in super::super) struct Position(u32); impl Step for Position { #[inline(always)] - fn steps_between(start: &Self, end: &Self) -> Option { + fn steps_between(start: &Self, end: &Self) -> (usize, Option) { u32::steps_between(&start.0, &end.0) } diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index ce1bf5389d..f1e8b479f6 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -16,6 +16,11 @@ #![cfg_attr(not(feature = "std"), no_std)] #![feature(const_trait_impl, variant_count)] +// `generic_const_exprs` is an incomplete feature +#![allow(incomplete_features)] +// TODO: This feature is not actually used in this crate, but is added as a workaround for +// https://github.com/rust-lang/rust/issues/133199 +#![feature(generic_const_exprs)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] // TODO: remove when upstream issue is fixed diff --git a/crates/subspace-verification/src/lib.rs b/crates/subspace-verification/src/lib.rs index 9a534d3905..e762747804 100644 --- a/crates/subspace-verification/src/lib.rs +++ b/crates/subspace-verification/src/lib.rs @@ -18,6 +18,11 @@ #![forbid(unsafe_code)] #![warn(rust_2018_idioms, missing_debug_implementations, missing_docs)] #![feature(array_chunks, portable_simd)] +// `generic_const_exprs` is an incomplete feature +#![allow(incomplete_features)] +// TODO: This feature is not actually used in this crate, but is added as a workaround for +// https://github.com/rust-lang/rust/issues/133199 +#![feature(generic_const_exprs)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(not(feature = "std"))] diff --git a/docker/bootstrap-node.Dockerfile b/docker/bootstrap-node.Dockerfile index 331a8f9420..d097279df8 100644 --- a/docker/bootstrap-node.Dockerfile +++ b/docker/bootstrap-node.Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64 FROM --platform=$BUILDPLATFORM ubuntu:22.04 -ARG RUSTC_VERSION=nightly-2024-10-22 +ARG RUSTC_VERSION=nightly-2024-12-24 ARG PROFILE=production ARG RUSTFLAGS # Incremental compilation here isn't helpful diff --git a/docker/farmer.Dockerfile b/docker/farmer.Dockerfile index 0c88b2e6b8..c26ec6e01f 100644 --- a/docker/farmer.Dockerfile +++ b/docker/farmer.Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64 FROM --platform=$BUILDPLATFORM ubuntu:22.04 -ARG RUSTC_VERSION=nightly-2024-10-22 +ARG RUSTC_VERSION=nightly-2024-12-24 ARG PROFILE=production ARG RUSTFLAGS # Incremental compilation here isn't helpful diff --git a/docker/gateway.Dockerfile b/docker/gateway.Dockerfile index f9a24df5fe..0c93266685 100644 --- a/docker/gateway.Dockerfile +++ b/docker/gateway.Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64 FROM --platform=$BUILDPLATFORM ubuntu:22.04 -ARG RUSTC_VERSION=nightly-2024-10-22 +ARG RUSTC_VERSION=nightly-2024-12-24 ARG PROFILE=production ARG RUSTFLAGS # Incremental compilation here isn't helpful diff --git a/docker/node.Dockerfile b/docker/node.Dockerfile index 395ebf0989..5bd50df90d 100644 --- a/docker/node.Dockerfile +++ b/docker/node.Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64 FROM --platform=$BUILDPLATFORM ubuntu:22.04 -ARG RUSTC_VERSION=nightly-2024-10-22 +ARG RUSTC_VERSION=nightly-2024-12-24 ARG PROFILE=production ARG RUSTFLAGS # Incremental compilation here isn't helpful diff --git a/docker/runtime.Dockerfile b/docker/runtime.Dockerfile index 7c56113a29..2756b04d65 100644 --- a/docker/runtime.Dockerfile +++ b/docker/runtime.Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile supports both native building and cross-compilation to x86-64, aarch64 and riscv64 FROM --platform=$BUILDPLATFORM ubuntu:22.04 -ARG RUSTC_VERSION=nightly-2024-10-22 +ARG RUSTC_VERSION=nightly-2024-12-24 ARG PROFILE=production ARG RUSTFLAGS # Incremental compilation here isn't helpful diff --git a/domains/client/domain-operator/src/fraud_proof.rs b/domains/client/domain-operator/src/fraud_proof.rs index 3f82ba8eb7..3d7d395e84 100644 --- a/domains/client/domain-operator/src/fraud_proof.rs +++ b/domains/client/domain-operator/src/fraud_proof.rs @@ -560,7 +560,7 @@ where let proof_data = if invalid_type .extrinsic_index() - .map_or(false, |idx| bundle.extrinsics.len() as u32 <= idx) + .is_some_and(|idx| bundle.extrinsics.len() as u32 <= idx) { // The bad receipt claims a non-exist extrinsic is invalid, in this case, generate a // `bundle_with_proof` as proof data is enough diff --git a/domains/pallets/auto-id/src/lib.rs b/domains/pallets/auto-id/src/lib.rs index 918c0b29d7..c1604f5a53 100644 --- a/domains/pallets/auto-id/src/lib.rs +++ b/domains/pallets/auto-id/src/lib.rs @@ -439,7 +439,7 @@ impl Pallet { ); ensure!( - !CertificateRevocationList::::get(issuer_id).map_or(false, |serials| { + !CertificateRevocationList::::get(issuer_id).is_some_and(|serials| { serials.iter().any(|s| { *s == issuer_auto_id.certificate.serial() || *s == tbs_certificate.serial @@ -517,7 +517,7 @@ impl Pallet { Error::::ExpiredCertificate ); ensure!( - !CertificateRevocationList::::get(issuer_id).map_or(false, |serials| { + !CertificateRevocationList::::get(issuer_id).is_some_and(|serials| { serials.iter().any(|s| { *s == issuer_auto_id.certificate.serial() || *s == tbs_certificate.serial @@ -627,7 +627,7 @@ impl Pallet { }; ensure!( - !CertificateRevocationList::::get(issuer_id).map_or(false, |serials| { + !CertificateRevocationList::::get(issuer_id).is_some_and(|serials| { serials.iter().any(|s| { *s == auto_id.certificate.serial() || *s == issuer_auto_id.certificate.serial() }) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 384bbb0612..16dc1786e6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2024-10-22" +channel = "nightly-2024-12-24" components = ["rust-src"] targets = ["wasm32-unknown-unknown"] profile = "default" diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index 5da265a213..bc9a81ae31 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -16,6 +16,11 @@ #![cfg_attr(not(feature = "std"), no_std)] #![feature(variant_count)] +// `generic_const_exprs` is an incomplete feature +#![allow(incomplete_features)] +// TODO: This feature is not actually used in this crate, but is added as a workaround for +// https://github.com/rust-lang/rust/issues/133199 +#![feature(generic_const_exprs)] // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] // TODO: remove when upstream issue is fixed