Skip to content

Commit

Permalink
feat: use noir_js and upgrade nargo to 0.17.0 (#45)
Browse files Browse the repository at this point in the history
resolves: #43 #44
  • Loading branch information
FilipHarald authored Oct 31, 2023
1 parent 70550a3 commit a59881b
Show file tree
Hide file tree
Showing 16 changed files with 509 additions and 249 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ This is a sandbox educational project for testing age-restricted contracts using
1. Run `yarn && yarn chain` in terminal 1 to start the hardhat chain locally
2. Run `yarn deploy --reset` in terminal 2 to deploy the contracts
3. Run `yarn start` in terminal 3 to run the UI

# Prerequisites
* requires [nargo](https://noir-lang.org/dev/getting_started/nargo_installation) (tested with v0.10.1)
* requires [nargo](https://noir-lang.org/dev/getting_started/nargo_installation) (tested with v0.17.0)
* requires [node] (https://nodejs.org/en) (tested with v18.8.0)
* requires [yarn] (https://yarnpkg.com/getting-started/install) (tested with 3.2.3)

Expand Down
2 changes: 2 additions & 0 deletions packages/hardhat/contracts/BalloonVendor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pragma solidity >=0.8.4;
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/access/Ownable.sol";
import "hardhat/console.sol";

import "./BalloonToken.sol";
import "./verifiers/LessThanSignedAge.sol";

Expand Down
230 changes: 133 additions & 97 deletions packages/hardhat/contracts/verifiers/LessThanSignedAge.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/hardhat/test/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const validProof =
"0x032c5a12cfa9108a8f4605468b1e436225046b8f818877c6384cf9dcb28d48541ae3623926947254d6902c16e98c6db60a3b921eb1d1c40c5dbc701fa8b18ebc05fcb82c8746a525ec782a89a713e9f0841acdaf6ad567105c047a4e68cd0b11091b0d59dbc86e3cab576999d3868ad81e2e744bfef521708943b962edef91ce0ae98dc2ccca39f14017e794c63e3bb4ca9f6143c27297e1931cefb4ba9162082575429f71900a7e3757ab9ce44e4c0d5856889355e19ef6678945828156ce220ff0b9bc9ffaa26f60d8b078b8432168da6ae549ecde8ff30c8edf513f94a4460e25fdd8a7f1a5ba77f3283eda17c6e0b96f789636dc857184dd74085e299a701e3b45371994ea15fd7f1acc562319faff27dc0949c56b7f71d9f99d12181e32091ca21162d800926d99436fa7afaefd5a65ce2777e01d5746cb18eb90f1867e0f144b258d6e5fa9686c22122a9356a75f369efc417424c9193ebd310a700f1922230d749dac06b3278d7364a584f60fdb4eb879fca065c628de124ec7f4f2982c3858e7926297db54a5228e578f52a55c5a9e02af3736a7a02cbf1499ec1309089b40d1c7e62687ca09dd5a364e9137295dd0f4603ef11c0e21a221a224c8772bee43fd2dac0648f833412eff8079364ec1e0b801d65efe037e3648d8b0813c0ad2a36705f2d224e39b8759554c7f86a7ecd6c34b4a775df14de1a330ed4d1a030ae9b8d8a596325188da1e9fbf471c3e4a63c2af86c59fa715715ed4b037290314bd90e8e2641990266a92593adab1aaebf3978735bbfcf5b446e7ffa801880b252fceacf67de92504312446531c384ffe9986dca44f7f7d1c6e76709bfabe113992cf5accf214c2a57fc5d3518fa54eb12e31dc4f1ff4ac5dfa8b8af4e05d24d0ec2a665f124dd3b2304c190d62095697faf6e3a06b4c40e482e1ceb20f371a4ed372ea6aa02e7297c346ffbcea8d7b35f298f363baabba38b790db90d5761d7ebffe36106dace62c06c52598af448d41d695979c5c4a9351f12da2c1770d1c0a791090013952218008a2fd29e00229c8257272abd7a7261e88f52ae56cb32bbc1d4d8facf913e81ab2d0d735e1845815cb688a1b1d05df5b5e7a6fcf6f7212bb433caf54aebe5e90c9360ce8fd4ba2d0475ff5466620b217f001fb0c542c2a3ab154f28d9c0678c20601577524188b964391b91ea49997d9f22fc7eafab4237b64b951a6d3b725b9d680da422ca132db5546003301b51b2e5d89ab72217a2cd1dad1b1edb872fcaa01d82d95a3dbe6a1026aea099d301429296a230d7c9f1fa5ca97fb9f7348d412218ce3dfba9d3c45670f5dd833ad70967654f22fdc3b23d7874da6936ae9b35abae92f6c28719b819a9572c8adf1479a86e16024891b285c26e00e652eea3dde624163023cedfe47e70a0c44e186db9423227aadc8b2182af3f97d6eb53ab109f25172590a89f23da1a75e1eb7cc9a4adece4883a9ed0623108fb1456b5d9179b47e0e1814df8d39da6f3b6c19f8639a7b5902a63fda20f27a63252ce228e2a11dd3d99f59ab71d03a3809e3ceb37a7d14afdf91e8912a90ead4dadd24b8f0ae6e35b589d04e3a9e49514e94eba9446bb54e891821cb0688e0ecbdc881e67cc32aa80d281dbae087a228bbc4bc5959c62de0bfd73a342a232e6a443d747d31760d8c3382017aca7ff50c857a22f052bca4c5e65f9afe0c8b9f7018c9107b921265a6fe650ed65145c96d9c526a87bb2030eb0990df4f122ce7f56aee591a357ef469dd69e60c9d28b9df8147dd63ffd767f122e166fc248022908cf5415ed4d1195ef50797c30323931d28e89a83497c39e37b7705641d5dd672252a3a927c9900dca6e8fc8427cf2575386c13ef9480dbed6dd623f206e74a356846a62959186e3bbf66adf5535fef60785fc2d7ce561c980a9476c30f1355937482ee735890870b95d266ed79f9a68aa9df70ab1a6219174f02594c2c259587eeabd501c83bfeab042d2041d356c5b84c824f38698e3025346cb0f4088c2ba48747008899438c4ac1cd84e03c5ee087c5f0dc3d73c2e03ce28db16a1e36c58857e1792ad2a2c5379c65a16abbb346e52bc6dc3bf08bafb7a4d5ef1000e39adfa02ecbb79dc7f2a28ef3a52a6765173627d1939ee9d53d90aa43c41a0acb68c3ac271913ccf5906e4a7c1ff85e2e790622e94edb6b472aa235f90a41098e3840943237db6de8fd3b9f75b6ead0c7232502e81e6edb7af35597e7c75229b17eac26e01cff594a7a083a43b5729e03ddbcc6f7ab834926dbaff6c4da4510b96fcfbc213d8a023814561e3e3605473a57a4b12f1f575b92b5276233b80f28306814a6d748f8884417240d7063f3cd21841f24dbce286eeebecf45a4ee8f070adec0fa757380cd0cd192492251a0b6f78858b5c450141904e2a29e9fef2905f356032fff17bed31469d6c2a8e65fd61a0a28f5a47058bbd59d3ca4bdde47158f5918b6ccc13b9eb9f45190397cf624398165c5ba9f84d9e0422eb14af1ad23762561c8571955ee6b43ce51a6fd8ad0685fc4a7620879f3a0ce2ad3c0975b2e9dcf47f9e43f1d662c5b897dcf62585c3ed8cd808f6859870ced7e8c96ace014af28f0f510656b1368f6f3e2baaf3ebcb759d76ff636a38efb8eb3980cbdee101b58256e15ddf503925688047a56fb7e53d00d58e06c228b91bec8d8a0516318e6e977054e0e3a60863a9ca21f9c46f393fe6e595cad81e33cd765fb65962814e1f88acb260d95b311a8eb19fd1926adaca926b9e6641781dc6f5d6e27b3bd2192d97ac909e13fd57590df7c33533a47a8fe7d5925f28b0b1f758874e0bea02777efd75c9ef52d679883a175bea07c21b2aa2b9d26fcf40e295b60a193212013f653eb7fe1a3af7b725b59a8fa154373a11a815c2f9e56e049e7de559e018214f0d2f736054a55889e1d9f0deacd06dce1f8e8d1e2dae00fd95e4b7ddb04dc1df705f774984c273d10930f623adbb63cf0383458b7b4335cd1e4dc4b02eb80";
"0x267aee5db68a8c31402e22654ed873d2f3de6491c49c8be14818e650c4fa50a015ce1ae0c496cef272b1c62c0583c3718c1bc85fefdcf5bcdaf869d76d25beac1a83ea857dd7ceeb1c165afa4461695f7f71f9a947b9f3db190e74b8378cbc181ec2c6151749097fb8e4e27d2257c205e372ef919cfdd941a8e7f6eef4a02e6711763ba2a554eaf1ca9c49beab9afdd1f3f39779849163b695111fef8345004616c1688ae57d90c7522a36ef02f6f6d844bbce49955659e8d154cfde2cb0592b13697b8c8ab2ce4f7660264279355a4ad917fac101169b4ae36dee319e5e873f195f8e6624ebac559e83ebb7188300af926843cafda494e79ff59a28627ba08c0c7139c34f0b14038b2c4967b1d57dd456866a7add4c781ef2f05299b11680d1106c91ee16cb2a45f6f8d33a3fa1e7d527003c3ff0aa2813d05f719fd531f1ea225237afd61a58af80f406f0ad838c57a25ebc9fbe9de73eb98d131ee87d32ab16d166262e47d0e67fc0dcdd0fc42605c32d03f2cdea0a31c9350788a68b1ed21184fefb96075fc551253b9da480b0572b5634d66ac2bca50bb0b4229588bf3000b442736763db0d5fec66c374e2e06d3ca07557ac115035d8d4727938a5476e24da8cc92ed8a8b4331b9a9a551ac6886fccccd3e7abe119c9b226f951ea895b0a1e2b51d512b8ff501a3278af6f0bb053fae859a6282b9e57562a93a66393aa023b822f9ead4c978a4abb9fe8c91af86be5d35bf71f63972893fc02d7397d401d37e14ed66c7de9b7d70fa823eaaae7708f937273bedfa03baad5dfbe30b0781bfe36f4c60bcf89f650057fa08f9bef99e0f66dcd866c8af4cd0724a0fb258e24462c3dc72ddebf65471a3be32dbd914efd7c77ad38f61bd3eb4816f9cd415d0308b5dc1dd81a1166f49eaf486062ae698647cf46234518355b9e53042f293414da342398fcd3c51e40f4cd30cee53c8b2fc6e5202d237b25893092c46503932a8c2fb92abcac15702d57c5ac9cd5f627405b8cdfae611bb0fb13cd092803821df8e29594d5dd30f241ca0a1430a529dc3aca5a44cda03866f5025b370394531e5234bbc0d8900f763e046fef5cfed53a5ebcff4cea7ddb321e0a32bcf5eed203b08cda0cea226f13d862ab2bc74aaaab820d2ab4d4d60622f9cc0bfef4841e1c8de564738ec1b9b7a7fbdf9f844f343dea9569d60edd7546da5a50977be0f104a23dcf146e4eddf496f4fc4b3377f862c4ec08f01669941f9e26f2223898341c7a66cf87e7fd42de8d385aee0e1c8090f19a83b23aa7f5bfef7177e028be7313e395b60f03494d55b99b1da58f401cfee6d45c32d7db313720b18f5bcb8e72183fe1099ab404b9abfcb28bf82f85eae78031baea2653ec61b1fcdaab604392023566a40ff1a31f1619e758bdf8e11dc7c7922d4383d007c1cd217b773d13031e4ffcd59e9b8bc703962bdb81bb9eabd5b1ab19d8115f87aee090e61a6450f91366a731d14630671b4f15ea3cc92d5402a20cb342ecfd00c28a8e9ea9787c7c043e883799fb22841c060c4a2067a9097c467907add6c83c3cc219c48be9e50a16631bcbaad9b72915e6ba73b4f753a059feda1052f506af61c44d04e4aaf146105be098bb46b8a3177ba2b30b35dd82b3ad66cff470314e72c36c5087b1ee391c48cd4154602f69b674654be7284f98e3c92badb69bd5ef482b4a48100c5068048af15e19883108f28d9f27d556b592916d5a26f90d3d63d5245853372a20730c7b755d6ab2a17b19fce90c6f7b62d8426f38a9505b6827caff88bad33485301e5c152832959ca3a24cc4cfb356d2d8b98f286e0060395d9ec38c2c10b2f70d06264ade965d5252652fce30ef2173b2a19bbb08dd481061a4316536c8f7734011460026c2d0b23d2f5e0de0a1c056fe13e6921f39f2e0c8ca5f8c9c3bb000890573880a8509d471231058963334d9e314e99f61f7a97cde32f869fd7565c08a1e19fa9a2b63763a1779d828a2e49839eac1b623b3d454e403d36d9c8c839096065c1eb6f08b77d9539312049112fe339865e49cf645bc5890cc7ba7b3a160a11f02914696e519a247fc919700c2bc8a6e3dfb5eb270945e61a77f46cabf30ad1d3163edbfe1d2d1e6f71eba450673e9674570e8b5381569a5ff5bf24e47f07f080b411fc4d6fbe994a7fdad18f73e5ada17cbb27d4efcdea48d1c90b61ed74b2304419114a41626e45570a03241ac7d491b4cf1c14e70ed9ea121510f50240d241a5b93d197c02e50c9fc07b68fd389326ef6ab2457b2c96b6091526259f50b1a29a12a0316d0ecfc7ea7d62901308e12900b11a72749b7c4562c5be94ce02501da922570fbb6d8f56fb38bbad67778ea5ec66820db587ad875d22c2f91cf431aa3834ff52be65087cfdc8cf209bc69ecd3162137c22239564eb01afdb1790a1fbfcc16ae950b3da2539dcb2cf00498cb69a3c233862714d00b6633e383579f2188b53164bf12bfc5d152ec1bc6385c776519729de74da237d44755aed9c44d27cb7063423ff6e7f1550dbe410d5fe235e2b532bc693f8d60633c27454cf64225e5924b489c36341094ccb882ad7134662e26ec21505b59334a4e787bd4422825ceee94981d418759c35129609d791dc95cacfcae6ddaf87c46d777aa1379ae2898f53bbdfb4b94609fbbdd6ebfebc73cd62eedf4b27bd6aab64ba7cb7e1ef917d13e50daa639cf5be0ee792caf5a9bb127bcb8ebb417415ca7564d78734c3807098765f751280a57222114ea9ec97025794a83e2b5b2ac0e9860f32568797726a61eedf52db66f0ab399672a0f90a1c1fec0975370bea8046b612cc25da6b726475e7253a21ff241517497bdab4c0865de90d87b02cdd799a0cfc44703bf531d695562f7113fe66291a0435c01a877d409518f52cc1373003d6e0adbf977a91656b2551d06d076b2e6a29e66b8b332867f6ebeaf86fe2f757bf52447ed54a924a999c064f08c8bc3e954cd112f9fdcf7807fba93ee8f26998aff7eadc50c8a";

export const invalidProof =
"0x06cfb880a472af9775ed95274c43848b75f0d97179b878b45ac7b9156d2ee9540c78c2bc34daf9e27c2e2cd67cff6ef467bff8b475b8f3ba8b8818de8fde89f62887e4e48b1510ca6a23d0b1b0eaba1283639b686b4341b2fe940a2e9481bb7d1c04a7be2bcb41e24b866df49924491352834a367883aaad0090997f1f729429271568df0145e43646b7d990921f55a73a0a9e586b2fccc5398f574cdeb7d5cc25a878ebe5cc818081987bbee9aee299c63b483194c822344bfffaffab1563a60dd538bfbee9eeb770e44e6fed939c479b68635fd4231ac37d4002bf8edebe2f2dec9c1ecd001ec1f65352ea38223d60768c361057beed2deee86ba04970caa02f8826b7334155c3da78163576ebe85c167c4dfbd9a1bfc9e132bc7ec4dd345524ef71c4519b13fa52d98b9899cf492caea270db2df92ba7fe59903e4065f3b62d22a8a1f9f5c579d48f87e34b36ec71f213054da57d0e0cb0ac982dad3cfe52141bcfb1350a55594dc3ddc8b49aab197de320d12e274d3175b7a0fdf60f92b2018bf4f97c6485222ec16f9897ddeb87b15809436e8e34eed8912a3d9b0317f9131a5f4f5a7c4359d9b61c731e4332286ca5f06f1e802ab3ec9fae49555422ec18bf27e36ce51e4d82b8e5c8e556826dd610021cba43c3625744ae21025ccec52751eb9cd1a17d205ca94eefdb43dc441584d3e8f70c7b9f47d65f700d2ba71405bf39bc9d452d9479828b0f54e25e7dd492200ca4ffb1d770e8f55f35658ccc15c55cfd64f19c17f0e3705f530db2d64c315abe6995cb3b6f6b7b68d8df89f02831649689eff301d265e84b97f89e6cb5354e6a57883381bd46d955f8ddeeb52711715132b01720b7d71ce44474afdcbfc96e8b248b75aaf468779e147904d1096b8535af5601c3773287a3dc60fe6b56c36be43922f7e167600e2bb6e102db2f085749a4ba75c2dd98a2c7a56c483ed501221441a4f6b446698eee992387df09a5238cfc673977ec9d1e8d716e8afc819ffe3933493237fd7b4a4e38ad7e73048ae55941d1ba6e25f982c956a5546b8d156c14f1dddb3aa3b0f9d77645ff772b7cd633ddbe7f32c69e13c0b5443c1c2267a85b96c6872ecf7f5b36d1372bd41ce1a2eae0ced0036b712881de6cf9e73e78ea70ed384fd3c1c104f85055e2572b57851d904aa377e513d11bad8bf1eaeb7d622f5a7e5ad234c87eaf7086417d26cb11c9494b485cdae4da826ffdf1c3322bf61aed9321c4c4cd4766a7886fdf1c8e178c26a4ec6d576578992695660a7aa7392bb43e41a3b96c0635efb7aec81d0db0bd46014956961d4ae2113b560f9576f08df9d8806b59d2885193c8a7200bea000babda63ec88ddb6b7c27b4e2a0c6424de3e37608639c761e5691293c10ee6d186bee457e38c74f585e6029efbbef22061bbd30a4405b33a69aa6428d924c0f2c7a37beaf3b86ae3e7f01b275ef2538234b79ec6809bb0acec401da4a80d961caafffd57c3c4de0da92df5dd0b1ffc05ac9b5f774b3f0f6f02eeb9eea509ba6416c17fe258f74a87e469d14ae539d0079c4065876bd0a60c21a849d0b72b881eb224a06a2392230df848f96dddc90b3bc7921b209b6e60444a93a125a106b107ff7d1d5b2516b33fff5217575c003b2ce5a7ee685d65de7557e2580cab1c15cd25b5cd519e719da71bfc2cf086813d7185492f9d42494fe6444479a286070a9c66acfd74f0b83e090d68c3be65b34db81020e869b7396d4292e0af29a425e44e572180c1cfe8527dd79da1504532a6d4c8543ac501debb141136f96eb6182e4a88370bb4c0dfa1d2b77568d1bfeddbfcadeb5352a0cc428df079be24a804ff8d65a6a5b3f1de65e8fcc08005f74d2ddae83cc6c5e6c97160fd5d166fb316aab7b3a072f43397daa2c126a55f45f551f05b85a7112ed246f82378a235c525a242a9f9addd1c3c651c25d5a98caa84e9ce913f3d58f9b237bbf56b4f403b12f704163c7b4810a363b2c26bdcda8408b5b9c449352c9cc8766ea5a14b644d160088734583035920d9bd262d9ca7ec08c7c64d6163563f936e176166e6b24f02070454c21ef6f02ccaada7b10f9ecc994f28d37c901488d992f28cfd4dcd3318d2655c113d26cd6f02f94f5f3019c6ddf8ea2ca6ee1a38bb21e39460ad51d81fe8dc6d942fc8d044cbf5d0bdd8dd53cdb0439d4ad74f1b1507be9f7e8fec18068843eae8030b80e32b087a2bc2385cc40a8a50fcde955a833f1302501a87dd05e153d6f132f0b82b26e26b99783d42e78f73114e41c4b56266a98cc8f9f77e3039d5cdf78298cc36c004e7366f8d7b5bd0605d6452e3c3e59b469c63e6322903707766ee6c7c4ea8e339512b53a475841eb5ae7d48c6ee09320d82454490ad167374985c454c6e5563ab708fcdfa3b5a435ab5dfd15392fc39e83a6440b5351db346c074612fbfdb7d883f60b23030038012a6ea5736adbbad665536cb61f70f458a7965e45cf2a3b54b88d91c3fa850b6b832a3c2205cbc00fae4f06b64d42fdf3dd2242b95c3087dd7cc6971b77b38f4ba4a9885817ce003f8cf42b4a52911acfa6d9c09f6791dd0380103c9d751712ed0d0cd7564bbd337203850d9271d16aa34fc087b801047028b2cbf5d129ee52779a680ec0e13e7d18fd9e5ea75cc29ce2f2b3929a040b7a831cb5f9a73ca6f4515aafe4bc5a5346fa784aae1424619da9717836eaeb1dd5ea96dcda0f76138b5545550bf7650fc91c73302fbbdab2845f5598824064294ef07c6be4c149923616cb6ca35d27d9fde5d7b620941af0a09b4bdd77c24b92337d82ebe78c255ef77d9760327bd193b4a0e7fb14faeda0812d5056faa9bacd99ae0c3c793700c5fee9a887083c40dc2abed3fa65c30251d32416365a82f9a2ec4aeacfcfed52aa30ee741073f53184cb37d9eded50bde2bda00fac1150f450e1b210e7fa737a7c3fff92cc53de9493da68b8395902551294456d32b2b81fe36dc1f7c6480f09b47addf661456050adefb199c0e68de56";
Expand Down
Loading

0 comments on commit a59881b

Please sign in to comment.