Skip to content

Commit

Permalink
Merge of #6536
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 18, 2023
2 parents 0d50d97 + 01d350c commit 4a07ca5
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 107 deletions.
307 changes: 235 additions & 72 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ skip-tree = [
# wait for zcash_primitives to remove duplicated dependencies
{ name = "block-buffer", version = "=0.9.0" },

# wait for zcash_address to upgrade
{ name = "bech32", version = "=0.8.1"},

# wait for zcash_proofs to upgrade `directories`
{ name = "dirs-sys", version = "=0.3.7"},

# zebra-utils dependencies

# wait for structopt upgrade (or upgrade to clap 3)
Expand Down
14 changes: 7 additions & 7 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ blake2s_simd = "1.0.1"
bs58 = { version = "0.4.0", features = ["check"] }
byteorder = "1.4.3"
equihash = "0.2.0"
group = "0.12.0"
group = "0.13.0"
incrementalmerkletree = "0.3.1"
jubjub = "0.9.0"
jubjub = "0.10.0"
lazy_static = "1.4.0"
primitive-types = "0.11.1"
rand_core = "0.6.4"
Expand All @@ -55,12 +55,12 @@ uint = "0.9.5"
x25519-dalek = { version = "2.0.0-pre.1", features = ["serde"] }

# ECC deps
halo2 = { package = "halo2_proofs", version = "0.2.0" }
orchard = "0.3.0"
halo2 = { package = "halo2_proofs", version = "0.3.0" }
orchard = "0.4.0"
zcash_encoding = "0.2.0"
zcash_history = "0.3.0"
zcash_note_encryption = "0.2.0"
zcash_primitives = { version = "0.10.2", features = ["transparent-inputs"] }
zcash_note_encryption = "0.3.0"
zcash_primitives = { version = "0.11.0", features = ["transparent-inputs"] }

# Time
chrono = { version = "0.4.24", default-features = false, features = ["clock", "std", "serde"] }
Expand All @@ -85,7 +85,7 @@ rayon = "1.7.0"

# ZF deps
ed25519-zebra = "3.1.0"
redjubjub = "0.5.0"
redjubjub = "0.7.0"
reddsa = "0.5.0"

# Experimental feature getblocktemplate-rpcs
Expand Down
17 changes: 10 additions & 7 deletions zebra-chain/src/orchard/arbitrary.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//! Randomised data generation for Orchard types.
use group::{ff::PrimeField, prime::PrimeCurveAffine};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use proptest::{arbitrary::any, array, collection::vec, prelude::*};

use group::{
ff::{FromUniformBytes, PrimeField},
prime::PrimeCurveAffine,
};
use halo2::pasta::pallas;
use reddsa::{orchard::SpendAuth, Signature, SigningKey, VerificationKey, VerificationKeyBytes};

use proptest::{arbitrary::any, array, collection::vec, prelude::*};

use super::{
keys::*, note, tree, Action, AuthorizedAction, Flags, NoteCommitment, ValueCommitment,
};
Expand Down Expand Up @@ -42,7 +45,7 @@ impl Arbitrary for note::Nullifier {
(vec(any::<u8>(), 64))
.prop_map(|bytes| {
let bytes = bytes.try_into().expect("vec is the correct length");
Self::try_from(pallas::Scalar::from_bytes_wide(&bytes).to_repr())
Self::try_from(pallas::Scalar::from_uniform_bytes(&bytes).to_repr())
.expect("a valid generated nullifier")
})
.boxed()
Expand Down Expand Up @@ -98,7 +101,7 @@ impl Arbitrary for SpendAuthVerificationKeyBytes {
.prop_map(|bytes| {
let bytes = bytes.try_into().expect("vec is the correct length");
// Convert to a scalar
let sk_scalar = pallas::Scalar::from_bytes_wide(&bytes);
let sk_scalar = pallas::Scalar::from_uniform_bytes(&bytes);
// Convert that back to a (canonical) encoding
let sk_bytes = sk_scalar.to_repr();
// Decode it into a signing key
Expand Down Expand Up @@ -129,7 +132,7 @@ impl Arbitrary for tree::Root {
(vec(any::<u8>(), 64))
.prop_map(|bytes| {
let bytes = bytes.try_into().expect("vec is the correct length");
Self::try_from(pallas::Base::from_bytes_wide(&bytes).to_repr())
Self::try_from(pallas::Base::from_uniform_bytes(&bytes).to_repr())
.expect("a valid generated Orchard note commitment tree root")
})
.boxed()
Expand Down
10 changes: 7 additions & 3 deletions zebra-chain/src/orchard/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
use std::{fmt, io};

use group::{ff::PrimeField, prime::PrimeCurveAffine, GroupEncoding};
use group::{
ff::{FromUniformBytes, PrimeField},
prime::PrimeCurveAffine,
GroupEncoding,
};
use halo2::{
arithmetic::{Coordinates, CurveAffine, FieldExt},
arithmetic::{Coordinates, CurveAffine},
pasta::pallas,
};
use lazy_static::lazy_static;
Expand All @@ -29,7 +33,7 @@ where
let mut bytes = [0u8; 64];
csprng.fill_bytes(&mut bytes);
// pallas::Scalar::from_bytes_wide() reduces the input modulo q_P under the hood.
pallas::Scalar::from_bytes_wide(&bytes)
pallas::Scalar::from_uniform_bytes(&bytes)
}

/// The randomness used in the Simsemilla hash for note commitment.
Expand Down
5 changes: 3 additions & 2 deletions zebra-chain/src/sapling/arbitrary.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::convert::TryInto;
//! Randomised data generation for sapling types.
use group::Group;
use jubjub::{AffinePoint, ExtendedPoint};
use proptest::{arbitrary::any, collection::vec, prelude::*};
use rand::SeedableRng;
use rand_chacha::ChaChaRng;

use proptest::{arbitrary::any, collection::vec, prelude::*};

use crate::primitives::Groth16Proof;

use super::{
Expand Down
12 changes: 6 additions & 6 deletions zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl", "ze

[dependencies]
blake2b_simd = "1.0.1"
bellman = "0.13.0"
bls12_381 = "0.7.0"
halo2 = { package = "halo2_proofs", version = "0.2.0" }
jubjub = "0.9.0"
bellman = "0.14.0"
bls12_381 = "0.8.0"
halo2 = { package = "halo2_proofs", version = "0.3.0" }
jubjub = "0.10.0"
rand = { version = "0.8.5", package = "rand" }
rayon = "1.7.0"

Expand All @@ -49,9 +49,9 @@ tower = { version = "0.4.13", features = ["timeout", "util", "buffer"] }
tracing = "0.1.37"
tracing-futures = "0.2.5"

orchard = "0.3.0"
orchard = "0.4.0"

zcash_proofs = { version = "0.10.0", features = ["local-prover", "multicore", "download-params"] }
zcash_proofs = { version = "0.11.0", features = ["local-prover", "multicore", "download-params"] }

tower-fallback = { path = "../tower-fallback/" }
tower-batch = { path = "../tower-batch/" }
Expand Down
2 changes: 0 additions & 2 deletions zebra-consensus/src/primitives/halo2/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ where
}

#[tokio::test(flavor = "multi_thread")]
// TODO: This test fails on nightly so it is temporally disabled. Enable when #6232 is resolved.
#[ignore]
async fn verify_generated_halo2_proofs() {
let _init_guard = zebra_test::init();

Expand Down
4 changes: 2 additions & 2 deletions zebra-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ insta = { version = "1.29.0", features = ["ron"] }
proptest = "1.1.0"
proptest-derive = "0.3.0"

halo2 = { package = "halo2_proofs", version = "0.2.0" }
jubjub = "0.9.0"
halo2 = { package = "halo2_proofs", version = "0.3.0" }
jubjub = "0.10.0"

tokio = { version = "1.27.0", features = ["full", "tracing", "test-util"] }

Expand Down

0 comments on commit 4a07ca5

Please sign in to comment.