All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Rust's notion of Semantic Versioning.
halo2_proofs::circuit::Value, a more usable and type-safe replacement forOption<V>in circuit synthesis.impl Mul<F: Field> for &Assigned<F>
All APIs that represented witnessed values as Option<V> now represent them as
halo2_proofs::circuit::Value<V>. The core API changes are listed below.
- The following APIs now take
Value<_>instead ofOption<_>:halo2_proofs::plonk:Assignment::fill_from_row
- The following APIs now take value closures that return
Value<V>instead ofResult<V, Error>:halo2_proofs::circuit:Region::{assign_advice, assign_fixed}Table::assign_cell
halo2_proofs::circuit::layouter:RegionLayouter::{assign_advice, assign_fixed}TableLayouter::assign_cell
halo2_proofs::plonk:Assignment::{assign_advice, assign_fixed}
- The following APIs now return
Value<_>instead ofOption<_>:halo2_proofs::circuit:AssignedCell::{value, value_field}
- The following APIs now return
Result<Value<F>, Error>instead ofResult<Option<F>, Error>:halo2_proofs::plonk:Assignment::query_instance
- The following APIs now return
Result<(Cell, Value<F>), Error>instead ofResult<(Cell, Option<F>), Error>:halo2_proofs::circuit::layouter:RegionLayouter::assign_advice_from_instance
halo2_proofs::plonk::BatchVerifierhas been rewritten. It is no longer a verification strategy to be used withverify_proof, but instead manages the entire batch verification process. Thebatchcrate feature (enabled by default) must be enabled to use the batch verifier.
halo2_proofs::dev:MockProver::assert_satisfied, for requiring that a circuit is satisfied. It panics likeassert_eq!(mock_prover.verify(), Ok(())), but pretty-prints any verification failures before panicking.
halo2_proofs::plonk::Constraintshelper, for constructing a gate from a set of constraints with a common selector.
halo2_proofs::dev:VerifyFailure::CellNotAssignednow has agate_offsetfield, storing the offset in the region at which the gate queries the cell that needs to be assigned.- The
rowfield ofVerifyFailure::Permutationhas been replaced by alocationfield, which can now indicate whether the location falls within an assigned region.
- PLONK prover was improved to avoid stack overflows when large numbers of gates are involved in a proof.
halo2_proofs::circuit:AssignedCell::<Assigned<F>, F>::evaluate -> AssignedCell<F, F>Assigned::{is_zero_vartime, double, square, cube}- Various trait impls for
Assigned<F>:From<&Assigned<F>>PartialEq, EqAdd<&Assigned<F>>, AddAssign, AddAssign<&Assigned<F>>Sub<&Assigned<F>>, SubAssign, SubAssign<&Assigned<F>>Mul<&Assigned<F>>, MulAssign, MulAssign<&Assigned<F>>
halo2_proofs::plonk::VerifyingKey::{read, write}(for details see issue 449)
(relative to halo2 0.1.0-beta.1)
halo2_proofs::circuit::AssignedCell, an abstraction for typedCells that track the type (and witnessed value if known) of the assignment.halo2_proofs::plonk:VerificationStrategySingleVerifier, an implementation ofVerificationStrategyfor verifying proofs individually.BatchVerifier, an implementation ofVerificationStrategyfor verifying multiple proofs in a batch.Column::column_typeimpl {PartialOrd, Ord} for AnyError::ColumnNotInPermutation
halo2_proofs::poly::Basis: Copybound, and corresponding implementations for the provided bases.halo2_proofs::dev:FailureLocation(used inVerifyFailure::Lookup)metadata::VirtualCell(used inVerifyFailure::ConstraintNotSatisfied)impl From<(usize, &str)> for metadata::Region
halo2_proofs::plonk::Assignedaddition was producing incorrect results in some cases due to how the deferred representation ofinv0was handled. This could not cause a soundness error, becauseAssignedis only used during witness generation, not when defining constraints. However, it did mean that the prover would fail to create a valid proof for some subset of valid witnesses. Fixed in #423.
- Migrated to
rand_core(instead ofrand),pasta_curves 0.3. halo2_proofs::circuit:Regionnow returnsAssignedCellinstead ofCellor(Cell, Option<F>)from its assignment APIs, and the result typesVRof their value closures now have the boundfor<'vr> Assigned<F>: From<&'vr VR>instead ofVR: Into<Assigned<F>>:assign_adviceassign_advice_from_constantassign_advice_from_instanceassign_fixed
halo2_proofs::plonk:create_proofnow take an argumentR: rand_core::RngCore.verify_proofnow takes aVerificationStrategyinstead of anMSMdirectly, and returnsVerificationStrategy::Outputinstead ofGuard.ConstraintSystem::enable_equalityandConstraintSystem::query_anynow takeInto<Column<Any>>instead ofColumn<Any>as a parameter to avoid excesive.into()usage.Errorhas been overhauled:Errornow implementsstd::fmt::Displayandstd::error::Error.Errorno longer implementsPartialEq. Tests can check for specific error cases withassert!(matches!(..)), or theassert_matchescrate.Error::IncompatibleParamsis nowError::InvalidInstances.Error::NotEnoughRowsAvailablenow stores the current value ofk.Error::OpeningErroris nowError::Opening.Error::SynthesisErroris nowError::Synthesis.Error::TranscriptErroris nowError::Transcript, and stores the underlyingio::Error.
halo2_proofs::poly:commitment::Accumulatorhad itschallenges_packedfield renamed tou_packed.commitment::Guard, returned by the closure passed intoVerificationStrategy::process(and previously returned fromverify_proofdirectly), has changed so that values returned from its methodcompute_gand expected by its methoduse_gare NOT backwards compatible with values in previous version (namelyhalo2 0.1.0-beta.1).commitment::MSM::add_to_h_scalarwas renamed toMSM::add_to_w_scalar.commitment::create_proofnow take an argumentR: rand_core::RngCore.multiopen::create_proofnow take an argumentR: rand_core::RngCore.
halo2_proofs::dev:CircuitLayout::rendernow takeskas au32, matching the regular parameter APIs.VerifyFailurehas been overhauled:VerifyFailure::Cellhas been renamed toVerifyFailure::CellNotAssigned.VerifyFailure::ConstraintNotSatisfiednow has acell_valuesfield, storing the values of the cells used in the unsatisfied constraint.- The
rowfields ofVerifyFailure::{ConstraintNotSatisfied, Lookup}have been replaced bylocationfields, which can now indicate whether the location falls within an assigned region.
halo2_proofs::arithmetic:BatchInvert(useff::BatchInvertinstead).- Several parts of the
pasta_curves::arithmeticAPI that were re-exported here (see the changelog forpasta_curves 0.3.0for details).
halo2_proofs::poly:EvaluationDomain::{add_extended, sub_extended, mul_extended}Polynomial::one_minusimpl Neg, Sub for Polynomialimpl Mul for Polynomial<_, ExtendedLagrangeCoeff>impl Default for Rotation(useRotation::cur()instead).