From e3f8d3cedd895b1fd8c909b63cb87e9487b5364e Mon Sep 17 00:00:00 2001 From: liuxiaobleach <1241368737@qq.com> Date: Thu, 9 May 2024 20:26:45 +0800 Subject: [PATCH] update --- backend/groth16/groth16.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backend/groth16/groth16.go b/backend/groth16/groth16.go index aa3010b7a..84b6b3460 100644 --- a/backend/groth16/groth16.go +++ b/backend/groth16/groth16.go @@ -20,6 +20,7 @@ package groth16 import ( + icicle_bw6761 "github.com/consensys/gnark/backend/groth16/bw6-761/icicle" "io" "github.com/consensys/gnark-crypto/ecc" @@ -182,6 +183,9 @@ func Prove(r1cs constraint.ConstraintSystem, pk ProvingKey, fullWitness witness. return groth16_bn254.Prove(_r1cs, pk.(*groth16_bn254.ProvingKey), fullWitness, opts...) case *cs_bw6761.R1CS: + if icicle_bw6761.HasIcicle { + return icicle_bw6761.Prove(_r1cs, pk.(*icicle_bw6761.ProvingKey), fullWitness, opts...) + } return groth16_bw6761.Prove(_r1cs, pk.(*groth16_bw6761.ProvingKey), fullWitness, opts...) case *cs_bls24317.R1CS: @@ -239,6 +243,9 @@ func Setup(r1cs constraint.ConstraintSystem) (ProvingKey, VerifyingKey, error) { if err := groth16_bw6761.Setup(_r1cs, &pk, &vk); err != nil { return nil, nil, err } + if icicle_bw6761.HasIcicle { + return &icicle_bw6761.ProvingKey{ProvingKey: &pk}, &vk, nil + } return &pk, &vk, nil case *cs_bls24317.R1CS: var pk groth16_bls24317.ProvingKey @@ -296,6 +303,13 @@ func DummySetup(r1cs constraint.ConstraintSystem) (ProvingKey, error) { } return &pk, nil case *cs_bw6761.R1CS: + if icicle_bw6761.HasIcicle { + var pk icicle_bw6761.ProvingKey + if err := icicle_bw6761.DummySetup(_r1cs, &pk); err != nil { + return nil, err + } + return &pk, nil + } var pk groth16_bw6761.ProvingKey if err := groth16_bw6761.DummySetup(_r1cs, &pk); err != nil { return nil, err @@ -341,6 +355,12 @@ func NewProvingKey(curveID ecc.ID) ProvingKey { case ecc.BLS12_381: pk = &groth16_bls12381.ProvingKey{} case ecc.BW6_761: + pk = &groth16_bw6761.ProvingKey{} + if icicle_bw6761.HasIcicle { + pk = &icicle_bw6761.ProvingKey{ + ProvingKey: &groth16_bw6761.ProvingKey{}, + } + } case ecc.BLS24_317: pk = &groth16_bls24317.ProvingKey{} case ecc.BLS24_315: