Skip to content

Commit

Permalink
Decrease sparse commitment size
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunming Jiang committed Dec 12, 2024
1 parent 1eb023e commit 7743f9a
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 125 deletions.
33 changes: 23 additions & 10 deletions circ_blocks/examples/zxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,16 +1308,29 @@ fn run_spartan_proof<S: SpartanExtensionField>(
println!("Generating Circuits...");
// --
// BLOCK INSTANCES
// block_inst is used by sumcheck. Every block has the same number of variables
let (block_num_vars, block_num_cons, block_num_non_zero_entries, mut block_inst) =
Instance::gen_block_inst::<true>(
block_num_instances_bound,
num_vars,
&ctk.args,
num_inputs_unpadded,
&block_num_phy_ops,
&block_num_vir_ops,
&ctk.num_vars_per_block,
&rtk.block_num_proofs,
Instance::gen_block_inst::<true, false>(
block_num_instances_bound,
num_vars,
&ctk.args,
num_inputs_unpadded,
&block_num_phy_ops,
&block_num_vir_ops,
&ctk.num_vars_per_block,
&rtk.block_num_proofs,
);
// block_inst is used by commitment. Every block has different number of variables
let (_, _, _, block_inst_for_commit) =
Instance::<S>::gen_block_inst::<true, true>(
block_num_instances_bound,
num_vars,
&ctk.args,
num_inputs_unpadded,
&block_num_phy_ops,
&block_num_vir_ops,
&ctk.num_vars_per_block,
&rtk.block_num_proofs,
);
println!("Finished Block");

Expand Down Expand Up @@ -1355,7 +1368,7 @@ fn run_spartan_proof<S: SpartanExtensionField>(
println!("Comitting Circuits...");
// block_comm_map records the sparse_polys committed in each commitment
// Note that A, B, C are committed separately, so sparse_poly[3*i+2] corresponds to poly C of instance i
let (block_comm_map, block_comm_list, block_decomm_list) = SNARK::multi_encode(&block_inst);
let (block_comm_map, block_comm_list, block_decomm_list) = SNARK::multi_encode(&block_inst_for_commit);
println!("Finished Block");
let (pairwise_check_comm, pairwise_check_decomm) = SNARK::encode(&pairwise_check_inst);
println!("Finished Pairwise");
Expand Down
17 changes: 15 additions & 2 deletions spartan_parallel/examples/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,21 @@ fn main() {
println!("Generating Circuits...");
// --
// BLOCK INSTANCES
// block_inst is used by sumcheck. Every block has the same number of variables
let (block_num_vars, block_num_cons, block_num_non_zero_entries, mut block_inst) =
Instance::gen_block_inst::<true>(
Instance::gen_block_inst::<true, false>(
block_num_instances_bound,
num_vars,
&ctk.args,
num_inputs_unpadded,
&block_num_phy_ops,
&block_num_vir_ops,
&ctk.num_vars_per_block,
&rtk.block_num_proofs,
);
// block_inst is used by commitment. Every block has different number of variables
let (_, _, _, block_inst_for_commit) =
Instance::<ScalarExt2>::gen_block_inst::<true, true>(
block_num_instances_bound,
num_vars,
&ctk.args,
Expand Down Expand Up @@ -185,7 +198,7 @@ fn main() {
println!("Comitting Circuits...");
// block_comm_map records the sparse_polys committed in each commitment
// Note that A, B, C are committed separately, so sparse_poly[3*i+2] corresponds to poly C of instance i
let (block_comm_map, block_comm_list, block_decomm_list) = SNARK::multi_encode(&block_inst);
let (block_comm_map, block_comm_list, block_decomm_list) = SNARK::multi_encode(&block_inst_for_commit);
println!("Finished Block");
let (pairwise_check_comm, pairwise_check_decomm) = SNARK::encode(&pairwise_check_inst);
println!("Finished Pairwise");
Expand Down
Loading

0 comments on commit 7743f9a

Please sign in to comment.