Skip to content

Conversation

@forkfury
Copy link

@forkfury forkfury commented Nov 13, 2025

Add constant value check at the start of AssertIsCrumb to avoid unnecessary constraint generation for compile-time constants.

Use separate variable x instead of overwriting input parameter for better code clarity.
Add mathematical comment explaining the polynomial constraint derivation, matching the SCS implementation style.


Note

Optimize and clarify AssertIsCrumb by adding a constant fast path, cleaner polynomial constraint with auxiliary variable, and explanatory comment.

  • Assertions (frontend/cs/r1cs/api_assertions.go):
    • AssertIsCrumb:
      • Add constant-value fast path: accept constants in [0,3], panic otherwise with clearer error message.
      • Rework constraint using auxiliary x := i1² - 3i1, enforcing x(x+2) = 0 without mutating the input.
      • Add brief mathematical comment explaining the polynomial derivation.

Written by Cursor Bugbot for commit 8a7ffdb. This will update automatically on new commits. Configure here.

Add constant value check at the start of AssertIsCrumb to avoid unnecessary
constraint generation for compile-time constants. Use separate variable x
instead of overwriting input parameter for better code clarity. Add mathematical
comment explaining the polynomial constraint derivation, matching the SCS
implementation style.
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.

1 participant