-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-rjjm-x32p-m3f7
* test: add failing test case * refactor: use lsh instead of exp for partition combination * fix: correct constraining of high limb * feat: count conditional check during optimisation * chore: update statistics
- Loading branch information
Showing
3 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package regressiontests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/consensys/gnark/frontend" | ||
"github.com/consensys/gnark/std/rangecheck" | ||
"github.com/consensys/gnark/test" | ||
) | ||
|
||
type TestRangeCheckCircuit struct { | ||
I1 frontend.Variable | ||
N int | ||
} | ||
|
||
func (circuit *TestRangeCheckCircuit) Define(api frontend.API) error { | ||
rangeChecker := rangecheck.New(api) | ||
rangeChecker.Check(circuit.I1, circuit.N) | ||
return nil | ||
} | ||
|
||
func TestIssue897(t *testing.T) { | ||
assert := test.NewAssert(t) | ||
circuit := TestRangeCheckCircuit{ | ||
N: 7, | ||
} | ||
witness := TestRangeCheckCircuit{ | ||
I1: 1 << 7, | ||
N: 7, | ||
} | ||
assert.CheckCircuit(&circuit, test.WithInvalidAssignment(&witness)) | ||
} |
Binary file not shown.
This file contains 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