Skip to content

Commit

Permalink
Remove blinding factors from assignment table
Browse files Browse the repository at this point in the history
  • Loading branch information
pnyda committed Mar 5, 2025
1 parent 11cad89 commit 41556e8
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 71 deletions.
90 changes: 45 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ resolver = "2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
halo2_proofs = { git = "https://github.com/pnyda/halo2.git", rev = "bdc6f1cb47ff96bf0696fd585bebd6e7700c5736" }
halo2_proofs = { git = "https://github.com/pnyda/halo2.git", rev = "42af2f214d565f5774d3e5dc2690922a126b172d" }
folding-schemes = { git = "https://github.com/privacy-scaling-explorations/sonobe.git", rev = "31fbe72df30159804c06c662b749ca27ab90e11e" }
ark-ff = { version = "0.5.0", default-features = false, features = ["parallel", "asm"] }
ark-std = { version = "0.5.0" }
ff = "0.13"
ark-pallas = { version = "0.5.0" }
halo2_gadgets = { git = "https://github.com/pnyda/halo2.git", rev = "bdc6f1cb47ff96bf0696fd585bebd6e7700c5736" }
halo2_gadgets = { git = "https://github.com/pnyda/halo2.git", rev = "42af2f214d565f5774d3e5dc2690922a126b172d" }
ark-poly = { version = "0.5.0" }

[dev-dependencies]
Expand Down
40 changes: 16 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,27 @@ pub fn convert_halo2_circuit<
plonk::Error,
> {
let mut meta = ConstraintSystem::<HALO2>::default();
// This line updates meta.num_instance_columns
let config = C::configure(&mut meta);
// This line reads meta.num_instance_columns
let mut cell_dumper: AssignmentDumper<HALO2> = AssignmentDumper::new(k, &meta);

// both AssignmentDumper and generate_ccs_instance expects Vec of length 2^k
// so I need to fill the vec
let instance_option: Vec<Vec<Option<HALO2>>> = instance
// instance_option has the same shape as cell_dumper.instance
let mut instance_option: Vec<Vec<Option<HALO2>>> = cell_dumper
.instance
.iter()
.map(|cells| {
let mut column = vec![None; 1 << k];
column[0..cells.len()]
.copy_from_slice(&cells.iter().map(|cell| Some(*cell)).collect::<Vec<_>>());
column
})
.collect();
let instance_value: Vec<Vec<Value<HALO2>>> = instance
.iter()
.map(|cells| {
let mut column = vec![Value::unknown(); 1 << k];
column[0..cells.len()].copy_from_slice(
&cells
.iter()
.map(|cell| Value::known(*cell))
.collect::<Vec<_>>(),
);
column
})
.map(|column| vec![None; column.len()])
.collect();

let mut cell_dumper: AssignmentDumper<HALO2> = AssignmentDumper::new(k, &meta);
cell_dumper.instance = instance_value;
for (column_index, column) in instance.iter().enumerate() {
for (row_index, cell) in column.iter().enumerate() {
// Assign an instance cell
cell_dumper.instance[column_index][row_index] = Value::known(*cell);
// Value does not implement unwrap so I need to keep track of the assignments in Option...
instance_option[column_index][row_index] = Some(*cell);
}
}

C::FloorPlanner::synthesize(&mut cell_dumper, circuit, config, meta.constants.clone())?;

let instance_option: Vec<&[Option<HALO2>]> =
Expand Down

0 comments on commit 41556e8

Please sign in to comment.