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 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 823fbb9b7d..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 eb62ff616d..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 725fea3202..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 56a20d7f12..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 8913a933ff..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 eb261d2b5b..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 940a7efd5b..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. @@ -109,13 +109,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _solution, err := r1cs.Solve(fullWitness, solverOpts...) if err != nil { return nil, err 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 41fc836692..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 544844cdc5..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 373a94b4b9..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 6792644a72..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 819e9728ae..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 d7b07a1160..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 8a7c7dd437..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,6 +128,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // 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 91bfd65069..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 5390eb44fb..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 4f44e6b72c..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 149c208e88..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 edb67f5753..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 f71a6406cb..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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/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 4b7d2a7096..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. @@ -67,6 +67,13 @@ func (cs *system) Solve(witness witness.Witness, opts ...csolver.Option) (any, e v := witness.Vector().(fr.Vector) + if cs.GkrInfo.Is() { + 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 solver, err := newSolver(cs, v, opts...) if err != nil { @@ -380,3 +387,14 @@ 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 { + 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 4d84a5466d..80c2887276 100644 --- a/constraint/gkr.go +++ b/constraint/gkr.go @@ -5,6 +5,8 @@ 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/slices" + "reflect" "sort" ) @@ -156,3 +158,96 @@ func (c GkrCircuit) Chunks(nbInstances int) []int { } return res } + +func SystemDiff(a, b System) string { + + 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 + + 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 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/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/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/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 5075e76415..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. @@ -380,3 +380,14 @@ 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 { + 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/go.sum b/go.sum index 40db4b3190..d47a5df5a6 100644 --- a/go.sum +++ b/go.sum @@ -12,21 +12,17 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs 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 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 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 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0= 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 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g= github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= 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= 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/representations/system.go.tmpl b/internal/generator/backend/template/representations/system.go.tmpl index e3fa05bb6f..a5d0c400ff 100644 --- a/internal/generator/backend/template/representations/system.go.tmpl +++ b/internal/generator/backend/template/representations/system.go.tmpl @@ -48,10 +48,18 @@ 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() { + 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}} + // init the solver solver, err := newSolver(cs, v, opts...) if err != nil { @@ -105,7 +113,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()) @@ -371,9 +378,20 @@ 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 { return s.System.AddGkr(gkr) +} + +func (s *system) Equal(other constraint.ConstraintSystem) bool { + if o, ok := other.(*system); !ok { + return false + } else { + 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 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 bbb9fd1bf5..ce7293958a 100644 --- a/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl +++ b/internal/generator/backend/template/zkpschemes/groth16/groth16.prove.go.tmpl @@ -93,13 +93,6 @@ func Prove(r1cs *cs.R1CS, pk *ProvingKey, fullWitness witness.Witness, opts ...b return nil })) - 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))) - } - _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 bbe0201c88..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,6 +105,18 @@ func Prove(spr *cs.SparseR1CS, pk *ProvingKey, fullWitness witness.Witness, opts start := time.Now() + // result + proof := &Proof{} + + commitmentInfo := spr.CommitmentInfo.(constraint.PlonkCommitments) + commitmentVal := make([]fr.Element, len(commitmentInfo)) // TODO @Tabaie get rid of this + cCommitments := make([]*iop.Polynomial, len(commitmentInfo)) + proof.Bsb22Commitments = make([]kzg.Digest, len(commitmentInfo)) + for i := range commitmentInfo { + opt.SolverOpts = append(opt.SolverOpts, solver.OverrideHint(commitmentInfo[i].HintID, + bsb22ComputeCommitmentHint(spr, pk, proof, cCommitments, &commitmentVal[i], i))) + } + // init instance g, ctx := errgroup.WithContext(context.Background()) instance, err := newInstance(ctx, spr, pk, fullWitness, &opt) diff --git a/std/gkr/api_test.go b/std/gkr/api_test.go index a0d1d4edbb..c674f84970 100644 --- a/std/gkr/api_test.go +++ b/std/gkr/api_test.go @@ -8,8 +8,10 @@ import ( "testing" "time" - "github.com/consensys/gnark-crypto/kzg" - "github.com/consensys/gnark/backend/plonk" + bn254r1cs "github.com/consensys/gnark/constraint/bn254" + "github.com/consensys/gnark/test" + "github.com/stretchr/testify/require" + bn254r1cs "github.com/consensys/gnark/constraint/bn254" "github.com/consensys/gnark/test" "github.com/stretchr/testify/require" @@ -19,11 +21,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,8 +74,7 @@ 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).ProverSucceeded(&circuit, &assignment, test.WithCurves(ecc.BN254)) } } } @@ -119,8 +118,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)) } } } @@ -182,8 +180,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)) } } } @@ -238,8 +235,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) { @@ -379,53 +375,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.RegisterHashBuilder("mimc", bn254MiMC.NewMiMC) stdHash.Register("mimc", func(api frontend.API) (stdHash.FieldHasher, error) { @@ -576,17 +525,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 @@ -637,10 +579,10 @@ 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 := 5; i < 100; i++ { + circuit, assignment := mimcNoDepCircuits(i, 1<<2) + test.NewAssert(t).SolvingSucceeded(circuit, assignment, test.WithCurves(ecc.BN254)) } } diff --git a/std/gkr/compile.go b/std/gkr/compile.go index d219257667..50772a367a 100644 --- a/std/gkr/compile.go +++ b/std/gkr/compile.go @@ -1,8 +1,8 @@ package gkr import ( + "crypto/rand" "fmt" - "math/big" "math/bits" "github.com/consensys/gnark/constraint" @@ -91,6 +91,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) { @@ -124,8 +132,9 @@ 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? + 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 } @@ -157,6 +166,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 @@ -176,11 +188,12 @@ 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? + 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 } - s.toStore.ProveHintID = solver.GetHintID(ProveHintPlaceholder) forSnarkSorted := algo_utils.MapRange(0, len(s.toStore.Circuit), slicePtrAt(forSnark.circuit)) @@ -202,14 +215,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] diff --git a/std/gkr/placeholder_hints.go b/std/gkr/placeholder_hints.go new file mode 100644 index 0000000000..bdf5d54c4f --- /dev/null +++ b/std/gkr/placeholder_hints.go @@ -0,0 +1,94 @@ +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 = 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) + + 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.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") + } + + delete(placeholderGkrSolvingData, solveHintId) + + return err + } +} 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 f2a7ade5b8..08b15f6179 100644 --- a/test/assert.go +++ b/test/assert.go @@ -150,7 +150,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 5702832bdb..b9a81138d0 100644 --- a/test/engine.go +++ b/test/engine.go @@ -334,7 +334,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] } @@ -749,7 +749,7 @@ 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 } // MustBeLessOrEqCst implements method comparing value given by its bits aBits