Merge pull request #743 from zcash/740-expose-instance-value

halo2_proofs: Add `Region::instance_value`
This commit is contained in:
str4d 2023-03-07 17:19:11 +00:00 committed by GitHub
commit a1034169bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View File

@ -16,9 +16,11 @@ and this project adheres to Rust's notion of
- `metadata::Region`
- `halo2_proofs::poly::Rotation`
- `halo2_proofs::arithmetic::FftGroup`
- `halo2_proofs::circuit::layouter`:
- `RegionLayouter::instance_value` method added to provide access to
instance values within a region.
- `halo2_proofs::circuit`:
- `Region::instance_value`, to provide access to instance values within a
region. This method is only provided for convenience; it does not create any
constraints. Callers still need to use `Region::assign_advice_from_instance`
to constrain the values in their circuit.
### Changed
- Migrated to `ff 0.13`, `group 0.13`, `pasta_curves 0.5`.
@ -27,7 +29,10 @@ and this project adheres to Rust's notion of
- `halo2_proofs::arithmetic`:
- `best_fft, recursive_butterfly_arithmetic` now use the `FftGroup` trait
instead of the (now-removed) `pasta_curves::arithmetic::Group` trait.
- `halo2::proofs::circuit`
- `halo2_proofs::circuit::layouter`:
- The `RegionLayouter` trait now requires implementing an `instance_value`
method, to back `Region::instance_value`.
- `halo2_proofs::plonk`
- `VirtualCells`
- `query_any` now panics if a non-`cur` `Rotation` is used with the
`Column<Fixed>` variant.

View File

@ -297,6 +297,19 @@ impl<'r, F: Field> Region<'r, F> {
})
}
/// Returns the value of the instance column's cell at absolute location `row`.
///
/// This method is only provided for convenience; it does not create any constraints.
/// Callers still need to use [`Self::assign_advice_from_instance`] to constrain the
/// instance values in their circuit.
pub fn instance_value(
&mut self,
instance: Column<Instance>,
row: usize,
) -> Result<Value<F>, Error> {
self.region.instance_value(instance, row)
}
/// Assign a fixed value.
///
/// Even though `to` has `FnMut` bounds, it is guaranteed to be called at most once.