Skip to content

Commit 26ee455

Browse files
committed
Update repo to use current dalek-cryptography dependencies
1 parent 322fc3e commit 26ee455

File tree

6 files changed

+10
-24
lines changed

6 files changed

+10
-24
lines changed

Cargo.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,18 @@ exclude = [
1818
features = ["nightly"]
1919

2020
[dependencies]
21-
merlin = "2"
22-
rand = "0.7"
21+
merlin = "3"
22+
rand = { version = "0.8", features = ["std"] }
2323
serde = "1"
2424
serde_derive = "1"
2525
thiserror = "1"
2626
# Disable default features to deselect a backend, then select one below
27-
curve25519-dalek = { version = "2", default-features = false, features = ["serde", "std"] }
27+
curve25519-dalek = { version = "4", default-features = false, features = ["serde", "rand_core", "alloc", "digest", "precomputed-tables"] }
2828

2929
[dev-dependencies]
3030
bincode = "1"
31-
sha2 = "0.8"
31+
sha2 = "0.10"
3232

3333
[features]
34-
nightly = ["curve25519-dalek/nightly"]
3534
debug-transcript = ["merlin/debug-transcript"]
3635
bench = []
37-
default = ["u64_backend"]
38-
u32_backend = ["curve25519-dalek/u32_backend"]
39-
u64_backend = ["curve25519-dalek/u64_backend"]
40-
simd_backend = ["curve25519-dalek/simd_backend"]

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ extern crate zkp;
6464
The `nightly` feature enables nightly-specific features. It is required
6565
to build the documentation.
6666

67-
#### Backend selection
68-
69-
`zkp` provides the following pass-through features to select a
70-
`curve25519-dalek` backend:
71-
72-
* `u32_backend`
73-
* `u64_backend`
74-
* `simd_backend`
75-
7667
#### Transcript debugging
7768

7869
The `debug-transcript` feature is for development and testing, and

src/toolbox/batch_verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a> BatchVerifier<'a> {
170170
let num_i = self.instance_points.len();
171171
let num_c = self.constraints.len();
172172

173-
let mut static_coeffs = vec![Scalar::zero(); num_s];
173+
let mut static_coeffs = vec![Scalar::ZERO; num_s];
174174
let mut instance_coeffs = Matrix::<Scalar>::new(num_i + num_c, self.batch_size);
175175

176176
for i in 0..num_c {

src/toolbox/verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'a> Verifier<'a> {
144144
let commitments_offset = self.points.len();
145145
let combined_points = self.points.iter().chain(proof.commitments.iter());
146146

147-
let mut coeffs = vec![Scalar::zero(); self.points.len() + proof.commitments.len()];
147+
let mut coeffs = vec![Scalar::ZERO; self.points.len() + proof.commitments.len()];
148148
// For each constraint of the form Q = sum(P_i, x_i),
149149
// we want to ensure Q_com = sum(P_i, resp_i) - c * Q,
150150
// so add the check rand*( sum(P_i, resp_i) - c * Q - Q_com ) == 0

tests/sig_and_vrf_example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct PublicKey(RistrettoPoint, CompressedRistretto);
5555

5656
impl<'a> From<&'a SecretKey> for PublicKey {
5757
fn from(sk: &'a SecretKey) -> PublicKey {
58-
let pk = &sk.0 * &dalek_constants::RISTRETTO_BASEPOINT_TABLE;
58+
let pk = &sk.0 * dalek_constants::RISTRETTO_BASEPOINT_TABLE;
5959
PublicKey(pk, pk.compress())
6060
}
6161
}

tests/zkp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn create_and_verify_compact() {
3333
let (proof, points) = {
3434
let H = RistrettoPoint::hash_from_bytes::<Sha512>(b"A VRF input, for instance");
3535
let x = Scalar::from(89327492234u64).invert();
36-
let A = &x * &dalek_constants::RISTRETTO_BASEPOINT_TABLE;
36+
let A = &x * dalek_constants::RISTRETTO_BASEPOINT_TABLE;
3737
let B = &x * &H;
3838

3939
let mut transcript = Transcript::new(b"DLEQTest");
@@ -76,7 +76,7 @@ fn create_and_verify_batchable() {
7676
let (proof, points) = {
7777
let H = RistrettoPoint::hash_from_bytes::<Sha512>(b"A VRF input, for instance");
7878
let x = Scalar::from(89327492234u64).invert();
79-
let A = &x * &dalek_constants::RISTRETTO_BASEPOINT_TABLE;
79+
let A = &x * dalek_constants::RISTRETTO_BASEPOINT_TABLE;
8080
let B = &x * &H;
8181

8282
let mut transcript = Transcript::new(b"DLEQTest");
@@ -129,7 +129,7 @@ fn create_batch_and_batch_verify() {
129129
for (i, message) in messages.iter().enumerate() {
130130
let H = RistrettoPoint::hash_from_bytes::<Sha512>(message.as_bytes());
131131
let x = Scalar::from(89327492234u64) * Scalar::from((i + 1) as u64);
132-
let A = &x * &dalek_constants::RISTRETTO_BASEPOINT_TABLE;
132+
let A = &x * dalek_constants::RISTRETTO_BASEPOINT_TABLE;
133133
let B = &x * &H;
134134

135135
let mut transcript = Transcript::new(b"DLEQTest");

0 commit comments

Comments
 (0)