Skip to content

Commit f5b9427

Browse files
authored
dusk-jubjub and bls12_381 bump w/ API rename (#322)
* dusk-jubjub and bls12_381 bump w/ API rename
1 parent 4451ca8 commit f5b9427

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1056
-947
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.3.4] - 02-11-20
11+
### Changed
12+
- dusk-jubjub update to `v0.5.0` with API renaming
13+
- dusk-bls12_381 update to `v0.3.0` with API renaming
14+
1015
## [0.3.3] - 02-11-20
1116
### Added
1217
- `canon` feature to manage `Canon` derivations usage in ecc libs.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dusk-plonk"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
authors = ["Kevaundray Wedderburn <[email protected]>",
55
"Luke Pearson <[email protected]>",
66
"CPerezz <[email protected]>"]
@@ -25,12 +25,12 @@ merlin = "2.0.0"
2525
rand = "0.7.2"
2626
rand_core = { version = "0.5", default-features = false }
2727
# Built by default with "std", "alloc", "pairing", "groups" and "endo" features.
28-
dusk-bls12_381 = "0.2.0"
28+
dusk-bls12_381 = "0.3.0"
2929
itertools = "0.9.0"
3030
rand_chacha = "0.2"
3131
rayon = "1.3.0"
3232
anyhow = "1.0.32"
33-
dusk-jubjub = "0.4.0"
33+
dusk-jubjub = "0.5.0"
3434
thiserror = "1.0"
3535
serde = "1.0"
3636

pk_testcirc

80.3 KB
Binary file not shown.

