Skip to content

Commit

Permalink
chore: add compile function to AggregationDependencyIntent
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Jan 1, 2024
1 parent c074006 commit 5c4be4f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion snark-verifier-sdk/src/halo2/utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
use halo2_base::halo2_proofs::{
halo2curves::bn256::{Fr, G1Affine},
halo2curves::bn256::{Bn256, Fr, G1Affine},
plonk::{Circuit, VerifyingKey},
poly::kzg::commitment::ParamsKZG,
};
use rand::{rngs::StdRng, SeedableRng};
use snark_verifier::{
system::halo2::{compile, Config},
verifier::plonk::PlonkProtocol,
};

use crate::{Snark, SHPLONK};

Expand All @@ -27,6 +31,19 @@ pub struct AggregationDependencyIntentOwned {
pub agg_vk_hash_data: Option<((usize, usize), Fr)>,
}

impl<'a> AggregationDependencyIntent<'a> {
/// Converts `self` into `PlonkProtocol`
pub fn compile(self, params: &ParamsKZG<Bn256>) -> PlonkProtocol<G1Affine> {
compile(
params,
self.vk,
Config::kzg()
.with_num_instance(self.num_instance.to_vec())
.with_accumulator_indices(self.accumulator_indices.map(|v| v.to_vec())),
)
}
}

/// This trait should be implemented on the minimal circuit configuration data necessary to
/// completely determine an aggregation circuit
/// (independent of circuit inputs or specific snarks to be aggregated).
Expand Down

0 comments on commit 5c4be4f

Please sign in to comment.