Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestions: lifetimes #1527

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
lifetimes
  • Loading branch information
spiral-ladder committed Apr 11, 2024
commit 83779b897b1dd1791201084c737194119558b8bc
14 changes: 6 additions & 8 deletions circuits/src/memory/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ impl<F, const D: usize> HasNamedColumns for MemoryStark<F, D> {
const COLUMNS: usize = Memory::<()>::NUMBER_OF_COLUMNS;
const PUBLIC_INPUTS: usize = 0;

// The clippy exception makes life times slightly easier to work with.
#[allow(clippy::needless_pass_by_value)]
// Constraints design: https://docs.google.com/presentation/d/1G4tmGl8V1W0Wqxv-MwjGjaM3zUF99dzTvFhpiood4x4/edit?usp=sharing
fn generate_constraints<T: Copy, U, const N2: usize>(
vars: StarkFrameTyped<Memory<Expr<T>>, [U; N2]>,
) -> ConstraintBuilder<Expr<T>> {
fn generate_constraints<'a, T: Copy, U, const N2: usize>(
vars: &StarkFrameTyped<Memory<Expr<'a, T>>, [U; N2]>,
) -> ConstraintBuilder<Expr<'a, T>> {
let lv = vars.local_values;
let nv = vars.next_values;
let mut constraints = ConstraintBuilder::default();
Expand Down Expand Up @@ -163,15 +161,15 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for MemoryStark<F
type EvaluationFrameTarget =
StarkFrame<ExtensionTarget<D>, ExtensionTarget<D>, COLUMNS, PUBLIC_INPUTS>;

fn eval_packed_generic<FE, P, const D2: usize>(
fn eval_packed_generic<'a, FE, P, const D2: usize>(
&self,
vars: &Self::EvaluationFrame<FE, P, D2>,
consumer: &mut ConstraintConsumer<P>,
) where
FE: FieldExtension<D2, BaseField = F>,
P: PackedField<Scalar = FE>, {
let eb = ExprBuilder::default();
let constraints = generate_constraints(eb.to_typed_starkframe(vars));
let constraints = generate_constraints(&eb.to_typed_starkframe(vars));
build_packed(constraints, consumer);
}

Expand All @@ -184,7 +182,7 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for MemoryStark<F
consumer: &mut RecursiveConstraintConsumer<F, D>,
) {
let eb = ExprBuilder::default();
let constraints = generate_constraints(eb.to_typed_starkframe(vars));
let constraints = generate_constraints(&eb.to_typed_starkframe(vars));
build_ext(constraints, builder, consumer);
}
}
Expand Down