mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
Moved to variables
This commit is contained in:
@@ -20,15 +20,15 @@ const BN254_SPONGE_WIDTH int = 4
|
||||
const BN254_SPONGE_RATE int = 3
|
||||
|
||||
type BN254Chip struct {
|
||||
api frontend.API `gnark:"-"`
|
||||
gl gl.GoldilocksApi `gnark:"-"`
|
||||
api frontend.API `gnark:"-"`
|
||||
gl gl.Chip `gnark:"-"`
|
||||
}
|
||||
|
||||
type BN254State = [BN254_SPONGE_WIDTH]frontend.Variable
|
||||
type BN254HashOut = frontend.Variable
|
||||
|
||||
func NewBN254Chip(api frontend.API) *BN254Chip {
|
||||
return &BN254Chip{api: api, gl: *gl.NewGoldilocksApi(api)}
|
||||
return &BN254Chip{api: api, gl: *gl.New(api)}
|
||||
}
|
||||
|
||||
func (c *BN254Chip) Poseidon(state BN254State) BN254State {
|
||||
|
||||
@@ -16,12 +16,12 @@ type GoldilocksStateExtension = [SPONGE_WIDTH]gl.QuadraticExtensionVariable
|
||||
type GoldilocksHashOut = [4]gl.Variable
|
||||
|
||||
type GoldilocksChip struct {
|
||||
api frontend.API `gnark:"-"`
|
||||
gl gl.GoldilocksApi `gnark:"-"`
|
||||
api frontend.API `gnark:"-"`
|
||||
gl gl.Chip `gnark:"-"`
|
||||
}
|
||||
|
||||
func NewGoldilocksChip(api frontend.API) *GoldilocksChip {
|
||||
return &GoldilocksChip{api: api, gl: *gl.NewGoldilocksApi(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.NewGoldilocksApi(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.NewGoldilocksApi(api)
|
||||
glAPI := gl.New(api)
|
||||
|
||||
// BN254 -> Binary(64) -> F
|
||||
var input [3]gl.Variable
|
||||
|
||||
Reference in New Issue
Block a user