We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading serialized R1CS panics
Serialization and deserialization should work as expected
panic: reflect: reflect.Value.Set using unaddressable value
N/A
import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" cs "github.com/consensys/gnark/constraint/bn254" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" "github.com/consensys/gnark/std/math/uints" ) type Circuit struct { Val uints.U32 Val1 uints.U32 } func (c *Circuit) Define(api frontend.API) error { uapi, err := uints.New[uints.U32](api) if err != nil { return err } uapi.AssertEq(c.Val, c.Val1) return nil } func main() { witness := Circuit{ Val: uints.NewU32(10), Val1: uints.NewU32(10), } curve := ecc.BN254.ScalarField() r1css, err := frontend.Compile(curve, r1cs.NewBuilder, &witness) if err != nil { panic(err) } buf := &bytes.Buffer{} r1css.WriteTo(buf) r1css = cs.NewR1CS(0) r1css.ReadFrom(bytes.NewBuffer(buf.Bytes())) fmt.Println(r1css.GetNbConstraints()) }
I was trying to load compiled circuit from file
The text was updated successfully, but these errors were encountered:
Hi -- replacing
r1css = cs.NewR1CS(0)
by
// import "github.com/consensys/gnark/backend/groth16" r1css = groth16.NewCS(ecc.BN254)
Will work. The cs.NewR1CS is indeed confusing now that it is exposed and not documented...
cs.NewR1CS
Sorry, something went wrong.
doc: add docs to NewR1CS and NewSparseR1CS in system.go #985
5fda666
gbotrel
No branches or pull requests
Description
Reading serialized R1CS panics
Expected Behavior
Serialization and deserialization should work as expected
Actual Behavior
panic: reflect: reflect.Value.Set using unaddressable value
Possible Fix
N/A
Steps to Reproduce
Context
I was trying to load compiled circuit from file
Your Environment
The text was updated successfully, but these errors were encountered: