Skip to content

Commit

Permalink
Merge pull request #3068 from autonomys/update-rust
Browse files Browse the repository at this point in the history
Update Rust toolchain
  • Loading branch information
nazar-pc authored Sep 26, 2024
2 parents b341816 + af1acfc commit d71ca47
Show file tree
Hide file tree
Showing 59 changed files with 281 additions and 116 deletions.
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
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-2024-08-01
ARG RUSTC_VERSION=nightly-2024-09-26
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
9 changes: 5 additions & 4 deletions crates/pallet-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ pub(crate) type StateRootOf<T> = <<T as frame_system::Config>::Hashing as Hash>:

#[frame_support::pallet]
mod pallet {
#![allow(clippy::large_enum_variant)]

#[cfg(not(feature = "runtime-benchmarks"))]
use crate::block_tree::AcceptedReceiptType;
use crate::block_tree::{
Expand Down Expand Up @@ -624,8 +622,9 @@ mod pallet {
pub(super) type NewAddedHeadReceipt<T: Config> =
StorageMap<_, Identity, DomainId, T::DomainHash, OptionQuery>;

/// The consensus block hash used to verify ER,
/// only store the consensus block hash for a domain
/// Map of consensus block hashes.
///
/// The consensus block hash used to verify ER, only store the consensus block hash for a domain
/// if that consensus block contains bundle of the domain, the hash will be pruned when the ER
/// that point to the consensus block is pruned.
///
Expand Down Expand Up @@ -724,13 +723,15 @@ mod pallet {
pub type DomainRuntimeUpgrades<T> = StorageValue<_, Vec<RuntimeId>, ValueQuery>;

/// Temporary storage to hold the sudo calls meant for the Domains.
///
/// Storage is cleared when there are any successful bundles in the next block.
/// Only one sudo call is allowed per domain per consensus block.
#[pallet::storage]
pub type DomainSudoCalls<T: Config> =
StorageMap<_, Identity, DomainId, DomainSudoCall, ValueQuery>;

/// Storage that hold a list of all frozen domains.
///
/// A frozen domain does not accept the bundles but does accept a fraud proof.
#[pallet::storage]
pub type FrozenDomains<T> = StorageValue<_, BTreeSet<DomainId>, ValueQuery>;
Expand Down
2 changes: 0 additions & 2 deletions crates/pallet-rewards/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(missing_debug_implementations)]

use frame_support::derive_impl;
use frame_support::traits::{ConstU128, ConstU32};
use sp_runtime::traits::parameter_types;
Expand Down
16 changes: 9 additions & 7 deletions crates/pallet-subspace/src/equivocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ use subspace_core_primitives::PublicKey;

use crate::{Call, Config, Pallet};

/// A trait with utility methods for handling equivocation reports in Subspace. The trait provides
/// methods for reporting an offence triggered by a valid equivocation report, checking the current
/// block author (to declare as the reporter), and also for creating and submitting equivocation
/// report extrinsics (useful only in offchain context).
/// A trait with utility methods for handling equivocation reports in Subspace.
///
/// The trait provides methods for reporting an offence triggered by a valid equivocation report,
/// checking the current block author (to declare as the reporter), and also for creating and
/// submitting equivocation report extrinsics (useful only in offchain context).
pub trait HandleEquivocation<T: Config> {
/// The longevity, in blocks, that the equivocation report is valid for. When using the staking
/// pallet this should be equal to the bonding duration (in blocks, not eras).
Expand Down Expand Up @@ -87,9 +88,10 @@ impl<T: Config> HandleEquivocation<T> for () {
}
}

/// Generic equivocation handler. This type implements `HandleEquivocation`
/// using existing subsystems that are part of frame (type bounds described
/// below) and will dispatch to them directly, it's only purpose is to wire all
/// Generic equivocation handler.
///
/// This type implements `HandleEquivocation` using existing subsystems that are part of frame (type
/// bounds described below) and will dispatch to them directly, it's only purpose is to wire all
/// subsystems together.
pub struct EquivocationHandler<R, L> {
_phantom: sp_std::marker::PhantomData<(R, L)>,
Expand Down
6 changes: 4 additions & 2 deletions crates/sc-consensus-subspace/src/archiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,10 @@ fn finalize_block<Block, Backend, Client>(
});
}

/// Create an archiver task that will listen for importing blocks and archive blocks at `K` depth,
/// producing pieces and segment headers (segment headers are then added back to the blockchain as
/// Create an archiver task.
///
/// Archiver task will listen for importing blocks and archive blocks at `K` depth, producing pieces
/// and segment headers (segment headers are then added back to the blockchain as
/// `store_segment_header` extrinsic).
///
/// NOTE: Archiver is doing blocking operations and must run in a dedicated task.
Expand Down
2 changes: 2 additions & 0 deletions crates/sc-consensus-subspace/src/slot_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ use tracing::{debug, error, info, warn};
/// Large enough size for any practical purposes, there shouldn't be even this many solutions.
const PENDING_SOLUTIONS_CHANNEL_CAPACITY: usize = 10;

/// Subspace sync oracle.
///
/// Subspace sync oracle that takes into account force authoring flag, allowing to bootstrap
/// Subspace network from scratch due to our fork of Substrate where sync state of nodes depends on
/// connected nodes (none of which will be synced initially). It also accounts for DSN sync, when
Expand Down
7 changes: 4 additions & 3 deletions crates/sc-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ where
}
}

