diff --git a/.github/nightly-version b/.github/nightly-version index 9f98e758..09a243d7 100644 --- a/.github/nightly-version +++ b/.github/nightly-version @@ -1 +1 @@ -nightly-2024-07-01 +nightly-2025-01-01 diff --git a/common/request/src/response.rs b/common/request/src/response.rs index 78295d37..e4628f72 100644 --- a/common/request/src/response.rs +++ b/common/request/src/response.rs @@ -11,7 +11,7 @@ use crate::{Client, Error}; #[allow(dead_code)] #[derive(Debug)] pub struct Response<'a>(pub(crate) hyper::Response<Incoming>, pub(crate) &'a Client); -impl<'a> Response<'a> { +impl Response<'_> { pub fn status(&self) -> StatusCode { self.0.status() } diff --git a/coordinator/tributary/src/lib.rs b/coordinator/tributary/src/lib.rs index 27baf45d..1e1235ad 100644 --- a/coordinator/tributary/src/lib.rs +++ b/coordinator/tributary/src/lib.rs @@ -133,7 +133,7 @@ struct ScanBlock<'a, TD: Db, TDT: DbTxn, P: P2p> { total_weight: u16, validator_weights: &'a HashMap<SeraiAddress, u16>, } -impl<'a, TD: Db, TDT: DbTxn, P: P2p> ScanBlock<'a, TD, TDT, P> { +impl<TD: Db, TDT: DbTxn, P: P2p> ScanBlock<'_, TD, TDT, P> { fn potentially_start_cosign(&mut self) { // Don't start a new cosigning instance if we're actively running one if TributaryDb::actively_cosigning(self.tributary_txn, self.set.set).is_some() { @@ -173,7 +173,7 @@ impl<'a, TD: Db, TDT: DbTxn, P: P2p> ScanBlock<'a, TD, TDT, P> { self.set.set, messages::coordinator::CoordinatorMessage::CosignSubstrateBlock { session: self.set.set.session, - intent, + cosign: intent.into_cosign(self.set.set.network), }, ); } diff --git a/crypto/dalek-ff-group/src/field.rs b/crypto/dalek-ff-group/src/field.rs index bc3078c8..e3813725 100644 --- a/crypto/dalek-ff-group/src/field.rs +++ b/crypto/dalek-ff-group/src/field.rs @@ -92,7 +92,7 @@ impl Neg for FieldElement { } } -impl<'a> Neg for &'a FieldElement { +impl Neg for &FieldElement { type Output = FieldElement; fn neg(self) -> Self::Output { (*self).neg() diff --git a/crypto/dleq/src/lib.rs b/crypto/dleq/src/lib.rs index a8958a2e..f6aed25a 100644 --- a/crypto/dleq/src/lib.rs +++ b/crypto/dleq/src/lib.rs @@ -37,11 +37,11 @@ pub(crate) fn challenge<T: Transcript, F: PrimeField>(transcript: &mut T) -> F { // Get a wide amount of bytes to safely reduce without bias // In most cases, <=1.5x bytes is enough. 2x is still standard and there's some theoretical // groups which may technically require more than 1.5x bytes for this to work as intended - let target_bytes = ((usize::try_from(F::NUM_BITS).unwrap() + 7) / 8) * 2; + let target_bytes = usize::try_from(F::NUM_BITS).unwrap().div_ceil(8) * 2; let mut challenge_bytes = transcript.challenge(b"challenge"); let challenge_bytes_len = challenge_bytes.as_ref().len(); // If the challenge is 32 bytes, and we need 64, we need two challenges - let needed_challenges = (target_bytes + (challenge_bytes_len - 1)) / challenge_bytes_len; + let needed_challenges = target_bytes.div_ceil(challenge_bytes_len); // The following algorithm should be equivalent to a wide reduction of the challenges, // interpreted as concatenated, big-endian byte string diff --git a/crypto/evrf/generalized-bulletproofs/src/arithmetic_circuit_proof.rs b/crypto/evrf/generalized-bulletproofs/src/arithmetic_circuit_proof.rs index e0c6e464..c4983b76 100644 --- a/crypto/evrf/generalized-bulletproofs/src/arithmetic_circuit_proof.rs +++ b/crypto/evrf/generalized-bulletproofs/src/arithmetic_circuit_proof.rs @@ -33,7 +33,7 @@ pub struct ArithmeticCircuitStatement<'a, C: Ciphersuite> { V: PointVector<C>, } -impl<'a, C: Ciphersuite> Zeroize for ArithmeticCircuitStatement<'a, C> { +impl<C: Ciphersuite> Zeroize for ArithmeticCircuitStatement<'_, C> { fn zeroize(&mut self) { self.constraints.zeroize(); self.C.zeroize(); diff --git a/crypto/evrf/generalized-bulletproofs/src/lib.rs b/crypto/evrf/generalized-bulletproofs/src/lib.rs index dc88e68c..48c4cd56 100644 --- a/crypto/evrf/generalized-bulletproofs/src/lib.rs +++ b/crypto/evrf/generalized-bulletproofs/src/lib.rs @@ -247,7 +247,7 @@ impl<C: Ciphersuite> Generators<C> { } } -impl<'a, C: Ciphersuite> ProofGenerators<'a, C> { +impl<C: Ciphersuite> ProofGenerators<'_, C> { pub(crate) fn len(&self) -> usize { self.g_bold.len() } diff --git a/crypto/frost/src/sign.rs b/crypto/frost/src/sign.rs index 5115244f..0351584a 100644 --- a/crypto/frost/src/sign.rs +++ b/crypto/frost/src/sign.rs @@ -203,14 +203,15 @@ pub trait SignMachine<S>: Send + Sync + Sized { /// SignatureMachine this SignMachine turns into. type SignatureMachine: SignatureMachine<S, SignatureShare = Self::SignatureShare>; - /// Cache this preprocess for usage later. This cached preprocess MUST only be used once. Reuse - /// of it enables recovery of your private key share. Third-party recovery of a cached preprocess - /// also enables recovery of your private key share, so this MUST be treated with the same - /// security as your private key share. + /// Cache this preprocess for usage later. + /// + /// This cached preprocess MUST only be used once. Reuse of it enables recovery of your private + /// key share. Third-party recovery of a cached preprocess also enables recovery of your private + /// key share, so this MUST be treated with the same security as your private key share. fn cache(self) -> CachedPreprocess; /// Create a sign machine from a cached preprocess. - + /// /// After this, the preprocess must be deleted so it's never reused. Any reuse will presumably /// cause the signer to leak their secret share. fn from_cache( @@ -219,11 +220,14 @@ pub trait SignMachine<S>: Send + Sync + Sized { cache: CachedPreprocess, ) -> (Self, Self::Preprocess); - /// Read a Preprocess message. Despite taking self, this does not save the preprocess. - /// It must be externally cached and passed into sign. + /// Read a Preprocess message. + /// + /// Despite taking self, this does not save the preprocess. It must be externally cached and + /// passed into sign. fn read_preprocess<R: Read>(&self, reader: &mut R) -> io::Result<Self::Preprocess>; /// Sign a message. + /// /// Takes in the participants' preprocess messages. Returns the signature share to be broadcast /// to all participants, over an authenticated channel. The parties who participate here will /// become the signing set for this session. diff --git a/crypto/multiexp/src/lib.rs b/crypto/multiexp/src/lib.rs index dfd8e033..604d0fd6 100644 --- a/crypto/multiexp/src/lib.rs +++ b/crypto/multiexp/src/lib.rs @@ -59,7 +59,7 @@ pub(crate) fn prep_bits<G: Group<Scalar: PrimeFieldBits>>( for pair in pairs { let p = groupings.len(); let mut bits = pair.0.to_le_bits(); - groupings.push(vec![0; (bits.len() + (w_usize - 1)) / w_usize]); + groupings.push(vec![0; bits.len().div_ceil(w_usize)]); for (i, mut bit) in bits.iter_mut().enumerate() { let mut bit = u8_from_bool(&mut bit); diff --git a/processor/scheduler/utxo/primitives/src/lib.rs b/processor/scheduler/utxo/primitives/src/lib.rs index c01baf02..a793c906 100644 --- a/processor/scheduler/utxo/primitives/src/lib.rs +++ b/processor/scheduler/utxo/primitives/src/lib.rs @@ -102,6 +102,7 @@ pub trait TransactionPlanner<S: ScannerFeed, A>: 'static + Send + Sync { /// /// Returns `None` if the fee exceeded the inputs, or `Some` otherwise. // TODO: Enum for Change of None, Some, Mandatory + #[allow(clippy::type_complexity)] fn plan_transaction_with_fee_amortization( &self, operating_costs: &mut u64, diff --git a/substrate/client/src/serai/coins.rs b/substrate/client/src/serai/coins.rs index c5bef95d..2da598fd 100644 --- a/substrate/client/src/serai/coins.rs +++ b/substrate/client/src/serai/coins.rs @@ -12,7 +12,7 @@ pub type CoinsEvent = serai_abi::coins::Event; #[derive(Clone, Copy)] pub struct SeraiCoins<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiCoins<'a> { +impl SeraiCoins<'_> { pub async fn mint_events(&self) -> Result<Vec<CoinsEvent>, SeraiError> { self .0 diff --git a/substrate/client/src/serai/dex.rs b/substrate/client/src/serai/dex.rs index ea76e625..8a53ba78 100644 --- a/substrate/client/src/serai/dex.rs +++ b/substrate/client/src/serai/dex.rs @@ -9,7 +9,7 @@ const PALLET: &str = "Dex"; #[derive(Clone, Copy)] pub struct SeraiDex<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiDex<'a> { +impl SeraiDex<'_> { pub async fn events(&self) -> Result<Vec<DexEvent>, SeraiError> { self .0 diff --git a/substrate/client/src/serai/genesis_liquidity.rs b/substrate/client/src/serai/genesis_liquidity.rs index 187844be..8b9c5538 100644 --- a/substrate/client/src/serai/genesis_liquidity.rs +++ b/substrate/client/src/serai/genesis_liquidity.rs @@ -15,7 +15,7 @@ const PALLET: &str = "GenesisLiquidity"; #[derive(Clone, Copy)] pub struct SeraiGenesisLiquidity<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiGenesisLiquidity<'a> { +impl SeraiGenesisLiquidity<'_> { pub async fn events(&self) -> Result<Vec<GenesisLiquidityEvent>, SeraiError> { self .0 diff --git a/substrate/client/src/serai/in_instructions.rs b/substrate/client/src/serai/in_instructions.rs index 29f9b1a2..675ff792 100644 --- a/substrate/client/src/serai/in_instructions.rs +++ b/substrate/client/src/serai/in_instructions.rs @@ -9,7 +9,7 @@ const PALLET: &str = "InInstructions"; #[derive(Clone, Copy)] pub struct SeraiInInstructions<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiInInstructions<'a> { +impl SeraiInInstructions<'_> { pub async fn last_batch_for_network( &self, network: NetworkId, diff --git a/substrate/client/src/serai/liquidity_tokens.rs b/substrate/client/src/serai/liquidity_tokens.rs index 3e9052b2..530b9257 100644 --- a/substrate/client/src/serai/liquidity_tokens.rs +++ b/substrate/client/src/serai/liquidity_tokens.rs @@ -8,7 +8,7 @@ const PALLET: &str = "LiquidityTokens"; #[derive(Clone, Copy)] pub struct SeraiLiquidityTokens<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiLiquidityTokens<'a> { +impl SeraiLiquidityTokens<'_> { pub async fn token_supply(&self, coin: Coin) -> Result<Amount, SeraiError> { Ok(self.0.storage(PALLET, "Supply", coin).await?.unwrap_or(Amount(0))) } diff --git a/substrate/client/src/serai/mod.rs b/substrate/client/src/serai/mod.rs index f99e9a39..fda876b6 100644 --- a/substrate/client/src/serai/mod.rs +++ b/substrate/client/src/serai/mod.rs @@ -80,7 +80,7 @@ pub struct TemporalSerai<'a> { block: [u8; 32], events: RwLock<Option<EventsInBlock>>, } -impl<'a> Clone for TemporalSerai<'a> { +impl Clone for TemporalSerai<'_> { fn clone(&self) -> Self { Self { serai: self.serai, block: self.block, events: RwLock::new(None) } } @@ -319,7 +319,7 @@ impl Serai { } } -impl<'a> TemporalSerai<'a> { +impl TemporalSerai<'_> { async fn events<E>( &self, filter_map: impl Fn(&Event) -> Option<E>, @@ -389,27 +389,27 @@ impl<'a> TemporalSerai<'a> { }) } - pub fn coins(&'a self) -> SeraiCoins<'a> { + pub fn coins(&self) -> SeraiCoins<'_> { SeraiCoins(self) } - pub fn dex(&'a self) -> SeraiDex<'a> { + pub fn dex(&self) -> SeraiDex<'_> { SeraiDex(self) } - pub fn in_instructions(&'a self) -> SeraiInInstructions<'a> { + pub fn in_instructions(&self) -> SeraiInInstructions<'_> { SeraiInInstructions(self) } - pub fn validator_sets(&'a self) -> SeraiValidatorSets<'a> { + pub fn validator_sets(&self) -> SeraiValidatorSets<'_> { SeraiValidatorSets(self) } - pub fn genesis_liquidity(&'a self) -> SeraiGenesisLiquidity { + pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity { SeraiGenesisLiquidity(self) } - pub fn liquidity_tokens(&'a self) -> SeraiLiquidityTokens { + pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens { SeraiLiquidityTokens(self) } } diff --git a/substrate/client/src/serai/validator_sets.rs b/substrate/client/src/serai/validator_sets.rs index 882f7af6..d7190651 100644 --- a/substrate/client/src/serai/validator_sets.rs +++ b/substrate/client/src/serai/validator_sets.rs @@ -18,7 +18,7 @@ pub type ValidatorSetsEvent = serai_abi::validator_sets::Event; #[derive(Clone, Copy)] pub struct SeraiValidatorSets<'a>(pub(crate) &'a TemporalSerai<'a>); -impl<'a> SeraiValidatorSets<'a> { +impl SeraiValidatorSets<'_> { pub async fn new_set_events(&self) -> Result<Vec<ValidatorSetsEvent>, SeraiError> { self .0