Fix the issues of comments
MODIFY
circuit-construction/src/writer.rs
circuit-construction/src/writer.rs
@@ -788,7 +788,7 @@ pub trait Cs<F: PrimeField> {
// Do one full round on the previous value
let mut acc = states[states.len() - 1]
.iter()
- .map(crate::writer::Var::val)
+ .map(|x| x.val())
.collect();
full_round::<F, PlonkSpongeConstantsKimchi>(
params,

MODIFY
kimchi/src/circuits/expr.rs
kimchi/src/circuits/expr.rs
@@ -1583,7 +1583,6 @@ impl<F: FftField> Linearization<Expr<ConstantExpr<F>>> {
impl<F: One> Expr<F> {
/// Exponentiate an expression
-
pub fn pow(self, p: u64) -> Self {
use Expr::*;
if p == 0 {
@@ -2007,7 +2006,6 @@ impl<F: Field> Mul<F> for Expr<ConstantExpr<F>> {
//
// Display
//
-
impl<F: PrimeField> ConstantExpr<F> {
fn ocaml(&self) -> String {
use ConstantExpr::*;
@@ -2174,15 +2172,12 @@ pub mod constraints {
Self: std::marker::Sized,
{
/// Double the value
-
fn double(&self) -> Self;
/// Compute the square of this value
-
fn square(&self) -> Self;
/// Raise the value to the given power
-
fn pow(&self, p: u64) -> Self;
/// Constrain to boolean
@@ -2317,25 +2312,21 @@ pub fn constant<F>(x: F) -> E<F> {
}
/// Helper function to quickly create an expression for a witness.
-
pub fn witness<F>(i: usize, row: CurrOrNext) -> E<F> {
E::<F>::cell(Column::Witness(i), row)
}
/// Same as [witness] but for the current row.
-
pub fn witness_curr<F>(i: usize) -> E<F> {
witness(i, CurrOrNext::Curr)
}
/// Same as [witness] but for the next row.
-
pub fn witness_next<F>(i: usize) -> E<F> {
witness(i, CurrOrNext::Next)
}
/// Handy function to quickly create an expression for a gate.
-
pub fn index<F>(g: GateType) -> E<F> {
E::<F>::cell(Column::Index(g), CurrOrNext::Curr)
}
@@ -2346,7 +2337,7 @@ pub fn coeff<F>(i: usize) -> E<F> {
/// You can import this module like `use kimchi::circuits::expr::prologue::*` to obtain a number of handy aliases and helpers
pub mod prologue {
- pub use super::*;
+ pub use super::{coeff, constant, index, witness, witness_curr, witness_next, E};
}
#[cfg(test)]

MODIFY
kimchi/src/circuits/gate.rs
kimchi/src/circuits/gate.rs
//! This module implements Plonk constraint gate primitive.
-
use crate::{
circuits::{
argument::{Argument, ArgumentEnv},
@@ -43,7 +42,6 @@ impl CurrOrNext {
/// Compute the offset corresponding to the `CurrOrNext` value.
/// - `Curr.shift() == 0`
/// - `Next.shift() == 1`
-
pub fn shift(&self) -> usize {
match self {
CurrOrNext::Curr => 0,
@@ -191,7 +189,6 @@ impl<F: PrimeField> ToBytes for CircuitGate<F> {
impl<F: PrimeField> CircuitGate<F> {
/// this function creates "empty" circuit gate
-
pub fn zero(wires: GateWires) -> Self {
CircuitGate {
typ: GateType::Zero,
@@ -213,11 +210,7 @@ impl<F: PrimeField> CircuitGate<F> {
cs: &ConstraintSystem<F>,
public: &[F],
) -> Result<(), String> {
- use GateType::{
- CairoClaim, CairoFlags, CairoInstruction, CairoTransition, ChaCha0, ChaCha1, ChaCha2,
- ChaChaFinal, CompleteAdd, EndoMul, EndoMulScalar, Generic, Lookup, Poseidon,
- RangeCheck0, RangeCheck1, VarBaseMul, Zero,
- };
+ use GateType::*;
match self.typ {
Zero => Ok(()),
Generic => self.verify_generic(row, witness, public),

MODIFY
kimchi/src/circuits/lookup/constraints.rs
kimchi/src/circuits/lookup/constraints.rs
use crate::{
circuits::{
- expr::{
- prologue::{witness, E},
- Column, ConstantExpr,
- },
+ expr::{prologue::*, Column, ConstantExpr},
gate::{CircuitGate, CurrOrNext},
lookup::lookups::{
JointLookup, JointLookupSpec, JointLookupValue, LocalPosition, LookupInfo, LookupsUsed,

MODIFY
kimchi/src/circuits/lookup/runtime_tables.rs
kimchi/src/circuits/lookup/runtime_tables.rs
//! At proving time, the prover can use [`RuntimeTable`] to specify the actual tables.
use crate::circuits::{
- expr::{prologue::E, Column},
+ expr::{prologue::*, Column},
gate::CurrOrNext,
};
use ark_ff::Field;

MODIFY
kimchi/src/linearization.rs
kimchi/src/linearization.rs
@@ -145,7 +145,7 @@ pub fn expr_linearization<F: FftField + SquareRootField>(
let linearization = expr
.linearize(evaluated_cols)
.unwrap()
- .map(crate::circuits::expr::Expr::to_polish);
+ .map(|x| x.to_polish());
(linearization, powers_of_alpha)
}

MODIFY
kimchi/src/prover.rs
kimchi/src/prover.rs
@@ -147,11 +147,6 @@ where
/// # Panics
///
/// Will panic if `lookup_context.joint_lookup_table_d8` is None.
- #[allow(
- clippy::needless_pass_by_value,
- clippy::too_many_lines,
- clippy::cast_possible_truncation
- )]
pub fn create_recursive<
EFqSponge: Clone + FqSponge<G::BaseField, G, G::ScalarField>,
EFrSponge: FrSponge<G::ScalarField>,

MODIFY
kimchi/src/tests/framework.rs
kimchi/src/tests/framework.rs
@@ -62,6 +62,7 @@ impl TestFramework {
self
}
+ #[must_use]
pub(crate) fn public_inputs(mut self, public_inputs: Vec<Fp>) -> Self {
self.public_inputs = public_inputs;
self

MODIFY
tools/kimchi-visu/src/lib.rs
tools/kimchi-visu/src/lib.rs
@@ -44,10 +44,7 @@ where
F: PrimeField,
{
fn latex() -> Vec<Vec<String>> {
- Self::constraints()
- .iter()
- .map(kimchi::circuits::expr::Expr::latex_str)
- .collect()
+ Self::constraints().iter().map(|c| c.latex_str()).collect()
}
}

Fix the issues of comments