Skip to content

Commit

Permalink
add-script-deploy add-test
Browse files Browse the repository at this point in the history
  • Loading branch information
kientt265 committed Nov 18, 2024
1 parent 806b203 commit 03940b6
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .vite/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"hash": "56a98f65",
"configHash": "5dd441ec",
"lockfileHash": "e3b0c442",
"browserHash": "34466ec6",
"optimized": {},
"chunks": {}
}
3 changes: 3 additions & 0 deletions .vite/deps/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
2 changes: 1 addition & 1 deletion cache/solidity-files-cache.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cache/test-failures
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setUp
1 change: 1 addition & 0 deletions out/DeployGroth16Verifier.s.sol/DeployG16Verify.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out/Groth16Verifier.sol/Groth16Verifier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"abi":[{"type":"function","name":"verifyProof","inputs":[{"name":"_pA","type":"uint256[2]","internalType":"uint256[2]"},{"name":"_pB","type":"uint256[2][2]","internalType":"uint256[2][2]"},{"name":"_pC","type":"uint256[2]","internalType":"uint256[2]"},{"name":"_pubSignals","type":"uint256[1]","internalType":"uint256[1]"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"}],"bytecode":{"object":"0x6080604052348015600f57600080fd5b5061055e8061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806343753b4d14610030575b600080fd5b61004361003e3660046104c1565b610057565b604051901515815260200160405180910390f35b6000610479565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001811061008f576000805260206000f35b50565b600060405183815284602082015285604082015260408160608360076107d05a03fa9150816100c5576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa915050806100f6576000805260206000f35b5050505050565b7f013546fdff9fc1a53a820ba6f97a9e2f5670e5329a9ce51fc9b6fe7bae39ee0885527f3045067b76279f4fc4e0f955dc99e07f5d5d148b7429628215c6e568ffa41f1c60208601526000608086018661019a87357f2aa96d636d8564adc9d81f1ee274c524b863373cb14088d9c1cd83d1ce45c70d7f2b36993ebff6ed5de853be07dc6367b280cb1327793bef6878df9a94ddf5d4f984610092565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f0254654fc2952502b42a90356e352a86bda7701727e3a451ceff66491a5fe0cd60c08201527f06a47fc24954664f4a5610edf0c0876727b3cbecb7fef0d1cf99037fa602506660e08201527f0e871f84408619371d5bec1e962ceb85f26ec12e1b1ad316534396f467b4dfb16101008201527f2c6e608207ff07b5c03d0a8d9d3f088405e40811c97759f83c45e1081c6b31c86101208201527f10f00ca9c9a70e2fb1897668f9e18a70fc6344d0cb7e6dd7bd49ee1e40d09fd16101408201527f14d95ead938526f175c26be2e1dfdf3d2c78419d59d811ddb94bbaf160be370d610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f2ca327150a7388a8c62be547045aa3f64ff32869f38f26a3d1fefa548e1d2b1d6102808201527f20b98ac5bab7749e76f180b4c9b7fa59095984af14264866c582f7d84f2e25a36102a08201527ee35ec673ced59cca9bb4dfd1da023bc7292ab8376cae63cd9a2b5030941e6d6102c08201527f109e74f9a5506d5d81597da4a30abf24dd6433482bc2b3b2d30f91adc04beacd6102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610491600084013561005e565b61049e818486888a6100fd565b90508060005260206000f35b80604081018310156104bb57600080fd5b92915050565b60008060008061012085870312156104d857600080fd5b6104e286866104aa565b935060c08501868111156104f557600080fd5b60408601935061050587826104aa565b925050856101208601111561051957600080fd5b5091949093509091610100019056fea264697066735822122061787d9324cfd0521dfb9222f2fac4a3576b6e5a8bf4f68b268a286375782f7764736f6c634300081a0033","sourceMap":"831:6230:20:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806343753b4d14610030575b600080fd5b61004361003e3660046104c1565b610057565b604051901515815260200160405180910390f35b6000610479565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001811061008f576000805260206000f35b50565b600060405183815284602082015285604082015260408160608360076107d05a03fa9150816100c5576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa915050806100f6576000805260206000f35b5050505050565b7f013546fdff9fc1a53a820ba6f97a9e2f5670e5329a9ce51fc9b6fe7bae39ee0885527f3045067b76279f4fc4e0f955dc99e07f5d5d148b7429628215c6e568ffa41f1c60208601526000608086018661019a87357f2aa96d636d8564adc9d81f1ee274c524b863373cb14088d9c1cd83d1ce45c70d7f2b36993ebff6ed5de853be07dc6367b280cb1327793bef6878df9a94ddf5d4f984610092565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f0254654fc2952502b42a90356e352a86bda7701727e3a451ceff66491a5fe0cd60c08201527f06a47fc24954664f4a5610edf0c0876727b3cbecb7fef0d1cf99037fa602506660e08201527f0e871f84408619371d5bec1e962ceb85f26ec12e1b1ad316534396f467b4dfb16101008201527f2c6e608207ff07b5c03d0a8d9d3f088405e40811c97759f83c45e1081c6b31c86101208201527f10f00ca9c9a70e2fb1897668f9e18a70fc6344d0cb7e6dd7bd49ee1e40d09fd16101408201527f14d95ead938526f175c26be2e1dfdf3d2c78419d59d811ddb94bbaf160be370d610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f2ca327150a7388a8c62be547045aa3f64ff32869f38f26a3d1fefa548e1d2b1d6102808201527f20b98ac5bab7749e76f180b4c9b7fa59095984af14264866c582f7d84f2e25a36102a08201527ee35ec673ced59cca9bb4dfd1da023bc7292ab8376cae63cd9a2b5030941e6d6102c08201527f109e74f9a5506d5d81597da4a30abf24dd6433482bc2b3b2d30f91adc04beacd6102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610491600084013561005e565b61049e818486888a6100fd565b90508060005260206000f35b80604081018310156104bb57600080fd5b92915050565b60008060008061012085870312156104d857600080fd5b6104e286866104aa565b935060c08501868111156104f557600080fd5b60408601935061050587826104aa565b925050856101208601111561051957600080fd5b5091949093509091610100019056fea264697066735822122061787d9324cfd0521dfb9222f2fac4a3576b6e5a8bf4f68b268a286375782f7764736f6c634300081a0033","sourceMap":"831:6230:20:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3249:3809;;;;;;:::i;:::-;;:::i;:::-;;;1018:14:21;;1011:22;993:41;;981:2;966:18;3249:3809:20;;;;;;;;3390:4;3429:163;;;3486:1;3483;3480:8;3470:108;;3522:1;3519;3512:12;3555:4;3552:1;3545:15;3470:108;3429:163;:::o;3696:738::-;3747:11;3792:4;3786:11;3826:1;3821:3;3814:14;3866:1;3861:2;3856:3;3852:12;3845:23;3906:1;3901:2;3896:3;3892:12;3885:23;3983:2;3978:3;3974:2;3969:3;3966:1;3959:4;3952:5;3948:16;3937:49;3926:60;;4014:7;4004:107;;4055:1;4052;4045:12;4088:4;4085:1;4078:15;4004:107;4156:2;4150:9;4145:2;4140:3;4136:12;4129:31;4212:2;4208;4204:11;4198:18;4193:2;4188:3;4184:12;4177:40;4292:2;4288;4283:3;4278;4275:1;4268:4;4261:5;4257:16;4246:49;4235:60;;;4323:7;4313:107;;4364:1;4361;4354:12;4397:4;4394:1;4387:15;4313:107;;3696:738;;;;:::o;4448:2197::-;4636:4;4623:18;;4680:4;4675:2;4665:13;;4658:27;4503:4;4553:8;4543:19;;4547:4;4775:62;4804:32;;4798:4;4792;4547;4775:62;:::i;:::-;;4925:2;4912:16;4901:9;4894:35;5012:1;5005:2;5001;4997:11;4984:25;4981:1;4977:33;4973:41;4968:2;4957:9;4953:18;4946:69;5094:2;5081:16;5076:2;5065:9;5061:18;5054:44;5163:2;5159;5155:11;5142:25;5137:2;5126:9;5122:18;5115:53;5234:2;5230;5226:11;5213:25;5207:3;5196:9;5192:19;5185:54;5305:2;5301;5297:11;5284:25;5278:3;5267:9;5263:19;5256:54;5382:6;5376:3;5365:9;5361:19;5354:35;5434:6;5428:3;5417:9;5413:19;5406:35;5512:6;5506:3;5495:9;5491:19;5484:35;5564:6;5558:3;5547:9;5543:19;5536:35;5616:6;5610:3;5599:9;5595:19;5588:35;5668:6;5662:3;5651:9;5647:19;5640:35;5761:3;5755:4;5751:14;5745:21;5739:3;5728:9;5724:19;5717:50;5837:2;5832:3;5828:12;5822:4;5818:23;5812:30;5806:3;5795:9;5791:19;5784:59;5916:7;5910:3;5899:9;5895:19;5888:36;5969:7;5963:3;5952:9;5948:19;5941:36;6022:7;6016:3;6005:9;6001:19;5994:36;6075:7;6069:3;6058:9;6054:19;6047:36;6163:2;6150:16;6144:3;6133:9;6129:19;6122:45;6233:2;6229;6225:11;6212:25;6206:3;6195:9;6191:19;6184:54;6310:7;6304:3;6293:9;6289:19;6282:36;6363:7;6357:3;6346:9;6342:19;6335:36;6416:7;6410:3;6399:9;6395:19;6388:36;6469:7;6463:3;6452:9;6448:19;6441:36;6570:4;6559:9;6554:3;6543:9;6540:1;6533:4;6526:5;6522:16;6511:64;6614:16;;6601:30;;4448:2197;-1:-1:-1;;;;;;4448:2197:20:o;:::-;6677:4;6671:11;6718:8;6712:4;6708:19;6702:4;6695:33;6806:45;6847:1;6834:11;6830:19;6817:33;6806:45;:::i;:::-;6933:46;6974:4;6961:11;6956:3;6951;6946;6933:46;:::i;:::-;6918:61;;7003:7;7000:1;6993:18;7035:4;7032:1;7025:15;14:159:21;108:6;141:2;129:15;;126:24;-1:-1:-1;123:44:21;;;163:1;160;153:12;123:44;14:159;;;;:::o;178:670::-;389:6;397;405;413;466:3;454:9;445:7;441:23;437:33;434:53;;;483:1;480;473:12;434:53;506;551:7;540:9;506:53;:::i;:::-;496:63;;593:3;582:9;578:19;616:7;612:2;609:15;606:35;;;637:1;634;627:12;606:35;675:2;664:9;660:18;650:28;;697:46;735:7;731:2;697:46;:::i;:::-;687:56;;;779:7;773:3;762:9;758:19;755:32;752:52;;;800:1;797;790:12;752:52;-1:-1:-1;178:670:21;;;;-1:-1:-1;178:670:21;;838:3;823:19;;178:670::o","linkReferences":{}},"methodIdentifiers":{"verifyProof(uint256[2],uint256[2][2],uint256[2],uint256[1])":"43753b4d"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256[2]\",\"name\":\"_pA\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"_pB\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_pC\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[1]\",\"name\":\"_pubSignals\",\"type\":\"uint256[1]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/hopital/Groth16Verifier.sol\":\"Groth16Verifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\"]},\"sources\":{\"src/hopital/Groth16Verifier.sol\":{\"keccak256\":\"0x470c24be9421a38786ec4ae94fa01fbabad9719eae3b41698b3743fab7eac414\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://1337203bb576b2eed7fb2b7fa7437eb90f967b968a38ecd40bbb82462505a40a\",\"dweb:/ipfs/QmeK6RKPZE6uKygmYcVB2AkeMWQgzNoTH9TvzvSfZBhP9Z\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256[2]","name":"_pA","type":"uint256[2]"},{"internalType":"uint256[2][2]","name":"_pB","type":"uint256[2][2]"},{"internalType":"uint256[2]","name":"_pC","type":"uint256[2]"},{"internalType":"uint256[1]","name":"_pubSignals","type":"uint256[1]"}],"stateMutability":"view","type":"function","name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}]}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/hopital/Groth16Verifier.sol":"Groth16Verifier"},"evmVersion":"paris","libraries":{}},"sources":{"src/hopital/Groth16Verifier.sol":{"keccak256":"0x470c24be9421a38786ec4ae94fa01fbabad9719eae3b41698b3743fab7eac414","urls":["bzz-raw://1337203bb576b2eed7fb2b7fa7437eb90f967b968a38ecd40bbb82462505a40a","dweb:/ipfs/QmeK6RKPZE6uKygmYcVB2AkeMWQgzNoTH9TvzvSfZBhP9Z"],"license":"GPL-3.0"}},"version":1},"id":20}
1 change: 1 addition & 0 deletions out/TestGroth16Verifier.t.sol/TestGroth16Verifier.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion out/build-info/16c8ebe7b2340df066b163e66207f551.json

