arnaucube
arnaucube/miksi-corePublic Self-hosted repository
Add SmartContracts test flow with 3 deposits
arnaucube root@arnaucube.com
Sun, 17 May 2020 17:59:21 +0200
commit

4b2a229bd900bf589c0a113326123753dfc90c87

parent

c3b5165006b989dafc99ada65bd10a59fab87e18

M circuits/deposit.circom → circuits/deposit.circom

@@ -35,6 +35,7 @@ signal input coinCode;

signal input amount; signal private input secret; signal private input nullifier; + signal private input oldKey; signal private input siblingsOld[nLevels]; signal private input siblingsNew[nLevels]; signal input rootOld;

@@ -61,7 +62,8 @@ smtOld.root <== rootOld;

for (var i=0; i<nLevels; i++) { smtOld.siblings[i] <== siblingsOld[i]; } - smtOld.oldKey <== 1; + /* smtOld.oldKey <== 1; */ + smtOld.oldKey <== oldKey; smtOld.oldValue <== 0; smtOld.isOld0 <== 0; smtOld.key <== hash.out;
M contracts/deposit-verifier.sol → contracts/deposit-verifier.sol

@@ -174,17 +174,17 @@ DepositPairing.G2Point B;

DepositPairing.G1Point C; } function verifyingKey() internal pure returns (VerifyingKey memory vk) { - vk.alfa1 = DepositPairing.G1Point(6065483927189198444682905308325000951246257469152828409806284077885133249739,1990028136278429445518006524392551345128366216259976542235494496185998414912); - vk.beta2 = DepositPairing.G2Point([9264834971516100639871261194399140486562775525051734782501439416023479225391,5162939940530468633865380033187237384667734222189925309044161499791615506375], [489842918389814266437556836747821551396498728159626876991041866052737351566,17404338846724633734949676544603763660215742965552403738436754194013115104404]); - vk.gamma2 = DepositPairing.G2Point([3816215622778176681699259539967429072196356640030859639514936270238959698219,236252540670993251838452790992568688843063704489202689719563908537636316738], [16303927206925158108103606822067759987757608633916911445237700431553497043690,12668251450800271509987871102239080189070836108197224795008764353502619814964]); - vk.delta2 = DepositPairing.G2Point([7734429969653199634693555623385094248569235945832114705562051837787377060806,7566151879414510490108686246718202304489426052757532512550882626288777754959], [17950916274576625246093655071576904884259522730229572495774693174259627926717,15060426040589607858464359473475255324856592450467055295537458068465028256933]); + vk.alfa1 = DepositPairing.G1Point(4690052268710270598869542532809702456418003799694536273077130369652196429884,9145902013599810527210227446448286424172036724970647907168421870847502009945); + vk.beta2 = DepositPairing.G2Point([16623062689690044255750716956401317560821762623856422123246403067057225130588,14652078637219990978821431784894112719594629514313306953371073983618015546541], [676307836452309210538606902645077301940331422390550491696691282441239090551,10369757414475454684684292675796821047567632748417978318178776038061059658326]); + vk.gamma2 = DepositPairing.G2Point([16528273881363574239250709218131920578661276173856341283262670072792844980215,6787263438752395682957935213403119833234411728635969992478064476167401704867], [5274450027585795927175443590954483941244906290165165924583130738506736130942,3392062216862930269651390569850019803754187174311810728530683507098775212357]); + vk.delta2 = DepositPairing.G2Point([17494603128862092548460623189930936969297925345032047648552416238816792961152,10402239940545833330287339048137499178728329705094695706126321196019762386747], [6175570631583630130350739728971333086849468117273142369720724145166167909214,20067049654764111179832549405286061192607773249291087398308936796066289541314]); vk.IC = new DepositPairing.G1Point[](6); - vk.IC[0] = DepositPairing.G1Point(15740910832481450063917199200607757253896563901763566776712306503750389541655,7002622853975178066023339356151543160177210573049820374279694406406811606683); - vk.IC[1] = DepositPairing.G1Point(15651632245328303900076885367222245590896431851640402182626448905226427580557,17750666936414774331918745613015398412439836969964160634716436648984069791919); - vk.IC[2] = DepositPairing.G1Point(20430695676495506508861377450422139686450342947107294821941229966423680102028,14134642346581319191800114388829157260027077654897972406787486086063657679416); - vk.IC[3] = DepositPairing.G1Point(20847463192934719709544463297660864346200920891710723190222906696182133119937,18120989364581496594830515144678135218782618145865982639015727693739056183109); - vk.IC[4] = DepositPairing.G1Point(12885189407733919760194724425636212244425270670891712206493473002258558049469,11907583641464815994264125178011364350201623207761143086863586332263235489212); - vk.IC[5] = DepositPairing.G1Point(15710396156244792890296909465340259245113590590754779011653647914536045233207,3713091448502606308226556683433495935849952195712182929387849333358831559987); + vk.IC[0] = DepositPairing.G1Point(12697195619443882847721561991615544069218791667870821589914853846794238615885,18011435976524410295453245674507929643029222984348817278231712383283229915782); + vk.IC[1] = DepositPairing.G1Point(20324524778567704633470845008079551007952919835272398568401853167438653396525,8061504440558567975766943783054577602934521477527864647610640054521787242724); + vk.IC[2] = DepositPairing.G1Point(13332163378649502560807390864020561151254011879905389699984218750502394665905,4286598055677625399864995783940420134575107187974587372574457085466044561759); + vk.IC[3] = DepositPairing.G1Point(10175138903387311357088170792861518054422766016077544491949838159573444744976,16570515458939310802788756001103880353070070639900081360517205384175233432226); + vk.IC[4] = DepositPairing.G1Point(3298627468931988714290186736998190106240510584555740172431361939625148350723,10415330389886845959598036431340102923398308416032482557275534081287380793067); + vk.IC[5] = DepositPairing.G1Point(16030968253618323807449863533252146464206835591288004165377534537620304134907,6223567249648011787592835059978931866773091863735841649895374018321000148662); } function verify(uint[] memory input, Proof memory proof) internal view returns (uint) {
M contracts/withdraw-verifier.sol → contracts/withdraw-verifier.sol

@@ -174,17 +174,17 @@ WithdrawPairing.G2Point B;

WithdrawPairing.G1Point C; } function verifyingKey() internal pure returns (VerifyingKey memory vk) { - vk.alfa1 = WithdrawPairing.G1Point(6000897918197332766506368147052471432111990912139168143792639323668717117554,12425390154424956101354759127312889936479801351672835365540548682812480095245); - vk.beta2 = WithdrawPairing.G2Point([12995810398277449653207359598519433373340512547398516711648573639615955145427,343617895487181701521196169649006712676439974399109594954509192275962550132], [17161358293812801401457835844542021467864192455439896392380755898197601531143,7029713736223430242826003690322757881565075810973246047711502677037078502374]); - vk.gamma2 = WithdrawPairing.G2Point([4451458705618509102819397935871317286248761901894290610851650437269450341367,4727411170130069370259012444008481725824234708683616201162714031612495948731], [19293222415010534295664881991699322834609751800455409899967018063051565373785,745420935028621855676130519141412373862608212652605821057639752116562245651]); - vk.delta2 = WithdrawPairing.G2Point([4374144803633960156913542400168655607562448734674078186890371435456649285947,18059818950726521358193085349108907422220028073396980874415049690926599813200], [18613292511366130375634190418118794626384059450307359965218281303441038152855,6142273376405607153924858120972958679132506572414341818723557928185966082039]); + vk.alfa1 = WithdrawPairing.G1Point(13125964035345732513320606972223597271702849498706862906431560515196316741541,2743237172859524479647981525721821119820168209195336069832075995585988365216); + vk.beta2 = WithdrawPairing.G2Point([2669112095067980506727873345758867054347466312660021806636272987760660828849,14539491114301519973242319011485401150263667232078179655062833197913312500017], [11720061635178934637313951615051060311580364580444053837400914945552182061616,2177765169672031700082566520171740120321696910335776288543190901344722545410]); + vk.gamma2 = WithdrawPairing.G2Point([10917104788485395001839994387809646569218736354722844653893803100190554724907,7478437791943783449531717383744438552168785436031321431732103220558102742468], [14238787877319603173234096439758621306673382329766962364233031837910870237536,10502637950741476389590969419560058151857179703312600335067455738743909083958]); + vk.delta2 = WithdrawPairing.G2Point([11073954909083264728700321333863259614089048106992800121105800848198886470375,14812237089106501466576017780356417002388876842333510442550104527732748120622], [17635776349801663084503912927095921433092564181571541546104162053167176565421,27998176086381233961153068490868928492606872937787873022612510202839716507]); vk.IC = new WithdrawPairing.G1Point[](6); - vk.IC[0] = WithdrawPairing.G1Point(18721847862304480418699947867805588529802575657037041011052498091030411101583,9568910167355731514566701497653796956835627895615164441707708470729627612263); - vk.IC[1] = WithdrawPairing.G1Point(10992751145268189991746341097903721033023715291976945698456511965931756835520,19961192492430389207692681921975764975917502670389597865899368965309694589277); - vk.IC[2] = WithdrawPairing.G1Point(21240739576686376297062566361701745917046221787464798372252058270610707408612,5312356818216485347682134231435321362864300228436464960252407654010175727066); - vk.IC[3] = WithdrawPairing.G1Point(12021960796216563791001698492379654159377101982562013928932485809042439120925,15563397276080084799646082626498117356990307894712348255140484765600785090381); - vk.IC[4] = WithdrawPairing.G1Point(3353092686593664458934514005821883140650039230269909371443918946771143324513,14956396613446673022413666390276229141175487038479075213761081413376234000704); - vk.IC[5] = WithdrawPairing.G1Point(16092225522211246726577788389583375146706125153344163393485911026516851929934,19965075922885092132859170198788412557863541723358903150696160537884812856033); + vk.IC[0] = WithdrawPairing.G1Point(7491469026033918642677753652819151318339809973344463260827293357803586754235,4395946869661103322863744384786121261968956085472500963739363200632751346458); + vk.IC[1] = WithdrawPairing.G1Point(15792971708971548807702008065816978287582873199570212151763666852711881685748,20015547917924502689826594351540769795386333462562793050625401907390132405289); + vk.IC[2] = WithdrawPairing.G1Point(793110436159598650905223468298132112327901373645402348921311553793588112899,14932167562920745456386464748315950361167693788066386103439968740538587455112); + vk.IC[3] = WithdrawPairing.G1Point(3599763262227997054360288324315679176821090066709181138105454315553755125997,4842799741086852072636969222133537228560778966327440675220863187433692844579); + vk.IC[4] = WithdrawPairing.G1Point(1332654856961752997984248173858188249144320018346121854916888456163273080288,18357171701145993355281642916301559974565034917797021528848570764297806434641); + vk.IC[5] = WithdrawPairing.G1Point(12178090359527457673534455683642890230743486788471599510120235645318440790942,14955354663406965918722091973717855430180824697349764743374253473894681342412); } function verify(uint[] memory input, Proof memory proof) internal view returns (uint) {
M test/circuits/deposit.test.ts → test/circuits/deposit.test.ts

@@ -61,6 +61,7 @@ "coinCode": coinCode,

"amount": amount, "secret": secret, "nullifier": nullifier, + "oldKey": "1", "siblingsOld": siblingsOld, "siblingsNew": siblingsNew, "rootOld": rootOld,
M test/contracts/miksi.test.ts → test/contracts/miksi.test.ts

@@ -13,6 +13,29 @@ const WitnessCalculatorBuilder = require("circom_runtime").WitnessCalculatorBuilder;

const circomlib = require("circomlib"); const smt = require("circomlib").smt; +let insVerifier; +let insMiksi; + +const nLevels = 5; +const secret = ["1234567890", "987654321", "123"]; + +const coinCode = "0"; // refearing to ETH +const ethAmount = '1'; +const amount = web3.utils.toWei(ethAmount, 'ether'); +const nullifier = ["567891234", "432198765", "321"]; +let commitment = []; +let tree; +let oldKey = []; +let siblingsOld = []; +let siblingsNew = []; +let rootOld = []; +let rootNew = []; +// let commitment = []; +let proof = []; +let publicSignals = []; +let commitmentsArray = []; +let u = 0; + contract("miksi", (accounts) => {

@@ -21,27 +44,9 @@ 0: owner,

1: addr1, // used for the deposit 2: addr2, // used for the withdraw 3: addr3, + 4: addr4, } = accounts; - let insVerifier; - let insMiksi; - - const nLevels = 5; - const secret = "1234567890"; - - const coinCode = "0"; // refearing to ETH - const ethAmount = '1'; - const amount = web3.utils.toWei(ethAmount, 'ether'); - const nullifier = "567891234"; - let tree; - let siblingsOld; - let siblingsNew; - let rootOld; - let rootNew; - let commitment; - let proof; - let publicSignals; - let commitmentsArray; before(async () => { insDepositVerifier = await DepositVerifier.new();

@@ -54,35 +59,126 @@ let balance_wei = await web3.eth.getBalance(addr1);

// console.log("Balance at " + addr1, web3.utils.fromWei(balance_wei, 'ether')); expect(balance_wei).to.be.equal('100000000000000000000'); + tree = await smt.newMemEmptyTrie(); + await tree.insert(1, 0); + + await computeTree(0); + + expect(rootOld[0].toString()).to.be.equal('11499909227292257605992378629333104385616480982267969744564817844870636870870'); + expect(rootNew[0].toString()).to.be.equal('9328869343897770565751281504295758914771207504252217956739346620422361279598'); + }); + + it("Make first deposit", async () => { + await makeDeposit(0, addr1); + balance_wei = await web3.eth.getBalance(addr1); + // console.log("Balance at " + addr1, web3.utils.fromWei(balance_wei, 'ether')); + // expect(balance_wei).to.be.equal('98993526980000000000'); + }); + it("Make second deposit", async () => { + await computeTree(1); + await makeDeposit(1, addr3); + }); + it("Make 3rd deposit", async () => { + await computeTree(2); + await makeDeposit(2, addr3); + }); + + it("Get the commitments data", async () => { + // getCommitments data + let res = await insMiksi.getCommitments(); + expect(res[0][0].toString()).to.be.equal('189025084074544266465422070282645213792582195466360448472858620722286781863'); + // expect(res[1].toString()).to.be.equal('9328869343897770565751281504295758914771207504252217956739346620422361279598'); + console.log(res[0]); + commitmentsArray[0] = res[0]; + }); + + it("Rebuild the tree from sc commitments", async () => { + let treeTmp = await smt.newMemEmptyTrie(); + await treeTmp.insert(1, 0); + for (let i=0; i<commitmentsArray[0].length; i++) { + await treeTmp.insert(commitmentsArray[0][i], 0); + } + expect(treeTmp.root).to.be.equal(tree.root); + }); + + it("Calculate witness and generate the zkProof", async () => { + await genZKProof(0, addr2); + await genZKProof(1, addr4); + await genZKProof(2, addr4); + }); + + it("Try to use the zkProof with another address and get revert", async () => { + // console.log("Try to reuse the zkproof and expect revert"); + await truffleAssert.fails( + withdrawSC(0, addr1), + truffleAssert.ErrorType.REVERT, + "zkProof withdraw could not be verified" + ); + }); + + it("Withdraw 1 ETH with the zkProof of the 1st deposit to addr2", async () => { + // withdraw + // console.log("Withdraw of " + ethAmount + " ETH to " + addr2); + let resW = await withdrawSC(0, addr2); + // console.log("resW", resW); + + balance_wei = await web3.eth.getBalance(addr2); + // console.log("Balance at " + addr2, web3.utils.fromWei(balance_wei, 'ether')); + expect(balance_wei).to.be.equal('101000000000000000000'); + }); + + it("Try to reuse the zkProof and get revert", async () => { + // console.log("Try to reuse the zkproof and expect revert"); + await truffleAssert.fails( + withdrawSC(0, addr2), + truffleAssert.ErrorType.REVERT, + "nullifier already used" + ); + balance_wei = await web3.eth.getBalance(addr2); + expect(balance_wei).to.be.equal('101000000000000000000'); + }); + it("Withdraw 1 ETH with the zkProof of the 2nd deposit to addr4", async () => { + let resW = await withdrawSC(1, addr4); + balance_wei = await web3.eth.getBalance(addr4); + expect(balance_wei).to.be.equal('101000000000000000000'); + }); + it("Withdraw 1 ETH with the zkProof of the 3rd deposit to addr4", async () => { + let resW = await withdrawSC(2, addr4); + balance_wei = await web3.eth.getBalance(addr4); + expect(balance_wei).to.be.equal('102000000000000000000'); + }); +}); + + +async function computeTree(u) { const poseidon = circomlib.poseidon.createHash(6, 8, 57); - commitment = poseidon([coinCode, amount, secret, nullifier]).toString(); + commitment[u] = poseidon([coinCode, amount, secret[u], nullifier[u]]).toString(); // deposit // add commitment into SMT - tree = await smt.newMemEmptyTrie(); - await tree.insert(1, 0); - rootOld = tree.root; - const resC = await tree.find(commitment); + rootOld[u] = tree.root; + const resC = await tree.find(commitment[u]); assert(!resC.found); - siblingsOld = resC.siblings; - while (siblingsOld.length < nLevels) { - siblingsOld.push("0"); + oldKey[u] = "1"; + if (!resC.found) { + oldKey[u] = resC.notFoundKey.toString(); + } + siblingsOld[u] = resC.siblings; + while (siblingsOld[u].length < nLevels) { + siblingsOld[u].push("0"); }; - await tree.insert(commitment, 0); - rootNew = tree.root; + await tree.insert(commitment[u], 0); + rootNew[u] = tree.root; +} - expect(rootOld.toString()).to.be.equal('11499909227292257605992378629333104385616480982267969744564817844870636870870'); - expect(rootNew.toString()).to.be.equal('9328869343897770565751281504295758914771207504252217956739346620422361279598'); - }); - - it("Make the deposit", async () => { - const resC = await tree.find(commitment); +async function makeDeposit(u, addr) { + const resC = await tree.find(commitment[u]); assert(resC.found); - siblingsNew = resC.siblings; - while (siblingsNew.length < nLevels) { - siblingsNew.push("0"); + siblingsNew[u] = resC.siblings; + while (siblingsNew[u].length < nLevels) { + siblingsNew[u].push("0"); }; // calculate witness

@@ -90,13 +186,14 @@ const wasm = await fs.promises.readFile("./build/deposit.wasm");

const input = unstringifyBigInts({ "coinCode": coinCode, "amount": amount, - "secret": secret, - "nullifier": nullifier, - "siblingsOld": siblingsOld, - "siblingsNew": siblingsNew, - "rootOld": rootOld, - "rootNew": rootNew, - "commitment": commitment + "secret": secret[u], + "nullifier": nullifier[u], + "oldKey": oldKey[u], + "siblingsOld": siblingsOld[u], + "siblingsNew": siblingsNew[u], + "rootOld": rootOld[u], + "rootNew": rootNew[u], + "commitment": commitment[u] }); const options = {}; // console.log("Calculate witness");

@@ -109,50 +206,29 @@ const provingKey = unstringifyBigInts(JSON.parse(fs.readFileSync("./build/deposit-proving_key.json", "utf8")));

// console.log("Generate zkSNARK proof"); const res = groth.genProof(provingKey, witness); - proof = res.proof; - publicSignals = res.publicSignals; + proof[u] = res.proof; + publicSignals[u] = res.publicSignals; const verificationKey = unstringifyBigInts(JSON.parse(fs.readFileSync("./build/deposit-verification_key.json", "utf8"))); - let pubI = unstringifyBigInts([coinCode, amount, rootOld.toString(), rootNew.toString(), commitment]); - let validCheck = groth.isValid(verificationKey, proof, pubI); + let pubI = unstringifyBigInts([coinCode, amount, rootOld[u].toString(), rootNew[u].toString(), commitment[u]]); + let validCheck = groth.isValid(verificationKey, proof[u], pubI); assert(validCheck); await insMiksi.deposit( - commitment, + commitment[u], tree.root.toString(), - [proof.pi_a[0].toString(), proof.pi_a[1].toString()], + [proof[u].pi_a[0].toString(), proof[u].pi_a[1].toString()], [ - [proof.pi_b[0][1].toString(), proof.pi_b[0][0].toString()], - [proof.pi_b[1][1].toString(), proof.pi_b[1][0].toString()] + [proof[u].pi_b[0][1].toString(), proof[u].pi_b[0][0].toString()], + [proof[u].pi_b[1][1].toString(), proof[u].pi_b[1][0].toString()] ], - [proof.pi_c[0].toString(), proof.pi_c[1].toString()], - {from: addr1, value: amount} + [proof[u].pi_c[0].toString(), proof[u].pi_c[1].toString()], + {from: addr, value: amount} ); - balance_wei = await web3.eth.getBalance(addr1); - // console.log("Balance at " + addr1, web3.utils.fromWei(balance_wei, 'ether')); - // expect(balance_wei).to.be.equal('98993526980000000000'); - }); +} - it("Get the commitments data", async () => { - // getCommitments data - let res = await insMiksi.getCommitments(); - expect(res[0][0].toString()).to.be.equal('189025084074544266465422070282645213792582195466360448472858620722286781863'); - expect(res[1].toString()).to.be.equal('9328869343897770565751281504295758914771207504252217956739346620422361279598'); - console.log(res[0]); - commitmentsArray = res[0]; - }); - - it("Rebuild the tree from sc commitments", async () => { - let treeTmp = await smt.newMemEmptyTrie(); - await treeTmp.insert(1, 0); - for (let i=0; i<commitmentsArray.length; i++) { - await treeTmp.insert(commitmentsArray[i], 0); - } - expect(treeTmp.root).to.be.equal(tree.root); - }); - - it("Calculate witness and generate the zkProof", async () => { - const resC = await tree.find(commitment); +async function genZKProof(u, addr) { + const resC = await tree.find(commitment[u]); assert(resC.found); let siblings = resC.siblings; while (siblings.length < nLevels) {

@@ -165,11 +241,11 @@ const wasm = await fs.promises.readFile("./build/withdraw.wasm");

const input = unstringifyBigInts({ "coinCode": coinCode, "amount": amount, - "secret": secret, - "nullifier": nullifier, + "secret": secret[u], + "nullifier": nullifier[u], "siblings": siblings, "root": tree.root, - "address": addr2 + "address": addr }); const options = {}; // console.log("Calculate witness");

@@ -182,65 +258,20 @@ const provingKey = unstringifyBigInts(JSON.parse(fs.readFileSync("./build/withdraw-proving_key.json", "utf8")));

// console.log("Generate zkSNARK proof"); const res = groth.genProof(provingKey, witness); - proof = res.proof; - publicSignals = res.publicSignals; - }); + proof[u] = res.proof; + publicSignals[u] = res.publicSignals; +} - it("Try to use the zkProof with another address and get revert", async () => { - // console.log("Try to reuse the zkproof and expect revert"); - await truffleAssert.fails( - insMiksi.withdraw( - addr1, - nullifier, - [proof.pi_a[0].toString(), proof.pi_a[1].toString()], +async function withdrawSC(u, addr) { + return insMiksi.withdraw( + addr, + nullifier[u], + [proof[u].pi_a[0].toString(), proof[u].pi_a[1].toString()], [ - [proof.pi_b[0][1].toString(), proof.pi_b[0][0].toString()], - [proof.pi_b[1][1].toString(), proof.pi_b[1][0].toString()] + [proof[u].pi_b[0][1].toString(), proof[u].pi_b[0][0].toString()], + [proof[u].pi_b[1][1].toString(), proof[u].pi_b[1][0].toString()] ], - [proof.pi_c[0].toString(), proof.pi_c[1].toString()] - ), - truffleAssert.ErrorType.REVERT, - "zkProof withdraw could not be verified" - ); - }); + [proof[u].pi_c[0].toString(), proof[u].pi_c[1].toString()] + ); +} - it("Withdraw 1 ETH with the zkProof", async () => { - // withdraw - // console.log("Withdraw of " + ethAmount + " ETH to " + addr2); - let resW = await insMiksi.withdraw( - addr2, - nullifier, - [proof.pi_a[0].toString(), proof.pi_a[1].toString()], - [ - [proof.pi_b[0][1].toString(), proof.pi_b[0][0].toString()], - [proof.pi_b[1][1].toString(), proof.pi_b[1][0].toString()] - ], - [proof.pi_c[0].toString(), proof.pi_c[1].toString()] - ); - // console.log("resW", resW); - - balance_wei = await web3.eth.getBalance(addr2); - // console.log("Balance at " + addr2, web3.utils.fromWei(balance_wei, 'ether')); - expect(balance_wei).to.be.equal('101000000000000000000'); - }); - - it("Try to reuse the zkProof and get revert", async () => { - // console.log("Try to reuse the zkproof and expect revert"); - await truffleAssert.fails( - insMiksi.withdraw( - addr2, - nullifier, - [proof.pi_a[0].toString(), proof.pi_a[1].toString()], - [ - [proof.pi_b[0][1].toString(), proof.pi_b[0][0].toString()], - [proof.pi_b[1][1].toString(), proof.pi_b[1][0].toString()] - ], - [proof.pi_c[0].toString(), proof.pi_c[1].toString()] - ), - truffleAssert.ErrorType.REVERT, - "nullifier already used" - ); - balance_wei = await web3.eth.getBalance(addr2); - expect(balance_wei).to.be.equal('101000000000000000000'); - }); -});