mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
Significant refactor and all tests passing, as well as optimized range check for Goldilocks (#37)
This commit is contained in:
@@ -28,7 +28,7 @@ type BN254State = [BN254_SPONGE_WIDTH]frontend.Variable
|
||||
type BN254HashOut = frontend.Variable
|
||||
|
||||
func NewBN254Chip(api frontend.API) *BN254Chip {
|
||||
return &BN254Chip{api: api, gl: *gl.NewChip(api)}
|
||||
return &BN254Chip{api: api, gl: *gl.New(api)}
|
||||
}
|
||||
|
||||
func (c *BN254Chip) Poseidon(state BN254State) BN254State {
|
||||
|
||||
@@ -21,7 +21,7 @@ type GoldilocksChip struct {
|
||||
}
|
||||
|
||||
func NewGoldilocksChip(api frontend.API) *GoldilocksChip {
|
||||
return &GoldilocksChip{api: api, gl: *gl.NewChip(api)}
|
||||
return &GoldilocksChip{api: api, gl: *gl.New(api)}
|
||||
}
|
||||
|
||||
// The permutation function.
|
||||
|
||||
@@ -25,7 +25,7 @@ func (circuit *TestPoseidonCircuit) Define(api frontend.API) error {
|
||||
poseidonChip := NewGoldilocksChip(api)
|
||||
output := poseidonChip.Poseidon(input)
|
||||
|
||||
glApi := gl.NewChip(api)
|
||||
glApi := gl.New(api)
|
||||
|
||||
for i := 0; i < 12; i++ {
|
||||
glApi.AssertIsEqual(output[i], gl.NewVariable(circuit.Out[i]))
|
||||
|
||||
@@ -18,7 +18,7 @@ type TestPublicInputsHashCircuit struct {
|
||||
}
|
||||
|
||||
func (circuit *TestPublicInputsHashCircuit) Define(api frontend.API) error {
|
||||
glAPI := gl.NewChip(api)
|
||||
glAPI := gl.New(api)
|
||||
|
||||
// BN254 -> Binary(64) -> F
|
||||
var input [3]gl.Variable
|
||||
@@ -78,6 +78,6 @@ func TestPublicInputsHashWitness2(t *testing.T) {
|
||||
test.WithBackends(backend.GROTH16),
|
||||
test.WithCurves(ecc.BN254),
|
||||
test.NoFuzzing(),
|
||||
test.NoSerialization(),
|
||||
test.NoSerializationChecks(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user