Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
12a86ad0
Commit
12a86ad0
authored
Sep 14, 2021
by
mdj33
Committed by
vipwzw
Sep 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update commens
parent
4bf5547c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
58 deletions
+1
-58
util.go
plugin/dapp/mix/executor/util.go
+1
-0
verify.go
plugin/dapp/mix/executor/zksnark/verify.go
+0
-58
verify_test.go
plugin/dapp/mix/executor/zksnark/verify_test.go
+0
-0
No files found.
plugin/dapp/mix/executor/util.go
View file @
12a86ad0
...
...
@@ -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
{
...
...
plugin/dapp/mix/executor/zksnark/verify.go
View file @
12a86ad0
...
...
@@ -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
//}
plugin/dapp/mix/executor/zksnark/verify_test.go
View file @
12a86ad0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment