Further cleanups.

This commit is contained in:
therealyingtong 2021-08-25 13:38:23 +08:00
parent c6a37af154
commit cf5dd3b396
7 changed files with 17 additions and 12 deletions

View File

@ -9,5 +9,3 @@ members = [
[patch.crates-io]
halo2 = { git = "https://github.com/zcash/halo2.git", rev = "27c4187673a9c6ade13fbdbd4f20955530c22d7f" }
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "13b023387bafdc7b5712c933dc0e16ee94b96a6a" }
orchard = { path = "../" }

View File

@ -709,7 +709,7 @@ mod tests {
root.fill(&WHITE).unwrap();
let root = root.titled("Ecc Chip Layout", ("sans-serif", 60)).unwrap();
let circuit = MyCircuit {};
let circuit = super::testing::MyCircuit::<Test, FixedBase>(std::marker::PhantomData);
halo2::dev::CircuitLayout::default()
.render(13, &circuit, &root)
.unwrap();

View File

@ -23,8 +23,12 @@ bitvec = "0.22"
ff = "0.10"
halo2 = { version = "0.0", optional = true }
pasta_curves = "0.1.2"
rand = "0.8"
utilities = { package = "halo2_utilities", version = "0.0", path = "../halo2_utilities" }
[dev-dependencies]
criterion = "0.3"
[[bench]]
name = "primitive"
harness = false

View File

@ -1,16 +1,14 @@
use std::array;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use criterion::{criterion_group, criterion_main, Criterion};
use ff::Field;
use poseidon::primitive::{ConstantLength, Hash, P128Pow5T3};
use halo2_poseidon::primitive::{ConstantLength, Hash, P128Pow5T3};
use pasta_curves::pallas;
#[cfg(unix)]
use pprof::criterion::{Output, PProfProfiler};
use rand::{rngs::OsRng, Rng};
use rand::rngs::OsRng;
fn bench_primitives(c: &mut Criterion) {
let mut rng = OsRng;
let rng = OsRng;
{
let mut group = c.benchmark_group("Poseidon");

View File

@ -126,7 +126,6 @@ impl<F: FieldExt + PrimeFieldBits, const K: usize> LookupRangeCheckConfig<F, K>
config
}
#[cfg(test)]
// Loads the values [0..2^K) into `table_idx`. This is only used in testing
// for now, since the Sinsemilla chip provides a pre-loaded table in the
// Orchard context.

View File

@ -445,7 +445,12 @@ pub mod tests {
root.fill(&WHITE).unwrap();
let root = root.titled("MerkleCRH Path", ("sans-serif", 60)).unwrap();
let circuit = super::testing::MyCircuit::<Hash, Commit, FixedBase, Test>::default();
let circuit = super::testing::MyCircuit::<Hash, Commit, FixedBase, Test> {
leaf: None,
leaf_pos: None,
merkle_path: None,
_marker: std::marker::PhantomData,
};
halo2::dev::CircuitLayout::default()
.show_labels(false)
.render(11, &circuit, &root)

View File

@ -358,6 +358,7 @@ where
{
use crate::{merkle::i2lebsp, primitive::HashDomain};
use ff::PrimeFieldBits;
use group::prime::PrimeCurveAffine;
if let (Some(left), Some(right)) = (left.value(), right.value()) {
let l = i2lebsp::<10>(l as u64);
@ -373,7 +374,7 @@ where
.by_val()
.take(L_PALLAS_BASE)
.collect();
let merkle_crh = HashDomain { Q };
let merkle_crh = HashDomain { Q: Q.to_curve() };
let mut message = l.to_vec();
message.extend_from_slice(&left);