-
Notifications
You must be signed in to change notification settings - Fork 443
feat: constant value binary decomposition #1510
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
Conversation
Co-authored-by: Copilot <[email protected]>
Uh, ton of tests started to fail now. I'll see if there is something systematic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements constant value binary decomposition and improves the handling of constant inputs in binary conversion routines, along with updating the test engine behavior for witness reduction.
- Improved witness reduction logic by mod reducing values when copying witness data.
- Enhanced binary conversion functions to separately handle constant inputs and added comprehensive tests for both valid and invalid cases.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/engine.go | Removed obsolete IsConstant and updated witness copying to mod reduce values. |
std/math/bits/conversion_test.go | Added tests to validate binary conversion with constant inputs and ensured consistency between decomposed and constant binary representations. |
std/math/bits/conversion_binary.go | Refactored handling of constant inputs in FromBinary and ToBinary; potential error in loop iteration in constant branch of ToBinary. |
frontend/cs/scs/api_assertions.go | Refactored AssertIsLessOrEqual to use a switch for clarity and improved constant handling. |
frontend/cs/r1cs/api_assertions.go | Similar refactoring as in scs assertions to handle constant bounds via a switch statement. |
Found the bugs. One was from my change and other one was another existing one. |
Description
Handle binary decomposition for constant inputs.
Fixes #913. #1481 is duplicate of it, but it was not well implemented.
I also updated the test engine to mod-reduce the witness when copying. This mimics better the behaviour of actual solver.
Type of change
How has this been tested?
Checklist:
golangci-lint
does not output errors locally