diff --git a/snark-verifier-sdk/benches/standard_plonk.rs b/snark-verifier-sdk/benches/standard_plonk.rs index 913687cc..a5d88fe4 100644 --- a/snark-verifier-sdk/benches/standard_plonk.rs +++ b/snark-verifier-sdk/benches/standard_plonk.rs @@ -11,7 +11,6 @@ use halo2_proofs::{ }; use pprof::criterion::{Output, PProfProfiler}; use rand::rngs::OsRng; -use rand::thread_rng; use snark_verifier_sdk::evm::{evm_verify, gen_evm_proof_shplonk, gen_evm_verifier_shplonk}; use snark_verifier_sdk::halo2::aggregation::{AggregationConfigParams, VerifierUniversality}; use snark_verifier_sdk::{ diff --git a/snark-verifier-sdk/examples/k_as_witness.rs b/snark-verifier-sdk/examples/k_as_witness.rs index 95b851ef..d13289fb 100644 --- a/snark-verifier-sdk/examples/k_as_witness.rs +++ b/snark-verifier-sdk/examples/k_as_witness.rs @@ -7,8 +7,6 @@ use halo2_base::halo2_proofs::poly::commitment::Params; use halo2_base::utils::fs::gen_srs; use halo2_proofs::halo2curves as halo2_curves; -use rand::rngs::StdRng; -use rand::SeedableRng; use snark_verifier_sdk::halo2::aggregation::{AggregationConfigParams, VerifierUniversality}; use snark_verifier_sdk::SHPLONK; use snark_verifier_sdk::{ @@ -107,9 +105,9 @@ mod application { layouter.assign_region( || "", |mut region| { - region.assign_advice(|| "", config.a, 0, || Value::known(self.0)); - region.assign_fixed(|| "", config.q_a, 0, || Value::known(-Fr::one())); - region.assign_advice(|| "", config.a, 1, || Value::known(-Fr::from(5u64))); + region.assign_advice(|| "", config.a, 0, || Value::known(self.0))?; + region.assign_fixed(|| "", config.q_a, 0, || Value::known(-Fr::one()))?; + region.assign_advice(|| "", config.a, 1, || Value::known(-Fr::from(5u64)))?; for (idx, column) in (1..).zip([ config.q_a, config.q_b, @@ -122,11 +120,11 @@ mod application { column, 1, || Value::known(Fr::from(idx as u64)), - ); + )?; } let a = region.assign_advice(|| "", config.a, 2, || Value::known(Fr::one()))?; - a.copy_advice(|| "", &mut region, config.b, 3); - a.copy_advice(|| "", &mut region, config.c, 4); + a.copy_advice(|| "", &mut region, config.b, 3)?; + a.copy_advice(|| "", &mut region, config.c, 4)?; // assuming <= 10 blinding factors // fill in most of circuit with a computation @@ -137,7 +135,7 @@ mod application { config.a, offset, || Value::known(-Fr::from(5u64)), - ); + )?; for (idx, column) in (1..).zip([ config.q_a, config.q_b, @@ -150,7 +148,7 @@ mod application { column, offset, || Value::known(Fr::from(idx as u64)), - ); + )?; } } diff --git a/snark-verifier-sdk/examples/vkey_as_witness.rs b/snark-verifier-sdk/examples/vkey_as_witness.rs index 97168723..a6cd5ea4 100644 --- a/snark-verifier-sdk/examples/vkey_as_witness.rs +++ b/snark-verifier-sdk/examples/vkey_as_witness.rs @@ -115,9 +115,9 @@ mod application { layouter.assign_region( || "", |mut region| { - region.assign_advice(|| "", config.a, 0, || Value::known(self.0)); - region.assign_fixed(|| "", config.q_a, 0, || Value::known(-Fr::one())); - region.assign_advice(|| "", config.a, 1, || Value::known(-Fr::from(5u64))); + region.assign_advice(|| "", config.a, 0, || Value::known(self.0))?; + region.assign_fixed(|| "", config.q_a, 0, || Value::known(-Fr::one()))?; + region.assign_advice(|| "", config.a, 1, || Value::known(-Fr::from(5u64)))?; if self.1 != ComputeFlag::SkipFixed { for (idx, column) in (1..).zip([ config.q_a, @@ -131,13 +131,13 @@ mod application { column, 1, || Value::known(Fr::from(idx as u64)), - ); + )?; } } let a = region.assign_advice(|| "", config.a, 2, || Value::known(Fr::one()))?; if self.1 != ComputeFlag::SkipCopy { - a.copy_advice(|| "", &mut region, config.b, 3); - a.copy_advice(|| "", &mut region, config.c, 4); + a.copy_advice(|| "", &mut region, config.b, 3)?; + a.copy_advice(|| "", &mut region, config.c, 4)?; } Ok(()) diff --git a/snark-verifier/examples/evm-verifier-with-accumulator.rs b/snark-verifier/examples/evm-verifier-with-accumulator.rs index 6301492b..7096d9f0 100644 --- a/snark-verifier/examples/evm-verifier-with-accumulator.rs +++ b/snark-verifier/examples/evm-verifier-with-accumulator.rs @@ -12,7 +12,7 @@ use halo2_proofs::{ commitment::ParamsProver, kzg::{ commitment::{KZGCommitmentScheme, ParamsKZG}, - multiopen::{ProverGWC, VerifierGWC}, + multiopen::{ProverSHPLONK, VerifierSHPLONK}, strategy::AccumulatorStrategy, }, VerificationStrategy, @@ -26,7 +26,7 @@ use snark_verifier::{ evm::{self, deploy_and_call, encode_calldata, EvmLoader}, native::NativeLoader, }, - pcs::kzg::{Gwc19, KzgAs, LimbsEncoding}, + pcs::kzg::{Bdfg21, KzgAs, LimbsEncoding}, system::halo2::{compile, transcript::evm::EvmTranscript, Config}, verifier::{self, SnarkVerifier}, }; @@ -35,7 +35,7 @@ use std::{fs::File, io::Cursor, rc::Rc}; const LIMBS: usize = 3; const BITS: usize = 88; -type As = KzgAs; +type As = KzgAs; type PlonkSuccinctVerifier = verifier::plonk::PlonkSuccinctVerifier>; type PlonkVerifier = verifier::plonk::PlonkVerifier>; @@ -46,7 +46,6 @@ mod application { poly::Rotation, }; use super::Fr; - use halo2_base::halo2_proofs::plonk::Assigned; use rand::RngCore; #[derive(Clone, Copy)] @@ -430,7 +429,7 @@ fn gen_proof< let instances = instances.iter().map(|instances| instances.as_slice()).collect_vec(); let proof = { let mut transcript = TW::init(Vec::new()); - create_proof::, ProverGWC<_>, _, _, TW, _>( + create_proof::, ProverSHPLONK<_>, _, _, TW, _>( params, pk, &[circuit], @@ -444,8 +443,8 @@ fn gen_proof< let accept = { let mut transcript = TR::init(Cursor::new(proof.clone())); - VerificationStrategy::<_, VerifierGWC<_>>::finalize( - verify_proof::<_, VerifierGWC<_>, _, TR, _>( + VerificationStrategy::<_, VerifierSHPLONK<_>>::finalize( + verify_proof::<_, VerifierSHPLONK<_>, _, TR, _>( params.verifier_params(), pk.get_vk(), AccumulatorStrategy::new(params.verifier_params()), diff --git a/snark-verifier/examples/evm-verifier.rs b/snark-verifier/examples/evm-verifier.rs index 9c60bd42..00f72eaa 100644 --- a/snark-verifier/examples/evm-verifier.rs +++ b/snark-verifier/examples/evm-verifier.rs @@ -4,14 +4,14 @@ use halo2_proofs::{ dev::MockProver, halo2curves::bn256::{Bn256, Fq, Fr, G1Affine}, plonk::{ - create_proof, keygen_pk, keygen_vk, verify_proof, Advice, Assigned, Circuit, Column, + create_proof, keygen_pk, keygen_vk, verify_proof, Advice, Circuit, Column, ConstraintSystem, Error, Fixed, Instance, ProvingKey, VerifyingKey, }, poly::{ commitment::{Params, ParamsProver}, kzg::{ commitment::{KZGCommitmentScheme, ParamsKZG}, - multiopen::{ProverGWC, VerifierGWC}, + multiopen::{ProverSHPLONK, VerifierSHPLONK}, strategy::AccumulatorStrategy, }, Rotation, VerificationStrategy, @@ -22,13 +22,13 @@ use itertools::Itertools; use rand::{rngs::OsRng, RngCore}; use snark_verifier::{ loader::evm::{self, deploy_and_call, encode_calldata, EvmLoader}, - pcs::kzg::{Gwc19, KzgAs}, + pcs::kzg::{Bdfg21, KzgAs}, system::halo2::{compile, transcript::evm::EvmTranscript, Config}, verifier::{self, SnarkVerifier}, }; use std::rc::Rc; -type PlonkVerifier = verifier::plonk::PlonkVerifier>; +type PlonkVerifier = verifier::plonk::PlonkVerifier>; #[derive(Clone, Copy)] struct StandardPlonkConfig { @@ -192,22 +192,22 @@ fn gen_proof>( let instances = instances.iter().map(|instances| instances.as_slice()).collect_vec(); let proof = { let mut transcript = TranscriptWriterBuffer::<_, G1Affine, _>::init(Vec::new()); - create_proof::, ProverGWC<_>, _, _, EvmTranscript<_, _, _, _>, _>( - params, - pk, - &[circuit], - &[instances.as_slice()], - OsRng, - &mut transcript, - ) + create_proof::< + KZGCommitmentScheme, + ProverSHPLONK<_>, + _, + _, + EvmTranscript<_, _, _, _>, + _, + >(params, pk, &[circuit], &[instances.as_slice()], OsRng, &mut transcript) .unwrap(); transcript.finalize() }; let accept = { let mut transcript = TranscriptReadBuffer::<_, G1Affine, _>::init(proof.as_slice()); - VerificationStrategy::<_, VerifierGWC<_>>::finalize( - verify_proof::<_, VerifierGWC<_>, _, EvmTranscript<_, _, _, _>, _>( + VerificationStrategy::<_, VerifierSHPLONK<_>>::finalize( + verify_proof::<_, VerifierSHPLONK<_>, _, EvmTranscript<_, _, _, _>, _>( params.verifier_params(), pk.get_vk(), AccumulatorStrategy::new(params.verifier_params()),