mirror of
https://github.com/arnaucube/go-circom-prover-verifier.git
synced 2026-02-07 11:26:44 +01:00
Compare commits
1 Commits
feature/rm
...
feature/mi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d4b1abc10 |
1
cli/.gitignore
vendored
Normal file
1
cli/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
cli
|
||||
@@ -34,6 +34,7 @@ type PkString struct {
|
||||
DomainSize int `json:"domainSize"`
|
||||
PolsA []map[string]string `json:"polsA"`
|
||||
PolsB []map[string]string `json:"polsB"`
|
||||
PolsC []map[string]string `json:"polsC"`
|
||||
}
|
||||
|
||||
// WitnessString contains the Witness in string representation
|
||||
@@ -148,6 +149,10 @@ func pkStringToPk(ps PkString) (*types.Pk, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.PolsC, err = polsStringToBigInt(ps.PolsC)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &p, nil
|
||||
}
|
||||
|
||||
@@ -238,6 +238,11 @@ func testCircuitParsePkBin(t *testing.T, circuit string) {
|
||||
assert.Equal(t, pkJ.B2, pk.B2)
|
||||
assert.Equal(t, pkJ.C, pk.C)
|
||||
assert.Equal(t, pkJ.HExps[:pkJ.DomainSize], pk.HExps[:pk.DomainSize]) // circom behaviour
|
||||
|
||||
assert.Equal(t, pkJ.NVars, pk.NVars)
|
||||
assert.Equal(t, pkJ.NPublic, pk.NPublic)
|
||||
assert.Equal(t, pkJ.DomainSize, pk.DomainSize)
|
||||
assert.Equal(t, pkJ.PolsC, pk.PolsC)
|
||||
}
|
||||
|
||||
func TestParsePkBin(t *testing.T) {
|
||||
@@ -274,6 +279,17 @@ func testGoCircomPkFormat(t *testing.T, circuit string) {
|
||||
assert.Equal(t, pk.HExps, pkG.HExps)
|
||||
assert.Equal(t, pk.PolsA, pkG.PolsA)
|
||||
assert.Equal(t, pk.PolsB, pkG.PolsB)
|
||||
|
||||
assert.Equal(t, pk.NVars, pkG.NVars)
|
||||
assert.Equal(t, pk.NPublic, pkG.NPublic)
|
||||
assert.Equal(t, pk.DomainSize, pkG.DomainSize)
|
||||
assert.Equal(t, pk.PolsC, pkG.PolsC)
|
||||
|
||||
// pkPrettyJSON, err := json.MarshalIndent(pk, "", " ")
|
||||
// require.Nil(t, err)
|
||||
// pkGoPrettyJSON, err := json.MarshalIndent(pkG, "", " ")
|
||||
// require.Nil(t, err)
|
||||
// assert.Equal(t, pkPrettyJSON, pkGoPrettyJSON)
|
||||
}
|
||||
|
||||
func TestGoCircomPkFormat(t *testing.T) {
|
||||
|
||||
@@ -13,6 +13,36 @@ import (
|
||||
//"fmt"
|
||||
)
|
||||
|
||||
// Proof is the data structure of the Groth16 zkSNARK proof
|
||||
type Proof struct {
|
||||
A *bn256.G1
|
||||
B *bn256.G2
|
||||
C *bn256.G1
|
||||
}
|
||||
|
||||
// Pk holds the data structure of the ProvingKey
|
||||
type Pk struct {
|
||||
A []*bn256.G1
|
||||
B2 []*bn256.G2
|
||||
B1 []*bn256.G1
|
||||
C []*bn256.G1
|
||||
NVars int
|
||||
NPublic int
|
||||
VkAlpha1 *bn256.G1
|
||||
VkDelta1 *bn256.G1
|
||||
VkBeta1 *bn256.G1
|
||||
VkBeta2 *bn256.G2
|
||||
VkDelta2 *bn256.G2
|
||||
HExps []*bn256.G1
|
||||
DomainSize int
|
||||
PolsA []map[int]*big.Int
|
||||
PolsB []map[int]*big.Int
|
||||
PolsC []map[int]*big.Int
|
||||
}
|
||||
|
||||
// Witness contains the witness
|
||||
type Witness []*big.Int
|
||||
|
||||
// Group Size
|
||||
const (
|
||||
GSIZE = 6
|
||||
|
||||
@@ -83,6 +83,7 @@ type Pk struct {
|
||||
DomainSize int
|
||||
PolsA []map[int]*big.Int
|
||||
PolsB []map[int]*big.Int
|
||||
PolsC []map[int]*big.Int
|
||||
}
|
||||
|
||||
// Witness contains the witness
|
||||
|
||||
Reference in New Issue
Block a user