/// Generate MMR proof for the block `to_prove` in the current best fork. The returned proof
/// can be later used to verify stateless (without query offchain MMR leaf) and extract the state
/// root at `to_prove`.
/// Generate MMR proof for the block `to_prove` in the current best fork.
///
/// The returned proof can be later used to verify stateless (without query offchain MMR leaf) and
/// extract the state root at `to_prove`.
pub fn generate_mmr_proof<CClient, CBlock>(
consensus_client: &Arc<CClient>,
to_prove: NumberFor<CBlock>,
Expand Down
8 changes: 4 additions & 4 deletions crates/sc-subspace-block-relay/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use substrate_prometheus_endpoint::{

type NetworkRequestService = Arc<dyn NetworkRequest + Send + Sync + 'static>;

/// Wrapper to work around the circular dependency in substrate:
/// `build_network()` requires the block relay to be passed in,
/// which internally needs the network handle. `set()` is
/// used to fill in the network after the network is created.
/// Wrapper to work around the circular dependency in substrate.
///
/// `build_network()` requires the block relay to be passed in, which internally needs the network
/// handle. `set()` is used to fill in the network after the network is created.
pub struct NetworkWrapper {
network: Mutex<Option<NetworkRequestService>>,
}
Expand Down
7 changes: 4 additions & 3 deletions crates/sp-domains-fraud-proof/src/execution_prover.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! This module provides the feature of generating and verifying the execution proof used in
//! the Subspace fraud proof mechanism. The execution is more fine-grained than the entire
//! block execution, block execution hooks (`initialize_block` and `finalize_block`) and any
//! specific extrinsic execution are supported.
//! the Subspace fraud proof mechanism.
//!
//! The execution is more fine-grained than the entire block execution, block execution hooks
//! (`initialize_block` and `finalize_block`) and any specific extrinsic execution are supported.

use crate::fraud_proof::ExecutionPhase;
use codec::Codec;
Expand Down
6 changes: 6 additions & 0 deletions crates/sp-domains-fraud-proof/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
clippy::needless_return,
reason = "https://github.com/rust-lang/rust-clippy/issues/13458"
)]

use crate::test_ethereum_tx::{
EIP1559UnsignedTransaction, EIP2930UnsignedTransaction, LegacyUnsignedTransaction,
};
Expand Down
1 change: 1 addition & 0 deletions crates/sp-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ impl DomainAllowlistUpdates {
}

/// Domain Sudo runtime call.
///
/// This structure exists because we need to generate a storage proof for FP
/// and Storage shouldn't be None. So each domain must always hold this value even if
/// there is an empty runtime call inside
Expand Down
1 change: 1 addition & 0 deletions crates/sp-domains/src/valued_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type ArrayNode<T> = [CacheNode<TrieHash<T>>; 16];

/// This is a modified version of trie root that takes trie node values instead of deriving from
/// the actual data. Taken from `trie-db` as is.
///
/// Note: This is an opportunity to push this change upstream but I'm not sure how to present these
/// changes yet. Need to be discussed further.
pub fn valued_ordered_trie_root<Layout>(
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-core-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
const_option,
const_trait_impl,
const_try,
new_uninit,
new_zeroed_alloc,
portable_simd,
step_trait
)]
Expand Down
4 changes: 1 addition & 3 deletions crates/subspace-core-primitives/src/pieces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,7 @@ impl AsMut<[u8]> for CowBytes {

bytes.as_mut()
}
CowBytes::Owned(bytes) => {
return bytes.as_mut();
}
CowBytes::Owned(bytes) => bytes.as_mut(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer-components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
int_roundings,
iter_collect_into,
never_type,
new_uninit,
new_zeroed_alloc,
portable_simd,
try_blocks
)]
Expand Down
8 changes: 4 additions & 4 deletions crates/subspace-farmer-components/src/reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ where
S: ReadAtSync,
A: ReadAtAsync,
{
// TODO: Should have been just `::new()`, but https://github.com/rust-lang/rust/issues/53827
// SAFETY: Data structure filled with zeroes is a valid invariant
let mut record_chunks =
unsafe { Box::<[Option<Scalar>; Record::NUM_S_BUCKETS]>::new_zeroed().assume_init() };
let mut record_chunks = Box::<[Option<Scalar>; Record::NUM_S_BUCKETS]>::try_from(
vec![None::<Scalar>; Record::NUM_S_BUCKETS].into_boxed_slice(),
)
.expect("Correct size; qed");

let read_chunks_inputs = record_chunks
.par_iter_mut()
Expand Down
2 changes: 2 additions & 0 deletions crates/subspace-farmer-components/src/sector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ pub enum SectorContentsMapIterationError {
},
}

/// Map of sector contents.
///
/// Abstraction on top of bitfields that allow making sense of sector contents that contains both
/// encoded (meaning erasure coded and encoded with existing PoSpace quality) and unencoded chunks
/// (just erasure coded) used at the same time both in records (before writing to plot) and
Expand Down
5 changes: 5 additions & 0 deletions crates/subspace-farmer/src/bin/subspace-farmer/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// TODO: Remove
#![allow(
clippy::needless_return,
reason = "https://github.com/rust-lang/rust-clippy/issues/13458"
)]
#![feature(
const_option,
duration_constructors,
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/cluster/cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

//! Farming cluster cache
//!
//! Cache is responsible for caching pieces within allocated space to accelerate plotting and serve
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/cluster/farmer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

//! Farming cluster farmer
//!
//! Farmer is responsible for maintaining farms, doing audits and generating proofs when solution is
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/disk_piece_cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

//! Disk piece cache implementation

mod metrics;
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/farm.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

//! Abstract farm API
//!
//! This module provides a bunch of traits and simple data structures that serve as a layer of
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/farmer_cache/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
clippy::needless_return,
reason = "https://github.com/rust-lang/rust-clippy/issues/13458"
)]

use crate::disk_piece_cache::DiskPieceCache;
use crate::farmer_cache::{decode_piece_index_from_record_key, FarmerCache};
use crate::node_client::{Error, NodeClient};
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/single_disk_farm/piece_cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

//! Cache implementation specific to single disk farm

use crate::disk_piece_cache::DiskPieceCache;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
clippy::needless_return,
reason = "https://github.com/rust-lang/rust-clippy/issues/13458"
)]

use crate::farm::MaybePieceStoredResult;
use crate::single_disk_farm::plot_cache::DiskPlotCache;
#[cfg(windows)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
elided_named_lifetimes,
reason = "https://github.com/dtolnay/async-trait/issues/279"
)]

use crate::farm::{FarmError, PlottedSectors};
use async_lock::RwLock as AsyncRwLock;
use async_trait::async_trait;
Expand Down
2 changes: 0 additions & 2 deletions crates/subspace-farmer/src/single_disk_farm/plotting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ use tokio::task;
use tracing::{debug, info, info_span, trace, warn, Instrument};

const FARMER_APP_INFO_RETRY_INTERVAL: Duration = Duration::from_millis(500);
/// Size of the cache of archived segments for the purposes of faster sector expiration checks.

const PLOTTING_RETRY_DELAY: Duration = Duration::from_secs(1);

pub(super) struct SectorToPlot {
Expand Down
9 changes: 6 additions & 3 deletions crates/subspace-farmer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,12 @@ fn create_plotting_thread_pool_manager_thread_pool_pair(
.build()
}

/// Creates thread pool pairs for each of CPU core set pair with number of plotting and replotting threads corresponding
/// to number of cores in each set and pins threads to all of those CPU cores (each thread to all cors in a set, not
/// thread per core). Each thread will also have Tokio context available.
/// Create thread pools manager.
///
/// Creates thread pool pairs for each of CPU core set pair with number of plotting and replotting
/// threads corresponding to number of cores in each set and pins threads to all of those CPU cores
/// (each thread to all cors in a set, not thread per core). Each thread will also have Tokio
/// context available.
///
/// The easiest way to obtain CPUs is using [`all_cpu_cores`], but [`thread_pool_core_indices`] in case
/// support for user customizations is desired. They will then have to be composed into pairs for this function.
Expand Down
6 changes: 6 additions & 0 deletions crates/subspace-farmer/src/utils/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// TODO: Remove
#![allow(
clippy::needless_return,
reason = "https://github.com/rust-lang/rust-clippy/issues/13458"
)]

use crate::utils::{
parse_cpu_cores_sets, run_future_in_dedicated_thread, thread_pool_core_indices_internal,
CpuCoreSet,
Expand Down
Loading

0 comments on commit d71ca47

Please sign in to comment.