Skip to content

Commit

Permalink
Merge pull request #61 from privacy-scaling-explorations/feat/halo2_2…
Browse files Browse the repository at this point in the history
…023_10_17

Update halo2_proofs to v2023_01_17
  • Loading branch information
CPerezz authored Jan 18, 2023
2 parents 5bf79a8 + 35879e8 commit 9356201
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
8 changes: 4 additions & 4 deletions ecc/src/base_field_ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ mod tests {
fn run<C: CurveAffine>() {
let circuit = TestEccAddition::<C>::default();
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
run::<Bn256>();
run::<Pallas>();
Expand Down Expand Up @@ -599,7 +599,7 @@ mod tests {
b: Value::known(b),
};
let instance = vec![public_data];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}

run::<Bn256>();
Expand Down Expand Up @@ -686,7 +686,7 @@ mod tests {
window_size,
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
}
run::<Bn256>();
Expand Down Expand Up @@ -788,7 +788,7 @@ mod tests {
number_of_pairs,
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions ecc/src/general_ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ mod tests {
>() {
let circuit = TestEccAddition::<C, N, NUMBER_OF_LIMBS, BIT_LEN_LIMB>::default();
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}

run::<Pallas, BnScalar, NUMBER_OF_LIMBS, BIT_LEN_LIMB>();
Expand Down Expand Up @@ -708,7 +708,7 @@ mod tests {
..Default::default()
};
let instance = vec![public_data];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}

run::<Pallas, BnScalar, NUMBER_OF_LIMBS, BIT_LEN_LIMB>();
Expand Down Expand Up @@ -827,7 +827,7 @@ mod tests {
..Default::default()
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
}

Expand Down Expand Up @@ -957,7 +957,7 @@ mod tests {
..Default::default()
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ mod tests {
..Default::default()
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}

use crate::curves::bn256::Fr as BnScalar;
Expand Down
2 changes: 1 addition & 1 deletion halo2wrong/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
num-bigint = { version = "0.4", features = ["rand"] }
num-integer = "0.1"
num-traits = "0.2"
halo2 = { package = "halo2_proofs", git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v2022_10_22" }
halo2 = { package = "halo2_proofs", git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v2023_01_17" }
group = "0.12"

[dev-dependencies]
Expand Down
20 changes: 14 additions & 6 deletions halo2wrong/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::halo2::{
arithmetic::FieldExt,
circuit::Value,
dev::{MockProver, VerifyFailure},
dev::MockProver,
plonk::{
Advice, Any, Assigned, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed,
FloorPlanner, Instance, Selector,
Expand Down Expand Up @@ -63,14 +63,14 @@ pub fn compose(input: Vec<big_uint>, bit_len: usize) -> big_uint {
.fold(big_uint::zero(), |acc, val| (acc << bit_len) + val)
}

pub fn mock_prover_verify<F: FieldExt, C: Circuit<F>>(
circuit: &C,
instance: Vec<Vec<F>>,
) -> Result<(), Vec<VerifyFailure>> {
pub fn mock_prover_verify<F: FieldExt, C: Circuit<F>>(circuit: &C, instance: Vec<Vec<F>>) {
let dimension = DimensionMeasurement::measure(circuit).unwrap();
let prover = MockProver::run(dimension.k(), circuit, instance)
.unwrap_or_else(|err| panic!("{:#?}", err));
prover.verify_at_rows_par(dimension.advice_range(), dimension.advice_range())
assert_eq!(
prover.verify_at_rows_par(dimension.advice_range(), dimension.advice_range()),
Ok(())
)
}

#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -160,6 +160,14 @@ impl<F: FieldExt> Assignment<F> for DimensionMeasurement {
Ok(Value::unknown())
}

fn annotate_column<A, AR>(&mut self, _annotation: A, _column: Column<Any>)
where
A: FnOnce() -> AR,
AR: Into<String>,
{
// Do nothing.
}

fn assign_advice<V, VR, A, AR>(
&mut self,
_: A,
Expand Down
2 changes: 1 addition & 1 deletion integer/src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ mod tests {

let circuit = $circuit::<$wrong_field, $native_field, $bit_len_limb> { rns: Rc::new(rns) };
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
)*
};
}
Expand Down
2 changes: 1 addition & 1 deletion transcript/src/transcript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ mod tests {
expected: Value::known(expected),
};
let instance = vec![vec![]];
assert_eq!(mock_prover_verify(&circuit, instance), Ok(()));
mock_prover_verify(&circuit, instance);
}
}
}
Expand Down

0 comments on commit 9356201

Please sign in to comment.