arnaucube
arnaucube/gnark-plonky2-verifierPublic Self-hosted repository
fix for V-SCT-VUL-031
Kevin Jue kjue235@gmail.com
Tue, 19 Dec 2023 13:24:27 -0800
commit

49511611b595db6597f4ab90d621876b067f1dbd

parent

e3eff27eb14157ffbf86e40b5e559fe437ab520d

1 files changed, 5 insertions(+), 0 deletions(-)

jump to
M poseidon/bn254.go → poseidon/bn254.go

@@ -10,6 +10,7 @@

import ( "math/big" + "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark/frontend" gl "github.com/succinctlabs/gnark-plonky2-verifier/goldilocks" )

@@ -28,6 +29,10 @@ type BN254State = [BN254_SPONGE_WIDTH]frontend.Variable

type BN254HashOut = frontend.Variable func NewBN254Chip(api frontend.API) *BN254Chip { + if api.Compiler().Field().Cmp(bn254.ID.ScalarField()) != 0 { + panic("Gnark compiler not set to BN254 scalar field") + } + return &BN254Chip{api: api, gl: *gl.New(api)} }