Skip to content

Commit

Permalink
- make self in query_instance mutable
Browse files Browse the repository at this point in the history
  allows the keygen to compute size of advice cols
- remove evaluation.rs
- Add comments
- Compute all column sizes during keygen
  • Loading branch information
adr1anh committed Jul 7, 2023
1 parent 0446cdd commit 51c7359
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 1,088 deletions.
2 changes: 1 addition & 1 deletion halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl<F: Field> Assignment<F> for MockProver<F> {
}

fn query_instance(
&self,
&mut self,
column: Column<Instance>,
row: usize,
) -> Result<circuit::Value<F>, Error> {
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/dev/cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<F: Field> Assignment<F> for Assembly {
Ok(())
}

fn query_instance(&self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
fn query_instance(&mut self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
Ok(Value::unknown())
}

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/dev/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<F: Field> Assignment<F> for Graph {
// Do nothing
}

fn query_instance(&self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
fn query_instance(&mut self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
Ok(Value::unknown())
}

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/dev/graph/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl<F: Field> Assignment<F> for Layout {
Ok(())
}

fn query_instance(&self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
fn query_instance(&mut self, _: Column<Instance>, _: usize) -> Result<Value<F>, Error> {
Ok(Value::unknown())
}

Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/plonk/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ pub trait Assignment<F: Field> {
/// Queries the cell of an instance column at a particular absolute row.
///
/// Returns the cell's value, if known.
fn query_instance(&self, column: Column<Instance>, row: usize) -> Result<Value<F>, Error>;
fn query_instance(&mut self, column: Column<Instance>, row: usize) -> Result<Value<F>, Error>;

/// Assign an advice column value (witness)
fn assign_advice<V, VR, A, AR>(
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/plonk/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<F: Field> Assignment<F> for Assembly<F> {
Ok(())
}

fn query_instance(&self, _: Column<Instance>, row: usize) -> Result<Value<F>, Error> {
fn query_instance(&mut self, _: Column<Instance>, row: usize) -> Result<Value<F>, Error> {
if !self.usable_rows.contains(&row) {
return Err(Error::not_enough_rows_available(self.k));
}
Expand Down
6 changes: 5 additions & 1 deletion halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ where
// Do nothing
}

fn query_instance(&self, column: Column<Instance>, row: usize) -> Result<Value<F>, Error> {
fn query_instance(
&mut self,
column: Column<Instance>,
row: usize,
) -> Result<Value<F>, Error> {
if !self.usable_rows.contains(&row) {
return Err(Error::not_enough_rows_available(self.k));
}
Expand Down
1 change: 0 additions & 1 deletion halo2_proofs/src/protostar.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Contains logic for handling halo2 circuits with Protostar
mod error_check;
mod evaluation;
mod gate;
mod keygen;
mod prover;
Expand Down
Loading

0 comments on commit 51c7359

Please sign in to comment.