mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-05-28 12:49:54 +00:00
Added witness trait
This commit is contained in:
parent
98559c3256
commit
a44bf9ffd8
@ -504,7 +504,7 @@ mod tests {
|
|||||||
use crate::field::extension_field::algebra::ExtensionAlgebra;
|
use crate::field::extension_field::algebra::ExtensionAlgebra;
|
||||||
use crate::field::extension_field::quartic::QuarticCrandallField;
|
use crate::field::extension_field::quartic::QuarticCrandallField;
|
||||||
use crate::field::field_types::Field;
|
use crate::field::field_types::Field;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||||
use crate::plonk::circuit_data::CircuitConfig;
|
use crate::plonk::circuit_data::CircuitConfig;
|
||||||
use crate::plonk::verifier::verify;
|
use crate::plonk::verifier::verify;
|
||||||
|
|||||||
@ -43,7 +43,7 @@ mod tests {
|
|||||||
use crate::field::crandall_field::CrandallField;
|
use crate::field::crandall_field::CrandallField;
|
||||||
use crate::field::extension_field::quartic::QuarticCrandallField;
|
use crate::field::extension_field::quartic::QuarticCrandallField;
|
||||||
use crate::field::field_types::Field;
|
use crate::field::field_types::Field;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||||
use crate::plonk::circuit_data::CircuitConfig;
|
use crate::plonk::circuit_data::CircuitConfig;
|
||||||
use crate::plonk::verifier::verify;
|
use crate::plonk::verifier::verify;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use crate::field::extension_field::{Extendable, FieldExtension};
|
|||||||
use crate::field::field_types::Field;
|
use crate::field::field_types::Field;
|
||||||
use crate::gates::gate::Gate;
|
use crate::gates::gate::Gate;
|
||||||
use crate::hash::hash_types::HashOut;
|
use crate::hash::hash_types::HashOut;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||||
use crate::plonk::circuit_data::CircuitConfig;
|
use crate::plonk::circuit_data::CircuitConfig;
|
||||||
use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase};
|
use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase};
|
||||||
|
|||||||
@ -221,7 +221,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::field::crandall_field::CrandallField;
|
use crate::field::crandall_field::CrandallField;
|
||||||
use crate::hash::merkle_tree::MerkleTree;
|
use crate::hash::merkle_tree::MerkleTree;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||||
use crate::plonk::circuit_data::CircuitConfig;
|
use crate::plonk::circuit_data::CircuitConfig;
|
||||||
use crate::plonk::verifier::verify;
|
use crate::plonk::verifier::verify;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use crate::hash::hash_types::{HashOut, HashOutTarget, MerkleCapTarget};
|
|||||||
use crate::hash::merkle_tree::MerkleCap;
|
use crate::hash::merkle_tree::MerkleCap;
|
||||||
use crate::iop::target::{BoolTarget, Target};
|
use crate::iop::target::{BoolTarget, Target};
|
||||||
use crate::iop::wire::Wire;
|
use crate::iop::wire::Wire;
|
||||||
use crate::iop::witness::{PartialWitness, Witness};
|
use crate::iop::witness::{MatrixWitness, PartialWitness, Witness};
|
||||||
use crate::plonk::permutation_argument::ForestNode;
|
use crate::plonk::permutation_argument::ForestNode;
|
||||||
use crate::timed;
|
use crate::timed;
|
||||||
use crate::util::timing::TimingTree;
|
use crate::util::timing::TimingTree;
|
||||||
@ -159,7 +159,7 @@ impl<F: Field> Yo<F> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn full_witness(self, degree: usize, num_wires: usize) -> Witness<F> {
|
pub fn full_witness(self, degree: usize, num_wires: usize) -> MatrixWitness<F> {
|
||||||
let mut wire_values = vec![vec![F::ZERO; degree]; num_wires];
|
let mut wire_values = vec![vec![F::ZERO; degree]; num_wires];
|
||||||
// assert!(self.wire_values.len() <= degree);
|
// assert!(self.wire_values.len() <= degree);
|
||||||
for i in 0..degree {
|
for i in 0..degree {
|
||||||
@ -168,7 +168,7 @@ impl<F: Field> Yo<F> {
|
|||||||
wire_values[j][i] = self.0[self.0[self.1(t)].parent].value.unwrap_or(F::ZERO);
|
wire_values[j][i] = self.0[self.0[self.1(t)].parent].value.unwrap_or(F::ZERO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Witness { wire_values }
|
MatrixWitness { wire_values }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,12 +13,143 @@ use crate::iop::target::{BoolTarget, Target};
|
|||||||
use crate::iop::wire::Wire;
|
use crate::iop::wire::Wire;
|
||||||
use crate::plonk::copy_constraint::CopyConstraint;
|
use crate::plonk::copy_constraint::CopyConstraint;
|
||||||
|
|
||||||
|
pub trait Witness<F: Field> {
|
||||||
|
fn try_get_target(&self, target: Target) -> Option<F>;
|
||||||
|
|
||||||
|
fn set_target(&mut self, target: Target, value: F);
|
||||||
|
|
||||||
|
fn get_target(&self, target: Target) -> F {
|
||||||
|
self.try_get_target(target).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_targets(&self, targets: &[Target]) -> Vec<F> {
|
||||||
|
targets.iter().map(|&t| self.get_target(t)).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_extension_target<const D: usize>(&self, et: ExtensionTarget<D>) -> F::Extension
|
||||||
|
where
|
||||||
|
F: Extendable<D>,
|
||||||
|
{
|
||||||
|
F::Extension::from_basefield_array(
|
||||||
|
self.get_targets(&et.to_target_array()).try_into().unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_extension_targets<const D: usize>(&self, ets: &[ExtensionTarget<D>]) -> Vec<F::Extension>
|
||||||
|
where
|
||||||
|
F: Extendable<D>,
|
||||||
|
{
|
||||||
|
ets.iter()
|
||||||
|
.map(|&et| self.get_extension_target(et))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_bool_target(&self, target: BoolTarget) -> bool {
|
||||||
|
let value = self.get_target(target.target).to_canonical_u64();
|
||||||
|
match value {
|
||||||
|
0 => false,
|
||||||
|
1 => true,
|
||||||
|
_ => panic!("not a bool"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_hash_target(&self, ht: HashOutTarget) -> HashOut<F> {
|
||||||
|
HashOut {
|
||||||
|
elements: self.get_targets(&ht.elements).try_into().unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_wire(&self, wire: Wire) -> F {
|
||||||
|
self.get_target(Target::Wire(wire))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn try_get_wire(&self, wire: Wire) -> Option<F> {
|
||||||
|
self.try_get_target(Target::Wire(wire))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn contains(&self, target: Target) -> bool {
|
||||||
|
self.try_get_target(target).is_some()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn contains_all(&self, targets: &[Target]) -> bool {
|
||||||
|
targets.iter().all(|&t| self.contains(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_hash_target(&mut self, ht: HashOutTarget, value: HashOut<F>) {
|
||||||
|
ht.elements
|
||||||
|
.iter()
|
||||||
|
.zip(value.elements)
|
||||||
|
.for_each(|(&t, x)| self.set_target(t, x));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_cap_target(&mut self, ct: &MerkleCapTarget, value: &MerkleCap<F>) {
|
||||||
|
for (ht, h) in ct.0.iter().zip(&value.0) {
|
||||||
|
self.set_hash_target(*ht, *h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_extension_target<const D: usize>(&mut self, et: ExtensionTarget<D>, value: F::Extension)
|
||||||
|
where
|
||||||
|
F: Extendable<D>,
|
||||||
|
{
|
||||||
|
let limbs = value.to_basefield_array();
|
||||||
|
(0..D).for_each(|i| {
|
||||||
|
self.set_target(et.0[i], limbs[i]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_extension_targets<const D: usize>(
|
||||||
|
&mut self,
|
||||||
|
ets: &[ExtensionTarget<D>],
|
||||||
|
values: &[F::Extension],
|
||||||
|
) where
|
||||||
|
F: Extendable<D>,
|
||||||
|
{
|
||||||
|
debug_assert_eq!(ets.len(), values.len());
|
||||||
|
ets.iter()
|
||||||
|
.zip(values)
|
||||||
|
.for_each(|(&et, &v)| self.set_extension_target(et, v));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_bool_target(&mut self, target: BoolTarget, value: bool) {
|
||||||
|
self.set_target(target.target, F::from_bool(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_wire(&mut self, wire: Wire, value: F) {
|
||||||
|
self.set_target(Target::Wire(wire), value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_wires<W>(&mut self, wires: W, values: &[F])
|
||||||
|
where
|
||||||
|
W: IntoIterator<Item = Wire>,
|
||||||
|
{
|
||||||
|
// If we used itertools, we could use zip_eq for extra safety.
|
||||||
|
for (wire, &value) in wires.into_iter().zip(values) {
|
||||||
|
self.set_wire(wire, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_ext_wires<W, const D: usize>(&mut self, wires: W, value: F::Extension)
|
||||||
|
where
|
||||||
|
F: Extendable<D>,
|
||||||
|
W: IntoIterator<Item = Wire>,
|
||||||
|
{
|
||||||
|
self.set_wires(wires, &value.to_basefield_array());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extend<I: Iterator<Item = (Target, F)>>(&mut self, pairs: I) {
|
||||||
|
for (t, v) in pairs {
|
||||||
|
self.set_target(t, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Witness<F: Field> {
|
pub struct MatrixWitness<F: Field> {
|
||||||
pub(crate) wire_values: Vec<Vec<F>>,
|
pub(crate) wire_values: Vec<Vec<F>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: Field> Witness<F> {
|
impl<F: Field> MatrixWitness<F> {
|
||||||
pub fn get_wire(&self, gate: usize, input: usize) -> F {
|
pub fn get_wire(&self, gate: usize, input: usize) -> F {
|
||||||
self.wire_values[input][gate]
|
self.wire_values[input][gate]
|
||||||
}
|
}
|
||||||
@ -39,86 +170,17 @@ impl<F: Field> PartialWitness<F> {
|
|||||||
set_targets: vec![],
|
set_targets: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_target(&self, target: Target) -> F {
|
impl<F: Field> Witness<F> for PartialWitness<F> {
|
||||||
|
fn try_get_target(&self, target: Target) -> Option<F> {
|
||||||
match target {
|
match target {
|
||||||
Target::Wire(Wire { gate, input }) => self.wire_values[gate][input].unwrap(),
|
Target::Wire(Wire { gate, input }) => *self.wire_values.get(gate)?.get(input)?,
|
||||||
Target::VirtualTarget { index } => self.virtual_target_values[index].unwrap(),
|
Target::VirtualTarget { index } => *self.virtual_target_values.get(index)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_targets(&self, targets: &[Target]) -> Vec<F> {
|
fn set_target(&mut self, target: Target, value: F) {
|
||||||
targets.iter().map(|&t| self.get_target(t)).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_extension_target<const D: usize>(&self, et: ExtensionTarget<D>) -> F::Extension
|
|
||||||
where
|
|
||||||
F: Extendable<D>,
|
|
||||||
{
|
|
||||||
F::Extension::from_basefield_array(
|
|
||||||
self.get_targets(&et.to_target_array()).try_into().unwrap(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_extension_targets<const D: usize>(
|
|
||||||
&self,
|
|
||||||
ets: &[ExtensionTarget<D>],
|
|
||||||
) -> Vec<F::Extension>
|
|
||||||
where
|
|
||||||
F: Extendable<D>,
|
|
||||||
{
|
|
||||||
ets.iter()
|
|
||||||
.map(|&et| self.get_extension_target(et))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_bool_target(&self, target: BoolTarget) -> bool {
|
|
||||||
let value = self.get_target(target.target).to_canonical_u64();
|
|
||||||
match value {
|
|
||||||
0 => false,
|
|
||||||
1 => true,
|
|
||||||
_ => panic!("not a bool"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_hash_target(&self, ht: HashOutTarget) -> HashOut<F> {
|
|
||||||
HashOut {
|
|
||||||
elements: self.get_targets(&ht.elements).try_into().unwrap(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn try_get_target(&self, target: Target) -> Option<F> {
|
|
||||||
match target {
|
|
||||||
Target::Wire(Wire { gate, input }) => self.wire_values[gate][input],
|
|
||||||
Target::VirtualTarget { index } => self.virtual_target_values[index],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_wire(&self, wire: Wire) -> F {
|
|
||||||
self.get_target(Target::Wire(wire))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn try_get_wire(&self, wire: Wire) -> Option<F> {
|
|
||||||
self.try_get_target(Target::Wire(wire))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn contains(&self, target: Target) -> bool {
|
|
||||||
match target {
|
|
||||||
Target::Wire(Wire { gate, input }) => {
|
|
||||||
self.wire_values.len() > gate && self.wire_values[gate][input].is_some()
|
|
||||||
}
|
|
||||||
Target::VirtualTarget { index } => {
|
|
||||||
self.virtual_target_values.len() > index
|
|
||||||
&& self.virtual_target_values[index].is_some()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn contains_all(&self, targets: &[Target]) -> bool {
|
|
||||||
targets.iter().all(|&t| self.contains(t))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_target(&mut self, target: Target, value: F) {
|
|
||||||
match target {
|
match target {
|
||||||
Target::Wire(Wire { gate, input }) => {
|
Target::Wire(Wire { gate, input }) => {
|
||||||
if gate >= self.wire_values.len() {
|
if gate >= self.wire_values.len() {
|
||||||
@ -152,123 +214,4 @@ impl<F: Field> PartialWitness<F> {
|
|||||||
}
|
}
|
||||||
self.set_targets.push((target, value));
|
self.set_targets.push((target, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_hash_target(&mut self, ht: HashOutTarget, value: HashOut<F>) {
|
|
||||||
ht.elements
|
|
||||||
.iter()
|
|
||||||
.zip(value.elements)
|
|
||||||
.for_each(|(&t, x)| self.set_target(t, x));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_cap_target(&mut self, ct: &MerkleCapTarget, value: &MerkleCap<F>) {
|
|
||||||
for (ht, h) in ct.0.iter().zip(&value.0) {
|
|
||||||
self.set_hash_target(*ht, *h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_extension_target<const D: usize>(
|
|
||||||
&mut self,
|
|
||||||
et: ExtensionTarget<D>,
|
|
||||||
value: F::Extension,
|
|
||||||
) where
|
|
||||||
F: Extendable<D>,
|
|
||||||
{
|
|
||||||
let limbs = value.to_basefield_array();
|
|
||||||
(0..D).for_each(|i| {
|
|
||||||
self.set_target(et.0[i], limbs[i]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_extension_targets<const D: usize>(
|
|
||||||
&mut self,
|
|
||||||
ets: &[ExtensionTarget<D>],
|
|
||||||
values: &[F::Extension],
|
|
||||||
) where
|
|
||||||
F: Extendable<D>,
|
|
||||||
{
|
|
||||||
debug_assert_eq!(ets.len(), values.len());
|
|
||||||
ets.iter()
|
|
||||||
.zip(values)
|
|
||||||
.for_each(|(&et, &v)| self.set_extension_target(et, v));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_bool_target(&mut self, target: BoolTarget, value: bool) {
|
|
||||||
self.set_target(target.target, F::from_bool(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_wire(&mut self, wire: Wire, value: F) {
|
|
||||||
self.set_target(Target::Wire(wire), value)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_wires<W>(&mut self, wires: W, values: &[F])
|
|
||||||
where
|
|
||||||
W: IntoIterator<Item = Wire>,
|
|
||||||
{
|
|
||||||
// If we used itertools, we could use zip_eq for extra safety.
|
|
||||||
for (wire, &value) in wires.into_iter().zip(values) {
|
|
||||||
self.set_wire(wire, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_ext_wires<W, const D: usize>(&mut self, wires: W, value: F::Extension)
|
|
||||||
where
|
|
||||||
F: Extendable<D>,
|
|
||||||
W: IntoIterator<Item = Wire>,
|
|
||||||
{
|
|
||||||
self.set_wires(wires, &value.to_basefield_array());
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn extend<I: Iterator<Item = (Target, F)>>(&mut self, pairs: I) {
|
|
||||||
for (t, v) in pairs {
|
|
||||||
self.set_target(t, v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn full_witness(self, degree: usize, num_wires: usize) -> Witness<F> {
|
|
||||||
let mut wire_values = vec![vec![F::ZERO; degree]; num_wires];
|
|
||||||
assert!(self.wire_values.len() <= degree);
|
|
||||||
for i in 0..self.wire_values.len() {
|
|
||||||
for j in 0..num_wires {
|
|
||||||
wire_values[j][i] = self.wire_values[i][j].unwrap_or(F::ZERO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Witness { wire_values }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks that the copy constraints are satisfied in the witness.
|
|
||||||
pub fn check_copy_constraints<const D: usize>(
|
|
||||||
&self,
|
|
||||||
copy_constraints: &[CopyConstraint],
|
|
||||||
gate_instances: &[GateInstance<F, D>],
|
|
||||||
) -> Result<()>
|
|
||||||
where
|
|
||||||
F: Extendable<D>,
|
|
||||||
{
|
|
||||||
for CopyConstraint { pair: (a, b), name } in copy_constraints {
|
|
||||||
let va = self.try_get_target(*a).unwrap_or(F::ZERO);
|
|
||||||
let vb = self.try_get_target(*b).unwrap_or(F::ZERO);
|
|
||||||
let desc = |t: &Target| -> String {
|
|
||||||
match t {
|
|
||||||
Target::Wire(Wire { gate, input }) => format!(
|
|
||||||
"wire {} of gate #{} (`{}`)",
|
|
||||||
input,
|
|
||||||
gate,
|
|
||||||
gate_instances[*gate].gate_ref.0.id()
|
|
||||||
),
|
|
||||||
Target::VirtualTarget { index } => format!("{}-th virtual target", index),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ensure!(
|
|
||||||
va == vb,
|
|
||||||
"Copy constraint '{}' between {} and {} is not satisfied. \
|
|
||||||
Got values of {} and {} respectively.",
|
|
||||||
name,
|
|
||||||
desc(a),
|
|
||||||
desc(b),
|
|
||||||
va,
|
|
||||||
vb
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use crate::iop::challenger::Challenger;
|
|||||||
use crate::iop::generator::{generate_partial_witness, Yo};
|
use crate::iop::generator::{generate_partial_witness, Yo};
|
||||||
use crate::iop::target::Target;
|
use crate::iop::target::Target;
|
||||||
use crate::iop::wire::Wire;
|
use crate::iop::wire::Wire;
|
||||||
use crate::iop::witness::{PartialWitness, Witness};
|
use crate::iop::witness::{MatrixWitness, PartialWitness, Witness};
|
||||||
use crate::plonk::circuit_data::{CommonCircuitData, ProverOnlyCircuitData};
|
use crate::plonk::circuit_data::{CommonCircuitData, ProverOnlyCircuitData};
|
||||||
use crate::plonk::permutation_argument::ForestNode;
|
use crate::plonk::permutation_argument::ForestNode;
|
||||||
use crate::plonk::plonk_common::PlonkPolynomials;
|
use crate::plonk::plonk_common::PlonkPolynomials;
|
||||||
@ -268,7 +268,7 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
|
|||||||
|
|
||||||
/// Compute the partial products used in the `Z` polynomials.
|
/// Compute the partial products used in the `Z` polynomials.
|
||||||
fn all_wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
|
fn all_wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
|
||||||
witness: &Witness<F>,
|
witness: &MatrixWitness<F>,
|
||||||
betas: &[F],
|
betas: &[F],
|
||||||
gammas: &[F],
|
gammas: &[F],
|
||||||
prover_data: &ProverOnlyCircuitData<F, D>,
|
prover_data: &ProverOnlyCircuitData<F, D>,
|
||||||
@ -291,7 +291,7 @@ fn all_wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
|
|||||||
/// Returns the polynomials interpolating `partial_products(f / g)`
|
/// Returns the polynomials interpolating `partial_products(f / g)`
|
||||||
/// where `f, g` are the products in the definition of `Z`: `Z(g^i) = f / g`.
|
/// where `f, g` are the products in the definition of `Z`: `Z(g^i) = f / g`.
|
||||||
fn wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
|
fn wires_permutation_partial_products<F: Extendable<D>, const D: usize>(
|
||||||
witness: &Witness<F>,
|
witness: &MatrixWitness<F>,
|
||||||
beta: F,
|
beta: F,
|
||||||
gamma: F,
|
gamma: F,
|
||||||
prover_data: &ProverOnlyCircuitData<F, D>,
|
prover_data: &ProverOnlyCircuitData<F, D>,
|
||||||
|
|||||||
@ -137,7 +137,7 @@ mod tests {
|
|||||||
use crate::fri::FriConfig;
|
use crate::fri::FriConfig;
|
||||||
use crate::gadgets::polynomial::PolynomialCoeffsExtTarget;
|
use crate::gadgets::polynomial::PolynomialCoeffsExtTarget;
|
||||||
use crate::hash::merkle_proofs::MerkleProofTarget;
|
use crate::hash::merkle_proofs::MerkleProofTarget;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
use crate::plonk::proof::{OpeningSetTarget, Proof, ProofTarget, ProofWithPublicInputs};
|
use crate::plonk::proof::{OpeningSetTarget, Proof, ProofTarget, ProofWithPublicInputs};
|
||||||
use crate::plonk::verifier::verify;
|
use crate::plonk::verifier::verify;
|
||||||
use crate::util::log2_strict;
|
use crate::util::log2_strict;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use crate::field::extension_field::target::ExtensionTarget;
|
|||||||
use crate::field::extension_field::Extendable;
|
use crate::field::extension_field::Extendable;
|
||||||
use crate::hash::hash_types::HashOutTarget;
|
use crate::hash::hash_types::HashOutTarget;
|
||||||
use crate::iop::target::Target;
|
use crate::iop::target::Target;
|
||||||
use crate::iop::witness::PartialWitness;
|
use crate::iop::witness::{PartialWitness, Witness};
|
||||||
|
|
||||||
/// Enum representing all types of targets, so that they can be marked.
|
/// Enum representing all types of targets, so that they can be marked.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user