src/bit_iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ bit_iterator!(u8, BitIterator8);
5757
#[cfg(test)]
5858
mod test {
5959
use super::*;
60-
use dusk_bls12_381::Scalar;
60+
use dusk_bls12_381::BlsScalar;
6161
#[test]
6262
fn test_bit_iterator8() {
63-
let mut a = BitIterator8::new(Scalar::one().to_bytes());
63+
let mut a = BitIterator8::new(BlsScalar::one().to_bytes());
6464
let expected = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001";
6565
for e in expected.chars() {
6666
assert!(a.next().unwrap() == (e == '1'));

src/circuit_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use crate::commitment_scheme::kzg10::PublicParameters;
1010
use crate::constraint_system::StandardComposer;
1111
use crate::proof_system::{Proof, ProverKey, VerifierKey};
1212
use anyhow::Result;
13-
use dusk_bls12_381::Scalar as BlsScalar;
14-
use dusk_jubjub::{AffinePoint as JubJubAffine, Scalar as JubJubScalar};
13+
use dusk_bls12_381::BlsScalar;
14+
use dusk_jubjub::{JubJubAffine, JubJubScalar};
1515
use thiserror::Error;
1616

1717
/// Public Input

src/commitment_scheme/kzg10/key.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::{errors::KZG10Errors, AggregateProof, Commitment, Proof};
1111
use crate::{fft::Polynomial, transcript::TranscriptProtocol, util};
1212
use anyhow::{Error, Result};
1313
use dusk_bls12_381::{
14-
multiscalar_mul::msm_variable_base, G1Affine, G1Projective, G2Affine, G2Prepared, Scalar,
14+
multiscalar_mul::msm_variable_base, BlsScalar, G1Affine, G1Projective, G2Affine, G2Prepared,
1515
};
1616
use merlin::Transcript;
1717

@@ -122,7 +122,7 @@ impl CommitKey {
122122
/// However we note that the quotient polynomial is invariant under the value f(z)
123123
/// ie. only the remainder changes. We can therefore compute the witness as f(x) / x - z
124124
/// and only use the remainder term f(z) during verification.
125-
pub fn compute_single_witness(&self, polynomial: &Polynomial, point: &Scalar) -> Polynomial {
125+
pub fn compute_single_witness(&self, polynomial: &Polynomial, point: &BlsScalar) -> Polynomial {
126126
// Computes `f(x) / x-z`, returning it as the witness poly
127127
polynomial.ruffini(*point)
128128
}
@@ -133,7 +133,7 @@ impl CommitKey {
133133
pub(crate) fn compute_aggregate_witness(
134134
&self,
135135
polynomials: &[Polynomial],
136-
point: &Scalar,
136+
point: &BlsScalar,
137137
transcript: &mut Transcript,
138138
) -> Polynomial {
139139
let challenge = transcript.challenge_scalar(b"aggregate_witness");
@@ -155,8 +155,8 @@ impl CommitKey {
155155
pub fn open_single(
156156
&self,
157157
polynomial: &Polynomial,
158-
value: &Scalar,
159-
point: &Scalar,
158+
value: &BlsScalar,
159+
point: &BlsScalar,
160160
) -> Result<Proof, Error> {
161161
let witness_poly = self.compute_single_witness(polynomial, point);
162162
Ok(Proof {
@@ -172,8 +172,8 @@ impl CommitKey {
172172
pub fn open_multiple(
173173
&self,
174174
polynomials: &[Polynomial],
175-
evaluations: Vec<Scalar>,
176-
point: &Scalar,
175+
evaluations: Vec<BlsScalar>,
176+
point: &BlsScalar,
177177
transcript: &mut Transcript,
178178
) -> Result<AggregateProof, Error> {
179179
// Commit to polynomials
@@ -243,7 +243,7 @@ impl OpeningKey {
243243

244244
/// Checks that a polynomial `p` was evaluated at a point `z` and returned the value specified `v`.
245245
/// ie. v = p(z).
246-
pub fn check(&self, point: Scalar, proof: Proof) -> bool {
246+
pub fn check(&self, point: BlsScalar, proof: Proof) -> bool {
247247
let inner_a: G1Affine =
248248
(proof.commitment_to_polynomial.0 - (self.g * proof.evaluated_point)).into();
249249

@@ -262,7 +262,7 @@ impl OpeningKey {
262262
/// Checks whether a batch of polynomials evaluated at different points, returned their specified value.
263263
pub fn batch_check(
264264
&self,
265-
points: &[Scalar],
265+
points: &[BlsScalar],
266266
proofs: &[Proof],
267267
transcript: &mut Transcript,
268268
) -> Result<(), Error> {
@@ -273,7 +273,7 @@ impl OpeningKey {
273273
let powers = util::powers_of(&challenge, proofs.len() - 1);
274274
// Instead of multiplying g and gamma_g in each turn, we simply accumulate
275275
// their coefficients and perform a final multiplication at the end.
276-
let mut g_multiplier = Scalar::zero();
276+
let mut g_multiplier = BlsScalar::zero();
277277

278278
for ((proof, challenge), point) in proofs.iter().zip(powers).zip(points) {
279279
let mut c = G1Projective::from(proof.commitment_to_polynomial.0);
@@ -332,7 +332,7 @@ mod test {
332332
fn test_basic_commit() {
333333
let degree = 25;
334334
let (proving_key, opening_key) = setup_test(degree);
335-
let point = Scalar::from(10);
335+
let point = BlsScalar::from(10);
336336

337337
let poly = Polynomial::rand(degree, &mut rand::thread_rng());
338338
let value = poly.evaluate(&point);
@@ -347,8 +347,8 @@ mod test {
347347
let degree = 25;
348348
let (proving_key, vk) = setup_test(degree);
349349

350-
let point_a = Scalar::from(10);
351-
let point_b = Scalar::from(11);
350+
let point_a = BlsScalar::from(10);
351+
let point_b = BlsScalar::from(11);
352352

353353
// Compute secret polynomial a
354354
let poly_a = Polynomial::rand(degree, &mut rand::thread_rng());
@@ -378,7 +378,7 @@ mod test {
378378
fn test_aggregate_witness() {
379379
let max_degree = 27;
380380
let (proving_key, opening_key) = setup_test(max_degree);
381-
let point = Scalar::from(10);
381+
let point = BlsScalar::from(10);
382382

383383
// Committer's View
384384
let aggregated_proof = {
@@ -415,8 +415,8 @@ mod test {
415415
fn test_batch_with_aggregation() {
416416
let max_degree = 28;
417417
let (proving_key, opening_key) = setup_test(max_degree);
418-
let point_a = Scalar::from(10);
419-
let point_b = Scalar::from(11);
418+
let point_a = BlsScalar::from(10);
419+
let point_b = BlsScalar::from(11);
420420

421421
// Committer's View
422422
let (aggregated_proof, single_proof) = {

src/commitment_scheme/kzg10/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub use srs::PublicParameters;
1414

1515
use crate::transcript::TranscriptProtocol;
1616
use crate::util::powers_of;
17-
use dusk_bls12_381::{G1Affine, G1Projective, Scalar};
17+
use dusk_bls12_381::{BlsScalar, G1Affine, G1Projective};
1818
use merlin::Transcript;
1919

2020
#[derive(Copy, Clone, Debug)]
@@ -24,7 +24,7 @@ pub struct Proof {
2424
/// This is a commitment to the witness polynomial.
2525
pub commitment_to_witness: Commitment,
2626
/// This is the result of evaluating a polynomial at the point `z`.
27-
pub evaluated_point: Scalar,
27+
pub evaluated_point: BlsScalar,
2828
/// This is the commitment to the polynomial that you want to prove a statement about.
2929
pub commitment_to_polynomial: Commitment,
3030
}
@@ -36,7 +36,7 @@ pub struct AggregateProof {
3636
/// This is a commitment to the aggregated witness polynomial.
3737
pub commitment_to_witness: Commitment,
3838
/// These are the results of the evaluating each polynomial at the point `z`.
39-
pub evaluated_points: Vec<Scalar>,
39+
pub evaluated_points: Vec<BlsScalar>,
4040
/// These are the commitments to the polynomials which you want to prove a statement about.
4141
pub commitments_to_polynomials: Vec<Commitment>,
4242
}
@@ -52,7 +52,7 @@ impl AggregateProof {
5252
}
5353

5454
/// Adds an evaluated point with the commitment to the polynomial which produced it.
55-
pub fn add_part(&mut self, part: (Scalar, Commitment)) {
55+
pub fn add_part(&mut self, part: (BlsScalar, Commitment)) {
5656
self.evaluated_points.push(part.0);
5757
self.commitments_to_polynomials.push(part.1);
5858
}
@@ -71,12 +71,12 @@ impl AggregateProof {
7171
.map(|(poly, challenge)| poly.0 * challenge)
7272
.sum();
7373
// Flattened evaluation points
74-
let flattened_poly_evaluations: Scalar = self
74+
let flattened_poly_evaluations: BlsScalar = self
7575
.evaluated_points
7676
.iter()
7777
.zip(powers.iter())
7878
.map(|(eval, challenge)| eval * challenge)
79-
.fold(Scalar::zero(), |acc, current_val| acc + current_val);
79+
.fold(BlsScalar::zero(), |acc, current_val| acc + current_val);
8080

8181
Proof {
8282
commitment_to_witness: self.commitment_to_witness,

src/commitment_scheme/kzg10/srs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ impl PublicParameters {
112112
#[cfg(test)]
113113
mod test {
114114
use super::*;
115-
use dusk_bls12_381::Scalar;
115+
use dusk_bls12_381::BlsScalar;
116116
#[test]
117117
fn test_powers_of() {
118-
let x = Scalar::from(10u64);
118+
let x = BlsScalar::from(10u64);
119119
let degree = 100u64;
120120

121121
let powers_of_x = util::powers_of(&x, degree as usize);

0 commit comments

Comments
 (0)