Skip to content

Commit

Permalink
add circuit withdraw verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jul 28, 2021
1 parent 804ae4a commit 218d178
Show file tree
Hide file tree
Showing 9 changed files with 410 additions and 693 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
//
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.11;
import "hardhat/console.sol";

library Pairing {
struct G1Point {
Expand Down Expand Up @@ -237,15 +236,19 @@ contract VerifierWithdrawV2 {
}

function verifyingKey() internal pure returns (VerifyingKey memory vk) {
vk.alfa1 = Pairing.G1Point(1, 2);
vk.alfa1 = Pairing.G1Point(
388810387696872229600535426988510367661191668538620278246358506880151278377,
17012807097498437657437400703444959258860359960854381092881122887796891799764
);

vk.beta2 = Pairing.G2Point(
[
11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781
20834219205012105637945707216009277384365408423076044151691072833174688573103,
13134655269783470578064433288891955017063376221140036407895159623715719034212
],
[
4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930
13123146757901582440742420379387265563202471200050521454662146479289670350870,
9424872748620702615302289225079312376316964854917092525872944035178853577805
]
);
vk.gamma2 = Pairing.G2Point(
Expand All @@ -269,8 +272,16 @@ contract VerifierWithdrawV2 {
]
);
vk.IC = new Pairing.G1Point[](2);
vk.IC[0] = Pairing.G1Point(0, 1);
vk.IC[1] = Pairing.G1Point(0, 1);

vk.IC[0] = Pairing.G1Point(
9709798335278487073135934214642788341483364749831766588850420953696105265177,
6379602209297816575291953207502184116487138674423700332563836533325222425474
);

vk.IC[1] = Pairing.G1Point(
17228952008706007141311207908959456806520751866178136518819949659318129370336,
11243267546602369974266049105154296218563916482012084687186341306379428706307
);
}

function verify(uint256[] memory input, Proof memory proof)
Expand Down Expand Up @@ -318,19 +329,6 @@ contract VerifierWithdrawV2 {
uint256[2] memory c,
uint256[1] memory input
) public view returns (bool r) {
console.log(a[0]);
console.log(a[1]);

console.log(b[0][0]);
console.log(b[0][1]);
console.log(b[1][0]);
console.log(b[1][1]);

console.log(c[0]);
console.log(c[1]);

console.log(input[0]);

Proof memory proof;
proof.A = Pairing.G1Point(a[0], a[1]);
proof.B = Pairing.G2Point([b[0][0], b[0][1]], [b[1][0], b[1][1]]);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "",
"license": "AGPL-3.0",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^2.1.1",
"@nomiclabs/hardhat-solhint": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.1",
Expand All @@ -43,9 +43,9 @@
"dotenv": "^8.2.0",
"eth-gas-reporter": "^0.2.17",
"ethereum-waffle": "^3.2.2",
"ethers": "5.0.30",
"ethers": "^5.0.30",
"ffjavascript": "^0.2.10",
"hardhat": "^2.0.8",
"hardhat": "^2.5.0",
"hardhat-gas-reporter": "^1.0.4",
"hardhat-spdx-license-identifier": "^2.0.3",
"mocha": "^8.1.1",
Expand All @@ -62,6 +62,6 @@
"@hermeznetwork/commonjsV1": "git://github.com/hermeznetwork/commonjs.git#feature/upgrade-v1",
"axios": "^0.21.1",
"readline": "^1.3.0",
"snarkjs": "^0.3.60"
"snarkjs": "^0.4.6"
}
}
Loading

0 comments on commit 218d178

Please sign in to comment.