diff --git a/.github/workflows/dusk_ci.yml b/.github/workflows/dusk_ci.yml index 476af9b7..2b97c517 100644 --- a/.github/workflows/dusk_ci.yml +++ b/.github/workflows/dusk_ci.yml @@ -72,6 +72,6 @@ jobs: with: token: ${{secrets.CODECOV_TOKEN}} - test_nightly_std: - name: Nightly tests std + test_stable_std: + name: Stable tests std uses: dusk-network/.github/.github/workflows/run-tests.yml@main diff --git a/CHANGELOG.md b/CHANGELOG.md index efbe3e92..45926e51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added MSRV, set to rust version `1.85` [#860] + ### Changed +- Update rust edition to 2024 [#861] +- Update rust toolchain to stable [#859] +- Change dependency `msgpacker`to `0.4.8` - Update rust toolchain to nightly 2024-10-17 (1.84.0) ## [0.21.0] - 2025-02-06 @@ -618,6 +625,9 @@ is necessary since `rkyv/validation` was required as a bound. - Proof system module. +[#861]: https://github.com/dusk-network/plonk/issues/861 +[#860]: https://github.com/dusk-network/plonk/issues/860 +[#859]: https://github.com/dusk-network/plonk/issues/859 [#842]: https://github.com/dusk-network/plonk/issues/842 [#834]: https://github.com/dusk-network/plonk/issues/834 [#831]: https://github.com/dusk-network/plonk/issues/831 diff --git a/Cargo.toml b/Cargo.toml index d49378b3..4ec9f0e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,8 @@ name = "dusk-plonk" version = "0.21.0" categories =["algorithms", "cryptography", "science", "mathematics"] -edition = "2021" +edition = "2024" +rust-version = "1.85" keywords = ["cryptography", "plonk", "zk-snarks", "zero-knowledge", "crypto"] license = "MPL-2.0" repository = "https://github.com/dusk-network/plonk" @@ -15,6 +16,7 @@ exclude = [ ] [dependencies] +blake2b_simd = { version = "=1.0.3", default-features = false } merlin = {version = "3.0", default-features = false} rand_core = {version="0.6", default-features=false} dusk-bytes = "0.1" @@ -23,7 +25,7 @@ dusk-jubjub = {version = "0.15", default-features = false} ff = {version = "0.13", default-features = false} itertools = {version = "0.9", default-features = false} hashbrown = {version = "0.9", default-features=false, features = ["ahash"]} -msgpacker = {version = "=0.4.3", default-features=false, features = ["alloc", "derive"], optional=true} +msgpacker = {version = "=0.4.8", default-features=false, features = ["alloc", "derive"], optional=true} miniz_oxide = {version = "0.7", default-features=false, features = ["with-alloc"], optional = true} rayon = {version = "1.3", optional = true} sha2 = {version = "0.10", default-features = false, optional = true} diff --git a/benches/plonk.rs b/benches/plonk.rs index c2761284..cb5cedaa 100644 --- a/benches/plonk.rs +++ b/benches/plonk.rs @@ -6,7 +6,7 @@ #![allow(clippy::many_single_char_names)] -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use dusk_plonk::prelude::*; #[derive(Debug, Clone, Copy)] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b8976402..78114a50 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-10-17" +channel = "stable" components = ["rustfmt", "cargo", "clippy"] diff --git a/rustfmt.toml b/rustfmt.toml index 3450fc40..df99c691 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1 @@ max_width = 80 -wrap_comments = true diff --git a/src/commitment_scheme/kzg10/commitment.rs b/src/commitment_scheme/kzg10/commitment.rs index da7fc5f9..7b1aae0d 100644 --- a/src/commitment_scheme/kzg10/commitment.rs +++ b/src/commitment_scheme/kzg10/commitment.rs @@ -12,8 +12,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// Holds a commitment to a polynomial in a form of a [`G1Affine`]-bls12_381 diff --git a/src/commitment_scheme/kzg10/key.rs b/src/commitment_scheme/kzg10/key.rs index 82078b79..282d35b1 100644 --- a/src/commitment_scheme/kzg10/key.rs +++ b/src/commitment_scheme/kzg10/key.rs @@ -7,14 +7,14 @@ //! Key module contains the utilities and data structures //! that support the generation and usage of Commit and //! Opening keys. -use super::{proof::Proof, Commitment}; +use super::{Commitment, proof::Proof}; use crate::{ error::Error, fft::Polynomial, transcript::TranscriptProtocol, util, }; use alloc::vec::Vec; use dusk_bls12_381::{ - multiscalar_mul::msm_variable_base, BlsScalar, G1Affine, G1Projective, - G2Affine, G2Prepared, + BlsScalar, G1Affine, G1Projective, G2Affine, G2Prepared, + multiscalar_mul::msm_variable_base, }; use dusk_bytes::{DeserializableSlice, Serializable}; use merlin::Transcript; @@ -23,8 +23,8 @@ use merlin::Transcript; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// CommitKey is used to commit to a polynomial which is bounded by the @@ -84,17 +84,19 @@ impl CommitKey { /// happen, the inputed bytes must match the ones that were generated by /// the encoding functions of this lib. pub unsafe fn from_slice_unchecked(bytes: &[u8]) -> Self { - let mut len = [0u8; u64::SIZE]; - len.copy_from_slice(&bytes[..u64::SIZE]); - let len = u64::from_le_bytes(len); - - let powers_of_g = bytes[u64::SIZE..] - .chunks_exact(G1Affine::RAW_SIZE) - .zip(0..len) - .map(|(c, _)| G1Affine::from_slice_unchecked(c)) - .collect(); - - Self { powers_of_g } + unsafe { + let mut len = [0u8; u64::SIZE]; + len.copy_from_slice(&bytes[..u64::SIZE]); + let len = u64::from_le_bytes(len); + + let powers_of_g = bytes[u64::SIZE..] + .chunks_exact(G1Affine::RAW_SIZE) + .zip(0..len) + .map(|(c, _)| G1Affine::from_slice_unchecked(c)) + .collect(); + + Self { powers_of_g } + } } /// Serializes the [`CommitKey`] into a byte slice. diff --git a/src/commitment_scheme/kzg10/srs.rs b/src/commitment_scheme/kzg10/srs.rs index 709df97c..8c4de63d 100644 --- a/src/commitment_scheme/kzg10/srs.rs +++ b/src/commitment_scheme/kzg10/srs.rs @@ -18,8 +18,8 @@ use rand_core::{CryptoRng, RngCore}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// The Public Parameters can also be referred to as the Structured Reference @@ -128,16 +128,18 @@ impl PublicParameters { /// happen, the inputed bytes must match the ones that were generated by /// the encoding functions of this lib. pub unsafe fn from_slice_unchecked(bytes: &[u8]) -> Self { - let opening_key = &bytes[..OpeningKey::SIZE]; - let opening_key = OpeningKey::from_slice(opening_key) - .expect("Error at OpeningKey deserialization"); - - let commit_key = &bytes[OpeningKey::SIZE..]; - let commit_key = CommitKey::from_slice_unchecked(commit_key); - - Self { - commit_key, - opening_key, + unsafe { + let opening_key = &bytes[..OpeningKey::SIZE]; + let opening_key = OpeningKey::from_slice(opening_key) + .expect("Error at OpeningKey deserialization"); + + let commit_key = &bytes[OpeningKey::SIZE..]; + let commit_key = CommitKey::from_slice_unchecked(commit_key); + + Self { + commit_key, + opening_key, + } } } diff --git a/src/compiler.rs b/src/compiler.rs index e1dacf26..4f409eb7 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -10,7 +10,7 @@ use crate::commitment_scheme::{CommitKey, OpeningKey, PublicParameters}; use crate::error::Error; use crate::fft::{EvaluationDomain, Evaluations, Polynomial}; use crate::proof_system::preprocess::Polynomials; -use crate::proof_system::{widget, ProverKey}; +use crate::proof_system::{ProverKey, widget}; use crate::prelude::{Circuit, Composer}; @@ -161,8 +161,12 @@ impl Compiler { Polynomial::from_coefficients_vec(q_variable_group_add_poly); // 2. compute the sigma polynomials - let [s_sigma_1_poly, s_sigma_2_poly, s_sigma_3_poly, s_sigma_4_poly] = - perm.compute_sigma_polynomials(size, &domain); + let [ + s_sigma_1_poly, + s_sigma_2_poly, + s_sigma_3_poly, + s_sigma_4_poly, + ] = perm.compute_sigma_polynomials(size, &domain); let q_m_comm = commit_key.commit(&q_m_poly).unwrap_or_default(); let q_l_comm = commit_key.commit(&q_l_poly).unwrap_or_default(); diff --git a/src/compiler/prover.rs b/src/compiler/prover.rs index b3f5152c..df1d3108 100644 --- a/src/compiler/prover.rs +++ b/src/compiler/prover.rs @@ -18,7 +18,7 @@ use crate::compiler::prover::linearization_poly::ProofEvaluations; use crate::error::Error; use crate::fft::{EvaluationDomain, Polynomial}; use crate::proof_system::{ - linearization_poly, proof::Proof, quotient_poly, ProverKey, VerifierKey, + ProverKey, VerifierKey, linearization_poly, proof::Proof, quotient_poly, }; use crate::transcript::TranscriptProtocol; diff --git a/src/composer/permutation.rs b/src/composer/permutation.rs index f5494c26..83796ee6 100644 --- a/src/composer/permutation.rs +++ b/src/composer/permutation.rs @@ -993,8 +993,12 @@ mod test { assert_ne!(gamma, beta); // 1. Compute the permutation polynomial using both methods - let [s_sigma_1_poly, s_sigma_2_poly, s_sigma_3_poly, s_sigma_4_poly] = - perm.compute_sigma_polynomials(n, domain); + let [ + s_sigma_1_poly, + s_sigma_2_poly, + s_sigma_3_poly, + s_sigma_4_poly, + ] = perm.compute_sigma_polynomials(n, domain); let (z_vec, numerator_components, denominator_components) = compute_slow_permutation_poly( domain, diff --git a/src/error.rs b/src/error.rs index d3b0d675..e3377d8b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -129,7 +129,10 @@ impl std::fmt::Display for Error { write!(f, "circuit has already been preprocessed") } Self::InvalidCircuitSize(description_size, circuit_size) => { - write!(f, "circuit description has a different amount of gates than the circuit for the proof creation: description size = {description_size}, circuit size = {circuit_size}") + write!( + f, + "circuit description has a different amount of gates than the circuit for the proof creation: description size = {description_size}, circuit size = {circuit_size}" + ) } Self::DegreeIsZero => { write!(f, "cannot create PublicParameters with max degree 0") @@ -152,19 +155,27 @@ impl std::fmt::Display for Error { Self::NotEnoughBytes => write!(f, "not enough bytes left to read"), Self::PointMalformed => write!(f, "BLS point bytes malformed"), Self::BlsScalarMalformed => write!(f, "BLS scalar bytes malformed"), - Self::JubJubScalarMalformed => write!(f, "JubJub scalar bytes malformed"), + Self::JubJubScalarMalformed => { + write!(f, "JubJub scalar bytes malformed") + } Self::BytesError(err) => write!(f, "{:?}", err), Self::UnsupportedWNAF2k => write!( f, "WNAF2k cannot hold values not contained in `[-1..1]`" ), - Self::PublicInputNotFound { + Self::PublicInputNotFound { index } => write!( + f, + "The public input of index {} is defined in the circuit description, but wasn't declared in the prove instance", index - } => write!(f, "The public input of index {} is defined in the circuit description, but wasn't declared in the prove instance", index), - Self::InconsistentPublicInputsLen { - expected, provided, - } => write!(f, "The provided public inputs set of length {} doesn't match the processed verifier: {}", provided, expected), - Self::InvalidCompressedCircuit => write!(f, "invalid compressed circuit"), + ), + Self::InconsistentPublicInputsLen { expected, provided } => write!( + f, + "The provided public inputs set of length {} doesn't match the processed verifier: {}", + provided, expected + ), + Self::InvalidCompressedCircuit => { + write!(f, "invalid compressed circuit") + } } } } diff --git a/src/fft/domain.rs b/src/fft/domain.rs index d49d9e4d..5c6c0af2 100644 --- a/src/fft/domain.rs +++ b/src/fft/domain.rs @@ -19,8 +19,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// Defines a domain over which finite field (I)FFTs can be performed. Works diff --git a/src/fft/evaluations.rs b/src/fft/evaluations.rs index b1838d3f..3e5bde22 100644 --- a/src/fft/evaluations.rs +++ b/src/fft/evaluations.rs @@ -20,8 +20,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// Stores a polynomial in evaluation form. @@ -90,7 +90,7 @@ impl Index for Evaluations { } } -impl<'a, 'b> Mul<&'a Evaluations> for &'b Evaluations { +impl<'a> Mul<&'a Evaluations> for &Evaluations { type Output = Evaluations; #[inline] @@ -112,7 +112,7 @@ impl<'a> MulAssign<&'a Evaluations> for Evaluations { } } -impl<'a, 'b> Add<&'a Evaluations> for &'b Evaluations { +impl<'a> Add<&'a Evaluations> for &Evaluations { type Output = Evaluations; #[inline] @@ -134,7 +134,7 @@ impl<'a> AddAssign<&'a Evaluations> for Evaluations { } } -impl<'a, 'b> Sub<&'a Evaluations> for &'b Evaluations { +impl<'a> Sub<&'a Evaluations> for &Evaluations { type Output = Evaluations; #[inline] diff --git a/src/fft/polynomial.rs b/src/fft/polynomial.rs index e718ffe5..271c6aa6 100644 --- a/src/fft/polynomial.rs +++ b/src/fft/polynomial.rs @@ -19,8 +19,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// Represents a polynomial in coeffiient form. @@ -82,10 +82,12 @@ impl Polynomial { result.truncate_leading_zeros(); // Check that either the coefficients vec is empty or that the last // coeff is non-zero. - assert!(result - .coeffs - .last() - .map_or(true, |coeff| coeff != &BlsScalar::zero())); + assert!( + result + .coeffs + .last() + .is_none_or(|coeff| coeff != &BlsScalar::zero()) + ); result } @@ -109,11 +111,7 @@ impl Polynomial { } fn truncate_leading_zeros(&mut self) { - while self - .coeffs - .last() - .map_or(false, |c| c == &BlsScalar::zero()) - { + while self.coeffs.last().is_some_and(|c| c == &BlsScalar::zero()) { self.coeffs.pop(); } } @@ -185,7 +183,7 @@ impl Sum for Polynomial { } } -impl<'a, 'b> Add<&'a Polynomial> for &'b Polynomial { +impl<'a> Add<&'a Polynomial> for &Polynomial { type Output = Polynomial; fn add(self, other: &'a Polynomial) -> Polynomial { @@ -269,7 +267,7 @@ impl Neg for Polynomial { } } -impl<'a, 'b> Sub<&'a Polynomial> for &'b Polynomial { +impl<'a> Sub<&'a Polynomial> for &Polynomial { type Output = Polynomial; #[inline] @@ -370,7 +368,7 @@ impl Polynomial { } /// Performs O(nlogn) multiplication of polynomials if F is smooth. -impl<'a, 'b> Mul<&'a Polynomial> for &'b Polynomial { +impl<'a> Mul<&'a Polynomial> for &Polynomial { type Output = Polynomial; #[inline] @@ -395,7 +393,7 @@ impl<'a, 'b> Mul<&'a Polynomial> for &'b Polynomial { } } -impl<'a, 'b> Mul<&'a BlsScalar> for &'b Polynomial { +impl<'a> Mul<&'a BlsScalar> for &Polynomial { type Output = Polynomial; #[inline] @@ -409,7 +407,7 @@ impl<'a, 'b> Mul<&'a BlsScalar> for &'b Polynomial { } } -impl<'a, 'b> Add<&'a BlsScalar> for &'b Polynomial { +impl<'a> Add<&'a BlsScalar> for &Polynomial { type Output = Polynomial; #[inline] @@ -427,7 +425,7 @@ impl<'a, 'b> Add<&'a BlsScalar> for &'b Polynomial { } } -impl<'a, 'b> Sub<&'a BlsScalar> for &'b Polynomial { +impl<'a> Sub<&'a BlsScalar> for &Polynomial { type Output = Polynomial; #[inline] diff --git a/src/proof_system/linearization_poly.rs b/src/proof_system/linearization_poly.rs index 7d095a35..809c2f3e 100644 --- a/src/proof_system/linearization_poly.rs +++ b/src/proof_system/linearization_poly.rs @@ -7,7 +7,7 @@ #[cfg(feature = "alloc")] use crate::{ fft::{EvaluationDomain, Polynomial}, - proof_system::{proof, ProverKey}, + proof_system::{ProverKey, proof}, }; use dusk_bls12_381::BlsScalar; @@ -17,8 +17,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// Subset of all of the evaluations. These evaluations @@ -151,10 +151,9 @@ impl Serializable<{ 15 * BlsScalar::SIZE }> for ProofEvaluations { } } -#[cfg(feature = "alloc")] - /// Compute the linearization polynomial. // TODO: Improve the method signature +#[cfg(feature = "alloc")] #[allow(clippy::type_complexity)] pub(crate) fn compute( prover_key: &ProverKey, diff --git a/src/proof_system/proof.rs b/src/proof_system/proof.rs index 285e8947..3929543d 100644 --- a/src/proof_system/proof.rs +++ b/src/proof_system/proof.rs @@ -23,8 +23,8 @@ use crate::util::check_field; use bytecheck::{CheckBytes, StructCheckError}; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// A Proof is a composition of `Commitment`s to the Witness, Permutation, @@ -191,7 +191,7 @@ pub(crate) mod alloc { #[rustfmt::skip] use ::alloc::vec::Vec; use dusk_bls12_381::{ - multiscalar_mul::msm_variable_base, BlsScalar, G1Affine, G1Projective, + BlsScalar, G1Affine, G1Projective, multiscalar_mul::msm_variable_base, }; use merlin::Transcript; #[cfg(feature = "std")] diff --git a/src/proof_system/widget.rs b/src/proof_system/widget.rs index dda20b16..36138758 100644 --- a/src/proof_system/widget.rs +++ b/src/proof_system/widget.rs @@ -19,8 +19,8 @@ use crate::util::check_field; use bytecheck::{CheckBytes, StructCheckError}; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; /// PLONK circuit Verification Key. diff --git a/src/proof_system/widget/arithmetic/proverkey.rs b/src/proof_system/widget/arithmetic/proverkey.rs index 75288834..ce924de6 100644 --- a/src/proof_system/widget/arithmetic/proverkey.rs +++ b/src/proof_system/widget/arithmetic/proverkey.rs @@ -12,8 +12,8 @@ use dusk_bls12_381::BlsScalar; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/src/proof_system/widget/arithmetic/verifierkey.rs b/src/proof_system/widget/arithmetic/verifierkey.rs index 8bd3506c..951e7086 100644 --- a/src/proof_system/widget/arithmetic/verifierkey.rs +++ b/src/proof_system/widget/arithmetic/verifierkey.rs @@ -11,8 +11,8 @@ use dusk_bytes::{DeserializableSlice, Serializable}; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/proof_system/widget/ecc/curve_addition/proverkey.rs b/src/proof_system/widget/ecc/curve_addition/proverkey.rs index 1c80afc4..d69008e8 100644 --- a/src/proof_system/widget/ecc/curve_addition/proverkey.rs +++ b/src/proof_system/widget/ecc/curve_addition/proverkey.rs @@ -13,8 +13,8 @@ use dusk_jubjub::EDWARDS_D; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/src/proof_system/widget/ecc/curve_addition/verifierkey.rs b/src/proof_system/widget/ecc/curve_addition/verifierkey.rs index 2453d743..a5c311fc 100644 --- a/src/proof_system/widget/ecc/curve_addition/verifierkey.rs +++ b/src/proof_system/widget/ecc/curve_addition/verifierkey.rs @@ -10,8 +10,8 @@ use crate::commitment_scheme::Commitment; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/proof_system/widget/ecc/scalar_mul/fixed_base/proverkey.rs b/src/proof_system/widget/ecc/scalar_mul/fixed_base/proverkey.rs index f83b845e..df98d213 100644 --- a/src/proof_system/widget/ecc/scalar_mul/fixed_base/proverkey.rs +++ b/src/proof_system/widget/ecc/scalar_mul/fixed_base/proverkey.rs @@ -13,8 +13,8 @@ use dusk_jubjub::EDWARDS_D; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/src/proof_system/widget/ecc/scalar_mul/fixed_base/verifierkey.rs b/src/proof_system/widget/ecc/scalar_mul/fixed_base/verifierkey.rs index 8b1e8bc2..bb00831f 100644 --- a/src/proof_system/widget/ecc/scalar_mul/fixed_base/verifierkey.rs +++ b/src/proof_system/widget/ecc/scalar_mul/fixed_base/verifierkey.rs @@ -10,8 +10,8 @@ use crate::commitment_scheme::Commitment; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/proof_system/widget/logic/proverkey.rs b/src/proof_system/widget/logic/proverkey.rs index 72865c54..7ba94368 100644 --- a/src/proof_system/widget/logic/proverkey.rs +++ b/src/proof_system/widget/logic/proverkey.rs @@ -13,8 +13,8 @@ use dusk_bls12_381::BlsScalar; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/src/proof_system/widget/logic/verifierkey.rs b/src/proof_system/widget/logic/verifierkey.rs index ec8aa626..5f7db079 100644 --- a/src/proof_system/widget/logic/verifierkey.rs +++ b/src/proof_system/widget/logic/verifierkey.rs @@ -10,8 +10,8 @@ use crate::commitment_scheme::Commitment; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/proof_system/widget/permutation/proverkey.rs b/src/proof_system/widget/permutation/proverkey.rs index 8da74f10..2f6faa04 100644 --- a/src/proof_system/widget/permutation/proverkey.rs +++ b/src/proof_system/widget/permutation/proverkey.rs @@ -12,8 +12,8 @@ use dusk_bls12_381::BlsScalar; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] @@ -210,11 +210,11 @@ impl ProverKey { a *= a_2; a *= a_3; a *= alpha; // (a_eval + beta * z_challenge + gamma)(b_eval + beta * K1 * - // z_challenge + gamma)(c_eval + beta * K2 * z_challenge + gamma)(d_eval - // + beta * K3 * z_challenge + gamma) * alpha + // z_challenge + gamma)(c_eval + beta * K2 * z_challenge + gamma)(d_eval + // + beta * K3 * z_challenge + gamma) * alpha z_poly * &a // (a_eval + beta * z_challenge + gamma)(b_eval + beta * K1 - // * z_challenge + gamma)(c_eval + beta * K2 * z_challenge + - // gamma) * alpha z(X) + // * z_challenge + gamma)(c_eval + beta * K2 * z_challenge + + // gamma) * alpha z(X) } // -(a_eval + beta * sigma_1 + gamma)(b_eval + beta * sigma_2 + gamma) // (c_eval + beta * sigma_3 + gamma) * beta *z_eval * alpha^2 * Sigma_4(X) @@ -248,12 +248,12 @@ impl ProverKey { let mut a = a_0 * a_1 * a_2; a *= beta_z_eval; a *= alpha; // (a_eval + beta * sigma_1 + gamma)(b_eval + beta * sigma_2 + - // gamma)(c_eval + beta * sigma_3 + gamma) * beta * z_eval * alpha + // gamma)(c_eval + beta * sigma_3 + gamma) * beta * z_eval * alpha s_sigma_4_poly * &-a // -(a_eval + beta * sigma_1 + gamma)(b_eval + - // beta * sigma_2 + gamma) (c_eval + beta * - // sigma_3 + gamma) * beta * z_eval * alpha^2 * - // Sigma_4(X) + // beta * sigma_2 + gamma) (c_eval + beta * + // sigma_3 + gamma) * beta * z_eval * alpha^2 * + // Sigma_4(X) } fn compute_linearizer_check_is_one( diff --git a/src/proof_system/widget/permutation/verifierkey.rs b/src/proof_system/widget/permutation/verifierkey.rs index f5c21e5f..476e1232 100644 --- a/src/proof_system/widget/permutation/verifierkey.rs +++ b/src/proof_system/widget/permutation/verifierkey.rs @@ -10,8 +10,8 @@ use crate::commitment_scheme::Commitment; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/proof_system/widget/range/proverkey.rs b/src/proof_system/widget/range/proverkey.rs index 2a99efc5..fada67c7 100644 --- a/src/proof_system/widget/range/proverkey.rs +++ b/src/proof_system/widget/range/proverkey.rs @@ -12,8 +12,8 @@ use dusk_bls12_381::BlsScalar; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/src/proof_system/widget/range/verifierkey.rs b/src/proof_system/widget/range/verifierkey.rs index e32ebb68..50bc3d21 100644 --- a/src/proof_system/widget/range/verifierkey.rs +++ b/src/proof_system/widget/range/verifierkey.rs @@ -10,8 +10,8 @@ use crate::commitment_scheme::Commitment; use bytecheck::CheckBytes; #[cfg(feature = "rkyv-impl")] use rkyv::{ - ser::{ScratchSpace, Serializer}, Archive, Deserialize, Serialize, + ser::{ScratchSpace, Serializer}, }; #[derive(Debug, PartialEq, Eq, Copy, Clone)] diff --git a/src/transcript.rs b/src/transcript.rs index 741f9b8b..371be298 100644 --- a/src/transcript.rs +++ b/src/transcript.rs @@ -73,7 +73,7 @@ impl TranscriptProtocol for Transcript { // Safety: static lifetime is a pointless requirement from merlin that // doesn't add any security but instead restricts a lot the // serialization and deserialization of transcripts - let label = unsafe { mem::transmute(label) }; + let label = unsafe { mem::transmute::<&[u8], &[u8]>(label) }; let mut transcript = Transcript::new(label); diff --git a/tests/append_gate.rs b/tests/append_gate.rs index 9a06f210..71b557c3 100644 --- a/tests/append_gate.rs +++ b/tests/append_gate.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/assert_point.rs b/tests/assert_point.rs index 6fab08e3..c0b7609f 100644 --- a/tests/assert_point.rs +++ b/tests/assert_point.rs @@ -5,8 +5,8 @@ // Copyright (c) DUSK NETWORK. All rights reserved. use dusk_plonk::prelude::*; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/assert_scalar.rs b/tests/assert_scalar.rs index f1e870ca..fbf96206 100644 --- a/tests/assert_scalar.rs +++ b/tests/assert_scalar.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{ diff --git a/tests/boolean.rs b/tests/boolean.rs index 0f4e0f46..1b67af42 100644 --- a/tests/boolean.rs +++ b/tests/boolean.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/composer.rs b/tests/composer.rs index a8fee548..0dd51009 100644 --- a/tests/composer.rs +++ b/tests/composer.rs @@ -5,8 +5,8 @@ // Copyright (c) DUSK NETWORK. All rights reserved. use dusk_plonk::prelude::*; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; #[test] fn circuit_with_all_gates() { diff --git a/tests/debugger.rs b/tests/debugger.rs index 9d91e30b..b143353c 100644 --- a/tests/debugger.rs +++ b/tests/debugger.rs @@ -32,7 +32,9 @@ fn generate_cdf_works() -> io::Result<()> { let (prover, _verifier) = Compiler::compile::(&pp, label) .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; - env::set_var("CDF_OUTPUT", &path); + unsafe { + env::set_var("CDF_OUTPUT", &path); + } prover .prove(rng, &EmptyCircuit) diff --git a/tests/decomposition.rs b/tests/decomposition.rs index bf5f9e06..06533e7a 100644 --- a/tests/decomposition.rs +++ b/tests/decomposition.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/ecc.rs b/tests/ecc.rs index b19ab1de..e10b0ba5 100644 --- a/tests/ecc.rs +++ b/tests/ecc.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/error_size.rs b/tests/error_size.rs index 87726852..9ae5b2be 100644 --- a/tests/error_size.rs +++ b/tests/error_size.rs @@ -5,8 +5,8 @@ // Copyright (c) DUSK NETWORK. All rights reserved. use dusk_plonk::prelude::*; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; const CAPACITY: usize = 1 << 4; const LABEL: &[u8] = b"check_public_inputs"; diff --git a/tests/gate_add_mul.rs b/tests/gate_add_mul.rs index dd1e1947..ef38f68c 100644 --- a/tests/gate_add_mul.rs +++ b/tests/gate_add_mul.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/logic.rs b/tests/logic.rs index 916f76c4..81b6ca28 100644 --- a/tests/logic.rs +++ b/tests/logic.rs @@ -7,8 +7,8 @@ use core::cmp; use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/range.rs b/tests/range.rs index a4764dfe..a5630f08 100644 --- a/tests/range.rs +++ b/tests/range.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/select_bls.rs b/tests/select_bls.rs index 75f8389e..5119923e 100644 --- a/tests/select_bls.rs +++ b/tests/select_bls.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit}; diff --git a/tests/select_point.rs b/tests/select_point.rs index 330176f2..39f17626 100644 --- a/tests/select_point.rs +++ b/tests/select_point.rs @@ -6,8 +6,8 @@ use dusk_plonk::prelude::*; use ff::Field; -use rand::rngs::StdRng; use rand::SeedableRng; +use rand::rngs::StdRng; mod common; use common::{check_satisfied_circuit, check_unsatisfied_circuit};