This file was deleted.

1 change: 1 addition & 0 deletions out/build-info/2d8d82aa779b6cbf29ec6760bbea5ffe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"2d8d82aa779b6cbf29ec6760bbea5ffe","source_id_to_path":{"0":"lib/forge-std/src/Base.sol","1":"lib/forge-std/src/Script.sol","2":"lib/forge-std/src/StdAssertions.sol","3":"lib/forge-std/src/StdChains.sol","4":"lib/forge-std/src/StdCheats.sol","5":"lib/forge-std/src/StdError.sol","6":"lib/forge-std/src/StdInvariant.sol","7":"lib/forge-std/src/StdJson.sol","8":"lib/forge-std/src/StdMath.sol","9":"lib/forge-std/src/StdStorage.sol","10":"lib/forge-std/src/StdStyle.sol","11":"lib/forge-std/src/StdToml.sol","12":"lib/forge-std/src/StdUtils.sol","13":"lib/forge-std/src/Test.sol","14":"lib/forge-std/src/Vm.sol","15":"lib/forge-std/src/console.sol","16":"lib/forge-std/src/console2.sol","17":"lib/forge-std/src/interfaces/IERC165.sol","18":"lib/forge-std/src/interfaces/IERC20.sol","19":"lib/forge-std/src/interfaces/IERC721.sol","20":"lib/forge-std/src/interfaces/IMulticall3.sol","21":"lib/forge-std/src/mocks/MockERC20.sol","22":"lib/forge-std/src/mocks/MockERC721.sol","23":"lib/forge-std/src/safeconsole.sol","24":"script/DeployGroth16Verifier.s.sol","25":"src/hopital/Groth16Verifier.sol","26":"test/TestGroth16Verifier.t.sol"},"language":"Solidity"}
1 change: 1 addition & 0 deletions out/build-info/69217db49eb01dfc444a428c6f98b1b7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"69217db49eb01dfc444a428c6f98b1b7","source_id_to_path":{"0":"lib/forge-std/src/Base.sol","1":"lib/forge-std/src/Script.sol","2":"lib/forge-std/src/StdChains.sol","3":"lib/forge-std/src/StdCheats.sol","4":"lib/forge-std/src/StdJson.sol","5":"lib/forge-std/src/StdMath.sol","6":"lib/forge-std/src/StdStorage.sol","7":"lib/forge-std/src/StdStyle.sol","8":"lib/forge-std/src/StdUtils.sol","9":"lib/forge-std/src/Vm.sol","10":"lib/forge-std/src/console.sol","11":"lib/forge-std/src/console2.sol","12":"lib/forge-std/src/interfaces/IERC165.sol","13":"lib/forge-std/src/interfaces/IERC20.sol","14":"lib/forge-std/src/interfaces/IERC721.sol","15":"lib/forge-std/src/interfaces/IMulticall3.sol","16":"lib/forge-std/src/mocks/MockERC20.sol","17":"lib/forge-std/src/mocks/MockERC721.sol","18":"lib/forge-std/src/safeconsole.sol","19":"script/DeployGroth16Verifier.s.sol","20":"src/hopital/Groth16Verifier.sol"},"language":"Solidity"}
1 change: 1 addition & 0 deletions out/build-info/a9dfc5caaebeb5c961b515f47774f31e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"a9dfc5caaebeb5c961b515f47774f31e","source_id_to_path":{"0":"lib/forge-std/src/Base.sol","1":"lib/forge-std/src/Script.sol","2":"lib/forge-std/src/StdAssertions.sol","3":"lib/forge-std/src/StdChains.sol","4":"lib/forge-std/src/StdCheats.sol","5":"lib/forge-std/src/StdError.sol","6":"lib/forge-std/src/StdInvariant.sol","7":"lib/forge-std/src/StdJson.sol","8":"lib/forge-std/src/StdMath.sol","9":"lib/forge-std/src/StdStorage.sol","10":"lib/forge-std/src/StdStyle.sol","11":"lib/forge-std/src/StdToml.sol","12":"lib/forge-std/src/StdUtils.sol","13":"lib/forge-std/src/Test.sol","14":"lib/forge-std/src/Vm.sol","15":"lib/forge-std/src/console.sol","16":"lib/forge-std/src/console2.sol","17":"lib/forge-std/src/interfaces/IERC165.sol","18":"lib/forge-std/src/interfaces/IERC20.sol","19":"lib/forge-std/src/interfaces/IERC721.sol","20":"lib/forge-std/src/interfaces/IMulticall3.sol","21":"lib/forge-std/src/mocks/MockERC20.sol","22":"lib/forge-std/src/mocks/MockERC721.sol","23":"lib/forge-std/src/safeconsole.sol","24":"script/DeployGroth16Verifier.s.sol","25":"src/hopital/Groth16Verifier.sol","26":"test/TestGroth16Verifier.t.sol"},"language":"Solidity"}
21 changes: 21 additions & 0 deletions script/DeployGroth16Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script, console} from "forge-std/Script.sol";
import {Groth16Verifier} from "../src/hopital/Groth16Verifier.sol";

