You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After writing a ProvingKey to a bytes.Buffer and reading it back, groth16.Prove panics when trying to access InfinityA and InfinityB because they aren't handled by the corresponding marshaling functions. The formats []bool and int aren't supported by the gnark-crypto marshaller either.
Here's a minimal example that reproduces the behavior:
import (
"bytes""testing""github.com/consensys/gnark-crypto/ecc""github.com/consensys/gnark/backend""github.com/consensys/gnark/backend/groth16""github.com/consensys/gnark/frontend"
)
typeCircuitstruct {
X frontend.Variable`gnark:"x"`Y frontend.Variable`gnark:",public"`
}
func (circuit*Circuit) Define(curveID ecc.ID, cs*frontend.ConstraintSystem) error {
x3:=cs.Mul(circuit.X, circuit.X, circuit.X)
cs.AssertIsEqual(circuit.Y, cs.Add(x3, circuit.X, 5))
returnnil
}
funcTestCubicEquationMarshalled(t*testing.T) {
assert:=groth16.NewAssert(t)
varcubicCircuitCircuitr1cs, err:=frontend.Compile(ecc.BN254, backend.GROTH16, &cubicCircuit)
assert.NoError(err)
{
varwitnessCircuitwitness.X.Assign(3)
witness.Y.Assign(35)
pk, _, err:=groth16.Setup(r1cs)
assert.NoError(err, "generating public data should not have failed")
buf:=new(bytes.Buffer)
_, err=pk.WriteTo(buf)
assert.NoError(err, "writing proving key to buffer should not have failed")
pkCopy:=groth16.NewProvingKey(ecc.BN254)
_, err=pkCopy.ReadFrom(buf)
assert.NoError(err, "reading proving key back from buffer should not have failed")
_, err=groth16.Prove(r1cs, pkCopy, &witness, nil)
assert.NoError(err, "proving with good witness should not have failed")
}
}
The text was updated successfully, but these errors were encountered:
After writing a
ProvingKey
to abytes.Buffer
and reading it back,groth16.Prove
panics when trying to accessInfinityA
andInfinityB
because they aren't handled by the corresponding marshaling functions. The formats[]bool
andint
aren't supported by thegnark-crypto
marshaller either.Here's a minimal example that reproduces the behavior:
The text was updated successfully, but these errors were encountered: