Skip to content

Commit 2878b41

Browse files
committed
Merge branch 'main' into merlin-transcript
2 parents 7ba8376 + 9302131 commit 2878b41

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

docs/notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ The Bulletproofs paper outlines two versions of multi-party computation aggregat
614614

615615
For more information on how the aggregation protocol works and is implemented, see the [protocol notes](../aggregated_range_proof/index.html).
616616

617-
The aggregated range proof has the same form as the individual range proof, in that the provers (the parties) still perform the same calculations to prove that \\(t(x) = \langle \mathbf{l}(x), \mathbf{r}(x) \rangle \\) and that \\(t_0, \mathbf{l}(x), \mathbf{r}(x)\\) are correct. The difference is that the challenge values are obtained from the dealer, which generates them by combining commitments from all the parties, and that the calculations of different parties are seperated by different powers of the challenge scalars \\(y\\) and \\(z\\).
617+
The aggregated range proof has the same form as the individual range proof, in that the provers (the parties) still perform the same calculations to prove that \\(t(x) = \langle \mathbf{l}(x), \mathbf{r}(x) \rangle \\) and that \\(t_0, \mathbf{l}(x), \mathbf{r}(x)\\) are correct. The difference is that the challenge values are obtained from the dealer, which generates them by combining commitments from all the parties, and that the calculations of different parties are separated by different powers of the challenge scalars \\(y\\) and \\(z\\).
618618

619619
We will explain how one piece of the aggregated proof is generated for party \\(j\\), and then will show how all of the pieces for all of the \\(m\\) parties can be combined into one aggregated proof.
620620

@@ -879,4 +879,4 @@ With these observations, we can simplify the combined \\(m\\)-party statement ab
879879
\\]
880880

881881

882-
[bulletproofs_paper]: https://eprint.iacr.org/2017/1066.pdf
882+
[bulletproofs_paper]: https://eprint.iacr.org/2017/1066.pdf

docs/range-proof-protocol.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The dealer creates the aggregated vector polynomials \\(\mathbf{l}(x), \mathbf{r
128128
\end{aligned}
129129
\\]
130130

131-
The the dealer then performs the [inner product argument](../inner_product_proof/index.html) to prove the relation:
131+
The dealer then performs the [inner product argument](../inner_product_proof/index.html) to prove the relation:
132132
\\[
133133
\operatorname{PK}\left\\{
134134
({\mathbf{G}}, {\mathbf{H}}' \in {\mathbb G}^{n \cdot m}, P', Q \in {\mathbb G}; {\mathbf{l}}, {\mathbf{r}} \in {\mathbb Z\_p}^{n\cdot m})
@@ -289,4 +289,4 @@ multiplying equation `2` by \\(c\\), and adding it with equation `3`. Finally, t
289289
+ & \quad {\langle {- \mathbf{l}\_{(j)}(x)} -z\mathbf{1}, {\mathbf{G}\_{(j)}} \rangle}\\\\
290290
+ & \quad {\langle {- \mathbf{r}\_{(j)}(x)} \circ \mathbf{y}^{-n} y^{-j \cdot n} + z\mathbf{1} + z^{j+2} \cdot \mathbf{y}^{-n} y^{-j \cdot n} \circ {\mathbf{2}}^n, {\mathbf{H}}\_{(j)} \rangle}\\\\
291291
\end{aligned}
292-
\\]
292+
\\]

src/errors.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ pub enum ProofError {
1515
WrongNumBlindingFactors,
1616
/// This error occurs when attempting to create a proof with
1717
/// bitsize other than \\(8\\), \\(16\\), \\(32\\), or \\(64\\).
18-
#[fail(display = "Invalid bitsize, must have n = 8,16,32,64")]
18+
#[fail(display = "Invalid bitsize, must have n = 8,16,32,64.")]
1919
InvalidBitsize,
2020
/// This error occurs when attempting to create an aggregated
2121
/// proof with non-power-of-two aggregation size.
22-
#[fail(display = "Invalid aggregation size, m must be a power of 2")]
22+
#[fail(display = "Invalid aggregation size, m must be a power of 2.")]
2323
InvalidAggregation,
24+
/// This error occurs when the generators are of the wrong length.
25+
#[fail(display = "Invalid generators length, must be equal to n.")]
26+
InvalidGeneratorsLength,
2427
/// This error results from an internal error during proving.
2528
///
2629
/// The single-party prover is implemented by performing

src/range_proof/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ impl RangeProof {
7979
if values.len() != blindings.len() {
8080
return Err(ProofError::WrongNumBlindingFactors);
8181
}
82+
if generators.n != n {
83+
return Err(ProofError::InvalidGeneratorsLength);
84+
}
85+
if !(n == 8 || n == 16 || n == 32 || n == 64) {
86+
return Err(ProofError::InvalidBitsize);
87+
}
8288

8389
let dealer = Dealer::new(generators, n, values.len(), transcript)?;
8490

@@ -146,6 +152,12 @@ impl RangeProof {
146152
) -> Result<(), ProofError> {
147153
// First, replay the "interactive" protocol using the proof
148154
// data to recompute all challenges.
155+
if gens.n != n {
156+
return Err(ProofError::InvalidGeneratorsLength);
157+
}
158+
if !(n == 8 || n == 16 || n == 32 || n == 64) {
159+
return Err(ProofError::InvalidBitsize);
160+
}
149161

150162
let m = value_commitments.len();
151163

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn scalar_exp_vartime(x: &Scalar, mut n: u64) -> Scalar {
105105
}
106106

107107
/// Takes the sum of all the powers of `x`, up to `n`
108-
/// If `n` is a power of 2, it uses the efficient algorithm with `2*lg n` multiplcations and additions.
108+
/// If `n` is a power of 2, it uses the efficient algorithm with `2*lg n` multiplications and additions.
109109
/// If `n` is not a power of 2, it uses the slow algorithm with `n` multiplications and additions.
110110
/// In the Bulletproofs case, all calls to `sum_of_powers` should have `n` as a power of 2.
111111
pub fn sum_of_powers(x: &Scalar, n: usize) -> Scalar {

0 commit comments

Comments
 (0)