contract DeployG16Verify is Script {
Groth16Verifier public groth16Verifier;



function run() public returns(Groth16Verifier){
vm.startBroadcast();

groth16Verifier = new Groth16Verifier();

vm.stopBroadcast();

return groth16Verifier;
}
}
File renamed without changes.
44 changes: 44 additions & 0 deletions test/TestGroth16Verifier.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test, console} from "forge-std/Test.sol";
import {DeployG16Verify} from "../script/DeployGroth16Verifier.s.sol";
import {Groth16Verifier} from "../src/hopital/Groth16Verifier.sol";

contract TestGroth16Verifier is Test {
Groth16Verifier public groth16Verifier;
DeployG16Verify public deployG16Verify;

uint256 constant AMOUNT_OF_OWNER = 10 ether;
address owner = makeAddr("owner");

function setUp() external {
// Fund the owner with Ether
deal(owner, AMOUNT_OF_OWNER);
// Deploy the Groth16Verifier contract using the deployment script
vm.startPrank(owner);
deployG16Verify = new DeployG16Verify();
groth16Verifier = deployG16Verify.run();
// groth16Verifier = deployG16Verify.groth16Verifier();
vm.stopPrank();
}




function testVerifyProof() external {
// Example inputs to the verifyProof function
uint256[2] memory pA = [uint256(1), uint256(2)];
uint256[2][2] memory pB = [[uint256(1), uint256(2)], [uint256(3), uint256(4)]];
uint256[2] memory pC = [uint256(5), uint256(6)];
uint256[1] memory pubSignals = [uint256(7)];

// Call the verifyProof function
vm.startPrank(owner);
bool result = groth16Verifier.verifyProof(pA, pB, pC, pubSignals);
vm.stopPrank();

// Assert the result is as expected (this depends on your setup and valid proof)
assertEq(result, false, "verifyProof should return false for invalid proof");
}
}

0 comments on commit 03940b6

Please sign in to comment.