Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build errors introduced by curve25519-dalek update #7

Draft
wants to merge 2 commits into
base: mobilecoin
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/target/
**/*.rs.bk
Cargo.lock

.idea/
16 changes: 7 additions & 9 deletions src/linear_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ impl LinearProof {
// b_L = b_L + x_j * b_R
b_L[i] = b_L[i] + x_j * b_R[i];
// G_L = G_L + x_j * G_R
G_L[i] = RistrettoPoint::vartime_multiscalar_mul(
&[Scalar::one(), x_j],
&[G_L[i], G_R[i]],
);
G_L[i] =
RistrettoPoint::vartime_multiscalar_mul(&[Scalar::ONE, x_j], &[G_L[i], G_R[i]]);
}
a = a_L;
b = b_L;
Expand Down Expand Up @@ -300,7 +298,7 @@ impl LinearProof {
let lg_n = self.L_vec.len();

let mut s = Vec::with_capacity(n);
s.push(Scalar::one());
s.push(Scalar::ONE);
for i in 1..n {
let lg_i = (32 - 1 - (i as u32).leading_zeros()) as usize;
let k = 1 << lg_i;
Expand Down Expand Up @@ -391,10 +389,10 @@ impl LinearProof {

let pos = 2 * lg_n * 32;
let S = CompressedRistretto(read32(&slice[pos..]));
let a = Scalar::from_canonical_bytes(read32(&slice[pos + 32..]))
.ok_or(ProofError::FormatError)?;
let r = Scalar::from_canonical_bytes(read32(&slice[pos + 64..]))
.ok_or(ProofError::FormatError)?;
let a = Scalar::from_canonical_bytes(read32(&slice[pos + 32..]));
let a = Option::from(a).ok_or(ProofError::FormatError)?;
let r = Scalar::from_canonical_bytes(read32(&slice[pos + 64..]));
let r = Option::from(r).ok_or(ProofError::FormatError)?;

Ok(LinearProof {
L_vec,
Expand Down
24 changes: 16 additions & 8 deletions tests/range_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,43 @@ fn deserialize_and_verify() {
CompressedRistretto::from_slice(
&hex::decode("90b0c2fe57934dff9f5396e135e7d72b82b3c5393e1843178918eb2cf28a5f3c")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("74256a3e2a7fe948210c4095195ae4db3e3498c6c5fddc2afb226c0f1e97e468")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("7e348def6d03dc7bcbe7e03736ca2898e2efa9f6ff8ae4ed1cb5252ec1744075")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("861859f5d4c14f5d6d7ad88dcf43c9a98064a7d8702ffc9bad9eba2ed766702a")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("4c09b1260c833fefe25b1c3d3becc80979beca5e864d57fcb410bb15c7ba5c14")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("08cf26bfdf2e6b731536f5e48b4c0ac7b5fc846d36aaa3fe0d28f07c207f0814")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("a6e2d1c2770333c9a8a5ac10d9eb28e8609d5954428261335b2fd6ff0e0e8d69")
.unwrap(),
),
)
.unwrap(),
CompressedRistretto::from_slice(
&hex::decode("30beef3b58fd2c18dde771d5c77e32f8dc01361e284aef517bce54a5c74c4665")
.unwrap(),
),
)
.unwrap(),
];

let pc_gens = PedersenGens::default();
Expand Down