Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiaobleach committed May 9, 2024
1 parent 20530c7 commit e3f8d3c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/groth16/groth16.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e3f8d3c

Please sign in to comment.