From 0d5f6ad9275f50523aa9ffd8df2ab20ad8f383d1 Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Wed, 7 Aug 2024 09:25:23 -0400 Subject: [PATCH] Remove unneeded test Signed-off-by: Jim Zhang --- zkp/golang/go.mod | 10 +-- zkp/golang/go.sum | 10 +++ zkp/js/integration-test/check_smt_proof.js | 88 ---------------------- 3 files changed, 15 insertions(+), 93 deletions(-) delete mode 100644 zkp/js/integration-test/check_smt_proof.js diff --git a/zkp/golang/go.mod b/zkp/golang/go.mod index 57e474c..ffd66df 100644 --- a/zkp/golang/go.mod +++ b/zkp/golang/go.mod @@ -31,9 +31,9 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect ) @@ -46,8 +46,8 @@ require ( github.com/iden3/go-rapidsnark/types v0.0.2 // indirect github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/sys v0.22.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/sys v0.23.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/postgres v1.5.9 gorm.io/driver/sqlite v1.5.6 diff --git a/zkp/golang/go.sum b/zkp/golang/go.sum index 27d2655..6716f96 100644 --- a/zkp/golang/go.sum +++ b/zkp/golang/go.sum @@ -90,19 +90,29 @@ github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJ github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/zkp/js/integration-test/check_smt_proof.js b/zkp/js/integration-test/check_smt_proof.js deleted file mode 100644 index 3edab90..0000000 --- a/zkp/js/integration-test/check_smt_proof.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright © 2024 Kaleido, Inc. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const { expect } = require('chai'); -const { groth16 } = require('snarkjs'); -const { genKeypair } = require('maci-crypto'); -const { Merkletree, InMemoryDB, str2Bytes, ZERO_HASH } = require('@iden3/js-merkletree'); -const { Poseidon, loadCircuit } = require('../index.js'); -const { loadProvingKeys } = require('./utils.js'); - -const SMT_HEIGHT = 64; -const poseidonHash = Poseidon.poseidon2; - -describe('check_smt_proof circuit tests', () => { - let circuit, provingKeyFile, verificationKey, smt; - - const Alice = {}; - const Bob = {}; - const Charlie = {}; - const David = {}; - - before(async () => { - circuit = await loadCircuit('check_smt_proof'); - ({ provingKeyFile, verificationKey } = loadProvingKeys('check_smt_proof')); - - let keypair = genKeypair(); - Alice.privKey = keypair.privKey; - Alice.pubKey = keypair.pubKey; - Alice.keyHash = poseidonHash(Alice.pubKey); - - keypair = genKeypair(); - Bob.privKey = keypair.privKey; - Bob.pubKey = keypair.pubKey; - Bob.keyHash = poseidonHash(Bob.pubKey); - - keypair = genKeypair(); - Charlie.privKey = keypair.privKey; - Charlie.pubKey = keypair.pubKey; - Charlie.keyHash = poseidonHash(Charlie.pubKey); - - keypair = genKeypair(); - David.privKey = keypair.privKey; - David.pubKey = keypair.pubKey; - David.keyHash = poseidonHash(David.pubKey); - - // initialize the local storage for Alice to manage her UTXOs in the Spart Merkle Tree - const storage1 = new InMemoryDB(str2Bytes('')); - smt = new Merkletree(storage1, true, SMT_HEIGHT); - }); - - it('should generate a valid proof that can be verified successfully', async () => { - // generate the merkle proof for the inputs - const senderProof = await smt.generateCircomVerifierProof(Alice.keyHash, ZERO_HASH); - const receiverProof = await smt.generateCircomVerifierProof(David.keyHash, ZERO_HASH); - - const startTime = Date.now(); - const witness = await circuit.calculateWTNSBin( - { - root: senderProof.root.bigInt(), - merkleProof: [senderProof.siblings.map((s) => s.bigInt()), receiverProof.siblings.map((s) => s.bigInt())], - leafNodeIndexes: [Alice.keyHash, David.keyHash], - }, - true - ); - - const { proof, publicSignals } = await groth16.prove(provingKeyFile, witness); - console.log('Proving time: ', (Date.now() - startTime) / 1000, 's'); - - const success = await groth16.verify(verificationKey, publicSignals, proof); - // console.log('root', senderProof.root.bigInt()); - // console.log('keys', [Alice.keyHash, David.keyHash]); - // console.log('publicSignals', publicSignals); - expect(success, true); - }).timeout(600000); -});