diff --git a/Dockerfile-bootstrap-node b/Dockerfile-bootstrap-node index 0d04e63ebe..d7972a2d6d 100644 --- a/Dockerfile-bootstrap-node +++ b/Dockerfile-bootstrap-node @@ -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 diff --git a/Dockerfile-bootstrap-node.aarch64 b/Dockerfile-bootstrap-node.aarch64 index 97c5f29c56..ce28fd967a 100644 --- a/Dockerfile-bootstrap-node.aarch64 +++ b/Dockerfile-bootstrap-node.aarch64 @@ -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 diff --git a/Dockerfile-farmer b/Dockerfile-farmer index 3ae020411c..112f5b1db4 100644 --- a/Dockerfile-farmer +++ b/Dockerfile-farmer @@ -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 diff --git a/Dockerfile-farmer.aarch64 b/Dockerfile-farmer.aarch64 index 46dfbff8e2..c4138a1c73 100644 --- a/Dockerfile-farmer.aarch64 +++ b/Dockerfile-farmer.aarch64 @@ -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 diff --git a/Dockerfile-node b/Dockerfile-node index 1b110cb162..b051488fdc 100644 --- a/Dockerfile-node +++ b/Dockerfile-node @@ -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 diff --git a/Dockerfile-node.aarch64 b/Dockerfile-node.aarch64 index d3d5034ee0..4166286eab 100644 --- a/Dockerfile-node.aarch64 +++ b/Dockerfile-node.aarch64 @@ -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 diff --git a/Dockerfile-runtime b/Dockerfile-runtime index cad151932f..e6ca1d2377 100644 --- a/Dockerfile-runtime +++ b/Dockerfile-runtime @@ -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 diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index 87140ba169..12715799e6 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -624,8 +624,9 @@ mod pallet { pub(super) type NewAddedHeadReceipt = 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. /// @@ -724,6 +725,7 @@ mod pallet { pub type DomainRuntimeUpgrades = StorageValue<_, Vec, 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] @@ -731,6 +733,7 @@ mod pallet { 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 = StorageValue<_, BTreeSet, ValueQuery>; diff --git a/crates/pallet-subspace/src/equivocation.rs b/crates/pallet-subspace/src/equivocation.rs index b027df546b..a1463b4b0b 100644 --- a/crates/pallet-subspace/src/equivocation.rs +++ b/crates/pallet-subspace/src/equivocation.rs @@ -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 { /// 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). @@ -87,9 +88,10 @@ impl HandleEquivocation 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 { _phantom: sp_std::marker::PhantomData<(R, L)>, diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs index 87eb830779..92668433bc 100644 --- a/crates/sc-consensus-subspace/src/archiver.rs +++ b/crates/sc-consensus-subspace/src/archiver.rs @@ -736,8 +736,10 @@ fn finalize_block( }); } -/// 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. diff --git a/crates/sc-consensus-subspace/src/slot_worker.rs b/crates/sc-consensus-subspace/src/slot_worker.rs index 6e49239cc1..8de7c12c46 100644 --- a/crates/sc-consensus-subspace/src/slot_worker.rs +++ b/crates/sc-consensus-subspace/src/slot_worker.rs @@ -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 diff --git a/crates/sc-domains/src/lib.rs b/crates/sc-domains/src/lib.rs index f07a48f61b..5413a50f22 100644 --- a/crates/sc-domains/src/lib.rs +++ b/crates/sc-domains/src/lib.rs @@ -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( consensus_client: &Arc, to_prove: NumberFor, diff --git a/crates/sc-subspace-block-relay/src/utils.rs b/crates/sc-subspace-block-relay/src/utils.rs index b4569557e9..dba99750ac 100644 --- a/crates/sc-subspace-block-relay/src/utils.rs +++ b/crates/sc-subspace-block-relay/src/utils.rs @@ -15,10 +15,10 @@ use substrate_prometheus_endpoint::{ type NetworkRequestService = Arc; -/// 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>, } diff --git a/crates/sp-domains-fraud-proof/src/execution_prover.rs b/crates/sp-domains-fraud-proof/src/execution_prover.rs index 57c6d1b8f4..3ca980f615 100644 --- a/crates/sp-domains-fraud-proof/src/execution_prover.rs +++ b/crates/sp-domains-fraud-proof/src/execution_prover.rs @@ -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; diff --git a/crates/sp-domains-fraud-proof/src/tests.rs b/crates/sp-domains-fraud-proof/src/tests.rs index a7b13067d1..9de3d2d39d 100644 --- a/crates/sp-domains-fraud-proof/src/tests.rs +++ b/crates/sp-domains-fraud-proof/src/tests.rs @@ -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, }; diff --git a/crates/sp-domains/src/lib.rs b/crates/sp-domains/src/lib.rs index 6b9e614a6d..5aabc050ca 100644 --- a/crates/sp-domains/src/lib.rs +++ b/crates/sp-domains/src/lib.rs @@ -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 diff --git a/crates/sp-domains/src/valued_trie.rs b/crates/sp-domains/src/valued_trie.rs index 5e46554452..7a607c1282 100644 --- a/crates/sp-domains/src/valued_trie.rs +++ b/crates/sp-domains/src/valued_trie.rs @@ -29,6 +29,7 @@ type ArrayNode = [CacheNode>; 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( diff --git a/crates/subspace-core-primitives/src/lib.rs b/crates/subspace-core-primitives/src/lib.rs index cc0ea9f045..3ed0cdab9c 100644 --- a/crates/subspace-core-primitives/src/lib.rs +++ b/crates/subspace-core-primitives/src/lib.rs @@ -23,7 +23,7 @@ const_option, const_trait_impl, const_try, - new_uninit, + new_zeroed_alloc, portable_simd, step_trait )] diff --git a/crates/subspace-core-primitives/src/pieces.rs b/crates/subspace-core-primitives/src/pieces.rs index 640b41b05c..a8f6a5baf2 100644 --- a/crates/subspace-core-primitives/src/pieces.rs +++ b/crates/subspace-core-primitives/src/pieces.rs @@ -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(), } } } diff --git a/crates/subspace-farmer-components/src/lib.rs b/crates/subspace-farmer-components/src/lib.rs index 71fe389176..aaa902fc8e 100644 --- a/crates/subspace-farmer-components/src/lib.rs +++ b/crates/subspace-farmer-components/src/lib.rs @@ -9,7 +9,7 @@ int_roundings, iter_collect_into, never_type, - new_uninit, + new_zeroed_alloc, portable_simd, try_blocks )] diff --git a/crates/subspace-farmer-components/src/reading.rs b/crates/subspace-farmer-components/src/reading.rs index 1a79f2e0b9..0265677136 100644 --- a/crates/subspace-farmer-components/src/reading.rs +++ b/crates/subspace-farmer-components/src/reading.rs @@ -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; Record::NUM_S_BUCKETS]>::new_zeroed().assume_init() }; + let mut record_chunks = Box::<[Option; Record::NUM_S_BUCKETS]>::try_from( + vec![None::; Record::NUM_S_BUCKETS].into_boxed_slice(), + ) + .expect("Correct size; qed"); let read_chunks_inputs = record_chunks .par_iter_mut() diff --git a/crates/subspace-farmer-components/src/sector.rs b/crates/subspace-farmer-components/src/sector.rs index 21003ea99f..53c39247ed 100644 --- a/crates/subspace-farmer-components/src/sector.rs +++ b/crates/subspace-farmer-components/src/sector.rs @@ -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 diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/main.rs b/crates/subspace-farmer/src/bin/subspace-farmer/main.rs index 12d5e68284..0762220d2d 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/main.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/main.rs @@ -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, diff --git a/crates/subspace-farmer/src/cluster/cache.rs b/crates/subspace-farmer/src/cluster/cache.rs index 04b9a08dfd..2dc8cf6feb 100644 --- a/crates/subspace-farmer/src/cluster/cache.rs +++ b/crates/subspace-farmer/src/cluster/cache.rs @@ -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 diff --git a/crates/subspace-farmer/src/cluster/farmer.rs b/crates/subspace-farmer/src/cluster/farmer.rs index 483f12413e..5e1f00cd31 100644 --- a/crates/subspace-farmer/src/cluster/farmer.rs +++ b/crates/subspace-farmer/src/cluster/farmer.rs @@ -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 diff --git a/crates/subspace-farmer/src/disk_piece_cache.rs b/crates/subspace-farmer/src/disk_piece_cache.rs index 84c42fe994..21d9aa144b 100644 --- a/crates/subspace-farmer/src/disk_piece_cache.rs +++ b/crates/subspace-farmer/src/disk_piece_cache.rs @@ -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; diff --git a/crates/subspace-farmer/src/farm.rs b/crates/subspace-farmer/src/farm.rs index c755c2d343..acd40d18fe 100644 --- a/crates/subspace-farmer/src/farm.rs +++ b/crates/subspace-farmer/src/farm.rs @@ -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 diff --git a/crates/subspace-farmer/src/farmer_cache/tests.rs b/crates/subspace-farmer/src/farmer_cache/tests.rs index e095af1bae..c7a3c900ad 100644 --- a/crates/subspace-farmer/src/farmer_cache/tests.rs +++ b/crates/subspace-farmer/src/farmer_cache/tests.rs @@ -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}; diff --git a/crates/subspace-farmer/src/single_disk_farm/piece_cache.rs b/crates/subspace-farmer/src/single_disk_farm/piece_cache.rs index fb1d82434f..8ce1d2f006 100644 --- a/crates/subspace-farmer/src/single_disk_farm/piece_cache.rs +++ b/crates/subspace-farmer/src/single_disk_farm/piece_cache.rs @@ -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; diff --git a/crates/subspace-farmer/src/single_disk_farm/plot_cache/tests.rs b/crates/subspace-farmer/src/single_disk_farm/plot_cache/tests.rs index 00b81c7868..82aa5b941f 100644 --- a/crates/subspace-farmer/src/single_disk_farm/plot_cache/tests.rs +++ b/crates/subspace-farmer/src/single_disk_farm/plot_cache/tests.rs @@ -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)] diff --git a/crates/subspace-farmer/src/single_disk_farm/plotted_sectors.rs b/crates/subspace-farmer/src/single_disk_farm/plotted_sectors.rs index 618fb7f89c..bb8350783b 100644 --- a/crates/subspace-farmer/src/single_disk_farm/plotted_sectors.rs +++ b/crates/subspace-farmer/src/single_disk_farm/plotted_sectors.rs @@ -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; diff --git a/crates/subspace-farmer/src/single_disk_farm/plotting.rs b/crates/subspace-farmer/src/single_disk_farm/plotting.rs index bf779789f3..157867b8b4 100644 --- a/crates/subspace-farmer/src/single_disk_farm/plotting.rs +++ b/crates/subspace-farmer/src/single_disk_farm/plotting.rs @@ -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 { diff --git a/crates/subspace-farmer/src/utils.rs b/crates/subspace-farmer/src/utils.rs index 63c6d92610..6824504102 100644 --- a/crates/subspace-farmer/src/utils.rs +++ b/crates/subspace-farmer/src/utils.rs @@ -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. diff --git a/crates/subspace-farmer/src/utils/tests.rs b/crates/subspace-farmer/src/utils/tests.rs index 80a9db5ea8..8feb7e6146 100644 --- a/crates/subspace-farmer/src/utils/tests.rs +++ b/crates/subspace-farmer/src/utils/tests.rs @@ -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, diff --git a/crates/subspace-networking/examples/benchmark.rs b/crates/subspace-networking/examples/benchmark.rs index 3f54630cb1..850c7dab41 100644 --- a/crates/subspace-networking/examples/benchmark.rs +++ b/crates/subspace-networking/examples/benchmark.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use backoff::future::retry; use backoff::ExponentialBackoff; use clap::Parser; diff --git a/crates/subspace-networking/examples/get-peers.rs b/crates/subspace-networking/examples/get-peers.rs index acf345bfe1..94bf3304f4 100644 --- a/crates/subspace-networking/examples/get-peers.rs +++ b/crates/subspace-networking/examples/get-peers.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use futures::channel::oneshot; use futures::StreamExt; use libp2p::multiaddr::Protocol; diff --git a/crates/subspace-networking/examples/metrics.rs b/crates/subspace-networking/examples/metrics.rs index 51abd409bb..12c09999f6 100644 --- a/crates/subspace-networking/examples/metrics.rs +++ b/crates/subspace-networking/examples/metrics.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use futures::channel::oneshot; use futures::{select, FutureExt, StreamExt}; use libp2p::metrics::Metrics; diff --git a/crates/subspace-networking/examples/networking.rs b/crates/subspace-networking/examples/networking.rs index 08fc896b41..75ea739212 100644 --- a/crates/subspace-networking/examples/networking.rs +++ b/crates/subspace-networking/examples/networking.rs @@ -1,3 +1,8 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] #![feature(type_changing_struct_update)] use futures::channel::oneshot; diff --git a/crates/subspace-networking/examples/random-walker.rs b/crates/subspace-networking/examples/random-walker.rs index 39d48e1af0..30ec25e3de 100644 --- a/crates/subspace-networking/examples/random-walker.rs +++ b/crates/subspace-networking/examples/random-walker.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use clap::Parser; use futures::channel::oneshot; use futures::future::pending; diff --git a/crates/subspace-networking/examples/requests.rs b/crates/subspace-networking/examples/requests.rs index 75efd4b328..5f40a9d32c 100644 --- a/crates/subspace-networking/examples/requests.rs +++ b/crates/subspace-networking/examples/requests.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use futures::channel::oneshot; use libp2p::multiaddr::Protocol; use parity_scale_codec::{Decode, Encode}; diff --git a/crates/subspace-networking/src/behavior/tests.rs b/crates/subspace-networking/src/behavior/tests.rs index 827ab67b6e..294b0d7b30 100644 --- a/crates/subspace-networking/src/behavior/tests.rs +++ b/crates/subspace-networking/src/behavior/tests.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use super::persistent_parameters::remove_known_peer_addresses_internal; use crate::behavior::persistent_parameters::{append_p2p_suffix, remove_p2p_suffix}; use crate::{ diff --git a/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs b/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs index c9b5b29b35..997e144e95 100644 --- a/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs +++ b/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + //! Simple bootstrap node implementation #![feature(const_option, type_changing_struct_update)] diff --git a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs index 05395cd666..bce255b744 100644 --- a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs +++ b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use crate::protocols::request_response::request_response_factory::{ Event, IfDisconnected, IncomingRequest, OutboundFailure, OutgoingResponse, ProtocolConfig, RequestFailure, RequestHandler, RequestResponseFactoryBehaviour, diff --git a/crates/subspace-networking/src/protocols/reserved_peers/tests.rs b/crates/subspace-networking/src/protocols/reserved_peers/tests.rs index f4cb698859..20ac649f1e 100644 --- a/crates/subspace-networking/src/protocols/reserved_peers/tests.rs +++ b/crates/subspace-networking/src/protocols/reserved_peers/tests.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use crate::protocols::reserved_peers::{Behaviour, Config}; use futures::{select, FutureExt}; use libp2p::core::transport::MemoryTransport; diff --git a/crates/subspace-node/src/commands/run.rs b/crates/subspace-node/src/commands/run.rs index de5085c813..d97393bfef 100644 --- a/crates/subspace-node/src/commands/run.rs +++ b/crates/subspace-node/src/commands/run.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + mod consensus; mod domain; mod shared; diff --git a/crates/subspace-runtime-primitives/src/lib.rs b/crates/subspace-runtime-primitives/src/lib.rs index 3e765e69bd..f29e9e28e6 100644 --- a/crates/subspace-runtime-primitives/src/lib.rs +++ b/crates/subspace-runtime-primitives/src/lib.rs @@ -83,10 +83,12 @@ pub type Hash = sp_core::H256; /// Type used for expressing timestamp. pub type Moment = u64; -/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know -/// the specifics of the runtime. They can then be made to be agnostic over specific formats -/// of data like extrinsics, allowing for them to continue syncing the network through upgrades -/// to even the core data structures. +/// Opaque types. +/// +/// These are used by the CLI to instantiate machinery that don't need to know the specifics of the +/// runtime. They can then be made to be agnostic over specific formats of data like extrinsics, +/// allowing for them to continue syncing the network through upgrades to even the core data +/// structures. pub mod opaque { use super::BlockNumber; use sp_runtime::generic; @@ -100,6 +102,8 @@ pub mod opaque { } pub mod time { + /// Expected block time in milliseconds. + /// /// Since Subspace is probabilistic this is the average expected block time that /// we are targeting. Blocks will be produced at a minimum duration defined /// by `SLOT_DURATION`, but some slots will not be allocated to any diff --git a/crates/subspace-service/src/rpc.rs b/crates/subspace-service/src/rpc.rs index cf2ae496ab..b860296485 100644 --- a/crates/subspace-service/src/rpc.rs +++ b/crates/subspace-service/src/rpc.rs @@ -15,6 +15,7 @@ // along with this program. If not, see . //! A collection of node-specific RPC methods. +//! //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer //! used by Substrate nodes. This file extends those RPC definitions with //! capabilities that are specific to this project's runtime configuration. diff --git a/domains/client/block-preprocessor/src/inherents.rs b/domains/client/block-preprocessor/src/inherents.rs index 024e883bed..fdf0c88543 100644 --- a/domains/client/block-preprocessor/src/inherents.rs +++ b/domains/client/block-preprocessor/src/inherents.rs @@ -1,4 +1,5 @@ //! Provides functionality of adding inherent extrinsics to the Domain. +//! //! Unlike Primary chain where inherent data is first derived the block author //! and the data is verified by the on primary runtime, domains inherents //! short circuit the derivation and verification of inherent data diff --git a/domains/client/domain-operator/src/tests.rs b/domains/client/domain-operator/src/tests.rs index b9fcb3d33c..ad3a23da2f 100644 --- a/domains/client/domain-operator/src/tests.rs +++ b/domains/client/domain-operator/src/tests.rs @@ -1,3 +1,9 @@ +// TODO: Remove +#![allow( + clippy::needless_return, + reason = "https://github.com/rust-lang/rust-clippy/issues/13458" +)] + use crate::domain_block_processor::{DomainBlockProcessor, PendingConsensusBlocks}; use crate::domain_bundle_producer::DomainBundleProducer; use crate::domain_bundle_proposer::DomainBundleProposer; diff --git a/domains/primitives/runtime/src/lib.rs b/domains/primitives/runtime/src/lib.rs index cff7e01485..213e8defd5 100644 --- a/domains/primitives/runtime/src/lib.rs +++ b/domains/primitives/runtime/src/lib.rs @@ -250,10 +250,12 @@ pub struct DecodeExtrinsicError(pub String); pub const CHECK_EXTRINSICS_AND_DO_PRE_DISPATCH_METHOD_NAME: &str = "DomainCoreApi_check_extrinsics_and_do_pre_dispatch"; -/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know -/// the specifics of the runtime. They can then be made to be agnostic over specific formats -/// of data like extrinsics, allowing for them to continue syncing the network through upgrades -/// to even the core data structures. +/// Opaque types. +/// +/// These are used by the CLI to instantiate machinery that don't need to know the specifics of the +/// runtime. They can then be made to be agnostic over specific formats of data like extrinsics, +/// allowing for them to continue syncing the network through upgrades to even the core data +/// structures. pub mod opaque { use crate::BlockNumber; #[cfg(not(feature = "std"))] diff --git a/domains/runtime/evm/src/lib.rs b/domains/runtime/evm/src/lib.rs index a5040a0dd7..ee9d0726b5 100644 --- a/domains/runtime/evm/src/lib.rs +++ b/domains/runtime/evm/src/lib.rs @@ -933,33 +933,31 @@ fn pre_dispatch_evm_transaction( { let _ = transaction_validity?; - if let Call::transact { transaction } = call { - frame_system::CheckWeight::::do_pre_dispatch(dispatch_info, len)?; - - let transaction_data: TransactionData = (&transaction).into(); - let transaction_nonce = transaction_data.nonce; - // If the current account nonce is greater than the tracked nonce, then - // pick the highest nonce - let account_nonce = { - let tracked_nonce = - EVMNoncetracker::account_nonce(AccountId::from(account_id)) - .unwrap_or(U256::zero()); - let account_nonce = EVM::account_basic(&account_id).0.nonce; - max(tracked_nonce, account_nonce) - }; - - match transaction_nonce.cmp(&account_nonce) { - Ordering::Less => return Err(InvalidTransaction::Stale.into()), - Ordering::Greater => return Err(InvalidTransaction::Future.into()), - Ordering::Equal => {} - } + let Call::transact { transaction } = call; + frame_system::CheckWeight::::do_pre_dispatch(dispatch_info, len)?; + + let transaction_data: TransactionData = (&transaction).into(); + let transaction_nonce = transaction_data.nonce; + // If the current account nonce is greater than the tracked nonce, then + // pick the highest nonce + let account_nonce = { + let tracked_nonce = EVMNoncetracker::account_nonce(AccountId::from(account_id)) + .unwrap_or(U256::zero()); + let account_nonce = EVM::account_basic(&account_id).0.nonce; + max(tracked_nonce, account_nonce) + }; + + match transaction_nonce.cmp(&account_nonce) { + Ordering::Less => return Err(InvalidTransaction::Stale.into()), + Ordering::Greater => return Err(InvalidTransaction::Future.into()), + Ordering::Equal => {} + } - let next_nonce = account_nonce - .checked_add(U256::one()) - .ok_or(InvalidTransaction::Custom(ERR_NONCE_OVERFLOW))?; + let next_nonce = account_nonce + .checked_add(U256::one()) + .ok_or(InvalidTransaction::Custom(ERR_NONCE_OVERFLOW))?; - EVMNoncetracker::set_account_nonce(AccountId::from(account_id), next_nonce); - } + EVMNoncetracker::set_account_nonce(AccountId::from(account_id), next_nonce); } Ok(()) diff --git a/domains/service/src/rpc.rs b/domains/service/src/rpc.rs index 9ff6927893..e1d80295db 100644 --- a/domains/service/src/rpc.rs +++ b/domains/service/src/rpc.rs @@ -1,4 +1,5 @@ //! A collection of node-specific RPC methods. +//! //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer //! used by Substrate nodes. This file extends those RPC definitions with //! capabilities that are specific to this project's runtime configuration. diff --git a/domains/test/runtime/evm/src/lib.rs b/domains/test/runtime/evm/src/lib.rs index 2f14a20680..232a9d1714 100644 --- a/domains/test/runtime/evm/src/lib.rs +++ b/domains/test/runtime/evm/src/lib.rs @@ -896,33 +896,31 @@ fn pre_dispatch_evm_transaction( { transaction_validity.map(|_| ())?; - if let Call::transact { transaction } = call { - frame_system::CheckWeight::::do_pre_dispatch(dispatch_info, len)?; - - let transaction_data: TransactionData = (&transaction).into(); - let transaction_nonce = transaction_data.nonce; - // if the current account nonce is more the tracked nonce, then - // pick the highest nonce - let account_nonce = { - let tracked_nonce = - EVMNoncetracker::account_nonce(AccountId::from(account_id)) - .unwrap_or(U256::zero()); - let account_nonce = EVM::account_basic(&account_id).0.nonce; - max(tracked_nonce, account_nonce) - }; - - match transaction_nonce.cmp(&account_nonce) { - Ordering::Less => return Err(InvalidTransaction::Stale.into()), - Ordering::Greater => return Err(InvalidTransaction::Future.into()), - Ordering::Equal => {} - } + let Call::transact { transaction } = call; + frame_system::CheckWeight::::do_pre_dispatch(dispatch_info, len)?; + + let transaction_data: TransactionData = (&transaction).into(); + let transaction_nonce = transaction_data.nonce; + // if the current account nonce is more the tracked nonce, then + // pick the highest nonce + let account_nonce = { + let tracked_nonce = EVMNoncetracker::account_nonce(AccountId::from(account_id)) + .unwrap_or(U256::zero()); + let account_nonce = EVM::account_basic(&account_id).0.nonce; + max(tracked_nonce, account_nonce) + }; + + match transaction_nonce.cmp(&account_nonce) { + Ordering::Less => return Err(InvalidTransaction::Stale.into()), + Ordering::Greater => return Err(InvalidTransaction::Future.into()), + Ordering::Equal => {} + } - let next_nonce = account_nonce - .checked_add(U256::one()) - .ok_or(InvalidTransaction::Custom(ERR_NONCE_OVERFLOW))?; + let next_nonce = account_nonce + .checked_add(U256::one()) + .ok_or(InvalidTransaction::Custom(ERR_NONCE_OVERFLOW))?; - EVMNoncetracker::set_account_nonce(AccountId::from(account_id), next_nonce); - } + EVMNoncetracker::set_account_nonce(AccountId::from(account_id), next_nonce); } Ok(()) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 602a7c8df5..08025239d3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2024-08-01" +channel = "nightly-2024-09-26" 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 5e11cd4efd..57dd2c710a 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -136,6 +136,8 @@ pub const SSC: Balance = (10 * SHANNON).pow(DECIMAL_PLACES as u32); // TODO: Many of below constants should probably be updatable but currently they are not +/// Expected block time in milliseconds. +/// /// Since Subspace is probabilistic this is the average expected block time that /// we are targeting. Blocks will be produced at a minimum duration defined /// by `SLOT_DURATION`, but some slots will not be allocated to any