Skip to content
New issue

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

add bls12377 icicle #8

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
582 changes: 582 additions & 0 deletions backend/groth16/bls12-377/icicle/icicle.go

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions backend/groth16/bls12-377/icicle/noicicle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//go:build !icicle

package icicle

import (
"fmt"

"github.com/consensys/gnark/backend"
groth16_bls12377 "github.com/consensys/gnark/backend/groth16/bls12-377"
"github.com/consensys/gnark/backend/witness"
cs "github.com/consensys/gnark/constraint/bls12-377"
)

const HasIcicle = false

func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...backend.ProverOption) (*groth16_bls12377.Proof, error) {
return nil, fmt.Errorf("icicle backend requested but program compiled without 'icicle' build tag")
}
32 changes: 32 additions & 0 deletions backend/groth16/bls12-377/icicle/provingkey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package icicle

import (
"github.com/consensys/gnark-crypto/ecc/bls12-377/fr"
groth16_bls12377 "github.com/consensys/gnark/backend/groth16/bls12-377"
cs "github.com/consensys/gnark/constraint/bls12-377"
icicle_core "github.com/ingonyama-zk/icicle/v2/wrappers/golang/core"
)

type deviceInfo struct {
CosetGenerator [fr.Limbs * 2]uint32
G1Device struct {
A, B, K, Z icicle_core.DeviceSlice
}
G2Device struct {
B icicle_core.DeviceSlice
}
DenDevice icicle_core.DeviceSlice
}

type ProvingKey struct {
groth16_bls12377.ProvingKey
*deviceInfo
}

func Setup(r1cs *cs.R1CS, pk *ProvingKey, vk *groth16_bls12377.VerifyingKey) error {
return groth16_bls12377.Setup(r1cs, &pk.ProvingKey, vk)
}

func DummySetup(r1cs *cs.R1CS, pk *ProvingKey) error {
return groth16_bls12377.DummySetup(r1cs, &pk.ProvingKey)
}
2 changes: 1 addition & 1 deletion backend/groth16/bn254/icicle/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package icicle_bn254 implements ICICLE acceleration for BN254 Groth16 backend.
package icicle_bn254
package icicle
Loading