Skip to content

Commit

Permalink
Remove integrated heap profiling. Rename crate to halo2_debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
adria0 committed Jun 3, 2024
1 parent ed4c33b commit 0c54819
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"halo2_frontend",
"halo2_middleware",
"halo2_backend",
"halo2_test_utils",
"halo2_debug",
"p3_frontend"
]
resolver = "2"
2 changes: 1 addition & 1 deletion halo2_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gumdrop = "0.8"
proptest = "1"
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
serde_json = "1"
halo2_test_utils = { path = "../halo2_test_utils" }
halo2_debug = { path = "../halo2_debug" }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
getrandom = { version = "0.2", features = ["js"] }
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ use halo2curves::pasta::Fp;

#[test]
fn test_lagrange_interpolate() {
use halo2_test_utils::test_rng;
use halo2_debug::test_rng;
let rng = test_rng();

let points = (0..5).map(|_| Fp::random(rng)).collect::<Vec<_>>();
Expand Down
4 changes: 2 additions & 2 deletions halo2_backend/src/poly/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ pub struct PinnedEvaluationDomain<'a, F: Field> {
#[test]
fn test_rotate() {
use crate::arithmetic::eval_polynomial;
use halo2_test_utils::test_rng;
use halo2_debug::test_rng;
use halo2curves::pasta::pallas::Scalar;

let domain = EvaluationDomain::<Scalar>::new(1, 3);
Expand Down Expand Up @@ -518,7 +518,7 @@ fn test_rotate() {
#[test]
fn test_l_i() {
use crate::arithmetic::{eval_polynomial, lagrange_interpolate};
use halo2_test_utils::test_rng;
use halo2_debug::test_rng;
use halo2curves::pasta::pallas::Scalar;
let domain = EvaluationDomain::<Scalar>::new(1, 3);

Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/ipa/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ mod test {
use crate::poly::ipa::msm::MSMIPA;

use group::Curve;
use halo2_debug::test_rng;
use halo2_middleware::ff::Field;
use halo2_middleware::zal::impls::H2cEngine;
use halo2_test_utils::test_rng;

#[test]
fn test_commit_lagrange_epaffine() {
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/ipa/msm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ mod tests {
commitment::{ParamsProver, MSM},
ipa::{commitment::ParamsIPA, msm::MSMIPA},
};
use halo2_debug::test_rng;
use halo2_middleware::zal::impls::H2cEngine;
use halo2_test_utils::test_rng;
use halo2curves::{
pasta::{Ep, EpAffine, Fp, Fq},
CurveAffine,
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/kzg/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ mod test {
use crate::poly::commitment::ParamsProver;
use crate::poly::commitment::{Blind, Params};
use crate::poly::kzg::commitment::ParamsKZG;
use halo2_debug::test_rng;
use halo2_middleware::ff::Field;
use halo2_middleware::zal::impls::H2cEngine;
use halo2_test_utils::test_rng;

#[test]
fn test_commit_lagrange() {
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/multiopen_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ mod test {
TranscriptReadBuffer, TranscriptWriterBuffer,
};
use group::Curve;
use halo2_debug::test_rng;
use halo2_middleware::ff::WithSmallOrderMulGroup;
use halo2_middleware::zal::{impls::H2cEngine, traits::MsmAccel};
use halo2_test_utils::test_rng;

#[test]
fn test_roundtrip_ipa() {
Expand Down
14 changes: 7 additions & 7 deletions halo2_test_utils/Cargo.toml → halo2_debug/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
[package]
name = "halo2_test_utils"
name = "halo2_debug"
version = "0.3.0"
authors = [
"Sean Bowe <[email protected]>",
"Ying Tong Lai <[email protected]>",
"Daira Hopwood <[email protected]>",
"Jack Grigg <[email protected]>",
"Privacy Scaling Explorations team",
]
edition = "2021"
rust-version = "1.66.0"
description = """
Fast PLONK-based zero-knowledge proving system with no trusted setup
Halo2 Debug. This package contains utilities for debugging and testing within
the halo2 ecosystem.
"""
license = "MIT OR Apache-2.0"
repository = "https://github.com/privacy-scaling-explorations/halo2"
documentation = "https://privacy-scaling-explorations.github.io/halo2/"
readme = "README.md"
categories = ["cryptography"]
keywords = ["halo", "proofs", "zkp", "zkSNARKs"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]

[dependencies]
tiny-keccak = { version = "2.0.2", features=["keccak"] }
hex = "0.4.3"
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion halo2_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ bits = ["halo2curves/bits"]
gadget-traces = ["backtrace"]
thread-safe-region = []
circuit-params = []
heap-profiling = []
cost-estimator = ["serde", "serde_derive"]
derive_serde = ["halo2curves/derive_serde"]

Expand Down
4 changes: 1 addition & 3 deletions halo2_proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ harness = false
halo2_middleware = { path = "../halo2_middleware" }
halo2_backend = { path = "../halo2_backend" }
halo2_frontend = { path = "../halo2_frontend" }
halo2_test_utils = { path = "../halo2_test_utils" }
halo2_debug = { path = "../halo2_debug" }
halo2curves = { version = "0.6.1", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
plotters = { version = "0.3.0", default-features = false, optional = true }
Expand All @@ -60,7 +60,6 @@ assert_matches = "1.5"
criterion = "0.3"
gumdrop = "0.8"
proptest = "1"
dhat = "0.3.2"
serde_json = "1"

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
Expand All @@ -82,7 +81,6 @@ thread-safe-region = ["halo2_frontend/thread-safe-region"]
sanity-checks = ["halo2_backend/sanity-checks"]
batch = ["rand_core/getrandom", "halo2_backend/batch"]
circuit-params = ["halo2_frontend/circuit-params"]
heap-profiling = ["halo2_frontend/heap-profiling"]
cost-estimator = ["halo2_frontend/cost-estimator"]
derive_serde = ["halo2curves/derive_serde", "halo2_frontend/derive_serde", "halo2_backend/derive_serde"]

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/benches/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
extern crate criterion;

use group::ff::Field;
use halo2_debug::test_rng;
use halo2_proofs::circuit::{Cell, Layouter, SimpleFloorPlanner, Value};
use halo2_proofs::plonk::*;
use halo2_proofs::poly::{commitment::ParamsProver, Rotation};
use halo2_proofs::transcript::{Blake2bRead, Blake2bWrite, Challenge255};
use halo2_test_utils::test_rng;
use halo2curves::pasta::{EqAffine, Fp};

use halo2_proofs::{
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/examples/circuit-layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl<F: Field> Circuit<F> for MyCircuit<F> {
fn main() {
// Prepare the circuit you want to render.
// You don't need to include any witness variables.
let a = Fp::random(halo2_test_utils::test_rng());
let a = Fp::random(halo2_debug::test_rng());
let instance = Fp::one() + Fp::one();
let lookup_table = vec![instance, a, a, Fp::zero()];
let circuit: MyCircuit<Fp> = MyCircuit {
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/examples/two-chip.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::marker::PhantomData;

use halo2_debug::test_rng;
use halo2_proofs::{
arithmetic::Field,
circuit::{AssignedCell, Chip, Layouter, Region, SimpleFloorPlanner, Value},
plonk::{Advice, Circuit, Column, ConstraintSystem, ErrorFront, Instance, Selector},
poly::Rotation,
};
use halo2_test_utils::test_rng;

// ANCHOR: field-instructions
/// A variable representing a number.
Expand Down
4 changes: 2 additions & 2 deletions halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn test_create_proof() {
},
transcript::{Blake2bWrite, Challenge255, TranscriptWriterBuffer},
};
use halo2_debug::test_rng;
use halo2_middleware::ff::Field;
use halo2_test_utils::test_rng;
use halo2curves::bn256::Bn256;

#[derive(Clone, Copy)]
Expand Down Expand Up @@ -178,8 +178,8 @@ fn test_create_proof_custom() {
},
transcript::{Blake2bWrite, Challenge255, TranscriptWriterBuffer},
};
use halo2_debug::test_rng;
use halo2_middleware::ff::Field;
use halo2_test_utils::test_rng;
use halo2curves::bn256::Bn256;

#[derive(Clone, Copy)]
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/compress_selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use halo2_proofs::poly::Rotation;
use halo2_backend::transcript::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
};
use halo2_debug::{assert_test_proof, one_rng};
use halo2_middleware::zal::impls::{H2cEngine, PlonkEngineConfig};
use halo2_proofs::arithmetic::Field;
use halo2_proofs::plonk::{
Expand All @@ -19,7 +20,6 @@ use halo2_proofs::plonk::{
use halo2_proofs::poly::kzg::commitment::{KZGCommitmentScheme, ParamsKZG};
use halo2_proofs::poly::kzg::multiopen::{ProverSHPLONK, VerifierSHPLONK};
use halo2_proofs::poly::kzg::strategy::SingleStrategy;
use halo2_test_utils::{assert_test_proof, one_rng};
use halo2curves::bn256::{Bn256, Fr, G1Affine};

#[derive(Debug, Clone)]
Expand Down
12 changes: 1 addition & 11 deletions halo2_proofs/tests/frontend_backend_split.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#![allow(clippy::many_single_char_names)]
#![allow(clippy::op_ref)]

#[cfg(feature = "heap-profiling")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

use halo2_backend::{
plonk::{
keygen::{keygen_pk, keygen_vk},
Expand All @@ -15,6 +11,7 @@ use halo2_backend::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2_debug::{assert_test_proof, one_rng};
use halo2_frontend::{
circuit::{
compile_circuit, AssignedCell, Layouter, Region, SimpleFloorPlanner, Value,
Expand All @@ -28,7 +25,6 @@ use halo2_frontend::{
},
};
use halo2_middleware::{ff::Field, poly::Rotation};
use halo2_test_utils::{assert_test_proof, one_rng};
use std::collections::HashMap;

#[derive(Clone)]
Expand Down Expand Up @@ -489,9 +485,6 @@ const WIDTH_FACTOR: usize = 1;

#[test]
fn test_mycircuit_full_legacy() {
#[cfg(all(feature = "heap-profiling", not(coverage)))]
let _profiler = dhat::Profiler::new_heap();

use halo2_proofs::plonk::{
create_proof, keygen_pk as keygen_pk_legacy, keygen_vk as keygen_vk_legacy,
};
Expand Down Expand Up @@ -555,9 +548,6 @@ fn test_mycircuit_full_legacy() {
fn test_mycircuit_full_split() {
use halo2_middleware::zal::impls::{H2cEngine, PlonkEngineConfig};

#[cfg(all(feature = "heap-profiling", not(coverage)))]
let _profiler = dhat::Profiler::new_heap();

let engine = PlonkEngineConfig::new()
.set_curve::<G1Affine>()
.set_msm(H2cEngine::new())
Expand Down
4 changes: 2 additions & 2 deletions halo2_proofs/tests/plonk_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

use assert_matches::assert_matches;
use ff::{FromUniformBytes, WithSmallOrderMulGroup};
use halo2_debug::test_rng;
use halo2_debug::{assert_test_proof, one_rng};
use halo2_middleware::zal::{
impls::{PlonkEngine, PlonkEngineConfig},
traits::MsmAccel,
Expand All @@ -22,8 +24,6 @@ use halo2_proofs::transcript::{
Blake2bRead, Blake2bWrite, Challenge255, EncodedChallenge, TranscriptReadBuffer,
TranscriptWriterBuffer,
};
use halo2_test_utils::test_rng;
use halo2_test_utils::{assert_test_proof, one_rng};
use rand_core::RngCore;
use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
};

use ff::Field;
use halo2_debug::{assert_test_proof, one_rng};
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
plonk::{
Expand All @@ -23,7 +24,6 @@ use halo2_proofs::{
},
SerdeFormat,
};
use halo2_test_utils::{assert_test_proof, one_rng};
use halo2curves::bn256::{Bn256, Fr, G1Affine};

#[derive(Clone, Copy)]
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/shuffle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ff::{BatchInvert, FromUniformBytes};
use halo2_debug::{assert_test_proof, one_rng};
use halo2_proofs::{
arithmetic::{CurveAffine, Field},
circuit::{floor_planner::V1, Layouter, Value},
Expand All @@ -18,7 +19,6 @@ use halo2_proofs::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2_test_utils::{assert_test_proof, one_rng};
use rand_chacha::ChaCha20Rng;
use rand_core::{RngCore, SeedableRng};
use std::iter;
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/shuffle_api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{marker::PhantomData, vec};

use ff::FromUniformBytes;
use halo2_debug::{assert_test_proof, one_rng};
use halo2_proofs::{
arithmetic::Field,
circuit::{Layouter, SimpleFloorPlanner, Value},
Expand All @@ -22,7 +23,6 @@ use halo2_proofs::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2_test_utils::{assert_test_proof, one_rng};
use halo2curves::{pasta::EqAffine, CurveAffine};

struct ShuffleChip<F: Field> {
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/vector-ops-unblinded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use std::marker::PhantomData;

use ff::FromUniformBytes;
use halo2_debug::{assert_test_proof, one_rng};
use halo2_proofs::{
arithmetic::{CurveAffine, Field},
circuit::{AssignedCell, Chip, Layouter, Region, SimpleFloorPlanner, Value},
Expand All @@ -21,7 +22,6 @@ use halo2_proofs::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2_test_utils::{assert_test_proof, one_rng};

// ANCHOR: instructions
trait NumericInstructions<F: Field>: Chip<F> {
Expand Down

0 comments on commit 0c54819

Please sign in to comment.