Skip to content

Commit

Permalink
Merge pull request #2086 from subspace/rust-upgrade
Browse files Browse the repository at this point in the history
Upgrade Rust to nightly-2023-10-11, fix new lints
  • Loading branch information
nazar-pc authored Oct 11, 2023
2 parents f567ca7 + d0cb9ab commit 4ec9e5f
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion 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 Dockerfile-bootstrap-node
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-bootstrap-node.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-farmer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-farmer.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-node
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-node.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-runtime
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2023-07-21
ARG RUSTC_VERSION=nightly-2023-10-11
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-feeds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl<T: Config> Call<T> {
let mut co = object_mapping.try_into_call_object(
feed_id,
object.as_slice(),
|data| crypto::blake3_hash(data),
crypto::blake3_hash,
)?;
co.offset += base_offset;
Some(co)
Expand Down
2 changes: 1 addition & 1 deletion crates/sc-consensus-subspace/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<AS> SegmentHeadersStore<AS>
where
AS: AuxStore,
{
const KEY_PREFIX: &[u8] = b"segment-headers";
const KEY_PREFIX: &'static [u8] = b"segment-headers";
const INITIAL_CACHE_CAPACITY: usize = 1_000;

/// Create new instance
Expand Down
5 changes: 1 addition & 4 deletions crates/sp-domains/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,7 @@ pub fn shuffle_extrinsics<Extrinsic: Debug, AccountId: Ord + Clone>(
let mut grouped_extrinsics: BTreeMap<Option<AccountId>, VecDeque<_>> = extrinsics
.into_iter()
.fold(BTreeMap::new(), |mut groups, (maybe_signer, tx)| {
groups
.entry(maybe_signer)
.or_insert_with(VecDeque::new)
.push_back(tx);
groups.entry(maybe_signer).or_default().push_back(tx);
groups
});

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer-components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include = [
bench = false

[dependencies]
async-lock = "2.8.0"
async-trait = "0.1.73"
backoff = { version = "0.4.0", features = ["futures", "tokio"] }
bitvec = "1.0.1"
Expand All @@ -25,7 +26,6 @@ hex = "0.4.3"
libc = "0.2.146"
lru = "0.11.0"
parity-scale-codec = "3.6.5"
parking_lot = "0.12.1"
rand = "0.8.5"
rayon = "1.7.0"
schnorrkel = "0.9.1"
Expand Down
6 changes: 3 additions & 3 deletions crates/subspace-farmer-components/src/plotting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use crate::sector::{
};
use crate::segment_reconstruction::recover_missing_piece;
use crate::FarmerProtocolInfo;
use async_lock::Mutex;
use async_trait::async_trait;
use backoff::future::retry;
use backoff::{Error as BackoffError, ExponentialBackoff};
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use parity_scale_codec::Encode;
use parking_lot::Mutex;
use std::error::Error;
use std::mem;
use std::simd::Simd;
Expand Down Expand Up @@ -227,8 +227,8 @@ where
Mutex::new(piece_indexes.iter().copied().map(Some).collect::<Vec<_>>());

retry(default_backoff(), || async {
let mut raw_sector = raw_sector.lock();
let mut incremental_piece_indices = incremental_piece_indices.lock();
let mut raw_sector = raw_sector.lock().await;
let mut incremental_piece_indices = incremental_piece_indices.lock().await;

if let Err(error) = download_sector(
&mut raw_sector,
Expand Down
1 change: 0 additions & 1 deletion crates/subspace-farmer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const_option,
hash_extract_if,
impl_trait_in_assoc_type,
io_error_other,
int_roundings,
iter_collect_into,
let_chains,
Expand Down
17 changes: 7 additions & 10 deletions crates/subspace-networking/src/protocols/reserved_peers/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,14 @@ async fn test_reserved_peers_dial_event() {

peer1.listen().await;

loop {
select! {
event = peer1.next_swarm_event().fuse() => {
if let SwarmEvent::Dialing{peer_id, ..} = event{
assert_eq!(peer_id, Some(peer2_id));
}
break;
},
_ = sleep(long_delay).fuse() => {
panic!("No reserved peers dialing.");
select! {
event = peer1.next_swarm_event().fuse() => {
if let SwarmEvent::Dialing{peer_id, ..} = event{
assert_eq!(peer_id, Some(peer2_id));
}
},
_ = sleep(long_delay).fuse() => {
panic!("No reserved peers dialing.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-service/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
.block_body(incoming_block.hash)
.ok()
.flatten()
.unwrap_or(vec![]);
.unwrap_or_default();
self.blocks.inc();
self.extrinsics.inc_by(extrinsics.len() as u64);
let total_size: usize = extrinsics
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-07-21"
channel = "nightly-2023-10-11"
components = ["rust-src"]
targets = ["wasm32-unknown-unknown"]
profile = "default"

0 comments on commit 4ec9e5f

Please sign in to comment.