From 340fb2b6df23bf95c898b2e0f2a6750131d93399 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 19 Feb 2021 14:36:19 +0800 Subject: [PATCH 1/4] Move Permutation struct from crate::circuit -> plonk::circuit --- examples/simple-example.rs | 6 ++++-- src/circuit.rs | 20 +------------------- src/circuit/layouter.rs | 10 +++++----- src/plonk/circuit.rs | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/examples/simple-example.rs b/examples/simple-example.rs index 0acc59b..c69009c 100644 --- a/examples/simple-example.rs +++ b/examples/simple-example.rs @@ -4,9 +4,11 @@ use std::marker::PhantomData; use halo2::{ arithmetic::FieldExt, - circuit::{layouter::SingleChip, Cell, Chip, Layouter, Permutation}, + circuit::{layouter::SingleChip, Cell, Chip, Layouter}, dev::VerifyFailure, - plonk::{Advice, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed, Instance}, + plonk::{ + Advice, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed, Instance, Permutation, + }, poly::Rotation, }; diff --git a/src/circuit.rs b/src/circuit.rs index b414211..71780e2 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -4,7 +4,7 @@ use std::{fmt, marker::PhantomData}; use crate::{ arithmetic::FieldExt, - plonk::{Advice, Any, Column, ConstraintSystem, Error, Fixed}, + plonk::{Advice, Any, Column, Error, Fixed, Permutation}, }; pub mod layouter; @@ -73,24 +73,6 @@ pub struct Cell { column: Column, } -/// A permutation configured by a chip. -#[derive(Clone, Debug)] -pub struct Permutation { - index: usize, - mapping: Vec>, -} - -impl Permutation { - /// Configures a new permutation for the given columns. - pub fn new(meta: &mut ConstraintSystem, columns: &[Column]) -> Self { - let index = meta.permutation(columns); - Permutation { - index, - mapping: columns.iter().copied().collect(), - } - } -} - /// A region of the circuit in which a [`Chip`] can assign cells. /// /// Inside a region, the chip may freely use relative offsets; the [`Layouter`] will diff --git a/src/circuit/layouter.rs b/src/circuit/layouter.rs index e9c20d3..13b5311 100644 --- a/src/circuit/layouter.rs +++ b/src/circuit/layouter.rs @@ -5,8 +5,8 @@ use std::collections::{HashMap, HashSet}; use std::fmt; use std::marker::PhantomData; -use super::{Cell, Chip, Layouter, Permutation, Region, RegionIndex, RegionStart}; -use crate::plonk::{Advice, Any, Assignment, Column, Error, Fixed}; +use super::{Cell, Chip, Layouter, Region, RegionIndex, RegionStart}; +use crate::plonk::{Advice, Any, Assignment, Column, Error, Fixed, Permutation}; /// Helper trait for implementing a custom [`Layouter`]. /// @@ -321,18 +321,18 @@ impl<'r, 'a, C: Chip, CS: Assignment + 'a> RegionLayouter right: Cell, ) -> Result<(), Error> { let left_column = permutation - .mapping + .mapping() .iter() .position(|c| c == &left.column) .ok_or(Error::SynthesisError)?; let right_column = permutation - .mapping + .mapping() .iter() .position(|c| c == &right.column) .ok_or(Error::SynthesisError)?; self.layouter.cs.copy( - permutation.index, + permutation.index(), left_column, *self.layouter.regions[*left.region_index] + left.row_offset, right_column, diff --git a/src/plonk/circuit.rs b/src/plonk/circuit.rs index f9e38b2..0ca2a13 100644 --- a/src/plonk/circuit.rs +++ b/src/plonk/circuit.rs @@ -7,6 +7,7 @@ use std::{ }; use super::{lookup, permutation, Error}; +use crate::arithmetic::FieldExt; use crate::poly::Rotation; /// A column type @@ -126,6 +127,34 @@ impl TryFrom> for Column { } } +/// A permutation. +#[derive(Clone, Debug)] +pub struct Permutation { + index: usize, + mapping: Vec>, +} + +impl Permutation { + /// Configures a new permutation for the given columns. + pub fn new(meta: &mut ConstraintSystem, columns: &[Column]) -> Self { + let index = meta.permutation(columns); + Permutation { + index, + mapping: columns.iter().copied().collect(), + } + } + + /// Returns index of permutation + pub fn index(&self) -> usize { + self.index + } + + /// Returns mapping of permutation + pub fn mapping(&self) -> &[Column] { + &self.mapping + } +} + /// This trait allows a [`Circuit`] to direct some backend to assign a witness /// for a constraint system. pub trait Assignment { From d82a0c85b14b21c86684a0c289fe3b980996f996 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 19 Feb 2021 14:53:26 +0800 Subject: [PATCH 2/4] Modify Assignment::copy() to take Permutation instead of usize --- examples/performance_model.rs | 13 +++++++++---- src/circuit/layouter.rs | 2 +- src/dev.rs | 8 ++++---- src/plonk.rs | 17 +++++++++++------ src/plonk/circuit.rs | 17 ++++++++--------- src/plonk/keygen.rs | 8 ++++---- src/plonk/prover.rs | 4 ++-- 7 files changed, 39 insertions(+), 30 deletions(-) diff --git a/examples/performance_model.rs b/examples/performance_model.rs index 8cd9c53..1138bc0 100644 --- a/examples/performance_model.rs +++ b/examples/performance_model.rs @@ -17,7 +17,7 @@ use std::marker::PhantomData; #[derive(Copy, Clone, Debug)] pub struct Variable(Column, usize); -#[derive(Copy, Clone)] +#[derive(Clone)] struct PLONKConfig { a: Column, b: Column, @@ -29,7 +29,7 @@ struct PLONKConfig { sm: Column, sp: Column, - perm: usize, + perm: Permutation, } trait StandardCS { @@ -170,8 +170,13 @@ impl<'a, FF: FieldExt, CS: Assignment> StandardCS for StandardPLONK<'a, _ => unreachable!(), }; - self.cs - .copy(self.config.perm, left_column, left.1, right_column, right.1) + self.cs.copy( + &self.config.perm, + left_column, + left.1, + right_column, + right.1, + ) } fn public_input(&mut self, f: F) -> Result where diff --git a/src/circuit/layouter.rs b/src/circuit/layouter.rs index 13b5311..9561657 100644 --- a/src/circuit/layouter.rs +++ b/src/circuit/layouter.rs @@ -332,7 +332,7 @@ impl<'r, 'a, C: Chip, CS: Assignment + 'a> RegionLayouter .ok_or(Error::SynthesisError)?; self.layouter.cs.copy( - permutation.index(), + permutation, left_column, *self.layouter.regions[*left.region_index] + left.row_offset, right_column, diff --git a/src/dev.rs b/src/dev.rs index 7bdbcee..f7fd500 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -6,7 +6,7 @@ use crate::{ arithmetic::{FieldExt, Group}, plonk::{ permutation, Advice, Assignment, Circuit, Column, ColumnType, ConstraintSystem, Error, - Expression, Fixed, + Expression, Fixed, Permutation, }, poly::Rotation, }; @@ -211,18 +211,18 @@ impl Assignment for MockProver { fn copy( &mut self, - permutation: usize, + permutation: &Permutation, left_column: usize, left_row: usize, right_column: usize, right_row: usize, ) -> Result<(), crate::plonk::Error> { // Check bounds first - if permutation >= self.permutations.len() { + if permutation.index() >= self.permutations.len() { return Err(Error::BoundsFailure); } - self.permutations[permutation].copy(left_column, left_row, right_column, right_row) + self.permutations[permutation.index()].copy(left_column, left_row, right_column, right_row) } fn push_namespace(&mut self, _: N) diff --git a/src/plonk.rs b/src/plonk.rs index 0a7e1a6..8199e38 100644 --- a/src/plonk.rs +++ b/src/plonk.rs @@ -210,7 +210,7 @@ fn test_proving() { // Initialize the polynomial commitment parameters let params: Params = Params::new(K); - #[derive(Copy, Clone)] + #[derive(Clone)] struct PLONKConfig { a: Column, b: Column, @@ -226,8 +226,8 @@ fn test_proving() { sl: Column, sl2: Column, - perm: usize, - perm2: usize, + perm: Permutation, + perm2: Permutation, } trait StandardCS { @@ -393,10 +393,15 @@ fn test_proving() { _ => unreachable!(), }; - self.cs - .copy(self.config.perm, left_column, left.1, right_column, right.1)?; self.cs.copy( - self.config.perm2, + &self.config.perm, + left_column, + left.1, + right_column, + right.1, + )?; + self.cs.copy( + &self.config.perm2, left_column, left.1, right_column, diff --git a/src/plonk/circuit.rs b/src/plonk/circuit.rs index 0ca2a13..85cef67 100644 --- a/src/plonk/circuit.rs +++ b/src/plonk/circuit.rs @@ -137,11 +137,7 @@ pub struct Permutation { impl Permutation { /// Configures a new permutation for the given columns. pub fn new(meta: &mut ConstraintSystem, columns: &[Column]) -> Self { - let index = meta.permutation(columns); - Permutation { - index, - mapping: columns.iter().copied().collect(), - } + meta.permutation(columns) } /// Returns index of permutation @@ -208,7 +204,7 @@ pub trait Assignment { /// Assign two advice columns to have the same value fn copy( &mut self, - permutation: usize, + permutation: &Permutation, left_column: usize, left_row: usize, right_column: usize, @@ -477,8 +473,8 @@ impl ConstraintSystem { } } - /// Add a permutation argument for some advice columns - pub fn permutation(&mut self, columns: &[Column]) -> usize { + /// Add a permutation argument for some columns + pub fn permutation(&mut self, columns: &[Column]) -> Permutation { let index = self.permutations.len(); for column in columns { @@ -487,7 +483,10 @@ impl ConstraintSystem { self.permutations .push(permutation::Argument::new(columns.to_vec())); - index + Permutation { + index, + mapping: columns.to_vec(), + } } /// Add a lookup argument for some input expressions and table expressions. diff --git a/src/plonk/keygen.rs b/src/plonk/keygen.rs index 18cbafb..7531ec6 100644 --- a/src/plonk/keygen.rs +++ b/src/plonk/keygen.rs @@ -3,7 +3,7 @@ use group::Curve; use super::{ circuit::{Advice, Assignment, Circuit, Column, ConstraintSystem, Fixed}, - permutation, Error, LagrangeCoeff, Polynomial, ProvingKey, VerifyingKey, + permutation, Error, LagrangeCoeff, Permutation, Polynomial, ProvingKey, VerifyingKey, }; use crate::arithmetic::CurveAffine; use crate::poly::{ @@ -116,18 +116,18 @@ impl Assignment for Assembly { fn copy( &mut self, - permutation: usize, + permutation: &Permutation, left_column: usize, left_row: usize, right_column: usize, right_row: usize, ) -> Result<(), Error> { // Check bounds first - if permutation >= self.permutations.len() { + if permutation.index() >= self.permutations.len() { return Err(Error::BoundsFailure); } - self.permutations[permutation].copy(left_column, left_row, right_column, right_row) + self.permutations[permutation.index()].copy(left_column, left_row, right_column, right_row) } fn push_namespace(&mut self, _: N) diff --git a/src/plonk/prover.rs b/src/plonk/prover.rs index e919fd9..21b7680 100644 --- a/src/plonk/prover.rs +++ b/src/plonk/prover.rs @@ -5,7 +5,7 @@ use std::iter; use super::{ circuit::{Advice, Assignment, Circuit, Column, ConstraintSystem, Fixed}, lookup, permutation, vanishing, ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, - ChallengeY, Error, ProvingKey, + ChallengeY, Error, Permutation, ProvingKey, }; use crate::arithmetic::{eval_polynomial, CurveAffine, FieldExt}; use crate::poly::{ @@ -159,7 +159,7 @@ pub fn create_proof, ConcreteCircuit: Circ fn copy( &mut self, - _: usize, + _: &Permutation, _: usize, _: usize, _: usize, From 5a341b0f8faa0e61dc4519a368798fc42c824610 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 19 Feb 2021 15:07:08 +0800 Subject: [PATCH 3/4] Modify Assignment::copy() to take Column instead of usize --- examples/performance_model.rs | 17 ++--------------- src/circuit/layouter.rs | 15 ++------------- src/dev.rs | 24 ++++++++++++++++++++---- src/plonk.rs | 21 ++++----------------- src/plonk/circuit.rs | 4 ++-- src/plonk/keygen.rs | 24 ++++++++++++++++++++---- src/plonk/prover.rs | 6 +++--- 7 files changed, 53 insertions(+), 58 deletions(-) diff --git a/examples/performance_model.rs b/examples/performance_model.rs index 1138bc0..1d5d1d7 100644 --- a/examples/performance_model.rs +++ b/examples/performance_model.rs @@ -157,24 +157,11 @@ impl<'a, FF: FieldExt, CS: Assignment> StandardCS for StandardPLONK<'a, )) } fn copy(&mut self, left: Variable, right: Variable) -> Result<(), Error> { - let left_column = match left.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - let right_column = match right.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - self.cs.copy( &self.config.perm, - left_column, + left.0.into(), left.1, - right_column, + right.0.into(), right.1, ) } diff --git a/src/circuit/layouter.rs b/src/circuit/layouter.rs index 9561657..8ff687d 100644 --- a/src/circuit/layouter.rs +++ b/src/circuit/layouter.rs @@ -320,22 +320,11 @@ impl<'r, 'a, C: Chip, CS: Assignment + 'a> RegionLayouter left: Cell, right: Cell, ) -> Result<(), Error> { - let left_column = permutation - .mapping() - .iter() - .position(|c| c == &left.column) - .ok_or(Error::SynthesisError)?; - let right_column = permutation - .mapping() - .iter() - .position(|c| c == &right.column) - .ok_or(Error::SynthesisError)?; - self.layouter.cs.copy( permutation, - left_column, + left.column, *self.layouter.regions[*left.region_index] + left.row_offset, - right_column, + right.column, *self.layouter.regions[*right.region_index] + right.row_offset, )?; diff --git a/src/dev.rs b/src/dev.rs index f7fd500..f89a733 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -5,7 +5,7 @@ use ff::Field; use crate::{ arithmetic::{FieldExt, Group}, plonk::{ - permutation, Advice, Assignment, Circuit, Column, ColumnType, ConstraintSystem, Error, + permutation, Advice, Any, Assignment, Circuit, Column, ColumnType, ConstraintSystem, Error, Expression, Fixed, Permutation, }, poly::Rotation, @@ -212,9 +212,9 @@ impl Assignment for MockProver { fn copy( &mut self, permutation: &Permutation, - left_column: usize, + left_column: Column, left_row: usize, - right_column: usize, + right_column: Column, right_row: usize, ) -> Result<(), crate::plonk::Error> { // Check bounds first @@ -222,7 +222,23 @@ impl Assignment for MockProver { return Err(Error::BoundsFailure); } - self.permutations[permutation.index()].copy(left_column, left_row, right_column, right_row) + let left_column_index = permutation + .mapping() + .iter() + .position(|c| c == &left_column) + .ok_or(Error::SynthesisError)?; + let right_column_index = permutation + .mapping() + .iter() + .position(|c| c == &right_column) + .ok_or(Error::SynthesisError)?; + + self.permutations[permutation.index()].copy( + left_column_index, + left_row, + right_column_index, + right_row, + ) } fn push_namespace(&mut self, _: N) diff --git a/src/plonk.rs b/src/plonk.rs index 8199e38..f321fe2 100644 --- a/src/plonk.rs +++ b/src/plonk.rs @@ -380,31 +380,18 @@ fn test_proving() { )) } fn copy(&mut self, left: Variable, right: Variable) -> Result<(), Error> { - let left_column = match left.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - let right_column = match right.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - self.cs.copy( &self.config.perm, - left_column, + left.0.into(), left.1, - right_column, + right.0.into(), right.1, )?; self.cs.copy( &self.config.perm2, - left_column, + left.0.into(), left.1, - right_column, + right.0.into(), right.1, ) } diff --git a/src/plonk/circuit.rs b/src/plonk/circuit.rs index 85cef67..4893ddd 100644 --- a/src/plonk/circuit.rs +++ b/src/plonk/circuit.rs @@ -205,9 +205,9 @@ pub trait Assignment { fn copy( &mut self, permutation: &Permutation, - left_column: usize, + left_column: Column, left_row: usize, - right_column: usize, + right_column: Column, right_row: usize, ) -> Result<(), Error>; diff --git a/src/plonk/keygen.rs b/src/plonk/keygen.rs index 7531ec6..dfe0fe2 100644 --- a/src/plonk/keygen.rs +++ b/src/plonk/keygen.rs @@ -2,7 +2,7 @@ use ff::Field; use group::Curve; use super::{ - circuit::{Advice, Assignment, Circuit, Column, ConstraintSystem, Fixed}, + circuit::{Advice, Any, Assignment, Circuit, Column, ConstraintSystem, Fixed}, permutation, Error, LagrangeCoeff, Permutation, Polynomial, ProvingKey, VerifyingKey, }; use crate::arithmetic::CurveAffine; @@ -117,9 +117,9 @@ impl Assignment for Assembly { fn copy( &mut self, permutation: &Permutation, - left_column: usize, + left_column: Column, left_row: usize, - right_column: usize, + right_column: Column, right_row: usize, ) -> Result<(), Error> { // Check bounds first @@ -127,7 +127,23 @@ impl Assignment for Assembly { return Err(Error::BoundsFailure); } - self.permutations[permutation.index()].copy(left_column, left_row, right_column, right_row) + let left_column_index = permutation + .mapping() + .iter() + .position(|c| c == &left_column) + .ok_or(Error::SynthesisError)?; + let right_column_index = permutation + .mapping() + .iter() + .position(|c| c == &right_column) + .ok_or(Error::SynthesisError)?; + + self.permutations[permutation.index()].copy( + left_column_index, + left_row, + right_column_index, + right_row, + ) } fn push_namespace(&mut self, _: N) diff --git a/src/plonk/prover.rs b/src/plonk/prover.rs index 21b7680..1f3d986 100644 --- a/src/plonk/prover.rs +++ b/src/plonk/prover.rs @@ -3,7 +3,7 @@ use group::Curve; use std::iter; use super::{ - circuit::{Advice, Assignment, Circuit, Column, ConstraintSystem, Fixed}, + circuit::{Advice, Any, Assignment, Circuit, Column, ConstraintSystem, Fixed}, lookup, permutation, vanishing, ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, ChallengeY, Error, Permutation, ProvingKey, }; @@ -160,9 +160,9 @@ pub fn create_proof, ConcreteCircuit: Circ fn copy( &mut self, _: &Permutation, + _: Column, _: usize, - _: usize, - _: usize, + _: Column, _: usize, ) -> Result<(), Error> { // We only care about advice columns here From 4ae21a905da34d83b5af8e1b8d323a39531ab2f0 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 19 Feb 2021 15:24:21 +0800 Subject: [PATCH 4/4] Update tests --- benches/plonk.rs | 26 +++++++++----------------- examples/circuit-layout.rs | 34 +++++++++++++--------------------- src/dev/graph.rs | 10 ++++++---- src/dev/graph/layout.rs | 10 ++++++---- src/plonk/circuit.rs | 2 +- 5 files changed, 35 insertions(+), 47 deletions(-) diff --git a/benches/plonk.rs b/benches/plonk.rs index bf48509..1204336 100644 --- a/benches/plonk.rs +++ b/benches/plonk.rs @@ -20,7 +20,7 @@ fn bench_with_k(name: &str, k: u32, c: &mut Criterion) { // Initialize the polynomial commitment parameters let params: Params = Params::new(k); - #[derive(Copy, Clone)] + #[derive(Clone)] struct PLONKConfig { a: Column, b: Column, @@ -31,7 +31,7 @@ fn bench_with_k(name: &str, k: u32, c: &mut Criterion) { sc: Column, sm: Column, - perm: usize, + perm: Permutation, } trait StandardCS { @@ -156,21 +156,13 @@ fn bench_with_k(name: &str, k: u32, c: &mut Criterion) { )) } fn copy(&mut self, left: Variable, right: Variable) -> Result<(), Error> { - let left_column = match left.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - let right_column = match right.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - - self.cs - .copy(self.config.perm, left_column, left.1, right_column, right.1) + self.cs.copy( + &self.config.perm, + left.0.into(), + left.1, + right.0.into(), + right.1, + ) } } diff --git a/examples/circuit-layout.rs b/examples/circuit-layout.rs index ccd9338..14417e8 100644 --- a/examples/circuit-layout.rs +++ b/examples/circuit-layout.rs @@ -2,7 +2,7 @@ use halo2::{ arithmetic::FieldExt, dev::circuit_layout, pasta::Fp, - plonk::{Advice, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed}, + plonk::{Advice, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed, Permutation}, poly::Rotation, }; use plotters::prelude::*; @@ -30,8 +30,8 @@ fn main() { sl: Column, sl2: Column, - perm: usize, - perm2: usize, + perm: Permutation, + perm2: Permutation, } trait StandardCS { @@ -195,26 +195,18 @@ fn main() { )) } fn copy(&mut self, left: Variable, right: Variable) -> Result<(), Error> { - let left_column = match left.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - let right_column = match right.0 { - x if x == self.config.a => 0, - x if x == self.config.b => 1, - x if x == self.config.c => 2, - _ => unreachable!(), - }; - - self.cs - .copy(self.config.perm, left_column, left.1, right_column, right.1)?; self.cs.copy( - self.config.perm2, - left_column, + &self.config.perm, + left.0.into(), left.1, - right_column, + right.0.into(), + right.1, + )?; + self.cs.copy( + &self.config.perm2, + left.0.into(), + left.1, + right.0.into(), right.1, ) } diff --git a/src/dev/graph.rs b/src/dev/graph.rs index 6484864..cce172f 100644 --- a/src/dev/graph.rs +++ b/src/dev/graph.rs @@ -1,7 +1,9 @@ use ff::Field; use tabbycat::{AttrList, Edge, GraphBuilder, GraphType, Identity, StmtList}; -use crate::plonk::{Advice, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed}; +use crate::plonk::{ + Advice, Any, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed, Permutation, +}; pub mod layout; @@ -118,10 +120,10 @@ impl Assignment for Graph { fn copy( &mut self, + _: &Permutation, + _: Column, _: usize, - _: usize, - _: usize, - _: usize, + _: Column, _: usize, ) -> Result<(), crate::plonk::Error> { // Do nothing; we don't care about permutations in this context. diff --git a/src/dev/graph/layout.rs b/src/dev/graph/layout.rs index 71a91fc..5883253 100644 --- a/src/dev/graph/layout.rs +++ b/src/dev/graph/layout.rs @@ -6,7 +6,9 @@ use plotters::{ use std::cmp; use std::collections::HashSet; -use crate::plonk::{Advice, Any, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed}; +use crate::plonk::{ + Advice, Any, Assignment, Circuit, Column, ConstraintSystem, Error, Fixed, Permutation, +}; /// Renders the circuit layout on the given drawing area. /// @@ -251,10 +253,10 @@ impl Assignment for Layout { fn copy( &mut self, + _: &Permutation, + _: Column, _: usize, - _: usize, - _: usize, - _: usize, + _: Column, _: usize, ) -> Result<(), crate::plonk::Error> { // Do nothing; we don't care about permutations in this context. diff --git a/src/plonk/circuit.rs b/src/plonk/circuit.rs index 4893ddd..2f1bba6 100644 --- a/src/plonk/circuit.rs +++ b/src/plonk/circuit.rs @@ -201,7 +201,7 @@ pub trait Assignment { A: FnOnce() -> AR, AR: Into; - /// Assign two advice columns to have the same value + /// Assign two cells to have the same value fn copy( &mut self, permutation: &Permutation,