Skip to content

Conversation

@gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Feb 24, 2023

This PR is based on top of @ivokub #481 and #483 .

frontend/cs/scs now uses constraint/ package (killed TermToRefactor and LinearExpressionToRefactor) .

builder.addPlonkConstraint(...) signature changed;

introduced

// qL⋅xa + qR⋅xb + qO⋅xc + qM⋅(xaxb) + qC == 0
type sparseR1C struct {
	xa, xb, xc         int              // wires
	qL, qR, qO, qM, qC constraint.Coeff // coefficients
}

and ensured all apis use this format clearly (doc + call).

Perf improvement:

  • ~35% compile time for example for groth16 bls12377
  • less constraints in some cases when calling api.Add(v1, v2, constant, v3, ...); the constant part is now "merged" into one of the sub-constraints (for example AssertIsLessOrEqual benefits from that).

Fixes

  • some likely bugs in api.Xor api.Or and api.IsZero that would assume the coeff a variable that is boolean is always 1. (whereas we should check coeff*wire == 0|1).

@gbotrel gbotrel linked an issue Feb 24, 2023 that may be closed by this pull request
@gbotrel gbotrel merged commit 4f9bfba into develop Feb 28, 2023
@gbotrel gbotrel deleted the gbotrel/issue467 branch February 28, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: PlonK frontend should use constraint/ package

4 participants