chore!: explicitly constrain inputs and intermediate witnesses#19826
Merged
ledwards2225 merged 6 commits intomerge-train/barretenbergfrom Jan 23, 2026
Merged
chore!: explicitly constrain inputs and intermediate witnesses#19826ledwards2225 merged 6 commits intomerge-train/barretenbergfrom
ledwards2225 merged 6 commits intomerge-train/barretenbergfrom
Conversation
ledwards2225
commented
Jan 22, 2026
| * @param input The field element to constrain to 32 bits. | ||
| */ | ||
| template <typename Builder> | ||
| void SHA256<Builder>::apply_32_bit_range_constraint_via_lookup(const field_t<Builder>& input) |
Contributor
Author
There was a problem hiding this comment.
As Kesha pointed out, this is only beneficial if we don't already use the traditional range constraint mechanism in the circuit. In practice, noir applies explicit range constraints to all inputs so this will effectively never be the case. Thus, ignoring the high overhead, the cost is 1.75 vs 3 gates for explicit vs lookup-imposed range constraints.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 27, 2026
BEGIN_COMMIT_OVERRIDE feat: support JSON input files for bb verify command (#19800) fix: update bootstrap.sh to use new JSON field names chore: Update `index.js` so that `HAS_ZK` and `PUBLIC_INPUTS` variables must always be set in tests (#19884) chore: pippenger int audit (#19302) chore: deduplicate batch affine addition trick (#19788) chore: transcript+codec+poseidon2 fixes (#19419) chore!: explicitly constrain inputs and intermediate witnesses (#19826) fix: exclude nlohmann/json from WASM builds in json_output.hpp chore: translator circuit builder and flavor audit (#19798) Revert "fix: exclude nlohmann/json from WASM builds in json_output.hpp" Revert "feat: support JSON input files for bb verify command (#19800)" Revert "fix: update bootstrap.sh to use new JSON field names" END_COMMIT_OVERRIDE
danielntmd
pushed a commit
that referenced
this pull request
Jan 27, 2026
Changes include: - Add explicit range constraints so that all inputs are constrained within bb (possibly redundant with noir-applied constraints) - Add explicit range constraints so that intermediate witnesses are constrained to be unique where possible - Get rid of `apply_32_bit_range_constraint_via_lookup` in favor of explicit range constraints since the former is only cheaper if the latter is not already in use (which in practice won't occur)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes include:
apply_32_bit_range_constraint_via_lookupin favor of explicit range constraints since the former is only cheaper if the latter is not already in use (which in practice won't occur)