Skip to content

Commit

Permalink
fix: merge renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
ed255 committed May 17, 2024
1 parent 552043c commit c043d86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions p3_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
extern crate alloc;

use halo2_middleware::circuit::{
Any, Cell, ColumnMid, CompiledCircuitV2, ConstraintSystemMid, ExpressionMid, GateMid,
PreprocessingV2, QueryMid, VarMid,
Any, Cell, ColumnMid, CompiledCircuit, ConstraintSystemMid, ExpressionMid, GateMid,
Preprocessing, QueryMid, VarMid,
};
use halo2_middleware::ff::{Field, PrimeField};
use halo2_middleware::permutation;
Expand Down Expand Up @@ -89,7 +89,7 @@ pub fn compile_preprocessing<F, A>(
size: usize,
pre: &PreprocessingInfo,
_air: &A,
) -> PreprocessingV2<F>
) -> Preprocessing<F>
where
F: PrimeField + Hash,
A: Air<SymbolicAirBuilder<FWrap<F>>>,
Expand Down Expand Up @@ -137,7 +137,7 @@ where
));
}

PreprocessingV2 {
Preprocessing {
permutation: permutation::AssemblyMid { copies },
fixed,
}
Expand Down Expand Up @@ -307,7 +307,7 @@ pub fn trace_to_wit<F: Field>(k: u32, trace: RowMajorMatrix<FWrap<F>>) -> Vec<Op

// TODO: Move to middleware
pub fn check_witness<F: Field>(
circuit: &CompiledCircuitV2<F>,
circuit: &CompiledCircuit<F>,
k: u32,
witness: &[Option<Vec<F>>],
public: &[Vec<F>],
Expand Down
36 changes: 18 additions & 18 deletions p3_frontend/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ use halo2_backend::poly::kzg::multiopen::{ProverSHPLONK, VerifierSHPLONK};
use halo2_backend::poly::kzg::strategy::SingleStrategy;
use halo2_backend::{
plonk::{
keygen::{keygen_pk_v2, keygen_vk_v2},
prover::ProverV2Single,
keygen::{keygen_pk, keygen_vk},
prover::ProverSingle,
verifier::verify_proof_single,
},
transcript::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2_middleware::circuit::CompiledCircuitV2;
use halo2_middleware::circuit::CompiledCircuit;
use halo2_middleware::zal::impls::H2cEngine;
use halo2curves::bn256::{Bn256, Fr, G1Affine};
use p3_air::Air;
use p3_frontend::{
Expand Down Expand Up @@ -46,7 +47,7 @@ pub(crate) fn compile_witgen<A>(
size: usize,
num_public_values: usize,
trace: RowMajorMatrix<FWrap<Fr>>,
) -> (CompiledCircuitV2<Fr>, Vec<Option<Vec<Fr>>>, Vec<Vec<Fr>>)
) -> (CompiledCircuit<Fr>, Vec<Option<Vec<Fr>>>, Vec<Vec<Fr>>)
where
A: Air<SymbolicAirBuilder<FWrap<Fr>>>,
{
Expand All @@ -61,7 +62,7 @@ where
cs.gates.iter().map(|g| g.poly.degree()).max().unwrap()
);
let preprocessing = compile_preprocessing::<Fr, _>(k, size, &preprocessing_info, &air);
let compiled_circuit = CompiledCircuitV2 { cs, preprocessing };
let compiled_circuit = CompiledCircuit { cs, preprocessing };
let witness = trace_to_wit(k, trace);
let pis = get_public_inputs(&preprocessing_info, size, &witness);

Expand All @@ -70,7 +71,7 @@ where
}

pub(crate) fn setup_prove_verify(
compiled_circuit: &CompiledCircuitV2<Fr>,
compiled_circuit: &CompiledCircuit<Fr>,
k: u32,
pis: &[Vec<Fr>],
witness: Vec<Option<Vec<Fr>>>,
Expand All @@ -80,25 +81,24 @@ pub(crate) fn setup_prove_verify(
let params = ParamsKZG::<Bn256>::setup(k, &mut rng);
let verifier_params = params.verifier_params();
let start = Instant::now();
let vk = keygen_vk_v2(&params, compiled_circuit).expect("keygen_vk should not fail");
let pk =
keygen_pk_v2(&params, vk.clone(), compiled_circuit).expect("keygen_pk should not fail");
let vk = keygen_vk(&params, compiled_circuit).expect("keygen_vk should not fail");
let pk = keygen_pk(&params, vk.clone(), compiled_circuit).expect("keygen_pk should not fail");
println!("Keygen: {:?}", start.elapsed());

// Proving
println!("Proving...");
let start = Instant::now();
let vec_slices: Vec<&[Fr]> = pis.iter().map(|pi| &pi[..]).collect();
let mut transcript = Blake2bWrite::<_, G1Affine, Challenge255<_>>::init(vec![]);
let mut prover =
ProverV2Single::<KZGCommitmentScheme<Bn256>, ProverSHPLONK<'_, Bn256>, _, _, _>::new(
&params,
&pk,
&vec_slices,
&mut rng,
&mut transcript,
)
.unwrap();
let mut prover = ProverSingle::<
KZGCommitmentScheme<Bn256>,
ProverSHPLONK<'_, Bn256>,
_,
_,
_,
H2cEngine,
>::new(&params, &pk, &vec_slices, &mut rng, &mut transcript)
.unwrap();
println!("phase 0");
prover.commit_phase(0, witness).unwrap();
prover.create_proof().unwrap();
Expand Down

0 comments on commit c043d86

Please sign in to comment.