Commit 12a86ad0 authored by mdj33's avatar mdj33 Committed by vipwzw

update commens

parent 4bf5547c
......@@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
)
//考虑vk平滑切换的场景,允许有两个vk存在
func zkProofVerify(db dbm.KV, proof *mixTy.ZkProofInfo, ty mixTy.VerifyType) error {
keys, err := getVerifyKeys(db, int32(ty))
if err != nil {
......
......@@ -17,7 +17,6 @@ limitations under the License.
package zksnark
import (
"encoding/json"
"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend/groth16"
......@@ -25,21 +24,6 @@ import (
"github.com/pkg/errors"
)
func deserializeInput(input string) (map[string]interface{}, error) {
buff, err := mixTy.GetByteBuff(input)
if err != nil {
return nil, err
}
decoder := json.NewDecoder(buff)
toRead := make(map[string]interface{})
if err := decoder.Decode(&toRead); err != nil {
return nil, errors.Wrapf(err, "deserializeInput %s", input)
}
return toRead, nil
}
func Verify(verifyKeyStr, proofStr, pubInputStr string) (bool, error) {
vkBuf, err := mixTy.GetByteBuff(verifyKeyStr)
if err != nil {
......@@ -74,45 +58,3 @@ func Verify(verifyKeyStr, proofStr, pubInputStr string) (bool, error) {
}
return true, nil
}
//
//func Verify(verifyKeyStr, proofStr, pubInputStr string) (bool, error) {
// curveID := gurvy.BN256
//
// output, err := mixTy.GetByteBuff(verifyKeyStr)
// if err != nil {
// return false, errors.Wrapf(err, "zkVerify.GetByteBuff")
// }
// var vk groth16_bn256.VerifyingKey
// if err := gob.Deserialize(output, &vk, curveID); err != nil {
// return false, errors.Wrapf(err, "zkVerify.Deserize.VK=%s", verifyKeyStr[:10])
// }
//
// // parse input file
// assigns, err := deserializeInput(pubInputStr)
// if err != nil {
// return false, err
// }
// r1csInput := backend.NewAssignment()
// for k, v := range assigns {
// r1csInput.Assign(backend.Public, k, v)
// }
//
// // load proof
// output, err = mixTy.GetByteBuff(proofStr)
// if err != nil {
// return false, errors.Wrapf(err, "zkVerify.proof")
// }
// var proof groth16_bn256.Proof
// if err := gob.Deserialize(output, &proof, curveID); err != nil {
// return false, errors.Wrapf(err, "zkVerify.deserial.proof=%s", proofStr[:10])
// }
//
// // verify proof
// //start := time.Now()
// result, err := groth16_bn256.Verify(&proof, &vk, r1csInput)
// if err != nil {
// return false, errors.Wrapf(err, "zkVerify.verify")
// }
// return result, nil
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment