From d0b9a923f2ae32a22dc33a66928f2d7654ecb336 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 18:31:02 -0500 Subject: [PATCH 01/16] refactor: use same function for hint replacement --- backend/groth16/bls12-377/prove.go | 5 +---- backend/groth16/bls12-381/prove.go | 5 +---- backend/groth16/bls24-315/prove.go | 5 +---- backend/groth16/bls24-317/prove.go | 5 +---- backend/groth16/bn254/prove.go | 5 +---- backend/groth16/bw6-633/prove.go | 5 +---- backend/groth16/bw6-761/prove.go | 5 +---- backend/plonk/bls12-377/prove.go | 5 +---- backend/plonk/bls12-381/prove.go | 5 +---- backend/plonk/bls24-315/prove.go | 5 +---- backend/plonk/bls24-317/prove.go | 5 +---- backend/plonk/bn254/prove.go | 5 +---- backend/plonk/bw6-633/prove.go | 5 +---- backend/plonk/bw6-761/prove.go | 5 +---- .../template/zkpschemes/groth16/groth16.prove.go.tmpl | 5 +---- .../backend/template/zkpschemes/plonk/plonk.prove.go.tmpl | 5 +---- 16 files changed, 16 insertions(+), 64 deletions(-) diff --git a/backend/groth16/bls12-377/prove.go b/backend/groth16/bls12-377/prove.go index ed7124a557..33b02400df 100644 --- a/backend/groth16/bls12-377/prove.go +++ b/backend/groth16/bls12-377/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bls12-381/prove.go b/backend/groth16/bls12-381/prove.go index 6e4c0a5227..c42f1a1765 100644 --- a/backend/groth16/bls12-381/prove.go +++ b/backend/groth16/bls12-381/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bls24-315/prove.go b/backend/groth16/bls24-315/prove.go index c464544ad0..92399a8d84 100644 --- a/backend/groth16/bls24-315/prove.go +++ b/backend/groth16/bls24-315/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bls24-317/prove.go b/backend/groth16/bls24-317/prove.go index 10f38c5f77..76a60a3e3f 100644 --- a/backend/groth16/bls24-317/prove.go +++ b/backend/groth16/bls24-317/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bn254/prove.go b/backend/groth16/bn254/prove.go index 42ec4de8b9..3abdccbfd9 100644 --- a/backend/groth16/bn254/prove.go +++ b/backend/groth16/bn254/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bw6-633/prove.go b/backend/groth16/bw6-633/prove.go index b92dbb6943..9d20837acc 100644 --- a/backend/groth16/bw6-633/prove.go +++ b/backend/groth16/bw6-633/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/groth16/bw6-761/prove.go b/backend/groth16/bw6-761/prove.go index 3ee6b9ad0f..000f28fc50 100644 --- a/backend/groth16/bw6-761/prove.go +++ b/backend/groth16/bw6-761/prove.go @@ -95,10 +95,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/backend/plonk/bls12-377/prove.go b/backend/plonk/bls12-377/prove.go index 3f767215ba..ef004c4704 100644 --- a/backend/plonk/bls12-377/prove.go +++ b/backend/plonk/bls12-377/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bls12-381/prove.go b/backend/plonk/bls12-381/prove.go index 17627cd176..6e2f4b20fe 100644 --- a/backend/plonk/bls12-381/prove.go +++ b/backend/plonk/bls12-381/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bls24-315/prove.go b/backend/plonk/bls24-315/prove.go index 7ed6145ebb..ad48f92aa1 100644 --- a/backend/plonk/bls24-315/prove.go +++ b/backend/plonk/bls24-315/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bls24-317/prove.go b/backend/plonk/bls24-317/prove.go index 0cdc878d8d..6784bbb0c2 100644 --- a/backend/plonk/bls24-317/prove.go +++ b/backend/plonk/bls24-317/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bn254/prove.go b/backend/plonk/bn254/prove.go index 40b120a21f..58a885d7ae 100644 --- a/backend/plonk/bn254/prove.go +++ b/backend/plonk/bn254/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bw6-633/prove.go b/backend/plonk/bw6-633/prove.go index 1ea6ccf02d..e2b52f853f 100644 --- a/backend/plonk/bw6-633/prove.go +++ b/backend/plonk/bw6-633/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/backend/plonk/bw6-761/prove.go b/backend/plonk/bw6-761/prove.go index 603a95cf31..d0134d3798 100644 --- a/backend/plonk/bw6-761/prove.go +++ b/backend/plonk/bw6-761/prove.go @@ -128,10 +128,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded diff --git a/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl b/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl index fa72568220..93d77e9234 100644 --- a/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl @@ -78,10 +78,7 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b } if r1cs.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - solverOpts = append(solverOpts, - solver.OverrideHint(r1cs.GkrInfo.SolveHintID, cs.GkrSolveHint(r1cs.GkrInfo, &gkrData)), - solver.OverrideHint(r1cs.GkrInfo.ProveHintID, cs.GkrProveHint(r1cs.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) } _solution, err := r1cs.Solve(fullWitness, solverOpts...) diff --git a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl index def44c21ec..426924c305 100644 --- a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl @@ -106,10 +106,7 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts } if spr.GkrInfo.Is() { - var gkrData cs.GkrSolvingData - opt.SolverOpts = append(opt.SolverOpts, - solver.OverrideHint(spr.GkrInfo.SolveHintID, cs.GkrSolveHint(spr.GkrInfo, &gkrData)), - solver.OverrideHint(spr.GkrInfo.ProveHintID, cs.GkrProveHint(spr.GkrInfo.HashName, &gkrData))) + cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) } // query l, r, o in Lagrange basis, not blinded From 45613f53f766be4c717adce8a91da02dfe94db1c Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 19:00:40 -0500 Subject: [PATCH 02/16] feat: common ReplaceGkrHints function --- constraint/bls12-377/gkr.go | 7 +++++++ constraint/bls12-381/gkr.go | 7 +++++++ constraint/bls24-315/gkr.go | 7 +++++++ constraint/bls24-317/gkr.go | 7 +++++++ constraint/bn254/gkr.go | 7 +++++++ constraint/bw6-633/gkr.go | 7 +++++++ constraint/bw6-761/gkr.go | 7 +++++++ .../generator/backend/template/representations/gkr.go.tmpl | 7 +++++++ 8 files changed, 56 insertions(+) diff --git a/constraint/bls12-377/gkr.go b/constraint/bls12-377/gkr.go index 0a5bcdebef..d555469921 100644 --- a/constraint/bls12-377/gkr.go +++ b/constraint/bls12-377/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls12-381/gkr.go b/constraint/bls12-381/gkr.go index bd55673cd1..006a450a1a 100644 --- a/constraint/bls12-381/gkr.go +++ b/constraint/bls12-381/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls24-315/gkr.go b/constraint/bls24-315/gkr.go index 61925e2be8..a219acf0db 100644 --- a/constraint/bls24-315/gkr.go +++ b/constraint/bls24-315/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls24-317/gkr.go b/constraint/bls24-317/gkr.go index 4b18be9567..9b7fbca313 100644 --- a/constraint/bls24-317/gkr.go +++ b/constraint/bls24-317/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bn254/gkr.go b/constraint/bn254/gkr.go index a3730d97d3..db89cc7012 100644 --- a/constraint/bn254/gkr.go +++ b/constraint/bn254/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bw6-633/gkr.go b/constraint/bw6-633/gkr.go index db66fd871d..b08dcf1465 100644 --- a/constraint/bw6-633/gkr.go +++ b/constraint/bw6-633/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bw6-761/gkr.go b/constraint/bw6-761/gkr.go index 2c3ddabbc0..9f10a52378 100644 --- a/constraint/bw6-761/gkr.go +++ b/constraint/bw6-761/gkr.go @@ -191,5 +191,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/internal/generator/backend/template/representations/gkr.go.tmpl b/internal/generator/backend/template/representations/gkr.go.tmpl index 9f6735ab4c..5261138f8c 100644 --- a/internal/generator/backend/template/representations/gkr.go.tmpl +++ b/internal/generator/backend/template/representations/gkr.go.tmpl @@ -173,5 +173,12 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } +func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + var gkrData GkrSolvingData + *solverOpts = append(*solverOpts, + hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), + hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) +} + // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) \ No newline at end of file From 2ca348e76a7a9f412f6354d5cc6a49db951ef7e0 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 19:01:13 -0500 Subject: [PATCH 03/16] feat: random GKR hint IDs --- std/gkr/compile.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/std/gkr/compile.go b/std/gkr/compile.go index 7f8dc97925..79c03aa820 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -1,6 +1,7 @@ package gkr import ( + "crypto/rand" "fmt" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/constraint/solver" @@ -8,7 +9,6 @@ import ( fiatshamir "github.com/consensys/gnark/std/fiat-shamir" "github.com/consensys/gnark/std/hash" "github.com/consensys/gnark/std/utils/algo_utils" - "math/big" "math/bits" ) @@ -90,6 +90,14 @@ func appendNonNil(dst *[]frontend.Variable, src []frontend.Variable) { } } +func randHintID() solver.HintID { + bytes := make([]byte, 4) + if _, err := rand.Read(bytes); err != nil { + panic("could not generate random hint ID") + } + return solver.HintID(bytes[0]) | solver.HintID(bytes[1])<<8 | solver.HintID(bytes[2])<<16 | solver.HintID(bytes[3])<<24 +} + // Solve finalizes the GKR circuit and returns the output variables in the order created func (api *API) Solve(parentApi frontend.API) (Solution, error) { @@ -123,8 +131,8 @@ func (api *API) Solve(parentApi frontend.API) (Solution, error) { } } - outsSerialized, err := parentApi.Compiler().NewHint(SolveHintPlaceholder, solveHintNOut, ins...) - api.toStore.SolveHintID = solver.GetHintID(SolveHintPlaceholder) + api.toStore.SolveHintID = randHintID() // Possible danger of confusing with other hints? + outsSerialized, err := parentApi.Compiler().NewHintForId(api.toStore.SolveHintID, solveHintNOut, ins...) if err != nil { return Solution{}, err } @@ -175,11 +183,11 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable } copy(hintIns[1:], initialChallenges) - if proofSerialized, err = s.parentApi.Compiler().NewHint( - ProveHintPlaceholder, ProofSize(forSnark.circuit, logNbInstances), hintIns...); err != nil { + s.toStore.ProveHintID = randHintID() // Possible danger of confusing with other hints? + if proofSerialized, err = s.parentApi.Compiler().NewHintForId( + s.toStore.ProveHintID, ProofSize(forSnark.circuit, logNbInstances), hintIns...); err != nil { return err } - s.toStore.ProveHintID = solver.GetHintID(ProveHintPlaceholder) forSnarkSorted := algo_utils.MapRange(0, len(s.toStore.Circuit), slicePtrAt(forSnark.circuit)) @@ -201,14 +209,6 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable return s.parentApi.Compiler().SetGkrInfo(s.toStore) } -func SolveHintPlaceholder(*big.Int, []*big.Int, []*big.Int) error { // TODO @Tabaie Add implementation for testing - return fmt.Errorf("placeholder - not meant to be called") -} - -func ProveHintPlaceholder(*big.Int, []*big.Int, []*big.Int) error { // TODO @Tabaie Add implementation for testing - return fmt.Errorf("placeholder - not meant to be called") -} - func slicePtrAt[T any](slice []T) func(int) *T { return func(i int) *T { return &slice[i] From 2505c13033fc5446db6308f4a2426c3c95fc223d Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 19:42:50 -0500 Subject: [PATCH 04/16] feat: usable placeholder hints for bn254 --- constraint/solver/hint_registry.go | 6 +++ std/gkr/compile.go | 6 +++ std/gkr/placeholder_hints.go | 82 ++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 std/gkr/placeholder_hints.go diff --git a/constraint/solver/hint_registry.go b/constraint/solver/hint_registry.go index 7021de5024..398d6132e3 100644 --- a/constraint/solver/hint_registry.go +++ b/constraint/solver/hint_registry.go @@ -46,6 +46,12 @@ func RegisterNamedHint(hintFn Hint, key HintID) { registry[key] = hintFn } +func RemoveNamedHint(key HintID) { + registryM.Lock() + defer registryM.Unlock() + delete(registry, key) +} + // GetRegisteredHints returns all registered hint functions. func GetRegisteredHints() []Hint { registryM.RLock() diff --git a/std/gkr/compile.go b/std/gkr/compile.go index 79c03aa820..d0f77d467f 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -164,6 +164,9 @@ func (s Solution) Export(v frontend.Variable) []frontend.Variable { } // Verify encodes the verification circuitry for the GKR circuit +// hashName denotes the random oracle used to make GKR non-interactive (Fiat-Shamir) +// initialChallenges are initially fed to the Fiat-Shamir hash. If there is many of them, use api.(Committer).Commit to +// consolidate them into a few values func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable) error { var ( err error @@ -206,6 +209,9 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable return err } + solver.RegisterNamedHint(SolveHintPlaceholderGenerator(s.toStore.SolveHintID, s.toStore), s.toStore.SolveHintID) + solver.RegisterNamedHint(ProveHintPlaceholderGenerator(hashName, s.toStore.SolveHintID, s.toStore.ProveHintID), s.toStore.ProveHintID) + return s.parentApi.Compiler().SetGkrInfo(s.toStore) } diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go new file mode 100644 index 0000000000..22375e510f --- /dev/null +++ b/std/gkr/placeholder_hints.go @@ -0,0 +1,82 @@ +package gkr + +import ( + "errors" + "github.com/consensys/gnark-crypto/ecc" + "github.com/consensys/gnark/constraint" + bls12_377 "github.com/consensys/gnark/constraint/bls12-377" + bls12_381 "github.com/consensys/gnark/constraint/bls12-381" + bls24_315 "github.com/consensys/gnark/constraint/bls24-315" + bls24_317 "github.com/consensys/gnark/constraint/bls24-317" + bn254 "github.com/consensys/gnark/constraint/bn254" + bw6_633 "github.com/consensys/gnark/constraint/bw6-633" + bw6_761 "github.com/consensys/gnark/constraint/bw6-761" + + "github.com/consensys/gnark/constraint/solver" + "github.com/consensys/gnark/internal/utils" + "math/big" +) + +// TODO @Tabaie Autogen this and possibly move to another package + +var placeholderGkrSolvingData map[solver.HintID]any + +func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrInfo) func(*big.Int, []*big.Int, []*big.Int) error { + return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { + solver.RemoveNamedHint(hintId) + + curve := utils.FieldToCurve(mod) + switch curve { + case ecc.BLS12_377: + var data bls12_377.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bls12_377.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BLS12_381: + var data bls12_381.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bls12_381.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BLS24_315: + var data bls24_315.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bls24_315.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BLS24_317: + var data bls24_317.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bls24_317.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BN254: + var data bn254.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bn254.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BW6_633: + var data bw6_633.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bw6_633.GkrSolveHint(gkrInfo, &data)(mod, in, out) + case ecc.BW6_761: + var data bw6_761.GkrSolvingData + placeholderGkrSolvingData[hintId] = &data + err = bw6_761.GkrSolveHint(gkrInfo, &data)(mod, in, out) + default: + err = errors.New("unsupported curve") + } + + return err + } +} + +func ProveHintPlaceholderGenerator(hashName string, solveHintId, proveHintId solver.HintID) func(*big.Int, []*big.Int, []*big.Int) error { + return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { + solver.RemoveNamedHint(proveHintId) + + curve := utils.FieldToCurve(mod) + switch curve { + case ecc.BN254: + err = bn254.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bn254.GkrSolvingData))(mod, in, out) + default: + err = errors.New("unsupported curve") + } + + delete(placeholderGkrSolvingData, solveHintId) + + return err + } +} From 68d80a75ab956c21a2c94e9d58d0379a3ef0001b Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 19:55:39 -0500 Subject: [PATCH 05/16] test: ProverSucceeded with GKR (it didn't) --- std/gkr/api_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index d39b103962..c849c947cc 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -3,6 +3,7 @@ package gkr import ( "fmt" "github.com/consensys/gnark-crypto/kzg" + "github.com/consensys/gnark/backend" "github.com/consensys/gnark/backend/plonk" bn254r1cs "github.com/consensys/gnark/constraint/bn254" "github.com/consensys/gnark/test" @@ -636,10 +637,17 @@ func BenchmarkMiMCNoGkrFullDepthSolve(b *testing.B) { func TestMiMCFullDepthNoDepSolve(t *testing.T) { registerMiMC() - for i := 0; i < 100; i++ { - circuit, assignment := mimcNoDepCircuits(5, 1<<2) - testGroth16(t, circuit, assignment) - testPlonk(t, circuit, assignment) + for i := 0; i < 100; i++ { // TODO @Tabaie Why this loop? + + i = 5 + + circuit, assignment := mimcNoDepCircuits(i, 1<<2) + test.NewAssert(t).ProverSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) + //testGroth16(t, circuit, assignment) + //testPlonk(t, circuit, assignment) + + return + } } From 9cfd8488651410cb4731e671c1b879e1c90a3600 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 29 Jun 2023 20:53:32 -0500 Subject: [PATCH 06/16] fix: ignore gkr hints when comparing cs's --- constraint/bls12-377/gkr.go | 2 + constraint/bls12-377/system.go | 17 +++++++ constraint/bls12-381/gkr.go | 2 + constraint/bls12-381/system.go | 17 +++++++ constraint/bls24-315/gkr.go | 2 + constraint/bls24-315/system.go | 17 +++++++ constraint/bls24-317/gkr.go | 2 + constraint/bls24-317/system.go | 17 +++++++ constraint/bn254/gkr.go | 2 + constraint/bn254/system.go | 17 +++++++ constraint/bw6-633/gkr.go | 2 + constraint/bw6-633/system.go | 17 +++++++ constraint/bw6-761/gkr.go | 2 + constraint/bw6-761/system.go | 17 +++++++ constraint/gkr.go | 45 +++++++++++++++++++ constraint/system.go | 2 + constraint/tinyfield/system.go | 17 +++++++ .../template/representations/gkr.go.tmpl | 2 + .../template/representations/system.go.tmpl | 17 +++++++ std/gkr/api_test.go | 6 +-- std/gkr/compile.go | 2 + std/gkr/placeholder_hints.go | 2 + std/utils/algo_utils/algo_utils.go | 10 +++++ test/assert.go | 2 +- test/engine.go | 2 +- 25 files changed, 233 insertions(+), 7 deletions(-) diff --git a/constraint/bls12-377/gkr.go b/constraint/bls12-377/gkr.go index d555469921..3cfdd364b4 100644 --- a/constraint/bls12-377/gkr.go +++ b/constraint/bls12-377/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index 49ba1525ef..a8dc535f05 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bls12-381/gkr.go b/constraint/bls12-381/gkr.go index 006a450a1a..7c7832c4f0 100644 --- a/constraint/bls12-381/gkr.go +++ b/constraint/bls12-381/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index 5bcb7d44ee..77ab72a913 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bls24-315/gkr.go b/constraint/bls24-315/gkr.go index a219acf0db..6dddb4c86c 100644 --- a/constraint/bls24-315/gkr.go +++ b/constraint/bls24-315/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 01ea069cb3..4724b899f9 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bls24-317/gkr.go b/constraint/bls24-317/gkr.go index 9b7fbca313..28e80afd6f 100644 --- a/constraint/bls24-317/gkr.go +++ b/constraint/bls24-317/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 06633648ce..af600bc087 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bn254/gkr.go b/constraint/bn254/gkr.go index db89cc7012..9c8efaf13c 100644 --- a/constraint/bn254/gkr.go +++ b/constraint/bn254/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index a96fe5d5a2..fb3e54b49d 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bw6-633/gkr.go b/constraint/bw6-633/gkr.go index b08dcf1465..f1ba15cc2c 100644 --- a/constraint/bw6-633/gkr.go +++ b/constraint/bw6-633/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 7cd6843fc5..d159a24700 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/bw6-761/gkr.go b/constraint/bw6-761/gkr.go index 9f10a52378..999aa3049b 100644 --- a/constraint/bw6-761/gkr.go +++ b/constraint/bw6-761/gkr.go @@ -192,6 +192,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index 75252436e8..4f9d46787b 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/constraint/gkr.go b/constraint/gkr.go index 4d84a5466d..7f1ab4f58d 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -156,3 +156,48 @@ func (c GkrCircuit) Chunks(nbInstances int) []int { } return res } + +var GkrHints = map[solver.HintID]struct{}{} + +type kv struct { + k solver.HintID + v string +} + +func mapToSortedSlice(m map[solver.HintID]string) []kv { + res := make([]kv, 0, len(m)) + for k, v := range m { + res = append(res, kv{k, v}) + } + sort.Slice(res, func(i, j int) bool { + return res[i].k < res[j].k + }) + return res +} + +func skipGkrHints(a *[]kv) { + for len(*a) > 0 { + if _, ok := GkrHints[(*a)[0].k]; ok { + *a = (*a)[1:] + } else { + break + } + } +} + +func HintsEqual(a, b map[solver.HintID]string) bool { + A := mapToSortedSlice(a) + B := mapToSortedSlice(b) + + skipGkrHints(&A) + skipGkrHints(&B) + for len(A) > 0 && len(B) > 0 { + if A[0].k != B[0].k || A[0].v != B[0].v { + return false + } + skipGkrHints(&A) + skipGkrHints(&B) + } + + return len(A) == 0 && len(B) == 0 +} diff --git a/constraint/system.go b/constraint/system.go index e03586af4e..8611b5749a 100644 --- a/constraint/system.go +++ b/constraint/system.go @@ -78,6 +78,8 @@ type ConstraintSystem interface { GetInstruction(int) Instruction GetCoefficient(i int) Element + + Equal(ConstraintSystem) bool // for testing deterministic compilation } type CustomizableSystem interface { diff --git a/constraint/tinyfield/system.go b/constraint/tinyfield/system.go index bcb551272b..e3792d79fb 100644 --- a/constraint/tinyfield/system.go +++ b/constraint/tinyfield/system.go @@ -376,3 +376,20 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) } + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } +} diff --git a/internal/generator/backend/template/representations/gkr.go.tmpl b/internal/generator/backend/template/representations/gkr.go.tmpl index 5261138f8c..6df9d03497 100644 --- a/internal/generator/backend/template/representations/gkr.go.tmpl +++ b/internal/generator/backend/template/representations/gkr.go.tmpl @@ -174,6 +174,8 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { + delete(constraint.GkrHints, gkrInfo.SolveHintID) + delete(constraint.GkrHints, gkrInfo.ProveHintID) var gkrData GkrSolvingData *solverOpts = append(*solverOpts, hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index dc5b4a98d3..d2898216a3 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -372,4 +372,21 @@ func getTagSet() cbor.TagSet { func (s *system) AddGkr(gkr constraint.GkrInfo) error { return s.System.AddGkr(gkr) +} + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + oHints := o.MHintsDependencies + + if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s, o) + o.MHintsDependencies = oHints + return match + } } \ No newline at end of file diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index c849c947cc..f13386338d 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -637,17 +637,13 @@ func BenchmarkMiMCNoGkrFullDepthSolve(b *testing.B) { func TestMiMCFullDepthNoDepSolve(t *testing.T) { registerMiMC() - for i := 0; i < 100; i++ { // TODO @Tabaie Why this loop? - - i = 5 + for i := 5; i < 6; i++ { // TODO @Tabaie 0 -> 100 circuit, assignment := mimcNoDepCircuits(i, 1<<2) test.NewAssert(t).ProverSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) //testGroth16(t, circuit, assignment) //testPlonk(t, circuit, assignment) - return - } } diff --git a/std/gkr/compile.go b/std/gkr/compile.go index d0f77d467f..f769a2829e 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -211,6 +211,8 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable solver.RegisterNamedHint(SolveHintPlaceholderGenerator(s.toStore.SolveHintID, s.toStore), s.toStore.SolveHintID) solver.RegisterNamedHint(ProveHintPlaceholderGenerator(hashName, s.toStore.SolveHintID, s.toStore.ProveHintID), s.toStore.ProveHintID) + constraint.GkrHints[s.toStore.SolveHintID] = struct{}{} + constraint.GkrHints[s.toStore.ProveHintID] = struct{}{} return s.parentApi.Compiler().SetGkrInfo(s.toStore) } diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go index 22375e510f..67ba9edb94 100644 --- a/std/gkr/placeholder_hints.go +++ b/std/gkr/placeholder_hints.go @@ -24,6 +24,7 @@ var placeholderGkrSolvingData map[solver.HintID]any func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrInfo) func(*big.Int, []*big.Int, []*big.Int) error { return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { solver.RemoveNamedHint(hintId) + delete(constraint.GkrHints, hintId) curve := utils.FieldToCurve(mod) switch curve { @@ -66,6 +67,7 @@ func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrI func ProveHintPlaceholderGenerator(hashName string, solveHintId, proveHintId solver.HintID) func(*big.Int, []*big.Int, []*big.Int) error { return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { solver.RemoveNamedHint(proveHintId) + delete(constraint.GkrHints, proveHintId) curve := utils.FieldToCurve(mod) switch curve { diff --git a/std/utils/algo_utils/algo_utils.go b/std/utils/algo_utils/algo_utils.go index 37dbc8c464..1fa3e64277 100644 --- a/std/utils/algo_utils/algo_utils.go +++ b/std/utils/algo_utils/algo_utils.go @@ -58,6 +58,16 @@ func MapAt[K comparable, V any](mp map[K]V) func(K) V { } } +func MapKeys[K comparable, V any](mp map[K]V) []K { // copyright note: written by GitHub Copilot + keys := make([]K, len(mp)) + i := 0 + for k := range mp { + keys[i] = k + i++ + } + return keys +} + // InvertPermutation input permutation must contain exactly 0, ..., len(permutation)-1 func InvertPermutation(permutation []int) []int { res := make([]int, len(permutation)) diff --git a/test/assert.go b/test/assert.go index 10d1ebf977..617fca1e05 100644 --- a/test/assert.go +++ b/test/assert.go @@ -476,7 +476,7 @@ func (assert *Assert) compile(circuit frontend.Circuit, curveID ecc.ID, backendI return nil, fmt.Errorf("%w: %v", ErrCompilationNotDeterministic, err) } - if !reflect.DeepEqual(ccs, _ccs) { + if !ccs.Equal(_ccs) { return nil, ErrCompilationNotDeterministic } diff --git a/test/engine.go b/test/engine.go index afdcd1457c..7ad83d96c3 100644 --- a/test/engine.go +++ b/test/engine.go @@ -270,7 +270,7 @@ func (e *engine) ToBinary(i1 frontend.Variable, n ...int) []frontend.Variable { r := make([]frontend.Variable, nbBits) ri := make([]frontend.Variable, nbBits) for i := 0; i < len(r); i++ { - r[i] = (b1.Bit(i)) + r[i] = b1.Bit(i) ri[i] = r[i] } From a6f446a728d10b28e7601fdf54980e2dcf6576bf Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 30 Jun 2023 14:08:15 -0500 Subject: [PATCH 07/16] fix: some basic tests passed --- constraint/bn254/system.go | 14 +++------ constraint/gkr.go | 56 ++++++++++++++++++++++++++++++++++++ std/gkr/api_test.go | 7 +++-- std/gkr/compile.go | 6 ++-- std/gkr/placeholder_hints.go | 2 +- test/engine.go | 2 +- 6 files changed, 69 insertions(+), 18 deletions(-) diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index fb3e54b49d..193eb0aa06 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -378,18 +378,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/gkr.go b/constraint/gkr.go index 7f1ab4f58d..96bc685fc2 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -5,6 +5,9 @@ import ( "github.com/consensys/gnark-crypto/utils" "github.com/consensys/gnark/constraint/solver" "github.com/consensys/gnark/std/utils/algo_utils" + "golang.org/x/exp/maps" + "golang.org/x/exp/slices" + "reflect" "sort" ) @@ -201,3 +204,56 @@ func HintsEqual(a, b map[solver.HintID]string) bool { return len(A) == 0 && len(B) == 0 } + +//MHintsDependencies + +func SystemEqual(a, b System) bool { + + hintsNames := [2][2]solver.HintID{{ + a.GkrInfo.SolveHintID, b.GkrInfo.SolveHintID, + }, { + a.GkrInfo.ProveHintID, b.GkrInfo.ProveHintID, + }} + + b.GkrInfo.SolveHintID = a.GkrInfo.SolveHintID + b.GkrInfo.ProveHintID = a.GkrInfo.ProveHintID + + b.CallData = slices.Clone(b.CallData) // so as not to corrupt the original data + b.MHintsDependencies = maps.Clone(b.MHintsDependencies) + + for i := range b.CallData { + for j := range hintsNames { + if b.CallData[i] == uint32(hintsNames[j][1]) { + b.CallData[i] = uint32(hintsNames[j][0]) + } + } + } + + for k := range b.MHintsDependencies { + for j := range hintsNames { + if k == hintsNames[j][1] { + delete(b.MHintsDependencies, k) + b.MHintsDependencies[hintsNames[j][0]] = a.MHintsDependencies[hintsNames[j][0]] + } + } + } + + /*if match := HintsEqual(s.MHintsDependencies, oHints); !match { + return false + } + + //o.MHintsDependencies = s.MHintsDependencies + match := reflect.DeepEqual(s.field, o.field) + match = match && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) + match = match && reflect.DeepEqual(s.System, o.System) + //match := reflect.DeepEqual(s, o) + + fmt.Println(cmp.Diff(s.System, o.System, cmpopts.IgnoreUnexported(constraint.System{}, debug.SymbolTable{}))) + + o.MHintsDependencies = oHints + return match + + return false*/ + + return reflect.DeepEqual(a, b) +} diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index f13386338d..b7870efcd2 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -74,8 +74,9 @@ func TestDoubleNoDependencyCircuit(t *testing.T) { assignment := doubleNoDependencyCircuit{X: xValues} circuit := doubleNoDependencyCircuit{X: make([]frontend.Variable, len(xValues)), hashName: hashName} - testGroth16(t, &circuit, &assignment) - testPlonk(t, &circuit, &assignment) + test.NewAssert(t).SolvingSucceeded(&circuit, &assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) + //testGroth16(t, &circuit, &assignment) + //testPlonk(t, &circuit, &assignment) } } } @@ -640,7 +641,7 @@ func TestMiMCFullDepthNoDepSolve(t *testing.T) { for i := 5; i < 6; i++ { // TODO @Tabaie 0 -> 100 circuit, assignment := mimcNoDepCircuits(i, 1<<2) - test.NewAssert(t).ProverSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) + test.NewAssert(t).SolvingSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) //testGroth16(t, circuit, assignment) //testPlonk(t, circuit, assignment) diff --git a/std/gkr/compile.go b/std/gkr/compile.go index f769a2829e..44a79b577b 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -132,6 +132,7 @@ func (api *API) Solve(parentApi frontend.API) (Solution, error) { } api.toStore.SolveHintID = randHintID() // Possible danger of confusing with other hints? + solver.RegisterNamedHint(SolveHintPlaceholderGenerator(api.toStore.SolveHintID, api.toStore), api.toStore.SolveHintID) outsSerialized, err := parentApi.Compiler().NewHintForId(api.toStore.SolveHintID, solveHintNOut, ins...) if err != nil { return Solution{}, err @@ -187,6 +188,7 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable copy(hintIns[1:], initialChallenges) s.toStore.ProveHintID = randHintID() // Possible danger of confusing with other hints? + solver.RegisterNamedHint(ProveHintPlaceholderGenerator(hashName, s.toStore.SolveHintID, s.toStore.ProveHintID), s.toStore.ProveHintID) if proofSerialized, err = s.parentApi.Compiler().NewHintForId( s.toStore.ProveHintID, ProofSize(forSnark.circuit, logNbInstances), hintIns...); err != nil { return err @@ -209,9 +211,7 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable return err } - solver.RegisterNamedHint(SolveHintPlaceholderGenerator(s.toStore.SolveHintID, s.toStore), s.toStore.SolveHintID) - solver.RegisterNamedHint(ProveHintPlaceholderGenerator(hashName, s.toStore.SolveHintID, s.toStore.ProveHintID), s.toStore.ProveHintID) - constraint.GkrHints[s.toStore.SolveHintID] = struct{}{} + constraint.GkrHints[s.toStore.SolveHintID] = struct{}{} // TODO: Remove constraint.GkrHints[s.toStore.ProveHintID] = struct{}{} return s.parentApi.Compiler().SetGkrInfo(s.toStore) diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go index 67ba9edb94..2d63eb5350 100644 --- a/std/gkr/placeholder_hints.go +++ b/std/gkr/placeholder_hints.go @@ -19,7 +19,7 @@ import ( // TODO @Tabaie Autogen this and possibly move to another package -var placeholderGkrSolvingData map[solver.HintID]any +var placeholderGkrSolvingData = make(map[solver.HintID]any) func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrInfo) func(*big.Int, []*big.Int, []*big.Int) error { return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { diff --git a/test/engine.go b/test/engine.go index 7ad83d96c3..38c58b590b 100644 --- a/test/engine.go +++ b/test/engine.go @@ -680,5 +680,5 @@ func (e *engine) ToCanonicalVariable(v frontend.Variable) frontend.CanonicalVari } func (e *engine) SetGkrInfo(info constraint.GkrInfo) error { - return fmt.Errorf("not implemented") + return nil // TODO @Tabaie make sure this is legit. Maybe some deferred computations might need GkrInfo } From fe5af22193f090361ba9851441e933c529d17232 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 30 Jun 2023 14:28:39 -0500 Subject: [PATCH 08/16] refactor: move gkr hint replacement from prover --- backend/groth16/bls12-377/prove.go | 4 ---- backend/groth16/bls12-381/prove.go | 4 ---- backend/groth16/bls24-315/prove.go | 4 ---- backend/groth16/bls24-317/prove.go | 4 ---- backend/groth16/bn254/prove.go | 4 ---- backend/groth16/bw6-633/prove.go | 4 ---- backend/groth16/bw6-761/prove.go | 4 ---- backend/plonk/bls12-377/prove.go | 4 ---- backend/plonk/bls12-381/prove.go | 4 ---- backend/plonk/bls24-315/prove.go | 4 ---- backend/plonk/bls24-317/prove.go | 4 ---- backend/plonk/bn254/prove.go | 4 ---- backend/plonk/bw6-633/prove.go | 4 ---- backend/plonk/bw6-761/prove.go | 4 ---- constraint/bls12-377/system.go | 4 ++++ constraint/bls12-381/system.go | 4 ++++ constraint/bls24-315/system.go | 4 ++++ constraint/bls24-317/system.go | 4 ++++ constraint/bn254/system.go | 4 ++++ constraint/bw6-633/system.go | 4 ++++ constraint/bw6-761/system.go | 4 ++++ .../backend/template/representations/system.go.tmpl | 8 ++++++-- .../template/zkpschemes/groth16/groth16.prove.go.tmpl | 4 ---- .../backend/template/zkpschemes/plonk/plonk.prove.go.tmpl | 4 ---- 24 files changed, 34 insertions(+), 66 deletions(-) diff --git a/backend/groth16/bls12-377/prove.go b/backend/groth16/bls12-377/prove.go index 33b02400df..9b4ff35e3f 100644 --- a/backend/groth16/bls12-377/prove.go +++ b/backend/groth16/bls12-377/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bls12-381/prove.go b/backend/groth16/bls12-381/prove.go index c42f1a1765..b92f8e744f 100644 --- a/backend/groth16/bls12-381/prove.go +++ b/backend/groth16/bls12-381/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bls24-315/prove.go b/backend/groth16/bls24-315/prove.go index 92399a8d84..79cc5d8690 100644 --- a/backend/groth16/bls24-315/prove.go +++ b/backend/groth16/bls24-315/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bls24-317/prove.go b/backend/groth16/bls24-317/prove.go index 76a60a3e3f..7f2c01f516 100644 --- a/backend/groth16/bls24-317/prove.go +++ b/backend/groth16/bls24-317/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bn254/prove.go b/backend/groth16/bn254/prove.go index 3abdccbfd9..03b93c4d68 100644 --- a/backend/groth16/bn254/prove.go +++ b/backend/groth16/bn254/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bw6-633/prove.go b/backend/groth16/bw6-633/prove.go index 9d20837acc..eea524dd62 100644 --- a/backend/groth16/bw6-633/prove.go +++ b/backend/groth16/bw6-633/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/groth16/bw6-761/prove.go b/backend/groth16/bw6-761/prove.go index 000f28fc50..4f31c19b20 100644 --- a/backend/groth16/bw6-761/prove.go +++ b/backend/groth16/bw6-761/prove.go @@ -94,10 +94,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/backend/plonk/bls12-377/prove.go b/backend/plonk/bls12-377/prove.go index ef004c4704..b2d3804587 100644 --- a/backend/plonk/bls12-377/prove.go +++ b/backend/plonk/bls12-377/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bls12-381/prove.go b/backend/plonk/bls12-381/prove.go index 6e2f4b20fe..04af58ed95 100644 --- a/backend/plonk/bls12-381/prove.go +++ b/backend/plonk/bls12-381/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bls24-315/prove.go b/backend/plonk/bls24-315/prove.go index ad48f92aa1..650e71714c 100644 --- a/backend/plonk/bls24-315/prove.go +++ b/backend/plonk/bls24-315/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bls24-317/prove.go b/backend/plonk/bls24-317/prove.go index 6784bbb0c2..01eebfb5d6 100644 --- a/backend/plonk/bls24-317/prove.go +++ b/backend/plonk/bls24-317/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bn254/prove.go b/backend/plonk/bn254/prove.go index 58a885d7ae..6058692704 100644 --- a/backend/plonk/bn254/prove.go +++ b/backend/plonk/bn254/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bw6-633/prove.go b/backend/plonk/bw6-633/prove.go index e2b52f853f..abfc80c1ad 100644 --- a/backend/plonk/bw6-633/prove.go +++ b/backend/plonk/bw6-633/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/backend/plonk/bw6-761/prove.go b/backend/plonk/bw6-761/prove.go index d0134d3798..1aba64a32e 100644 --- a/backend/plonk/bw6-761/prove.go +++ b/backend/plonk/bw6-761/prove.go @@ -127,10 +127,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index 49ba1525ef..ebd5eecbe6 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index 5bcb7d44ee..54f904e700 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 01ea069cb3..4a92f8b6a4 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 06633648ce..b5887ee9cf 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index a96fe5d5a2..37e746f8ca 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 7cd6843fc5..fcb79fadba 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index 75252436e8..6fa72c6617 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -67,6 +67,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index dc5b4a98d3..ab3438dcbe 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -48,10 +48,15 @@ func newSystem(capacity int, t constraint.SystemType) *system { func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, error) { log := logger.Logger().With().Int("nbConstraints", cs.GetNbConstraints()).Logger() start := time.Now() - v := witness.Vector().(fr.Vector) + {{if ne .CurveID "UNKNOWN"}} {{/* TODO @Tabaie add tinyfield GKR support */}} + if cs.GkrInfo.Is() { + ReplaceGkrHints(&opts, cs.GkrInfo) + } + {{- end}} + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { @@ -98,7 +103,6 @@ func (cs *system) IsSolved(witness witness.Witness, opts ...csolver.Option) erro return err } - // GetR1Cs return the list of R1C func (cs *system) GetR1Cs() []constraint.R1C { toReturn := make([]constraint.R1C, 0, cs.GetNbConstraints()) diff --git a/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl b/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl index 93d77e9234..760cf22d24 100644 --- a/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl @@ -77,10 +77,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b }(i))) } - if r1cs.GkrInfo.Is() { - cs.ReplaceGkrHints(&solverOpts, r1cs.GkrInfo) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err diff --git a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl index 426924c305..a869528cf9 100644 --- a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl @@ -105,10 +105,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - if spr.GkrInfo.Is() { - cs.ReplaceGkrHints(&opt.SolverOpts, spr.GkrInfo) - } - // query l, r, o in Lagrange basis, not blinded _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) if err != nil { From 9d44a4d164215959c0e6306967a2b6c9e302288a Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 30 Jun 2023 15:45:35 -0500 Subject: [PATCH 09/16] build: generify system.Equal --- constraint/bls12-377/system.go | 14 ++-- constraint/bls12-381/system.go | 14 ++-- constraint/bls24-315/system.go | 14 ++-- constraint/bls24-317/system.go | 14 ++-- constraint/bw6-633/system.go | 14 ++-- constraint/bw6-761/system.go | 14 ++-- constraint/tinyfield/system.go | 14 ++-- .../template/representations/system.go.tmpl | 14 ++-- std/gkr/api_test.go | 64 ++----------------- std/gkr/placeholder_hints.go | 12 ++++ 10 files changed, 48 insertions(+), 140 deletions(-) diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index a86d64e63b..a28aba3286 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index c3ac1d1794..d083492389 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 7e9f4189a3..5ce3628f62 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 2754bb6ff3..124dc1e839 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 7be8a5db79..06767f667e 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index ab2e941cb4..0955e9b8fc 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -382,18 +382,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/constraint/tinyfield/system.go b/constraint/tinyfield/system.go index e3792d79fb..3c9f98dc7c 100644 --- a/constraint/tinyfield/system.go +++ b/constraint/tinyfield/system.go @@ -378,18 +378,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index 65c13b1b6c..ec718d724e 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -379,18 +379,12 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { + if !s.GkrInfo.Is() { + return reflect.DeepEqual(s, other) // fast track + } if o, ok := other.(*system); !ok { return false } else { - oHints := o.MHintsDependencies - - if match := constraint.HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s, o) - o.MHintsDependencies = oHints - return match + return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) } } \ No newline at end of file diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index b7870efcd2..c209042805 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -2,9 +2,7 @@ package gkr import ( "fmt" - "github.com/consensys/gnark-crypto/kzg" "github.com/consensys/gnark/backend" - "github.com/consensys/gnark/backend/plonk" bn254r1cs "github.com/consensys/gnark/constraint/bn254" "github.com/consensys/gnark/test" "github.com/stretchr/testify/require" @@ -19,11 +17,9 @@ import ( "github.com/consensys/gnark-crypto/ecc/bn254/fr/gkr" bn254MiMC "github.com/consensys/gnark-crypto/ecc/bn254/fr/mimc" "github.com/consensys/gnark/backend/groth16" - "github.com/consensys/gnark/backend/witness" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" - "github.com/consensys/gnark/frontend/cs/scs" stdHash "github.com/consensys/gnark/std/hash" "github.com/consensys/gnark/std/hash/mimc" test_vector_utils "github.com/consensys/gnark/std/utils/test_vectors_utils" @@ -74,9 +70,7 @@ func TestDoubleNoDependencyCircuit(t *testing.T) { assignment := doubleNoDependencyCircuit{X: xValues} circuit := doubleNoDependencyCircuit{X: make([]frontend.Variable, len(xValues)), hashName: hashName} - test.NewAssert(t).SolvingSucceeded(&circuit, &assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) - //testGroth16(t, &circuit, &assignment) - //testPlonk(t, &circuit, &assignment) + test.NewAssert(t).ProverSucceeded(&circuit, &assignment, test.WithCurves(ecc.BN254)) } } } @@ -120,8 +114,7 @@ func TestSqNoDependencyCircuit(t *testing.T) { for _, hashName := range hashes { assignment := sqNoDependencyCircuit{X: xValues} circuit := sqNoDependencyCircuit{X: make([]frontend.Variable, len(xValues)), hashName: hashName} - testGroth16(t, &circuit, &assignment) - testPlonk(t, &circuit, &assignment) + test.NewAssert(t).ProverSucceeded(&circuit, &assignment, test.WithCurves(ecc.BN254)) } } } @@ -183,8 +176,7 @@ func TestMulNoDependency(t *testing.T) { hashName: hashName, } - testGroth16(t, &circuit, &assignment) - testPlonk(t, &circuit, &assignment) + test.NewAssert(t).ProverSucceeded(&circuit, &assignment, test.WithCurves(ecc.BN254)) } } } @@ -239,8 +231,7 @@ func TestSolveMulWithDependency(t *testing.T) { } circuit := mulWithDependencyCircuit{Y: make([]frontend.Variable, len(assignment.Y)), hashName: "-20"} - testGroth16(t, &circuit, &assignment) - testPlonk(t, &circuit, &assignment) + test.NewAssert(t).ProverSucceeded(&circuit, &assignment, test.WithCurves(ecc.BN254)) } func TestApiMul(t *testing.T) { @@ -380,53 +371,6 @@ func (c *benchMiMCMerkleTreeCircuit) Define(api frontend.API) error { return solution.Verify("-20", challenge) } -func testGroth16(t *testing.T, circuit, assignment frontend.Circuit) { - cs, err := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, circuit, frontend.WithCompressThreshold(compressThreshold)) - require.NoError(t, err) - var ( - fullWitness witness.Witness - publicWitness witness.Witness - pk groth16.ProvingKey - vk groth16.VerifyingKey - proof groth16.Proof - ) - fullWitness, err = frontend.NewWitness(assignment, ecc.BN254.ScalarField()) - require.NoError(t, err) - publicWitness, err = fullWitness.Public() - require.NoError(t, err) - pk, vk, err = groth16.Setup(cs) - require.NoError(t, err) - proof, err = groth16.Prove(cs, pk, fullWitness) - require.NoError(t, err) - err = groth16.Verify(proof, vk, publicWitness) - require.NoError(t, err) -} - -func testPlonk(t *testing.T, circuit, assignment frontend.Circuit) { - cs, err := frontend.Compile(ecc.BN254.ScalarField(), scs.NewBuilder, circuit, frontend.WithCompressThreshold(compressThreshold)) - require.NoError(t, err) - var ( - fullWitness witness.Witness - publicWitness witness.Witness - pk plonk.ProvingKey - vk plonk.VerifyingKey - proof plonk.Proof - kzgSrs kzg.SRS - ) - fullWitness, err = frontend.NewWitness(assignment, ecc.BN254.ScalarField()) - require.NoError(t, err) - publicWitness, err = fullWitness.Public() - require.NoError(t, err) - kzgSrs, err = test.NewKZGSRS(cs) - require.NoError(t, err) - pk, vk, err = plonk.Setup(cs, kzgSrs) - require.NoError(t, err) - proof, err = plonk.Prove(cs, pk, fullWitness) - require.NoError(t, err) - err = plonk.Verify(proof, vk, publicWitness) - require.NoError(t, err) -} - func registerMiMC() { bn254r1cs.HashBuilderRegistry["mimc"] = bn254MiMC.NewMiMC stdHash.BuilderRegistry["mimc"] = func(api frontend.API) (stdHash.FieldHasher, error) { diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go index 2d63eb5350..3ba5621445 100644 --- a/std/gkr/placeholder_hints.go +++ b/std/gkr/placeholder_hints.go @@ -71,8 +71,20 @@ func ProveHintPlaceholderGenerator(hashName string, solveHintId, proveHintId sol curve := utils.FieldToCurve(mod) switch curve { + case ecc.BLS12_377: + err = bls12_377.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bls12_377.GkrSolvingData))(mod, in, out) + case ecc.BLS12_381: + err = bls12_381.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bls12_381.GkrSolvingData))(mod, in, out) + case ecc.BLS24_315: + err = bls24_315.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bls24_315.GkrSolvingData))(mod, in, out) + case ecc.BLS24_317: + err = bls24_317.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bls24_317.GkrSolvingData))(mod, in, out) case ecc.BN254: err = bn254.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bn254.GkrSolvingData))(mod, in, out) + case ecc.BW6_633: + err = bw6_633.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bw6_633.GkrSolvingData))(mod, in, out) + case ecc.BW6_761: + err = bw6_761.GkrProveHint(hashName, placeholderGkrSolvingData[solveHintId].(*bw6_761.GkrSolvingData))(mod, in, out) default: err = errors.New("unsupported curve") } From 95b7075db13a47117a18fb195444ee5783b536a1 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 30 Jun 2023 15:53:11 -0500 Subject: [PATCH 10/16] refactor: move replaceGkrHints into Solve --- constraint/bls12-377/gkr.go | 9 ---- constraint/bls12-377/system.go | 5 +- constraint/bls12-381/gkr.go | 9 ---- constraint/bls12-381/system.go | 5 +- constraint/bls24-315/gkr.go | 9 ---- constraint/bls24-315/system.go | 5 +- constraint/bls24-317/gkr.go | 9 ---- constraint/bls24-317/system.go | 5 +- constraint/bn254/gkr.go | 9 ---- constraint/bn254/system.go | 5 +- constraint/bw6-633/gkr.go | 9 ---- constraint/bw6-633/system.go | 5 +- constraint/bw6-761/gkr.go | 9 ---- constraint/bw6-761/system.go | 5 +- constraint/gkr.go | 47 ------------------- .../template/representations/gkr.go.tmpl | 9 ---- .../template/representations/system.go.tmpl | 5 +- std/gkr/compile.go | 3 -- std/gkr/placeholder_hints.go | 2 - 19 files changed, 32 insertions(+), 132 deletions(-) diff --git a/constraint/bls12-377/gkr.go b/constraint/bls12-377/gkr.go index 3cfdd364b4..0a5bcdebef 100644 --- a/constraint/bls12-377/gkr.go +++ b/constraint/bls12-377/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index a28aba3286..a3e3616d97 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bls12-381/gkr.go b/constraint/bls12-381/gkr.go index 7c7832c4f0..bd55673cd1 100644 --- a/constraint/bls12-381/gkr.go +++ b/constraint/bls12-381/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index d083492389..1d707e7170 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bls24-315/gkr.go b/constraint/bls24-315/gkr.go index 6dddb4c86c..61925e2be8 100644 --- a/constraint/bls24-315/gkr.go +++ b/constraint/bls24-315/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 5ce3628f62..8b384b7418 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bls24-317/gkr.go b/constraint/bls24-317/gkr.go index 28e80afd6f..4b18be9567 100644 --- a/constraint/bls24-317/gkr.go +++ b/constraint/bls24-317/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 124dc1e839..8150fc47e4 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bn254/gkr.go b/constraint/bn254/gkr.go index 9c8efaf13c..a3730d97d3 100644 --- a/constraint/bn254/gkr.go +++ b/constraint/bn254/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index 0f0f3a23a5..f4513b095a 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bw6-633/gkr.go b/constraint/bw6-633/gkr.go index f1ba15cc2c..db66fd871d 100644 --- a/constraint/bw6-633/gkr.go +++ b/constraint/bw6-633/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 06767f667e..0fdf0ffe1b 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/bw6-761/gkr.go b/constraint/bw6-761/gkr.go index 999aa3049b..2c3ddabbc0 100644 --- a/constraint/bw6-761/gkr.go +++ b/constraint/bw6-761/gkr.go @@ -191,14 +191,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index 0955e9b8fc..3c97cdf2ab 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -68,7 +68,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } // init the solver diff --git a/constraint/gkr.go b/constraint/gkr.go index 96bc685fc2..d467502ea0 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -160,53 +160,6 @@ func (c GkrCircuit) Chunks(nbInstances int) []int { return res } -var GkrHints = map[solver.HintID]struct{}{} - -type kv struct { - k solver.HintID - v string -} - -func mapToSortedSlice(m map[solver.HintID]string) []kv { - res := make([]kv, 0, len(m)) - for k, v := range m { - res = append(res, kv{k, v}) - } - sort.Slice(res, func(i, j int) bool { - return res[i].k < res[j].k - }) - return res -} - -func skipGkrHints(a *[]kv) { - for len(*a) > 0 { - if _, ok := GkrHints[(*a)[0].k]; ok { - *a = (*a)[1:] - } else { - break - } - } -} - -func HintsEqual(a, b map[solver.HintID]string) bool { - A := mapToSortedSlice(a) - B := mapToSortedSlice(b) - - skipGkrHints(&A) - skipGkrHints(&B) - for len(A) > 0 && len(B) > 0 { - if A[0].k != B[0].k || A[0].v != B[0].v { - return false - } - skipGkrHints(&A) - skipGkrHints(&B) - } - - return len(A) == 0 && len(B) == 0 -} - -//MHintsDependencies - func SystemEqual(a, b System) bool { hintsNames := [2][2]solver.HintID{{ diff --git a/internal/generator/backend/template/representations/gkr.go.tmpl b/internal/generator/backend/template/representations/gkr.go.tmpl index 6df9d03497..9f6735ab4c 100644 --- a/internal/generator/backend/template/representations/gkr.go.tmpl +++ b/internal/generator/backend/template/representations/gkr.go.tmpl @@ -173,14 +173,5 @@ func GkrProveHint(hashName string, data *GkrSolvingData) hint.Hint { } } -func ReplaceGkrHints(solverOpts *[]hint.Option, gkrInfo constraint.GkrInfo) { - delete(constraint.GkrHints, gkrInfo.SolveHintID) - delete(constraint.GkrHints, gkrInfo.ProveHintID) - var gkrData GkrSolvingData - *solverOpts = append(*solverOpts, - hint.OverrideHint(gkrInfo.SolveHintID, GkrSolveHint(gkrInfo, &gkrData)), - hint.OverrideHint(gkrInfo.ProveHintID, GkrProveHint(gkrInfo.HashName, &gkrData))) -} - // TODO: Move to gnark-crypto var HashBuilderRegistry = make(map[string]func() hash.Hash) \ No newline at end of file diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index ec718d724e..89e12e3fb0 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -53,7 +53,10 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e {{if ne .CurveID "UNKNOWN"}} {{/* TODO @Tabaie add tinyfield GKR support */}} if cs.GkrInfo.Is() { - ReplaceGkrHints(&opts, cs.GkrInfo) + var gkrData GkrSolvingData + opts = append(opts, + csolver.OverrideHint(cs.GkrInfo.SolveHintID, GkrSolveHint(cs.GkrInfo, &gkrData)), + csolver.OverrideHint(cs.GkrInfo.ProveHintID, GkrProveHint(cs.GkrInfo.HashName, &gkrData))) } {{- end}} diff --git a/std/gkr/compile.go b/std/gkr/compile.go index 44a79b577b..7e3d843737 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -211,9 +211,6 @@ func (s Solution) Verify(hashName string, initialChallenges ...frontend.Variable return err } - constraint.GkrHints[s.toStore.SolveHintID] = struct{}{} // TODO: Remove - constraint.GkrHints[s.toStore.ProveHintID] = struct{}{} - return s.parentApi.Compiler().SetGkrInfo(s.toStore) } diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go index 3ba5621445..bdf5d54c4f 100644 --- a/std/gkr/placeholder_hints.go +++ b/std/gkr/placeholder_hints.go @@ -24,7 +24,6 @@ var placeholderGkrSolvingData = make(map[solver.HintID]any) func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrInfo) func(*big.Int, []*big.Int, []*big.Int) error { return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { solver.RemoveNamedHint(hintId) - delete(constraint.GkrHints, hintId) curve := utils.FieldToCurve(mod) switch curve { @@ -67,7 +66,6 @@ func SolveHintPlaceholderGenerator(hintId solver.HintID, gkrInfo constraint.GkrI func ProveHintPlaceholderGenerator(hashName string, solveHintId, proveHintId solver.HintID) func(*big.Int, []*big.Int, []*big.Int) error { return func(mod *big.Int, in []*big.Int, out []*big.Int) (err error) { solver.RemoveNamedHint(proveHintId) - delete(constraint.GkrHints, proveHintId) curve := utils.FieldToCurve(mod) switch curve { From b0e6edf702e82795963add586850dff615e0d11a Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 30 Jun 2023 16:01:06 -0500 Subject: [PATCH 11/16] chore: cleanup --- constraint/gkr.go | 17 ----------------- std/gkr/api_test.go | 17 +++-------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/constraint/gkr.go b/constraint/gkr.go index d467502ea0..3ba14635cd 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -191,22 +191,5 @@ func SystemEqual(a, b System) bool { } } - /*if match := HintsEqual(s.MHintsDependencies, oHints); !match { - return false - } - - //o.MHintsDependencies = s.MHintsDependencies - match := reflect.DeepEqual(s.field, o.field) - match = match && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) - match = match && reflect.DeepEqual(s.System, o.System) - //match := reflect.DeepEqual(s, o) - - fmt.Println(cmp.Diff(s.System, o.System, cmpopts.IgnoreUnexported(constraint.System{}, debug.SymbolTable{}))) - - o.MHintsDependencies = oHints - return match - - return false*/ - return reflect.DeepEqual(a, b) } diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index c209042805..6a973bf3aa 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -2,7 +2,6 @@ package gkr import ( "fmt" - "github.com/consensys/gnark/backend" bn254r1cs "github.com/consensys/gnark/constraint/bn254" "github.com/consensys/gnark/test" "github.com/stretchr/testify/require" @@ -521,17 +520,10 @@ func (c *mimcNoDepCircuit) Define(api frontend.API) error { return err } - // cheat{ z = y for i := 0; i < c.mimcDepth; i++ { - _gkr.toStore.Circuit = append(_gkr.toStore.Circuit, constraint.GkrWire{ - Gate: "mimc", - Inputs: []int{int(x), int(z)}, - }) - _gkr.assignments = append(_gkr.assignments, nil) - z = constraint.GkrVariable(len(_gkr.toStore.Circuit) - 1) + z = _gkr.NamedGate("mimc", x, z) } - // } if solution, err = _gkr.Solve(api); err != nil { return err @@ -583,12 +575,9 @@ func BenchmarkMiMCNoGkrFullDepthSolve(b *testing.B) { func TestMiMCFullDepthNoDepSolve(t *testing.T) { registerMiMC() - for i := 5; i < 6; i++ { // TODO @Tabaie 0 -> 100 + for i := 5; i < 100; i++ { circuit, assignment := mimcNoDepCircuits(i, 1<<2) - test.NewAssert(t).SolvingSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16), test.WithCurves(ecc.BN254)) - //testGroth16(t, circuit, assignment) - //testPlonk(t, circuit, assignment) - + test.NewAssert(t).SolvingSucceeded(circuit, assignment, test.WithCurves(ecc.BN254)) } } From 1a60906ff32a219ee82deb9d962eef3066b07914 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Wed, 5 Jul 2023 13:57:38 -0500 Subject: [PATCH 12/16] fix: custom System equal --- constraint/bls12-377/system.go | 3 -- constraint/bls12-381/system.go | 3 -- constraint/bls24-315/system.go | 3 -- constraint/bls24-317/system.go | 3 -- constraint/bn254/system.go | 3 -- constraint/bw6-633/system.go | 3 -- constraint/bw6-761/system.go | 3 -- constraint/gkr.go | 32 ++++++++++++------- constraint/tinyfield/system.go | 3 -- .../template/representations/system.go.tmpl | 3 -- std/gkr/gkr_test.go | 5 ++- 11 files changed, 22 insertions(+), 42 deletions(-) diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index a3e3616d97..89b6431536 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index 1d707e7170..52d8824c3a 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 8b384b7418..1b7fabace5 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 8150fc47e4..924166ff0a 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index f4513b095a..a08e9d9f88 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 0fdf0ffe1b..78305a13ff 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index 3c97cdf2ab..d9ad4c9e71 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -385,9 +385,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/constraint/gkr.go b/constraint/gkr.go index 3ba14635cd..1dcb50a059 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -5,7 +5,6 @@ import ( "github.com/consensys/gnark-crypto/utils" "github.com/consensys/gnark/constraint/solver" "github.com/consensys/gnark/std/utils/algo_utils" - "golang.org/x/exp/maps" "golang.org/x/exp/slices" "reflect" "sort" @@ -172,7 +171,6 @@ func SystemEqual(a, b System) bool { b.GkrInfo.ProveHintID = a.GkrInfo.ProveHintID b.CallData = slices.Clone(b.CallData) // so as not to corrupt the original data - b.MHintsDependencies = maps.Clone(b.MHintsDependencies) for i := range b.CallData { for j := range hintsNames { @@ -182,14 +180,24 @@ func SystemEqual(a, b System) bool { } } - for k := range b.MHintsDependencies { - for j := range hintsNames { - if k == hintsNames[j][1] { - delete(b.MHintsDependencies, k) - b.MHintsDependencies[hintsNames[j][0]] = a.MHintsDependencies[hintsNames[j][0]] - } - } - } - - return reflect.DeepEqual(a, b) + return a.GnarkVersion == b.GnarkVersion && + a.ScalarField == b.ScalarField && + a.Type == b.Type && + reflect.DeepEqual(a.Instructions, b.Instructions) && + reflect.DeepEqual(a.Blueprints, b.Blueprints) && + reflect.DeepEqual(a.CallData, b.CallData) && + a.NbConstraints == b.NbConstraints && + a.NbInternalVariables == b.NbInternalVariables && + reflect.DeepEqual(a.Public, b.Public) && + reflect.DeepEqual(a.Secret, b.Secret) && + reflect.DeepEqual(a.Logs, b.Logs) && + reflect.DeepEqual(a.DebugInfo, b.DebugInfo) && + reflect.DeepEqual(a.MDebug, b.MDebug) && + reflect.DeepEqual(a.MHintsDependencies, b.MHintsDependencies) && + reflect.DeepEqual(a.Levels, b.Levels) && + reflect.DeepEqual(a.q, b.q) && + a.bitLen == b.bitLen && + reflect.DeepEqual(a.CommitmentInfo, b.CommitmentInfo) && + reflect.DeepEqual(a.GkrInfo, b.GkrInfo) && + reflect.DeepEqual(a.genericHint, b.genericHint) } diff --git a/constraint/tinyfield/system.go b/constraint/tinyfield/system.go index 3c9f98dc7c..131fc1849f 100644 --- a/constraint/tinyfield/system.go +++ b/constraint/tinyfield/system.go @@ -378,9 +378,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index 89e12e3fb0..e2ede2c3b6 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -382,9 +382,6 @@ func (s *system) AddGkr(gkr constraint.GkrInfo) error { } func (s *system) Equal(other constraint.ConstraintSystem) bool { - if !s.GkrInfo.Is() { - return reflect.DeepEqual(s, other) // fast track - } if o, ok := other.(*system); !ok { return false } else { diff --git a/std/gkr/gkr_test.go b/std/gkr/gkr_test.go index a16165a40d..02de3e5d04 100644 --- a/std/gkr/gkr_test.go +++ b/std/gkr/gkr_test.go @@ -8,7 +8,6 @@ import ( "reflect" "testing" - "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" fiatshamir "github.com/consensys/gnark/std/fiat-shamir" "github.com/consensys/gnark/std/polynomial" @@ -77,13 +76,13 @@ func generateTestVerifier(path string, options ...option) func(t *testing.T) { fillWithBlanks(circuit.Output, len(testCase.Input[0])) if !opts.noSuccess { - test.NewAssert(t).SolvingSucceeded(circuit, assignment, test.WithBackends(backend.GROTH16)) + test.NewAssert(t).SolvingSucceeded(circuit, assignment) } if !opts.noFail { assignment.ToFail = true // TODO: This one doesn't matter right? circuit.ToFail = true - test.NewAssert(t).SolvingFailed(circuit, assignment, test.WithBackends(backend.GROTH16)) + test.NewAssert(t).SolvingFailed(circuit, assignment) } } } From 91604d5f50c1dbdc908f1701052a69d1115a63f3 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Thu, 6 Jul 2023 09:45:01 -0500 Subject: [PATCH 13/16] fix: don't compare CoeffTable.mCoeffs --- constraint/bls12-377/system.go | 5 +- constraint/bls12-381/system.go | 5 +- constraint/bls24-315/system.go | 5 +- constraint/bls24-317/system.go | 5 +- constraint/bn254/system.go | 5 +- constraint/bw6-633/system.go | 5 +- constraint/bw6-761/system.go | 5 +- constraint/gkr.go | 83 ++++++++++++++----- constraint/tinyfield/system.go | 5 +- .../template/representations/system.go.tmpl | 5 +- 10 files changed, 98 insertions(+), 30 deletions(-) diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index 89b6431536..8f70c3c8dc 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index 52d8824c3a..5e8d8469ce 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index 1b7fabace5..78d96f565b 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index 924166ff0a..7d41a54487 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index a08e9d9f88..9759ca44af 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 78305a13ff..a5e611a728 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index d9ad4c9e71..496f93e6ae 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -388,6 +388,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/constraint/gkr.go b/constraint/gkr.go index 1dcb50a059..b9f54d5541 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -159,7 +159,7 @@ func (c GkrCircuit) Chunks(nbInstances int) []int { return res } -func SystemEqual(a, b System) bool { +func SystemDiff(a, b System) string { hintsNames := [2][2]solver.HintID{{ a.GkrInfo.SolveHintID, b.GkrInfo.SolveHintID, @@ -180,24 +180,65 @@ func SystemEqual(a, b System) bool { } } - return a.GnarkVersion == b.GnarkVersion && - a.ScalarField == b.ScalarField && - a.Type == b.Type && - reflect.DeepEqual(a.Instructions, b.Instructions) && - reflect.DeepEqual(a.Blueprints, b.Blueprints) && - reflect.DeepEqual(a.CallData, b.CallData) && - a.NbConstraints == b.NbConstraints && - a.NbInternalVariables == b.NbInternalVariables && - reflect.DeepEqual(a.Public, b.Public) && - reflect.DeepEqual(a.Secret, b.Secret) && - reflect.DeepEqual(a.Logs, b.Logs) && - reflect.DeepEqual(a.DebugInfo, b.DebugInfo) && - reflect.DeepEqual(a.MDebug, b.MDebug) && - reflect.DeepEqual(a.MHintsDependencies, b.MHintsDependencies) && - reflect.DeepEqual(a.Levels, b.Levels) && - reflect.DeepEqual(a.q, b.q) && - a.bitLen == b.bitLen && - reflect.DeepEqual(a.CommitmentInfo, b.CommitmentInfo) && - reflect.DeepEqual(a.GkrInfo, b.GkrInfo) && - reflect.DeepEqual(a.genericHint, b.genericHint) + if a.GnarkVersion != b.GnarkVersion { + return "GnarkVersion" + } + if a.ScalarField != b.ScalarField { + return "ScalarField" + } + if a.Type != b.Type { + return "Type" + } + if !reflect.DeepEqual(a.Instructions, b.Instructions) { + return "Instructions" + } + if !reflect.DeepEqual(a.Blueprints, b.Blueprints) { + return "Blueprints" + } + if !reflect.DeepEqual(a.CallData, b.CallData) { + return "CallData" + } + if a.NbConstraints != b.NbConstraints { + return "NbConstraints" + } + if a.NbInternalVariables != b.NbInternalVariables { + return "NbInternalVariables" + } + if !reflect.DeepEqual(a.Public, b.Public) { + return "Public" + } + if !reflect.DeepEqual(a.Secret, b.Secret) { + return "Secret" + } + if !reflect.DeepEqual(a.Logs, b.Logs) { + return "Logs" + } + if !reflect.DeepEqual(a.DebugInfo, b.DebugInfo) { + return "DebugInfo" + } + if !reflect.DeepEqual(a.MDebug, b.MDebug) { + return "MDebug" + } + if !reflect.DeepEqual(a.MHintsDependencies, b.MHintsDependencies) { + return "MHintsDependencies" + } + if !reflect.DeepEqual(a.Levels, b.Levels) { + return "Levels" + } + if !reflect.DeepEqual(a.q, b.q) { + return "q" + } + if a.bitLen != b.bitLen { + return "bitLen" + } + if !reflect.DeepEqual(a.CommitmentInfo, b.CommitmentInfo) { + return "CommitmentInfo" + } + if !reflect.DeepEqual(a.GkrInfo, b.GkrInfo) { + return "GkrInfo" + } + if !reflect.DeepEqual(a.genericHint, b.genericHint) { + return "genericHint" + } + return "" } diff --git a/constraint/tinyfield/system.go b/constraint/tinyfield/system.go index 131fc1849f..8d83d25b95 100644 --- a/constraint/tinyfield/system.go +++ b/constraint/tinyfield/system.go @@ -381,6 +381,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index e2ede2c3b6..c772706efa 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -385,6 +385,9 @@ func (s *system) Equal(other constraint.ConstraintSystem) bool { if o, ok := other.(*system); !ok { return false } else { - return reflect.DeepEqual(s.field, o.field) && reflect.DeepEqual(s.CoeffTable, o.CoeffTable) && constraint.SystemEqual(s.System, o.System) + systemDiff := constraint.SystemDiff(s.System, o.System) + return reflect.DeepEqual(s.field, o.field) && + reflect.DeepEqual(s.CoeffTable.Coefficients, o.CoeffTable.Coefficients) && + systemDiff == "" } } \ No newline at end of file From 418ed00d36750eb958bf08f3719c52d57b8f371d Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 4 Aug 2023 10:40:35 -0500 Subject: [PATCH 14/16] chore: ignore .raw files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1be9af1ba2..d85d2a83ae 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,5 @@ gnarkd/circuits/** go.work go.work.sum -examples/gbotrel/** \ No newline at end of file +examples/gbotrel/** +*.raw From d2d3f13d68305d1052fa981b8058676a20b7fce1 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 4 Aug 2023 10:45:17 -0500 Subject: [PATCH 15/16] build: bump gnark-crypto dependency --- constraint/gkr.go | 9 +++++++++ go.mod | 2 +- go.sum | 2 ++ .../backend/template/representations/system.go.tmpl | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/constraint/gkr.go b/constraint/gkr.go index b9f54d5541..80c2887276 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -180,6 +180,15 @@ func SystemDiff(a, b System) string { } } + for k := range b.MHintsDependencies { + for j := range hintsNames { + if k == hintsNames[j][1] { + delete(b.MHintsDependencies, k) + b.MHintsDependencies[hintsNames[j][0]] = a.MHintsDependencies[hintsNames[j][0]] + } + } + } + if a.GnarkVersion != b.GnarkVersion { return "GnarkVersion" } diff --git a/go.mod b/go.mod index 3de47678a5..b55cab1381 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/bits-and-blooms/bitset v1.7.0 github.com/blang/semver/v4 v4.0.0 github.com/consensys/bavard v0.1.13 - github.com/consensys/gnark-crypto v0.11.1-0.20230702195904-e0bc87ecc0e7 + github.com/consensys/gnark-crypto v0.11.1-0.20230803220843-16c23157a1ad github.com/fxamacker/cbor/v2 v2.4.0 github.com/google/go-cmp v0.5.9 github.com/google/pprof v0.0.0-20230309165930-d61513b1440d diff --git a/go.sum b/go.sum index 53968ce087..692ae7489f 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.11.1-0.20230702195904-e0bc87ecc0e7 h1:Y4eVT+d64VzJx+9osW/lLpdSzTWnahMMrCSKFj0zO6M= github.com/consensys/gnark-crypto v0.11.1-0.20230702195904-e0bc87ecc0e7/go.mod h1:6C2ytC8zmP8uH2GKVfPOjf0Vw3KwMAaUxlCPK5WQqmw= +github.com/consensys/gnark-crypto v0.11.1-0.20230803220843-16c23157a1ad h1:XbeIJt0HRycN7Jzehwl52jIlA/biwwHvRJpCMXKbuo8= +github.com/consensys/gnark-crypto v0.11.1-0.20230803220843-16c23157a1ad/go.mod h1:6C2ytC8zmP8uH2GKVfPOjf0Vw3KwMAaUxlCPK5WQqmw= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/generator/backend/template/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index 9d5452b447..15c6cfb02b 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -375,7 +375,7 @@ func getTagSet() cbor.TagSet { addType(reflect.TypeOf(constraint.Groth16Commitments{})) addType(reflect.TypeOf(constraint.PlonkCommitments{})) - return ts + return ts } func (s *system) AddGkr(gkr constraint.GkrInfo) error { From e4e7781c0cfaf12b5beb69250563c86e41583016 Mon Sep 17 00:00:00 2001 From: Arya Tabaie Date: Fri, 17 Nov 2023 14:46:05 -0600 Subject: [PATCH 16/16] style: ConsenSys -> Consensys --- backend/groth16/bls12-377/commitment_test.go | 2 +- backend/groth16/bls12-377/marshal.go | 2 +- backend/groth16/bls12-377/marshal_test.go | 2 +- backend/groth16/bls12-377/mpcsetup/lagrange.go | 2 +- backend/groth16/bls12-377/mpcsetup/marshal.go | 2 +- .../groth16/bls12-377/mpcsetup/marshal_test.go | 2 +- backend/groth16/bls12-377/mpcsetup/phase1.go | 2 +- backend/groth16/bls12-377/mpcsetup/phase2.go | 2 +- backend/groth16/bls12-377/mpcsetup/setup.go | 2 +- backend/groth16/bls12-377/mpcsetup/setup_test.go | 2 +- backend/groth16/bls12-377/mpcsetup/utils.go | 2 +- backend/groth16/bls12-377/prove.go | 2 +- backend/groth16/bls12-377/setup.go | 2 +- backend/groth16/bls12-377/verify.go | 2 +- backend/groth16/bls12-381/commitment_test.go | 2 +- backend/groth16/bls12-381/marshal.go | 2 +- backend/groth16/bls12-381/marshal_test.go | 2 +- backend/groth16/bls12-381/mpcsetup/lagrange.go | 2 +- backend/groth16/bls12-381/mpcsetup/marshal.go | 2 +- .../groth16/bls12-381/mpcsetup/marshal_test.go | 2 +- backend/groth16/bls12-381/mpcsetup/phase1.go | 2 +- backend/groth16/bls12-381/mpcsetup/phase2.go | 2 +- backend/groth16/bls12-381/mpcsetup/setup.go | 2 +- backend/groth16/bls12-381/mpcsetup/setup_test.go | 2 +- backend/groth16/bls12-381/mpcsetup/utils.go | 2 +- backend/groth16/bls12-381/prove.go | 2 +- backend/groth16/bls12-381/setup.go | 2 +- backend/groth16/bls12-381/verify.go | 2 +- backend/groth16/bls24-315/commitment_test.go | 2 +- backend/groth16/bls24-315/marshal.go | 2 +- backend/groth16/bls24-315/marshal_test.go | 2 +- backend/groth16/bls24-315/mpcsetup/lagrange.go | 2 +- backend/groth16/bls24-315/mpcsetup/marshal.go | 2 +- .../groth16/bls24-315/mpcsetup/marshal_test.go | 2 +- backend/groth16/bls24-315/mpcsetup/phase1.go | 2 +- backend/groth16/bls24-315/mpcsetup/phase2.go | 2 +- backend/groth16/bls24-315/mpcsetup/setup.go | 2 +- backend/groth16/bls24-315/mpcsetup/setup_test.go | 2 +- backend/groth16/bls24-315/mpcsetup/utils.go | 2 +- backend/groth16/bls24-315/prove.go | 2 +- backend/groth16/bls24-315/setup.go | 2 +- backend/groth16/bls24-315/verify.go | 2 +- backend/groth16/bls24-317/commitment_test.go | 2 +- backend/groth16/bls24-317/marshal.go | 2 +- backend/groth16/bls24-317/marshal_test.go | 2 +- backend/groth16/bls24-317/mpcsetup/lagrange.go | 2 +- backend/groth16/bls24-317/mpcsetup/marshal.go | 2 +- .../groth16/bls24-317/mpcsetup/marshal_test.go | 2 +- backend/groth16/bls24-317/mpcsetup/phase1.go | 2 +- backend/groth16/bls24-317/mpcsetup/phase2.go | 2 +- backend/groth16/bls24-317/mpcsetup/setup.go | 2 +- backend/groth16/bls24-317/mpcsetup/setup_test.go | 2 +- backend/groth16/bls24-317/mpcsetup/utils.go | 2 +- backend/groth16/bls24-317/prove.go | 2 +- backend/groth16/bls24-317/setup.go | 2 +- backend/groth16/bls24-317/verify.go | 2 +- backend/groth16/bn254/commitment_test.go | 2 +- backend/groth16/bn254/marshal.go | 2 +- backend/groth16/bn254/marshal_test.go | 2 +- backend/groth16/bn254/mpcsetup/lagrange.go | 2 +- backend/groth16/bn254/mpcsetup/marshal.go | 2 +- backend/groth16/bn254/mpcsetup/marshal_test.go | 2 +- backend/groth16/bn254/mpcsetup/phase1.go | 2 +- backend/groth16/bn254/mpcsetup/phase2.go | 2 +- backend/groth16/bn254/mpcsetup/setup.go | 2 +- backend/groth16/bn254/mpcsetup/setup_test.go | 2 +- backend/groth16/bn254/mpcsetup/utils.go | 2 +- backend/groth16/bn254/prove.go | 2 +- backend/groth16/bn254/setup.go | 2 +- backend/groth16/bn254/verify.go | 2 +- backend/groth16/bw6-633/commitment_test.go | 2 +- backend/groth16/bw6-633/marshal.go | 2 +- backend/groth16/bw6-633/marshal_test.go | 2 +- backend/groth16/bw6-633/mpcsetup/lagrange.go | 2 +- backend/groth16/bw6-633/mpcsetup/marshal.go | 2 +- backend/groth16/bw6-633/mpcsetup/marshal_test.go | 2 +- backend/groth16/bw6-633/mpcsetup/phase1.go | 2 +- backend/groth16/bw6-633/mpcsetup/phase2.go | 2 +- backend/groth16/bw6-633/mpcsetup/setup.go | 2 +- backend/groth16/bw6-633/mpcsetup/setup_test.go | 2 +- backend/groth16/bw6-633/mpcsetup/utils.go | 2 +- backend/groth16/bw6-633/prove.go | 2 +- backend/groth16/bw6-633/setup.go | 2 +- backend/groth16/bw6-633/verify.go | 2 +- backend/groth16/bw6-761/commitment_test.go | 2 +- backend/groth16/bw6-761/marshal.go | 2 +- backend/groth16/bw6-761/marshal_test.go | 2 +- backend/groth16/bw6-761/mpcsetup/lagrange.go | 2 +- backend/groth16/bw6-761/mpcsetup/marshal.go | 2 +- backend/groth16/bw6-761/mpcsetup/marshal_test.go | 2 +- backend/groth16/bw6-761/mpcsetup/phase1.go | 2 +- backend/groth16/bw6-761/mpcsetup/phase2.go | 2 +- backend/groth16/bw6-761/mpcsetup/setup.go | 2 +- backend/groth16/bw6-761/mpcsetup/setup_test.go | 2 +- backend/groth16/bw6-761/mpcsetup/utils.go | 2 +- backend/groth16/bw6-761/prove.go | 2 +- backend/groth16/bw6-761/setup.go | 2 +- backend/groth16/bw6-761/verify.go | 2 +- backend/plonk/bls12-377/marshal.go | 2 +- backend/plonk/bls12-377/marshal_test.go | 2 +- backend/plonk/bls12-377/prove.go | 7 +------ backend/plonk/bls12-377/setup.go | 2 +- backend/plonk/bls12-377/verify.go | 2 +- backend/plonk/bls12-381/marshal.go | 2 +- backend/plonk/bls12-381/marshal_test.go | 2 +- backend/plonk/bls12-381/prove.go | 7 +------ backend/plonk/bls12-381/setup.go | 2 +- backend/plonk/bls12-381/verify.go | 2 +- backend/plonk/bls24-315/marshal.go | 2 +- backend/plonk/bls24-315/marshal_test.go | 2 +- backend/plonk/bls24-315/prove.go | 7 +------ backend/plonk/bls24-315/setup.go | 2 +- backend/plonk/bls24-315/verify.go | 2 +- backend/plonk/bls24-317/marshal.go | 2 +- backend/plonk/bls24-317/marshal_test.go | 2 +- backend/plonk/bls24-317/prove.go | 7 +------ backend/plonk/bls24-317/setup.go | 2 +- backend/plonk/bls24-317/verify.go | 2 +- backend/plonk/bn254/marshal.go | 2 +- backend/plonk/bn254/marshal_test.go | 2 +- backend/plonk/bn254/prove.go | 7 +------ backend/plonk/bn254/setup.go | 2 +- backend/plonk/bn254/verify.go | 2 +- backend/plonk/bw6-633/marshal.go | 2 +- backend/plonk/bw6-633/marshal_test.go | 2 +- backend/plonk/bw6-633/prove.go | 7 +------ backend/plonk/bw6-633/setup.go | 2 +- backend/plonk/bw6-633/verify.go | 2 +- backend/plonk/bw6-761/marshal.go | 2 +- backend/plonk/bw6-761/marshal_test.go | 2 +- backend/plonk/bw6-761/prove.go | 7 +------ backend/plonk/bw6-761/setup.go | 2 +- backend/plonk/bw6-761/verify.go | 2 +- backend/plonkfri/bls12-377/prove.go | 2 +- backend/plonkfri/bls12-377/setup.go | 2 +- backend/plonkfri/bls12-377/verify.go | 2 +- backend/plonkfri/bls12-381/prove.go | 2 +- backend/plonkfri/bls12-381/setup.go | 2 +- backend/plonkfri/bls12-381/verify.go | 2 +- backend/plonkfri/bls24-315/prove.go | 2 +- backend/plonkfri/bls24-315/setup.go | 2 +- backend/plonkfri/bls24-315/verify.go | 2 +- backend/plonkfri/bls24-317/prove.go | 2 +- backend/plonkfri/bls24-317/setup.go | 2 +- backend/plonkfri/bls24-317/verify.go | 2 +- backend/plonkfri/bn254/prove.go | 2 +- backend/plonkfri/bn254/setup.go | 2 +- backend/plonkfri/bn254/verify.go | 2 +- backend/plonkfri/bw6-633/prove.go | 2 +- backend/plonkfri/bw6-633/setup.go | 2 +- backend/plonkfri/bw6-633/verify.go | 2 +- backend/plonkfri/bw6-761/prove.go | 2 +- backend/plonkfri/bw6-761/setup.go | 2 +- backend/plonkfri/bw6-761/verify.go | 2 +- constant/constant.go | 2 +- constraint/bls12-377/coeff.go | 2 +- constraint/bls12-377/gkr.go | 2 +- constraint/bls12-377/r1cs_test.go | 2 +- constraint/bls12-377/solver.go | 2 +- constraint/bls12-377/system.go | 2 +- constraint/bls12-381/coeff.go | 2 +- constraint/bls12-381/gkr.go | 2 +- constraint/bls12-381/r1cs_test.go | 2 +- constraint/bls12-381/solver.go | 2 +- constraint/bls12-381/system.go | 2 +- constraint/bls24-315/coeff.go | 2 +- constraint/bls24-315/gkr.go | 2 +- constraint/bls24-315/r1cs_test.go | 2 +- constraint/bls24-315/solver.go | 2 +- constraint/bls24-315/system.go | 2 +- constraint/bls24-317/coeff.go | 2 +- constraint/bls24-317/gkr.go | 2 +- constraint/bls24-317/r1cs_test.go | 2 +- constraint/bls24-317/solver.go | 2 +- constraint/bls24-317/system.go | 2 +- constraint/bn254/coeff.go | 2 +- constraint/bn254/gkr.go | 2 +- constraint/bn254/r1cs_test.go | 2 +- constraint/bn254/solver.go | 2 +- constraint/bn254/system.go | 2 +- constraint/bw6-633/coeff.go | 2 +- constraint/bw6-633/gkr.go | 2 +- constraint/bw6-633/r1cs_test.go | 2 +- constraint/bw6-633/solver.go | 2 +- constraint/bw6-633/system.go | 2 +- constraint/bw6-761/coeff.go | 2 +- constraint/bw6-761/gkr.go | 2 +- constraint/bw6-761/r1cs_test.go | 2 +- constraint/bw6-761/solver.go | 2 +- constraint/bw6-761/system.go | 2 +- constraint/tinyfield/coeff.go | 2 +- constraint/tinyfield/r1cs_test.go | 2 +- constraint/tinyfield/solver.go | 2 +- constraint/tinyfield/system.go | 2 +- go.sum | 16 ++++++++++++++++ internal/generator/backend/main.go | 2 +- .../zkpschemes/plonk/plonk.prove.go.tmpl | 5 ----- 197 files changed, 211 insertions(+), 235 deletions(-) diff --git a/backend/groth16/bls12-377/commitment_test.go b/backend/groth16/bls12-377/commitment_test.go index f18eefb837..8401d78354 100644 --- a/backend/groth16/bls12-377/commitment_test.go +++ b/backend/groth16/bls12-377/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/marshal.go b/backend/groth16/bls12-377/marshal.go index 525315efc2..24d4bc2502 100644 --- a/backend/groth16/bls12-377/marshal.go +++ b/backend/groth16/bls12-377/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/marshal_test.go b/backend/groth16/bls12-377/marshal_test.go index c84d78180a..ca6c829cd2 100644 --- a/backend/groth16/bls12-377/marshal_test.go +++ b/backend/groth16/bls12-377/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/lagrange.go b/backend/groth16/bls12-377/mpcsetup/lagrange.go index be7a1d0b27..f8cfdf0f67 100644 --- a/backend/groth16/bls12-377/mpcsetup/lagrange.go +++ b/backend/groth16/bls12-377/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/marshal.go b/backend/groth16/bls12-377/mpcsetup/marshal.go index 35ceece58f..3ef4e7232d 100644 --- a/backend/groth16/bls12-377/mpcsetup/marshal.go +++ b/backend/groth16/bls12-377/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/marshal_test.go b/backend/groth16/bls12-377/mpcsetup/marshal_test.go index a025f0580d..aada8345ba 100644 --- a/backend/groth16/bls12-377/mpcsetup/marshal_test.go +++ b/backend/groth16/bls12-377/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/phase1.go b/backend/groth16/bls12-377/mpcsetup/phase1.go index 573aaec996..b3f45e004e 100644 --- a/backend/groth16/bls12-377/mpcsetup/phase1.go +++ b/backend/groth16/bls12-377/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/phase2.go b/backend/groth16/bls12-377/mpcsetup/phase2.go index e3816d65ca..3fd8fdecaa 100644 --- a/backend/groth16/bls12-377/mpcsetup/phase2.go +++ b/backend/groth16/bls12-377/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/setup.go b/backend/groth16/bls12-377/mpcsetup/setup.go index 683369c871..b48e3def52 100644 --- a/backend/groth16/bls12-377/mpcsetup/setup.go +++ b/backend/groth16/bls12-377/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/setup_test.go b/backend/groth16/bls12-377/mpcsetup/setup_test.go index ca8cca346f..042d03d6a2 100644 --- a/backend/groth16/bls12-377/mpcsetup/setup_test.go +++ b/backend/groth16/bls12-377/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/mpcsetup/utils.go b/backend/groth16/bls12-377/mpcsetup/utils.go index 978b2ecbde..7c9557691c 100644 --- a/backend/groth16/bls12-377/mpcsetup/utils.go +++ b/backend/groth16/bls12-377/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/prove.go b/backend/groth16/bls12-377/prove.go index 25acf39b2e..ec99212a9e 100644 --- a/backend/groth16/bls12-377/prove.go +++ b/backend/groth16/bls12-377/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/setup.go b/backend/groth16/bls12-377/setup.go index 393d6a802e..69c0e3ea44 100644 --- a/backend/groth16/bls12-377/setup.go +++ b/backend/groth16/bls12-377/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-377/verify.go b/backend/groth16/bls12-377/verify.go index 867ce56708..d380efb6c3 100644 --- a/backend/groth16/bls12-377/verify.go +++ b/backend/groth16/bls12-377/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/commitment_test.go b/backend/groth16/bls12-381/commitment_test.go index 8f6882aeb1..a97c5a7cd4 100644 --- a/backend/groth16/bls12-381/commitment_test.go +++ b/backend/groth16/bls12-381/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/marshal.go b/backend/groth16/bls12-381/marshal.go index 9b0e59446b..51533b67c6 100644 --- a/backend/groth16/bls12-381/marshal.go +++ b/backend/groth16/bls12-381/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/marshal_test.go b/backend/groth16/bls12-381/marshal_test.go index 7b0e6a56cd..fc83eab6a8 100644 --- a/backend/groth16/bls12-381/marshal_test.go +++ b/backend/groth16/bls12-381/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/lagrange.go b/backend/groth16/bls12-381/mpcsetup/lagrange.go index 700d3b31b6..8178d46fd6 100644 --- a/backend/groth16/bls12-381/mpcsetup/lagrange.go +++ b/backend/groth16/bls12-381/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/marshal.go b/backend/groth16/bls12-381/mpcsetup/marshal.go index 0aa64ea1f0..1cb1f6f982 100644 --- a/backend/groth16/bls12-381/mpcsetup/marshal.go +++ b/backend/groth16/bls12-381/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/marshal_test.go b/backend/groth16/bls12-381/mpcsetup/marshal_test.go index b6db6846f1..679633f6d2 100644 --- a/backend/groth16/bls12-381/mpcsetup/marshal_test.go +++ b/backend/groth16/bls12-381/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/phase1.go b/backend/groth16/bls12-381/mpcsetup/phase1.go index 14cef5f605..33094a78d2 100644 --- a/backend/groth16/bls12-381/mpcsetup/phase1.go +++ b/backend/groth16/bls12-381/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/phase2.go b/backend/groth16/bls12-381/mpcsetup/phase2.go index ed42a69f9c..ef41353e1e 100644 --- a/backend/groth16/bls12-381/mpcsetup/phase2.go +++ b/backend/groth16/bls12-381/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/setup.go b/backend/groth16/bls12-381/mpcsetup/setup.go index dd568aa21e..f08651e09b 100644 --- a/backend/groth16/bls12-381/mpcsetup/setup.go +++ b/backend/groth16/bls12-381/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/setup_test.go b/backend/groth16/bls12-381/mpcsetup/setup_test.go index 0e9880b010..8ba2c0d004 100644 --- a/backend/groth16/bls12-381/mpcsetup/setup_test.go +++ b/backend/groth16/bls12-381/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/mpcsetup/utils.go b/backend/groth16/bls12-381/mpcsetup/utils.go index e29ec7ae32..67c1cf3acc 100644 --- a/backend/groth16/bls12-381/mpcsetup/utils.go +++ b/backend/groth16/bls12-381/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/prove.go b/backend/groth16/bls12-381/prove.go index 6cb00ceec7..2244f29c2d 100644 --- a/backend/groth16/bls12-381/prove.go +++ b/backend/groth16/bls12-381/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/setup.go b/backend/groth16/bls12-381/setup.go index b5333ba374..35d8e6880a 100644 --- a/backend/groth16/bls12-381/setup.go +++ b/backend/groth16/bls12-381/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls12-381/verify.go b/backend/groth16/bls12-381/verify.go index 0bf293f1d3..b816c4d30f 100644 --- a/backend/groth16/bls12-381/verify.go +++ b/backend/groth16/bls12-381/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/commitment_test.go b/backend/groth16/bls24-315/commitment_test.go index 0f626448b3..9e29784ec2 100644 --- a/backend/groth16/bls24-315/commitment_test.go +++ b/backend/groth16/bls24-315/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/marshal.go b/backend/groth16/bls24-315/marshal.go index efbb31d620..859e6e2788 100644 --- a/backend/groth16/bls24-315/marshal.go +++ b/backend/groth16/bls24-315/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/marshal_test.go b/backend/groth16/bls24-315/marshal_test.go index 9b5efcade2..a7a38e6cd8 100644 --- a/backend/groth16/bls24-315/marshal_test.go +++ b/backend/groth16/bls24-315/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/lagrange.go b/backend/groth16/bls24-315/mpcsetup/lagrange.go index 9f8cee5768..b25690e864 100644 --- a/backend/groth16/bls24-315/mpcsetup/lagrange.go +++ b/backend/groth16/bls24-315/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/marshal.go b/backend/groth16/bls24-315/mpcsetup/marshal.go index f670a7af74..0e540deedf 100644 --- a/backend/groth16/bls24-315/mpcsetup/marshal.go +++ b/backend/groth16/bls24-315/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/marshal_test.go b/backend/groth16/bls24-315/mpcsetup/marshal_test.go index b7cd61c85a..671a66e340 100644 --- a/backend/groth16/bls24-315/mpcsetup/marshal_test.go +++ b/backend/groth16/bls24-315/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/phase1.go b/backend/groth16/bls24-315/mpcsetup/phase1.go index cefde6c90f..a946b1877b 100644 --- a/backend/groth16/bls24-315/mpcsetup/phase1.go +++ b/backend/groth16/bls24-315/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/phase2.go b/backend/groth16/bls24-315/mpcsetup/phase2.go index 48939131d3..bc6ac01562 100644 --- a/backend/groth16/bls24-315/mpcsetup/phase2.go +++ b/backend/groth16/bls24-315/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/setup.go b/backend/groth16/bls24-315/mpcsetup/setup.go index 98fc63f1ad..2596ea7e85 100644 --- a/backend/groth16/bls24-315/mpcsetup/setup.go +++ b/backend/groth16/bls24-315/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/setup_test.go b/backend/groth16/bls24-315/mpcsetup/setup_test.go index 25c8affc68..b219b6c9da 100644 --- a/backend/groth16/bls24-315/mpcsetup/setup_test.go +++ b/backend/groth16/bls24-315/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/mpcsetup/utils.go b/backend/groth16/bls24-315/mpcsetup/utils.go index c86248ac16..10bfb7efa8 100644 --- a/backend/groth16/bls24-315/mpcsetup/utils.go +++ b/backend/groth16/bls24-315/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/prove.go b/backend/groth16/bls24-315/prove.go index 424e8b0e74..5f7df43aff 100644 --- a/backend/groth16/bls24-315/prove.go +++ b/backend/groth16/bls24-315/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/setup.go b/backend/groth16/bls24-315/setup.go index 6a8c8e60d2..c574425c8a 100644 --- a/backend/groth16/bls24-315/setup.go +++ b/backend/groth16/bls24-315/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-315/verify.go b/backend/groth16/bls24-315/verify.go index 2c95a54d0d..058e35ceb5 100644 --- a/backend/groth16/bls24-315/verify.go +++ b/backend/groth16/bls24-315/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/commitment_test.go b/backend/groth16/bls24-317/commitment_test.go index bfb2fc578e..acfd4e0988 100644 --- a/backend/groth16/bls24-317/commitment_test.go +++ b/backend/groth16/bls24-317/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/marshal.go b/backend/groth16/bls24-317/marshal.go index b16d681254..e3ba6e8fdd 100644 --- a/backend/groth16/bls24-317/marshal.go +++ b/backend/groth16/bls24-317/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/marshal_test.go b/backend/groth16/bls24-317/marshal_test.go index 2e984257dc..55e37f7b04 100644 --- a/backend/groth16/bls24-317/marshal_test.go +++ b/backend/groth16/bls24-317/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/lagrange.go b/backend/groth16/bls24-317/mpcsetup/lagrange.go index 87502a5c09..47f1c7748e 100644 --- a/backend/groth16/bls24-317/mpcsetup/lagrange.go +++ b/backend/groth16/bls24-317/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/marshal.go b/backend/groth16/bls24-317/mpcsetup/marshal.go index 6e1ebfc02c..f668fd6f7e 100644 --- a/backend/groth16/bls24-317/mpcsetup/marshal.go +++ b/backend/groth16/bls24-317/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/marshal_test.go b/backend/groth16/bls24-317/mpcsetup/marshal_test.go index 0224685d65..1bfbd04bb8 100644 --- a/backend/groth16/bls24-317/mpcsetup/marshal_test.go +++ b/backend/groth16/bls24-317/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/phase1.go b/backend/groth16/bls24-317/mpcsetup/phase1.go index 72e61e9977..920c902b52 100644 --- a/backend/groth16/bls24-317/mpcsetup/phase1.go +++ b/backend/groth16/bls24-317/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/phase2.go b/backend/groth16/bls24-317/mpcsetup/phase2.go index d3037cc3d3..ecf4c6d221 100644 --- a/backend/groth16/bls24-317/mpcsetup/phase2.go +++ b/backend/groth16/bls24-317/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/setup.go b/backend/groth16/bls24-317/mpcsetup/setup.go index f90fea816c..ef26ca35fe 100644 --- a/backend/groth16/bls24-317/mpcsetup/setup.go +++ b/backend/groth16/bls24-317/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/setup_test.go b/backend/groth16/bls24-317/mpcsetup/setup_test.go index 750ab1e0cf..04012dcea7 100644 --- a/backend/groth16/bls24-317/mpcsetup/setup_test.go +++ b/backend/groth16/bls24-317/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/mpcsetup/utils.go b/backend/groth16/bls24-317/mpcsetup/utils.go index 877fef7fad..5d8f93559c 100644 --- a/backend/groth16/bls24-317/mpcsetup/utils.go +++ b/backend/groth16/bls24-317/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/prove.go b/backend/groth16/bls24-317/prove.go index 80bfdfa99b..8a3afbb1ba 100644 --- a/backend/groth16/bls24-317/prove.go +++ b/backend/groth16/bls24-317/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/setup.go b/backend/groth16/bls24-317/setup.go index 68ee5c8922..5804adffb5 100644 --- a/backend/groth16/bls24-317/setup.go +++ b/backend/groth16/bls24-317/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bls24-317/verify.go b/backend/groth16/bls24-317/verify.go index f4c92dc687..b73a91b05d 100644 --- a/backend/groth16/bls24-317/verify.go +++ b/backend/groth16/bls24-317/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/commitment_test.go b/backend/groth16/bn254/commitment_test.go index 759501ebe2..40e884ccb2 100644 --- a/backend/groth16/bn254/commitment_test.go +++ b/backend/groth16/bn254/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/marshal.go b/backend/groth16/bn254/marshal.go index c6539a7ba2..3fc0921ef2 100644 --- a/backend/groth16/bn254/marshal.go +++ b/backend/groth16/bn254/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/marshal_test.go b/backend/groth16/bn254/marshal_test.go index ae007c3668..7f8414d884 100644 --- a/backend/groth16/bn254/marshal_test.go +++ b/backend/groth16/bn254/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/lagrange.go b/backend/groth16/bn254/mpcsetup/lagrange.go index ffa21be073..3fd1fa34f7 100644 --- a/backend/groth16/bn254/mpcsetup/lagrange.go +++ b/backend/groth16/bn254/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/marshal.go b/backend/groth16/bn254/mpcsetup/marshal.go index 08cb2ae3d1..af96c406c8 100644 --- a/backend/groth16/bn254/mpcsetup/marshal.go +++ b/backend/groth16/bn254/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/marshal_test.go b/backend/groth16/bn254/mpcsetup/marshal_test.go index 386e3faf66..08267024d6 100644 --- a/backend/groth16/bn254/mpcsetup/marshal_test.go +++ b/backend/groth16/bn254/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/phase1.go b/backend/groth16/bn254/mpcsetup/phase1.go index a912a473aa..cd92cd72f1 100644 --- a/backend/groth16/bn254/mpcsetup/phase1.go +++ b/backend/groth16/bn254/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/phase2.go b/backend/groth16/bn254/mpcsetup/phase2.go index 3fcafb30da..13b4892f80 100644 --- a/backend/groth16/bn254/mpcsetup/phase2.go +++ b/backend/groth16/bn254/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/setup.go b/backend/groth16/bn254/mpcsetup/setup.go index 4946e9f597..b012f8d149 100644 --- a/backend/groth16/bn254/mpcsetup/setup.go +++ b/backend/groth16/bn254/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/setup_test.go b/backend/groth16/bn254/mpcsetup/setup_test.go index 63b717cac4..53b0b305fd 100644 --- a/backend/groth16/bn254/mpcsetup/setup_test.go +++ b/backend/groth16/bn254/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/mpcsetup/utils.go b/backend/groth16/bn254/mpcsetup/utils.go index e3b47d1121..61dc94adf6 100644 --- a/backend/groth16/bn254/mpcsetup/utils.go +++ b/backend/groth16/bn254/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/prove.go b/backend/groth16/bn254/prove.go index 100f30e85a..286552ca21 100644 --- a/backend/groth16/bn254/prove.go +++ b/backend/groth16/bn254/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/setup.go b/backend/groth16/bn254/setup.go index 372c723da0..7100481c65 100644 --- a/backend/groth16/bn254/setup.go +++ b/backend/groth16/bn254/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bn254/verify.go b/backend/groth16/bn254/verify.go index 14eda65ed6..fc8e6512b0 100644 --- a/backend/groth16/bn254/verify.go +++ b/backend/groth16/bn254/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/commitment_test.go b/backend/groth16/bw6-633/commitment_test.go index a832752ffd..47c9babcdd 100644 --- a/backend/groth16/bw6-633/commitment_test.go +++ b/backend/groth16/bw6-633/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/marshal.go b/backend/groth16/bw6-633/marshal.go index d5c2339407..38c733c6d0 100644 --- a/backend/groth16/bw6-633/marshal.go +++ b/backend/groth16/bw6-633/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/marshal_test.go b/backend/groth16/bw6-633/marshal_test.go index 31b93fe801..74dcd2fb49 100644 --- a/backend/groth16/bw6-633/marshal_test.go +++ b/backend/groth16/bw6-633/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/lagrange.go b/backend/groth16/bw6-633/mpcsetup/lagrange.go index 0d0e87309e..cf4f6641e5 100644 --- a/backend/groth16/bw6-633/mpcsetup/lagrange.go +++ b/backend/groth16/bw6-633/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/marshal.go b/backend/groth16/bw6-633/mpcsetup/marshal.go index 4955ec6d92..6ae5a9b9ce 100644 --- a/backend/groth16/bw6-633/mpcsetup/marshal.go +++ b/backend/groth16/bw6-633/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/marshal_test.go b/backend/groth16/bw6-633/mpcsetup/marshal_test.go index fd7fa474d2..d7f99cb446 100644 --- a/backend/groth16/bw6-633/mpcsetup/marshal_test.go +++ b/backend/groth16/bw6-633/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/phase1.go b/backend/groth16/bw6-633/mpcsetup/phase1.go index fa91cc5025..055311d29f 100644 --- a/backend/groth16/bw6-633/mpcsetup/phase1.go +++ b/backend/groth16/bw6-633/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/phase2.go b/backend/groth16/bw6-633/mpcsetup/phase2.go index cdf0bb7578..ec1fd6a741 100644 --- a/backend/groth16/bw6-633/mpcsetup/phase2.go +++ b/backend/groth16/bw6-633/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/setup.go b/backend/groth16/bw6-633/mpcsetup/setup.go index 35bfdca0e9..cf84fb053a 100644 --- a/backend/groth16/bw6-633/mpcsetup/setup.go +++ b/backend/groth16/bw6-633/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/setup_test.go b/backend/groth16/bw6-633/mpcsetup/setup_test.go index fa51d16fe2..67c056c835 100644 --- a/backend/groth16/bw6-633/mpcsetup/setup_test.go +++ b/backend/groth16/bw6-633/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/mpcsetup/utils.go b/backend/groth16/bw6-633/mpcsetup/utils.go index 7a2979c53c..99ccd11381 100644 --- a/backend/groth16/bw6-633/mpcsetup/utils.go +++ b/backend/groth16/bw6-633/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/prove.go b/backend/groth16/bw6-633/prove.go index 31e0ef7722..d6b3f850e6 100644 --- a/backend/groth16/bw6-633/prove.go +++ b/backend/groth16/bw6-633/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/setup.go b/backend/groth16/bw6-633/setup.go index f168993476..2ede8b88ee 100644 --- a/backend/groth16/bw6-633/setup.go +++ b/backend/groth16/bw6-633/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-633/verify.go b/backend/groth16/bw6-633/verify.go index 3bfaaffd39..c83ea951d5 100644 --- a/backend/groth16/bw6-633/verify.go +++ b/backend/groth16/bw6-633/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/commitment_test.go b/backend/groth16/bw6-761/commitment_test.go index f16cb25786..e84790278e 100644 --- a/backend/groth16/bw6-761/commitment_test.go +++ b/backend/groth16/bw6-761/commitment_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/marshal.go b/backend/groth16/bw6-761/marshal.go index b9de7f8d90..4f93e9206f 100644 --- a/backend/groth16/bw6-761/marshal.go +++ b/backend/groth16/bw6-761/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/marshal_test.go b/backend/groth16/bw6-761/marshal_test.go index 61bd28a632..fd6d6ca6bf 100644 --- a/backend/groth16/bw6-761/marshal_test.go +++ b/backend/groth16/bw6-761/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/lagrange.go b/backend/groth16/bw6-761/mpcsetup/lagrange.go index 962efe5ff9..ddb69e2549 100644 --- a/backend/groth16/bw6-761/mpcsetup/lagrange.go +++ b/backend/groth16/bw6-761/mpcsetup/lagrange.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/marshal.go b/backend/groth16/bw6-761/mpcsetup/marshal.go index d1a071aa5d..ff69cd5502 100644 --- a/backend/groth16/bw6-761/mpcsetup/marshal.go +++ b/backend/groth16/bw6-761/mpcsetup/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/marshal_test.go b/backend/groth16/bw6-761/mpcsetup/marshal_test.go index 89650992c2..b39819d575 100644 --- a/backend/groth16/bw6-761/mpcsetup/marshal_test.go +++ b/backend/groth16/bw6-761/mpcsetup/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/phase1.go b/backend/groth16/bw6-761/mpcsetup/phase1.go index 07af196d3f..08544bfa9b 100644 --- a/backend/groth16/bw6-761/mpcsetup/phase1.go +++ b/backend/groth16/bw6-761/mpcsetup/phase1.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/phase2.go b/backend/groth16/bw6-761/mpcsetup/phase2.go index cb0c6f9768..0a7f28a808 100644 --- a/backend/groth16/bw6-761/mpcsetup/phase2.go +++ b/backend/groth16/bw6-761/mpcsetup/phase2.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/setup.go b/backend/groth16/bw6-761/mpcsetup/setup.go index 9008fd26b0..dcda5b9549 100644 --- a/backend/groth16/bw6-761/mpcsetup/setup.go +++ b/backend/groth16/bw6-761/mpcsetup/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/setup_test.go b/backend/groth16/bw6-761/mpcsetup/setup_test.go index 83994ca73d..ae24ee3f24 100644 --- a/backend/groth16/bw6-761/mpcsetup/setup_test.go +++ b/backend/groth16/bw6-761/mpcsetup/setup_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/mpcsetup/utils.go b/backend/groth16/bw6-761/mpcsetup/utils.go index dfdd1e8a97..9d912247d7 100644 --- a/backend/groth16/bw6-761/mpcsetup/utils.go +++ b/backend/groth16/bw6-761/mpcsetup/utils.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/prove.go b/backend/groth16/bw6-761/prove.go index 6b47f5bfee..d717be8eeb 100644 --- a/backend/groth16/bw6-761/prove.go +++ b/backend/groth16/bw6-761/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/setup.go b/backend/groth16/bw6-761/setup.go index b0fa2811e6..1e35240dd3 100644 --- a/backend/groth16/bw6-761/setup.go +++ b/backend/groth16/bw6-761/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/groth16/bw6-761/verify.go b/backend/groth16/bw6-761/verify.go index f08d631d62..dc941c3687 100644 --- a/backend/groth16/bw6-761/verify.go +++ b/backend/groth16/bw6-761/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-377/marshal.go b/backend/plonk/bls12-377/marshal.go index be1e58618d..87b4c0a823 100644 --- a/backend/plonk/bls12-377/marshal.go +++ b/backend/plonk/bls12-377/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-377/marshal_test.go b/backend/plonk/bls12-377/marshal_test.go index 7618d455f4..c88d594654 100644 --- a/backend/plonk/bls12-377/marshal_test.go +++ b/backend/plonk/bls12-377/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-377/prove.go b/backend/plonk/bls12-377/prove.go index ca5d9d9683..6a3dfebfea 100644 --- a/backend/plonk/bls12-377/prove.go +++ b/backend/plonk/bls12-377/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bls12-377/setup.go b/backend/plonk/bls12-377/setup.go index cede3fe039..6fcade911a 100644 --- a/backend/plonk/bls12-377/setup.go +++ b/backend/plonk/bls12-377/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-377/verify.go b/backend/plonk/bls12-377/verify.go index 70b76c39d3..114e23dcb0 100644 --- a/backend/plonk/bls12-377/verify.go +++ b/backend/plonk/bls12-377/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-381/marshal.go b/backend/plonk/bls12-381/marshal.go index 808e6ebfd4..6a90417fa0 100644 --- a/backend/plonk/bls12-381/marshal.go +++ b/backend/plonk/bls12-381/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-381/marshal_test.go b/backend/plonk/bls12-381/marshal_test.go index 3a02d789c1..5301ca5392 100644 --- a/backend/plonk/bls12-381/marshal_test.go +++ b/backend/plonk/bls12-381/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-381/prove.go b/backend/plonk/bls12-381/prove.go index b2baae5308..b9556e9fca 100644 --- a/backend/plonk/bls12-381/prove.go +++ b/backend/plonk/bls12-381/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bls12-381/setup.go b/backend/plonk/bls12-381/setup.go index 470f928e90..1c534e7595 100644 --- a/backend/plonk/bls12-381/setup.go +++ b/backend/plonk/bls12-381/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls12-381/verify.go b/backend/plonk/bls12-381/verify.go index 567be1b01b..3d689eea52 100644 --- a/backend/plonk/bls12-381/verify.go +++ b/backend/plonk/bls12-381/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-315/marshal.go b/backend/plonk/bls24-315/marshal.go index 8f83f8a48a..38bab9e615 100644 --- a/backend/plonk/bls24-315/marshal.go +++ b/backend/plonk/bls24-315/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-315/marshal_test.go b/backend/plonk/bls24-315/marshal_test.go index 29cf02bddb..54931dc3c9 100644 --- a/backend/plonk/bls24-315/marshal_test.go +++ b/backend/plonk/bls24-315/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-315/prove.go b/backend/plonk/bls24-315/prove.go index 28aff6cc85..e0360c22ca 100644 --- a/backend/plonk/bls24-315/prove.go +++ b/backend/plonk/bls24-315/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bls24-315/setup.go b/backend/plonk/bls24-315/setup.go index bdb6c050ad..5a97364101 100644 --- a/backend/plonk/bls24-315/setup.go +++ b/backend/plonk/bls24-315/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-315/verify.go b/backend/plonk/bls24-315/verify.go index d2a23f820b..c3a3e5f487 100644 --- a/backend/plonk/bls24-315/verify.go +++ b/backend/plonk/bls24-315/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-317/marshal.go b/backend/plonk/bls24-317/marshal.go index 59470dc834..7008cf9ba2 100644 --- a/backend/plonk/bls24-317/marshal.go +++ b/backend/plonk/bls24-317/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-317/marshal_test.go b/backend/plonk/bls24-317/marshal_test.go index 54c93b4de9..7436e701bd 100644 --- a/backend/plonk/bls24-317/marshal_test.go +++ b/backend/plonk/bls24-317/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-317/prove.go b/backend/plonk/bls24-317/prove.go index 54d4fe8289..b784642381 100644 --- a/backend/plonk/bls24-317/prove.go +++ b/backend/plonk/bls24-317/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bls24-317/setup.go b/backend/plonk/bls24-317/setup.go index 05e3c69112..023a4bc9b7 100644 --- a/backend/plonk/bls24-317/setup.go +++ b/backend/plonk/bls24-317/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bls24-317/verify.go b/backend/plonk/bls24-317/verify.go index 907eeceb23..3a74a83e0e 100644 --- a/backend/plonk/bls24-317/verify.go +++ b/backend/plonk/bls24-317/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bn254/marshal.go b/backend/plonk/bn254/marshal.go index 852de72b9f..0d1b55540a 100644 --- a/backend/plonk/bn254/marshal.go +++ b/backend/plonk/bn254/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bn254/marshal_test.go b/backend/plonk/bn254/marshal_test.go index a2ab848ced..69d81964f8 100644 --- a/backend/plonk/bn254/marshal_test.go +++ b/backend/plonk/bn254/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bn254/prove.go b/backend/plonk/bn254/prove.go index a1b95c9d20..020d744bc0 100644 --- a/backend/plonk/bn254/prove.go +++ b/backend/plonk/bn254/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bn254/setup.go b/backend/plonk/bn254/setup.go index dcd0481581..8b9687d8dd 100644 --- a/backend/plonk/bn254/setup.go +++ b/backend/plonk/bn254/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bn254/verify.go b/backend/plonk/bn254/verify.go index 42c2415268..d00cea7e9a 100644 --- a/backend/plonk/bn254/verify.go +++ b/backend/plonk/bn254/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-633/marshal.go b/backend/plonk/bw6-633/marshal.go index 2d60b8b7db..d81d1f14b1 100644 --- a/backend/plonk/bw6-633/marshal.go +++ b/backend/plonk/bw6-633/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-633/marshal_test.go b/backend/plonk/bw6-633/marshal_test.go index c47269443c..204ffdb95c 100644 --- a/backend/plonk/bw6-633/marshal_test.go +++ b/backend/plonk/bw6-633/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-633/prove.go b/backend/plonk/bw6-633/prove.go index 17c33be71b..b1c1ca2ff2 100644 --- a/backend/plonk/bw6-633/prove.go +++ b/backend/plonk/bw6-633/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bw6-633/setup.go b/backend/plonk/bw6-633/setup.go index 3be6c6fd5d..f2814193cc 100644 --- a/backend/plonk/bw6-633/setup.go +++ b/backend/plonk/bw6-633/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-633/verify.go b/backend/plonk/bw6-633/verify.go index 1d80b9d256..20cce7e303 100644 --- a/backend/plonk/bw6-633/verify.go +++ b/backend/plonk/bw6-633/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-761/marshal.go b/backend/plonk/bw6-761/marshal.go index 51bd484e7b..6504f6f095 100644 --- a/backend/plonk/bw6-761/marshal.go +++ b/backend/plonk/bw6-761/marshal.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-761/marshal_test.go b/backend/plonk/bw6-761/marshal_test.go index bc460d7f9f..e7957170f9 100644 --- a/backend/plonk/bw6-761/marshal_test.go +++ b/backend/plonk/bw6-761/marshal_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-761/prove.go b/backend/plonk/bw6-761/prove.go index 1b2cabc24b..7ef6735cf9 100644 --- a/backend/plonk/bw6-761/prove.go +++ b/backend/plonk/bw6-761/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,9 +128,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -143,8 +140,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/backend/plonk/bw6-761/setup.go b/backend/plonk/bw6-761/setup.go index e19f17f151..67742fad88 100644 --- a/backend/plonk/bw6-761/setup.go +++ b/backend/plonk/bw6-761/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonk/bw6-761/verify.go b/backend/plonk/bw6-761/verify.go index 701fde89cb..6d7bcc348e 100644 --- a/backend/plonk/bw6-761/verify.go +++ b/backend/plonk/bw6-761/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-377/prove.go b/backend/plonkfri/bls12-377/prove.go index c0b800e45f..057f67ef86 100644 --- a/backend/plonkfri/bls12-377/prove.go +++ b/backend/plonkfri/bls12-377/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-377/setup.go b/backend/plonkfri/bls12-377/setup.go index f24bb00188..5937f7c607 100644 --- a/backend/plonkfri/bls12-377/setup.go +++ b/backend/plonkfri/bls12-377/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-377/verify.go b/backend/plonkfri/bls12-377/verify.go index f4b2653f2f..2b8d588389 100644 --- a/backend/plonkfri/bls12-377/verify.go +++ b/backend/plonkfri/bls12-377/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-381/prove.go b/backend/plonkfri/bls12-381/prove.go index aae8121d9f..8e4b93de76 100644 --- a/backend/plonkfri/bls12-381/prove.go +++ b/backend/plonkfri/bls12-381/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-381/setup.go b/backend/plonkfri/bls12-381/setup.go index 5d8ef893a5..48d906b398 100644 --- a/backend/plonkfri/bls12-381/setup.go +++ b/backend/plonkfri/bls12-381/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls12-381/verify.go b/backend/plonkfri/bls12-381/verify.go index 49a1f5bc02..115f3639b3 100644 --- a/backend/plonkfri/bls12-381/verify.go +++ b/backend/plonkfri/bls12-381/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-315/prove.go b/backend/plonkfri/bls24-315/prove.go index 594df2cdc0..ee5aa0a3f0 100644 --- a/backend/plonkfri/bls24-315/prove.go +++ b/backend/plonkfri/bls24-315/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-315/setup.go b/backend/plonkfri/bls24-315/setup.go index b65e43fd6a..510b803a06 100644 --- a/backend/plonkfri/bls24-315/setup.go +++ b/backend/plonkfri/bls24-315/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-315/verify.go b/backend/plonkfri/bls24-315/verify.go index ad04736683..c0ab21192c 100644 --- a/backend/plonkfri/bls24-315/verify.go +++ b/backend/plonkfri/bls24-315/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-317/prove.go b/backend/plonkfri/bls24-317/prove.go index 7653db67ae..47324ab98f 100644 --- a/backend/plonkfri/bls24-317/prove.go +++ b/backend/plonkfri/bls24-317/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-317/setup.go b/backend/plonkfri/bls24-317/setup.go index 5ad55bb5c9..ae834dc2fa 100644 --- a/backend/plonkfri/bls24-317/setup.go +++ b/backend/plonkfri/bls24-317/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bls24-317/verify.go b/backend/plonkfri/bls24-317/verify.go index 996302faf5..cf0c066475 100644 --- a/backend/plonkfri/bls24-317/verify.go +++ b/backend/plonkfri/bls24-317/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bn254/prove.go b/backend/plonkfri/bn254/prove.go index 4a79841f26..39d100c374 100644 --- a/backend/plonkfri/bn254/prove.go +++ b/backend/plonkfri/bn254/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bn254/setup.go b/backend/plonkfri/bn254/setup.go index 62ecb4ccec..1b28a702ba 100644 --- a/backend/plonkfri/bn254/setup.go +++ b/backend/plonkfri/bn254/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bn254/verify.go b/backend/plonkfri/bn254/verify.go index d28b58ce02..e3a2ad76e9 100644 --- a/backend/plonkfri/bn254/verify.go +++ b/backend/plonkfri/bn254/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-633/prove.go b/backend/plonkfri/bw6-633/prove.go index 1202013681..0bf7c27b79 100644 --- a/backend/plonkfri/bw6-633/prove.go +++ b/backend/plonkfri/bw6-633/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-633/setup.go b/backend/plonkfri/bw6-633/setup.go index 6ca38844d1..e6f9040189 100644 --- a/backend/plonkfri/bw6-633/setup.go +++ b/backend/plonkfri/bw6-633/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-633/verify.go b/backend/plonkfri/bw6-633/verify.go index 9b8cd07344..084864c96b 100644 --- a/backend/plonkfri/bw6-633/verify.go +++ b/backend/plonkfri/bw6-633/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-761/prove.go b/backend/plonkfri/bw6-761/prove.go index 74ccbbc4c5..c71741d356 100644 --- a/backend/plonkfri/bw6-761/prove.go +++ b/backend/plonkfri/bw6-761/prove.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-761/setup.go b/backend/plonkfri/bw6-761/setup.go index 35d9409b84..c8af68b096 100644 --- a/backend/plonkfri/bw6-761/setup.go +++ b/backend/plonkfri/bw6-761/setup.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/backend/plonkfri/bw6-761/verify.go b/backend/plonkfri/bw6-761/verify.go index 458c30b0d3..a6ef0e5837 100644 --- a/backend/plonkfri/bw6-761/verify.go +++ b/backend/plonkfri/bw6-761/verify.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constant/constant.go b/constant/constant.go index 237a3ba935..4e7b977a68 100644 --- a/constant/constant.go +++ b/constant/constant.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-377/coeff.go b/constraint/bls12-377/coeff.go index a1b86b75c4..022f8269ff 100644 --- a/constraint/bls12-377/coeff.go +++ b/constraint/bls12-377/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-377/gkr.go b/constraint/bls12-377/gkr.go index adfe94b61a..019cd8ae89 100644 --- a/constraint/bls12-377/gkr.go +++ b/constraint/bls12-377/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-377/r1cs_test.go b/constraint/bls12-377/r1cs_test.go index 9883601a4a..e79ccb50dd 100644 --- a/constraint/bls12-377/r1cs_test.go +++ b/constraint/bls12-377/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-377/solver.go b/constraint/bls12-377/solver.go index c992d55b4a..ad5557124a 100644 --- a/constraint/bls12-377/solver.go +++ b/constraint/bls12-377/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-377/system.go b/constraint/bls12-377/system.go index 8b2a3b1db0..ddb246357d 100644 --- a/constraint/bls12-377/system.go +++ b/constraint/bls12-377/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-381/coeff.go b/constraint/bls12-381/coeff.go index 9eb3786806..88ffece631 100644 --- a/constraint/bls12-381/coeff.go +++ b/constraint/bls12-381/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-381/gkr.go b/constraint/bls12-381/gkr.go index 811d8d8f7f..dbaa02c0e0 100644 --- a/constraint/bls12-381/gkr.go +++ b/constraint/bls12-381/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-381/r1cs_test.go b/constraint/bls12-381/r1cs_test.go index 5a1e5a7c31..f3b4ae4225 100644 --- a/constraint/bls12-381/r1cs_test.go +++ b/constraint/bls12-381/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-381/solver.go b/constraint/bls12-381/solver.go index 125ce56e8e..097813b82e 100644 --- a/constraint/bls12-381/solver.go +++ b/constraint/bls12-381/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls12-381/system.go b/constraint/bls12-381/system.go index 83b9076336..23f8e905f3 100644 --- a/constraint/bls12-381/system.go +++ b/constraint/bls12-381/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-315/coeff.go b/constraint/bls24-315/coeff.go index 084652f545..e969582bf8 100644 --- a/constraint/bls24-315/coeff.go +++ b/constraint/bls24-315/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-315/gkr.go b/constraint/bls24-315/gkr.go index 21fee9bcbd..92a6ab4e6d 100644 --- a/constraint/bls24-315/gkr.go +++ b/constraint/bls24-315/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-315/r1cs_test.go b/constraint/bls24-315/r1cs_test.go index 6a48dbc3f5..73b74d0c7f 100644 --- a/constraint/bls24-315/r1cs_test.go +++ b/constraint/bls24-315/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-315/solver.go b/constraint/bls24-315/solver.go index 41f89208ce..8001445034 100644 --- a/constraint/bls24-315/solver.go +++ b/constraint/bls24-315/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-315/system.go b/constraint/bls24-315/system.go index ce56f5a9b2..c6ef834b65 100644 --- a/constraint/bls24-315/system.go +++ b/constraint/bls24-315/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-317/coeff.go b/constraint/bls24-317/coeff.go index 5df92edf1b..24078c593f 100644 --- a/constraint/bls24-317/coeff.go +++ b/constraint/bls24-317/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-317/gkr.go b/constraint/bls24-317/gkr.go index 516f92fcde..0b534334aa 100644 --- a/constraint/bls24-317/gkr.go +++ b/constraint/bls24-317/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-317/r1cs_test.go b/constraint/bls24-317/r1cs_test.go index 6c4bc3deb0..c4bdb1eba5 100644 --- a/constraint/bls24-317/r1cs_test.go +++ b/constraint/bls24-317/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-317/solver.go b/constraint/bls24-317/solver.go index e1dcad13e9..2c22b272b4 100644 --- a/constraint/bls24-317/solver.go +++ b/constraint/bls24-317/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bls24-317/system.go b/constraint/bls24-317/system.go index e3f1228373..3455af807e 100644 --- a/constraint/bls24-317/system.go +++ b/constraint/bls24-317/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bn254/coeff.go b/constraint/bn254/coeff.go index da49b0e68b..fc172376be 100644 --- a/constraint/bn254/coeff.go +++ b/constraint/bn254/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bn254/gkr.go b/constraint/bn254/gkr.go index 9ce0a8a161..4ee599205f 100644 --- a/constraint/bn254/gkr.go +++ b/constraint/bn254/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bn254/r1cs_test.go b/constraint/bn254/r1cs_test.go index 98b1786581..aa5a51b1d2 100644 --- a/constraint/bn254/r1cs_test.go +++ b/constraint/bn254/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bn254/solver.go b/constraint/bn254/solver.go index 5038f2ef4b..fda9fb40d1 100644 --- a/constraint/bn254/solver.go +++ b/constraint/bn254/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bn254/system.go b/constraint/bn254/system.go index 775209089c..0cb94bbcbb 100644 --- a/constraint/bn254/system.go +++ b/constraint/bn254/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-633/coeff.go b/constraint/bw6-633/coeff.go index dd1d29ad18..cf0a00eee7 100644 --- a/constraint/bw6-633/coeff.go +++ b/constraint/bw6-633/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-633/gkr.go b/constraint/bw6-633/gkr.go index 862843f646..1e29695f00 100644 --- a/constraint/bw6-633/gkr.go +++ b/constraint/bw6-633/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-633/r1cs_test.go b/constraint/bw6-633/r1cs_test.go index 1fc0ce531a..78c82a7d85 100644 --- a/constraint/bw6-633/r1cs_test.go +++ b/constraint/bw6-633/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-633/solver.go b/constraint/bw6-633/solver.go index 948bb4a2e4..49b87d6d5f 100644 --- a/constraint/bw6-633/solver.go +++ b/constraint/bw6-633/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-633/system.go b/constraint/bw6-633/system.go index 90133b8cda..e737d8d65f 100644 --- a/constraint/bw6-633/system.go +++ b/constraint/bw6-633/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-761/coeff.go b/constraint/bw6-761/coeff.go index 506ee5e586..c7528ca3e6 100644 --- a/constraint/bw6-761/coeff.go +++ b/constraint/bw6-761/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-761/gkr.go b/constraint/bw6-761/gkr.go index a2b159cdff..013afa40aa 100644 --- a/constraint/bw6-761/gkr.go +++ b/constraint/bw6-761/gkr.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-761/r1cs_test.go b/constraint/bw6-761/r1cs_test.go index 45e3e0b0ad..4aeb7662e5 100644 --- a/constraint/bw6-761/r1cs_test.go +++ b/constraint/bw6-761/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-761/solver.go b/constraint/bw6-761/solver.go index 803035e1a9..e979f48a68 100644 --- a/constraint/bw6-761/solver.go +++ b/constraint/bw6-761/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/bw6-761/system.go b/constraint/bw6-761/system.go index c53a96e2fc..bc91b86cf3 100644 --- a/constraint/bw6-761/system.go +++ b/constraint/bw6-761/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/tinyfield/coeff.go b/constraint/tinyfield/coeff.go index 3aec8da553..395259e4ca 100644 --- a/constraint/tinyfield/coeff.go +++ b/constraint/tinyfield/coeff.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/tinyfield/r1cs_test.go b/constraint/tinyfield/r1cs_test.go index 425f6e3f2b..bc999726d9 100644 --- a/constraint/tinyfield/r1cs_test.go +++ b/constraint/tinyfield/r1cs_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/tinyfield/solver.go b/constraint/tinyfield/solver.go index 7cb146906c..518a449b82 100644 --- a/constraint/tinyfield/solver.go +++ b/constraint/tinyfield/solver.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/constraint/tinyfield/system.go b/constraint/tinyfield/system.go index 75236c2459..7cdcd710dd 100644 --- a/constraint/tinyfield/system.go +++ b/constraint/tinyfield/system.go @@ -1,4 +1,4 @@ -// Copyright 2020 ConsenSys Software Inc. +// Copyright 2020 Consensys Software Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go.sum b/go.sum index 9be007ee58..d47a5df5a6 100644 --- a/go.sum +++ b/go.sum @@ -7,42 +7,58 @@ github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH github.com/consensys/gnark-crypto v0.12.2-0.20231023220848-538dff926c15 h1:fu5ienFKWWqrfMPbWnhw4zfIFZW3pzVIbv3KtASymbU= github.com/consensys/gnark-crypto v0.12.2-0.20231023220848-538dff926c15/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= +github.com/ingonyama-zk/icicle v0.0.0-20230928131117-97f0079e5c71 h1:YxI1RTPzpFJ3MBmxPl3Bo0F7ume7CmQEC1M9jL6CT94= github.com/ingonyama-zk/icicle v0.0.0-20230928131117-97f0079e5c71/go.mod h1:kAK8/EoN7fUEmakzgZIYdWy1a2rBnpCaZLqSHwZWxEk= +github.com/ingonyama-zk/iciclegnark v0.1.0 h1:88MkEghzjQBMjrYRJFxZ9oR9CTIpB8NG2zLeCJSvXKQ= github.com/ingonyama-zk/iciclegnark v0.1.0/go.mod h1:wz6+IpyHKs6UhMMoQpNqz1VY+ddfKqC/gRwR/64W6WU= github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/internal/generator/backend/main.go b/internal/generator/backend/main.go index 3af25e7b3d..bc250e5ecd 100644 --- a/internal/generator/backend/main.go +++ b/internal/generator/backend/main.go @@ -12,7 +12,7 @@ import ( "github.com/consensys/gnark-crypto/field/generator/config" ) -const copyrightHolder = "ConsenSys Software Inc." +const copyrightHolder = "Consensys Software Inc." var bgen = bavard.NewBatchGenerator(copyrightHolder, 2020, "gnark") diff --git a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl index 109cd5b457..5c49dad9f5 100644 --- a/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/plonk/plonk.prove.go.tmpl @@ -105,9 +105,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() - // create a transcript manager to apply Fiat Shamir - fs := fiatshamir.NewTranscript(hFunc, "gamma", "beta", "alpha", "zeta") - // result proof := &Proof{} @@ -120,8 +117,6 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) } - // query l, r, o in Lagrange basis, not blinded - _solution, err := spr.Solve(fullWitness, opt.SolverOpts...) // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt)