From 4a1b5322dc78921d253e6a374eba0b616ab788df Mon Sep 17 00:00:00 2001 From: Charlie Lye Date: Wed, 5 Jul 2023 17:04:00 +0200 Subject: [PATCH] feat: Initial native version of bb binary. (#524) --- .circleci/config.yml | 39 +++- barretenberg-wasm.nix | 7 +- cpp/.dockerignore | 33 +++- cpp/CMakeLists.txt | 2 +- cpp/CMakePresets.json | 4 +- {ts/test => cpp/bin-test}/.gitignore | 0 cpp/bin-test/Nargo.toml | 5 + cpp/bin-test/Prover.toml | 6 + cpp/bin-test/README.md | 10 + cpp/bin-test/Verifier.toml | 1 + cpp/bin-test/bin-test.sh | 12 ++ ts/test/README.md => cpp/bin-test/src/main.nr | 28 +-- {ts/test => cpp/bin-test}/target/main.json | 0 {ts/test => cpp/bin-test}/target/witness.tr | Bin cpp/cmake/threading.cmake | 6 +- .../Dockerfile.x86_64-linux-clang-assert | 4 +- cpp/scripts/bb-tests | 15 -- cpp/scripts/bb-tests.sh | 37 ++++ cpp/scripts/bin-test.sh | 14 ++ cpp/scripts/build_libacvm_backend.sh | 51 ----- cpp/scripts/run_tests | 4 + cpp/src/CMakeLists.txt | 1 + cpp/src/barretenberg/bb/CMakeLists.txt | 11 ++ cpp/src/barretenberg/bb/exec_pipe.hpp | 22 +++ cpp/src/barretenberg/bb/file_io.hpp | 24 +++ cpp/src/barretenberg/bb/get_bytecode.hpp | 13 ++ cpp/src/barretenberg/bb/get_crs.hpp | 84 ++++++++ cpp/src/barretenberg/bb/main.cpp | 183 ++++++++++++++++++ cpp/src/barretenberg/bb/vinfo.hpp | 11 ++ .../barretenberg/common/parallel_for_omp.cpp | 2 + .../dsl/acir_proofs/acir_composer.cpp | 18 +- .../dsl/acir_proofs/acir_composer.hpp | 10 +- .../grumpkin_srs_gen/grumpkin_srs_gen.cpp | 4 + flake.nix | 16 +- ts/bin-test/.gitignore | 3 + ts/bin-test/Nargo.toml | 5 + ts/bin-test/Prover.toml | 6 + ts/bin-test/README.md | 10 + ts/bin-test/Verifier.toml | 1 + ts/{test => bin-test}/bin-test.sh | 0 ts/bin-test/src/main.nr | 32 +++ ts/bin-test/target/main.json | 1 + ts/bin-test/target/witness.tr | Bin 0 -> 10240 bytes ts/package.json | 2 +- wasi-sdk.nix | 4 +- 45 files changed, 614 insertions(+), 127 deletions(-) rename {ts/test => cpp/bin-test}/.gitignore (100%) create mode 100644 cpp/bin-test/Nargo.toml create mode 100644 cpp/bin-test/Prover.toml create mode 100644 cpp/bin-test/README.md create mode 100644 cpp/bin-test/Verifier.toml create mode 100755 cpp/bin-test/bin-test.sh rename ts/test/README.md => cpp/bin-test/src/main.nr (58%) rename {ts/test => cpp/bin-test}/target/main.json (100%) rename {ts/test => cpp/bin-test}/target/witness.tr (100%) delete mode 100644 cpp/scripts/bb-tests create mode 100755 cpp/scripts/bb-tests.sh create mode 100755 cpp/scripts/bin-test.sh delete mode 100755 cpp/scripts/build_libacvm_backend.sh create mode 100644 cpp/src/barretenberg/bb/CMakeLists.txt create mode 100644 cpp/src/barretenberg/bb/exec_pipe.hpp create mode 100644 cpp/src/barretenberg/bb/file_io.hpp create mode 100644 cpp/src/barretenberg/bb/get_bytecode.hpp create mode 100644 cpp/src/barretenberg/bb/get_crs.hpp create mode 100644 cpp/src/barretenberg/bb/main.cpp create mode 100644 cpp/src/barretenberg/bb/vinfo.hpp create mode 100644 ts/bin-test/.gitignore create mode 100644 ts/bin-test/Nargo.toml create mode 100644 ts/bin-test/Prover.toml create mode 100644 ts/bin-test/README.md create mode 100644 ts/bin-test/Verifier.toml rename ts/{test => bin-test}/bin-test.sh (100%) create mode 100644 ts/bin-test/src/main.nr create mode 100644 ts/bin-test/target/main.json create mode 100644 ts/bin-test/target/witness.tr diff --git a/.circleci/config.yml b/.circleci/config.yml index cc2d7acff6..770bf274d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -203,7 +203,7 @@ jobs: - *setup_env - run: name: "Test" - command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 bb-tests + command: cond_spot_run_test_script ./scripts/bb-tests.sh barretenberg-x86_64-linux-clang-assert - *save_logs honk-tests: @@ -266,6 +266,18 @@ jobs: command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 3 join_split_example_proofs_join_split_tests --gtest_filter=-*full_proof* - *save_logs + bb-bin-tests: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - run: + name: "Test" + command: cond_spot_run_test_script ./scripts/bin-test.sh barretenberg-x86_64-linux-clang-assert + - *save_logs + benchmark-aggregator: docker: - image: aztecprotocol/alpine-build-image @@ -302,6 +314,29 @@ jobs: name: "Test" command: cond_spot_run_tests bb.js + # These machines cost a fortune (10x other machines). + # There is a branch coming for github actions that will build mac stuff on releases. + # I'll leave this here for now, just in case proves useful to be able to do CI mac builds on branches, + # but let's not uncomment in master. + # + # aarch64-macos-clang: + # macos: + # xcode: "14.3.1" + # resource_class: macos.m1.medium.gen1 + # steps: + # - *checkout + # - run: + # name: "Install toolchain" + # command: brew install cmake ninja + # - run: + # name: "Build" + # working_directory: ~/project/cpp + # command: cmake --preset default && cmake --build --preset default --target bb + # - run: + # name: "Test" + # working_directory: ~/project/cpp/bin-test + # command: ./bin-test.sh + ################################### # Aztec integration tests #circuits-wasm-linux-clang-builder-runner: @@ -381,6 +416,7 @@ notmaster: ¬master workflows: system: jobs: + # - aarch64-macos-clang: *defaults - x86_64-linux-gcc: *defaults - x86_64-linux-clang: *defaults - x86_64-linux-clang-assert: *defaults @@ -393,6 +429,7 @@ workflows: - stdlib-recursion-turbo-tests: *bb_test - stdlib-recursion-ultra-tests: *bb_test - join-split-tests: *bb_test + - bb-bin-tests: *bb_test - benchmark-aggregator: requires: - barretenberg-tests diff --git a/barretenberg-wasm.nix b/barretenberg-wasm.nix index 941bea758a..2b0a40bf2c 100644 --- a/barretenberg-wasm.nix +++ b/barretenberg-wasm.nix @@ -10,11 +10,12 @@ stdenv.mkDerivation src = ./cpp; - nativeBuildInputs = [ cmake ninja binaryen wasi-sdk ]; + nativeBuildInputs = [ cmake ninja wasi-sdk ]; buildInputs = [ ]; cmakeFlags = [ + "-GNinja" "-DTESTING=OFF" "-DBENCHMARKS=OFF" "-DCMAKE_TOOLCHAIN_FILE=${toolchain_file}" @@ -31,5 +32,7 @@ stdenv.mkDerivation "-DCMAKE_CXX_COMPILER_WORKS=ON" ]; - enableParallelBuilding = true; + buildPhase = '' + cmake --build . --target barretenberg.wasm --parallel + ''; } diff --git a/cpp/.dockerignore b/cpp/.dockerignore index fe967835d6..027fd417cc 100644 --- a/cpp/.dockerignore +++ b/cpp/.dockerignore @@ -1,8 +1,25 @@ -build* -docker* -.* -src/wasi-sdk* -src/barretenberg/rollup/proofs/root_*/fixtures/account -src/barretenberg/rollup/proofs/root_*/fixtures/join_split -src/barretenberg/rollup/proofs/root_*/fixtures/**/proving_key -srs_db/ignition/transcript* +# We want to explicitly define what's allowed into the context. +* + +# Important cmake files. +!CMakeLists.txt +!CMakePresets.json +!cmake + +# Important srs_db files. +!srs_db/download_ignition.sh +!srs_db/ignition/checksums + +# Source code. +!src/CMakeLists.txt +!src/barretenberg +!src/msgpack-c + +# Needed scripts. +!scripts/install-wasi-sdk.sh + +# Noir project for testing bb binary. +!bin-test +bin-test/crs +bin-test/proof +bin-test/vk \ No newline at end of file diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 45313c2e2d..e8abc4c600 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -13,7 +13,7 @@ project( option(DISABLE_ASM "Disable custom assembly" OFF) option(DISABLE_ADX "Disable ADX assembly variant" OFF) option(MULTITHREADING "Enable multi-threading" ON) -option(OMP_MULTITHREADING "Enable OMP multi-threading" ON) +option(OMP_MULTITHREADING "Enable OMP multi-threading" OFF) option(TESTING "Build tests" ON) option(BENCHMARKS "Build benchmarks" ON) option(FUZZING "Build fuzzing harnesses" OFF) diff --git a/cpp/CMakePresets.json b/cpp/CMakePresets.json index 9fb5b06344..310dd897b1 100644 --- a/cpp/CMakePresets.json +++ b/cpp/CMakePresets.json @@ -25,9 +25,7 @@ "inherits": "default", "environment": { "CC": "$env{BREW_PREFIX}/opt/llvm/bin/clang", - "CXX": "$env{BREW_PREFIX}/opt/llvm/bin/clang++", - "LDFLAGS": "-L$env{BREW_PREFIX}/opt/libomp/lib", - "CPPFLAGS": "-I$env{BREW_PREFIX}/opt/libomp/include" + "CXX": "$env{BREW_PREFIX}/opt/llvm/bin/clang++" } }, { diff --git a/ts/test/.gitignore b/cpp/bin-test/.gitignore similarity index 100% rename from ts/test/.gitignore rename to cpp/bin-test/.gitignore diff --git a/cpp/bin-test/Nargo.toml b/cpp/bin-test/Nargo.toml new file mode 100644 index 0000000000..670888e37c --- /dev/null +++ b/cpp/bin-test/Nargo.toml @@ -0,0 +1,5 @@ +[package] +authors = [""] +compiler_version = "0.6.0" + +[dependencies] \ No newline at end of file diff --git a/cpp/bin-test/Prover.toml b/cpp/bin-test/Prover.toml new file mode 100644 index 0000000000..3b4ca3c198 --- /dev/null +++ b/cpp/bin-test/Prover.toml @@ -0,0 +1,6 @@ +input_aggregation_object = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"] +key_hash = "0x284158f92a5305f662f78fc36a397fb8eb44d229fd22152e2dc085cad142c3c2" +proof = ["0x000000000000000000000000000000000000000000000000000000000000000a","0x0000000000000000000000000000005e77a294b0829c1233b25f34cbd1e36ca5","0x00000000000000000000000000000000001efb564c6d131a2005503e7bc96dfd","0x0000000000000000000000000000003a2960d64558302ab11263ac1d4e99c792","0x000000000000000000000000000000000027934be1b834b8444d8974e4c1c9bb","0x000000000000000000000000000000a5e281184b833e3567ce8e285c80bd7dfc","0x00000000000000000000000000000000002ef660bd670bea9dc8e18192cb71fa","0x00000000000000000000000000000075b29302806ec08bb2c7af1b5463fc34fa","0x00000000000000000000000000000000001138c220233f7b40034a4f49a23ae6","0x000000000000000000000000000000c24fb0b91d6ea29b55a925f221c5b285d8","0x000000000000000000000000000000000013ff3e12b86654ca896bfd6bbedd69","0x0000000000000000000000000000005709282fede94015f85bce4c39d859e34a","0x00000000000000000000000000000000000fb8a86b7540bfdc1c2784d7943400","0x00000000000000000000000000000020bf9ff7ac6ddadf43c1f9128f13f66481","0x000000000000000000000000000000000012f42d353e8a008c1c65650aea9720","0x0000000000000000000000000000009b8c079fcd0a17aecbda82b255ac26131b","0x000000000000000000000000000000000027fe6ea46f3898befbae77137e493e","0x0000000000000000000000000000002a66a58be32207d7ac2e318e6d3235edac","0x00000000000000000000000000000000000fa3dfdf2bbf7c51f39b861dc44be6","0x0000000000000000000000000000003746eb9ded01fcafcc65c5d87f49141ee5","0x00000000000000000000000000000000001e65f8c6b1af063d4103022b38cd3e","0x00000000000000000000000000000046c520b61b4608d1bc2c98ca800765ebd7","0x000000000000000000000000000000000020434f43987d0f71d0a1aa2ed8f270","0x000000000000000000000000000000827b6b7c3b2a9c71a45a253a2a298c47f4","0x000000000000000000000000000000000009e45e0d42b0e22cbde0f4667e6288","0x000000000000000000000000000000c8150ed84dd7b794ce5427fe99040bcd3d","0x00000000000000000000000000000000002696a5d48bf45b5a80619ef91013d4","0x0000000000000000000000000000003a1caa16acc8da5032b2e836770312009d","0x0000000000000000000000000000000000237a8423952c1c64e1e7c75da9d7cf","0x0000000000000000000000000000000d8eb5fa6490a4cd67943b646d05bd0859","0x0000000000000000000000000000000000159ebdb4a5c764c0346287984ed47d","0x000000000000000000000000000000e862c821c535a49e93959d08dc9f2645b5","0x00000000000000000000000000000000000c440edae454a8865dc27c8de51090","0x000000000000000000000000000000a6973dd133a0e974b564e76d185a4b06b0","0x000000000000000000000000000000000016248ed7566da68af6f2bc248763b4","0x000000000000000000000000000000a568fd8430c974e995915c9265ac74617d","0x000000000000000000000000000000000006e205349a7913be4af0af8778a0fd","0x00000000000000000000000000000009fd63b6ca1767490d4ce191e7332fbdd6","0x00000000000000000000000000000000000f95d28c7e720dc455fd46a532731e","0x00000000000000000000000000000008d1b9d51b2425ddf4a15bc5307ea911b4","0x000000000000000000000000000000000001131845742cefc926b7d2b7dc4b9c","0x0000000000000000000000000000008dbc181365f1a3db87a66d527ca9d81ca5","0x00000000000000000000000000000000000a6f78cdcd1e2177580e6c89c23235","0x0000000000000000000000000000004723acbe295108f00ff760c0671d2d4bbf","0x000000000000000000000000000000000006058d93abb1d596501ee4c3f62971","0x08bacf9fdaba383e584559b8cd64ae8c04e670d9203f90c6b49efac7f00f5003","0x18541473055ebbcaefe15759125b820ed1c6b932af2659c5280bdf70bd5c09cc","0x161e0a0cb1aa6028cabb8ccb98646a9b0976618cad99bb1145c4d25cecef50be","0x0d353ffc0833fd6e1947133f5391544ed7dde0fbfa0109ec7a54baafb117b1ca","0x1a5209fd1dcf2705b7081b4e3bf7b2c33dd00ac4b2becfdf8ee7927703ea0357","0x1d247635110c48df6f62387026c5823f0eb9d843848fe7b8e1a9a96b1c6ad763","0x1cc4a7a8be5edc32432191b0ee2a9051d3b6384313c6b9e5efe8cd8712c872f2","0x2c8b6fa617041faeb2e814b39c288ff607ac03d746f3c0e622860720dfb24b83","0x1ecc99a77fda5d79a6426b18049876b36ad1a1aba693518b1b976360630c2f55","0x2f75dc15bb6fdd3d9762fe74485c5ead7a5476c11cd44ed9f43324028cd2dd68","0x0e20add7931c78604ef7986fe7b286ab582842a23b4c09e8ec03d8d88a31969c","0x2467bb747466b69b6b4deeaac4a82e32ca7585194cd838912a65d12f912b5c6c","0x23edab06b87cf9fd4a5f0161287283d97a9bcdbdd68779e08cad3e763420bd20","0x2817c054ad1ac5454f58ff525196ed920ba54fbb4d86820a5a414aaa61d7d1b1","0x12d63d1f6ed0a080694a209534ee08e4758b0382f9bab7e13aafcbcb62ecc8d0","0x153104c35caab490767364a7db8bca01043c63f358f20edd6205c544cf4a61ea","0x178bcc674a84c8a0839ca8ba82298b1d92edc463b82965d9895bbebe3ba7fb04","0x1224834d4b8a36290e11b8b153d81062ba503c36d6e7ef41916b647517a6e632","0x13112373ea4e5bf7e041a7312167b4f82653ead2f5e5e3d4d07bafd79ca690b6","0x26b7669e3463c6d162363b2cd0e8f6720aa97f9cdb04a8340fce7ead2421af56","0x120d09593529a665d992bf009fc6268a9088c95f401784f939d5ed1649a4e779","0x1c415baf2638f0c09def30dfcf650d56b0508544769813d1d807b1b114632d38","0x1e9c2353141304d0ab1874f27602ce733f01e5b4d5cf6acdff5dab2a80c0c652","0x20f6eaf701ed18e0b841b9051ca08f8fcdb346253506c1ca26b3a4a3ed1e5f6c","0x2351b29aefc72cf0c56afd17c33e50ac5c64a695943e18c64e099e1d597bf886","0x19e6940b385edcb090c5eccd28c74c3a219f24d41760bcd5b0b1b837a805941e","0x2cd7e4b967101d6ee0f2a33521762cace8ffe35930bc210554e8307df664c899","0x041f06de46e4862d5d59c363c119a79629261d6aa18aa737c288ac7f4bfb4153","0x2dc39620da58c2822418179ba6f61de6d31ee938c79a5ca15c473aef7ca1e824","0x00000000000000000000000000000000ffbd168649f4e00f0baef4ec3a08615f","0x18fbeff26a87cb38f373584bbd02d016fed78aefc6462811a23006679509b3a9","0x1888e78ad37d146406e710ae2dbd244877263b133875d090f7615a1e9c0ac083","0x2196fbe28ce9ce0e0e202bbf1268cabdcd0a2c03588e118765ba1ee1a16f2dc7","0x0137bc731354b1531dbdcbfc83802605035f69f937f9a7311a57e6d7126368ba","0x19f38da8f0717fe78812addd655ef59411805d70eb731d5da309ad111698e8d0","0x155452e2824d5bd4fd8f8e5feaa4bd7abe783613d6b78cf88377a48e9f7e70c2","0x2396966b07a6e535a9ae30883a97e854ff2425c6dcfa34bda164394ba919191f","0x09374f47b862065ac0ac49ceb02b5cc0d925af1980ab2bd5f4d9df555e8c4c91","0x26366e50b5c7244ffc3ecdf50a65180742b1c53092659bd1db852bdd726d52f3","0x12d13ee6d1faa21b7f810c64e31d7af08409f2ff2a669b3c7e4e82d1964e5954","0x2fd05defcf5fc010bb13908b3d573636ed9609163c210b3864f9cf59aa2f5fb6","0x00000000000000000000000000000046955fdfd58ca9013b39025ae688416131","0x00000000000000000000000000000000001d335d2fb9857cbc49e72cf34e86a5","0x0000000000000000000000000000000c6a8930092b36c72dbd0a7f4b65533c19","0x00000000000000000000000000000000000d099ff72ffae0f73756528d629a5e","0x0000000000000000000000000000008c8d80c3f2886519cb37a563f88f166cb8","0x00000000000000000000000000000000000393e9f6fdc31492e4b3da33fa5fe4","0x000000000000000000000000000000417fb818a6933554bf3ff602f1f450728d","0x00000000000000000000000000000000002074eb75888a752047676f72f5343f"] +public_inputs = ["0x000000000000000000000000000000000000000000000000000000000000000a"] +verification_key = ["0x21082ca216cbbf4e1c6e4f4594dd508c996dfbe1174efb98b11509c6e306460b","0x0000000000000000000000000000000000000000000000000000000000000010","0x0000000000000000000000000000000000000000000000000000000000000005","0x0000000000000000000000000000000000000000000000000000000000000010","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000004cf4015c3a5297f556c3b72581f2dca64d","0x00000000000000000000000000000000000a67b44462aa65528a3e3b181e0bcd","0x00000000000000000000000000000091507f347e13f13eec9d9f327ac25ada11","0x00000000000000000000000000000000001993946f40247aa93aedba75857f3e","0x0000000000000000000000000000005d340a5ecb1a33c0b7055734ef91200c97","0x00000000000000000000000000000000001eebbe1207643a8bd1669b999e8226","0x0000000000000000000000000000006b27d5d1ffba12754d0718481e1a9a419a","0x00000000000000000000000000000000002f08a6a07ed616c588bcf4e3555c00","0x0000000000000000000000000000003cbc8e573c1299e8ba491bd2218a413bd7","0x0000000000000000000000000000000000192b586ec6fb3b1b6d063a00a86c65","0x000000000000000000000000000000c4516b3cffabe3dcdd074d74f595c81c04","0x000000000000000000000000000000000021142418da600cf97a5248cbd45524","0x000000000000000000000000000000c292117b1a17fefe9de0bfd9edf1a84bf9","0x000000000000000000000000000000000002d6fd9e84dbe74b7531e1801405a1","0x000000000000000000000000000000459a3b2a0b768da45ac7af7f2aec40fc42","0x0000000000000000000000000000000000293c6ab3c06a0669af13393a82c60a","0x0000000000000000000000000000006c845044cca9a2d9dbf94039a11d999aaa","0x00000000000000000000000000000000000efe5ad29f99fce939416b6638dff2","0x000000000000000000000000000000587f768022c11ac8e37cd9dce243d01ef2","0x00000000000000000000000000000000000a44bf49517a4b66ae6b51eee6ac68","0x00000000000000000000000000000059d49ef10107e88711fc0919e244e17a08","0x0000000000000000000000000000000000132d159fdf1907b0619b9809904594","0x00000000000000000000000000000016d9bd1186bcef7a31846ce703eb4cb5b2","0x0000000000000000000000000000000000291c00ed4a7689fec327330104b85c","0x0000000000000000000000000000004b6c55389300451eb2a2deddf244129e7a","0x000000000000000000000000000000000018c3e78f81e83b52719158e4ac4c2f","0x0000000000000000000000000000008d7beb75f905a5894e18d27c42c62fd797","0x00000000000000000000000000000000000002e9c902fe5cd49b64563cadf3bb","0x0000000000000000000000000000000d9e28aa6d00e046852781a5f20816645c","0x00000000000000000000000000000000002cbce7beee3076b78dace04943d69d","0x000000000000000000000000000000fd915d11bfedbdc0e59de09e5b28952080","0x00000000000000000000000000000000002bc27ec2e1612ea284b08bcc55b6f2","0x000000000000000000000000000000be6ed4f4d252a79059e505f9abc1bdf3ed","0x00000000000000000000000000000000000ad34b5e8db72a5acf4427546c7294","0x00000000000000000000000000000090a049f42a3852acd45e6f521f24b4900e","0x00000000000000000000000000000000001e5b26790a26eb340217dd9ad28dbf","0x000000000000000000000000000000ac27e570ae50bc180509764eb3fef94815","0x0000000000000000000000000000000000155a0f51fec78c33ffceb7364d69d7","0x000000000000000000000000000000b644999713a8d3c66e9054aa5726324c76","0x00000000000000000000000000000000001c1c4720bed44a591d97cbc72b6e44","0x000000000000000000000000000000058cc5ad51753faec2a5908155d472e429","0x00000000000000000000000000000000000f7261cf55a71f4d0d7b961dda9ddb","0x0000000000000000000000000000004a36df78f0d50144437ef26f8bbfe69ac1","0x00000000000000000000000000000000001b7b1a10c1e638ce11d8c84b831aca","0x000000000000000000000000000000826ba5b1d1ddd8d6bb960f01cd1321a169","0x0000000000000000000000000000000000163a9c8b67447afccc64e9ccba9d9e","0x0000000000000000000000000000007653a773088aba5c6b1337f435188d72c4","0x000000000000000000000000000000000019256311d43dbc795f746c63b20966","0x000000000000000000000000000000df58a7bad9afe3651be67bc6c298092e11","0x00000000000000000000000000000000001fa51a0d75363b3af4e259e0dbb2c5","0x000000000000000000000000000000c8b5836b29551d41dbc04bdb1fcf1a1868","0x000000000000000000000000000000000021915198840ad9c3666122b2837aea","0x0000000000000000000000000000005df0e69d7efdbc7898b3762f0a0ed976ad","0x00000000000000000000000000000000000cee6b75dcf02a07c50939e8ca3cf3","0x00000000000000000000000000000066a493be1ea69d2b335152719acd54d735","0x000000000000000000000000000000000027e49262bd388ce2d0f193988f3b8f","0x000000000000000000000000000000dd783bff1a1cfc999bb29859cfb16c46fc","0x000000000000000000000000000000000002c397073c8abce6d4140c9b961209","0x000000000000000000000000000000750599be670db593af86e1923fe8a1bb18","0x00000000000000000000000000000000002b7bba2d1efffce0d033f596b4d030","0x0000000000000000000000000000008ffb571a4b3cf83533f3f71b99a04f6e6b","0x00000000000000000000000000000000002c71c58b66498f903b3bbbda3d05ce","0x0000000000000000000000000000002afaefbcbd080c84dcea90b54f4e0a858f","0x0000000000000000000000000000000000039dce37f94d1bbd97ccea32a224fe","0x00000000000000000000000000000075783c73cfe56847d848fd93b63bf32083","0x000000000000000000000000000000000027dc44977efe6b3746a290706f4f72","0x000000000000000000000000000000de0cbf2edc8f085b16d73652b15eced8f5","0x00000000000000000000000000000000000a5366266dd7b71a10b356030226a2","0x00000000000000000000000000000000a7588ec4d6809c90bb451005a3de3077","0x0000000000000000000000000000000000136097d79e1b0ae373255e8760c499","0x000000000000000000000000000000f2595d77bdf72e4acdb0b0b43969860d98","0x000000000000000000000000000000000013dd7515ccac4095302d204f06f0bf","0x000000000000000000000000000000057fe211dad1b706e49a3b55920fac20ec","0x000000000000000000000000000000000016ff3501369121d410b445929239ba","0x000000000000000000000000000000eb8007673c1ed10b834a695adf0068522a","0x00000000000000000000000000000000001e190987ebd9cf480f608b82134a00","0x0000000000000000000000000000000944f94301aa6da3016a226de04de52f4c","0x00000000000000000000000000000000001e44194e60f0ab4ee0f77adc50f422","0x0000000000000000000000000000006c2c7bea37dfbd20be6bed19efd743397a","0x00000000000000000000000000000000002a017d0d9f40d0aeb5c8152ffddec5","0x0000000000000000000000000000007f43efe5631bf48c872c317bed3b8bf12b","0x000000000000000000000000000000000027579be0883627093cf8bdec0b72e7","0x000000000000000000000000000000cef6108b89e89b35679431d113f3be7dff","0x00000000000000000000000000000000000ddb2d01ec88ed69144177a4af3850","0x0000000000000000000000000000000083e7ab1f26781948b36d131759f7c8c9","0x00000000000000000000000000000000000a7fe830f1cb7a5d49d71877dd226a","0x0000000000000000000000000000001834ecd1ce1e8e80812bdd95f960a45e57","0x00000000000000000000000000000000002db7a5185064e6501ef61e989895a0","0x000000000000000000000000000000363f0c994e91cecad25835338edee2294f","0x00000000000000000000000000000000002eea648c8732596b1314fe2a4d2f05","0x000000000000000000000000000000b2671d2ae51d31c1210433c3972bb64578","0x00000000000000000000000000000000000ab49886c2b94bd0bd3f6ed1dbbe2c"] +proof_b = ["0x000000000000000000000000000000000000000000000000000000000000000a","0x000000000000000000000000000000522e2d3071a75aa35d1e477d9e0ad3c0c2","0x000000000000000000000000000000000027bd4377f2ede7bc0133dde7d3b79d","0x000000000000000000000000000000df15ed61667d6fc6b99b97daafc3f7eddb","0x000000000000000000000000000000000003572ca7295a3ee92dc2ddafed48cd","0x000000000000000000000000000000b5dfb839be2c47c3d0e289df3c482bf286","0x00000000000000000000000000000000002471c02fbda062e36bcc7fbdf42dce","0x000000000000000000000000000000e3cbbbc33fb43fb006bd9f8e02dfd4cf9b","0x00000000000000000000000000000000000b3eb6b7a756351688c2561977d618","0x00000000000000000000000000000058d410d526cbd3adbee65868596758007f","0x0000000000000000000000000000000000289c7fe794a87811176d6b8a3973b3","0x000000000000000000000000000000deebf1d6b009435d734b2399d3558eb3f7","0x000000000000000000000000000000000023b6573225d811337c37b16691b872","0x000000000000000000000000000000c29b8cb5048472631403ee526a725ac163","0x0000000000000000000000000000000000206bff7bf596fde59255e7b85f9c7a","0x000000000000000000000000000000d8907ebb05228e706b57826cfc8207af57","0x0000000000000000000000000000000000305f614425315c05fc891c9a92a743","0x000000000000000000000000000000f183e5285136ab6c87d28dcfb65a99b02c","0x00000000000000000000000000000000000383ca0c47e2c56d39f5b58b9726a4","0x000000000000000000000000000000cc11844c28848bcdb1575af5bbae6eafa5","0x000000000000000000000000000000000018b1f820411130433f38ede2bd9158","0x000000000000000000000000000000821bd5681fdbbc82311485f9750ecda390","0x0000000000000000000000000000000000064257d786e839c16aa159b3672cc8","0x0000000000000000000000000000000e5205d207323e06ea8a18111dff8354af","0x00000000000000000000000000000000001254044ff7e569e4002f38956d2762","0x0000000000000000000000000000004591d851f6226ffe1a8a63456ee13411f7","0x00000000000000000000000000000000002b118f2b6639c3f776ed6847f98863","0x000000000000000000000000000000a0a0f63e73dd651c139b2fc3f45e9f4a94","0x00000000000000000000000000000000002669baf309d743d8c94871745bb19a","0x0000000000000000000000000000004cafdee2031bda8c4a2be55862c864524e","0x000000000000000000000000000000000002e68b1c1d2454113f78a184434cf2","0x000000000000000000000000000000899c0497e76b6b345776d9990c8eee4160","0x00000000000000000000000000000000000ec802d07823d277acf631b5c451f3","0x000000000000000000000000000000d5f1fa88434b81dd239ca62a3d168ff20e","0x000000000000000000000000000000000028511b798a4e506da8219fefcfe462","0x000000000000000000000000000000597adcfba2064c09a9e57b37d6a50fe775","0x00000000000000000000000000000000001f691d6d4cbed7b749f55e9af17403","0x00000000000000000000000000000071c78d719253bf3165591474d0a27a50ac","0x000000000000000000000000000000000024858bf4aff0e08df3c03fae341fc0","0x000000000000000000000000000000d0e80eafe0f0d2c1f760bd98087a069da0","0x0000000000000000000000000000000000266239c233e34815ca720e2e378f21","0x000000000000000000000000000000ad6462e3eca1c9a94e4dd30f3cecba48ad","0x0000000000000000000000000000000000147e1bff29ff6979f76ab6d840ded4","0x00000000000000000000000000000047cd629558a91f9db60c63944fa3835cdb","0x00000000000000000000000000000000002531925eaa902131ef11542fb5b20a","0x198e99c9dbc6f3ca902d080fdafb51410ee129edf20015c8337964f3f92b0376","0x2f04d8358d5740b6fa3aca9893cac185d641f2a00089b2bc428401ac21343d2c","0x2d5e2a67dee4e227ca84367a7d7ecd4860b1586a0d1eb799a41ee1042857e46a","0x2651bde5af62489c373d5fa812d6140b60df4569c6184d0d38f6f55dd49ec439","0x10e9e9d0cb817c09034cf3a4dbc9a44ed7a2618fd0281bf0d07a30b12facc6ea","0x11256980eccf0e654c61db759c8d71b04cd9a7c74d44165beaca2978aae075a9","0x2360ce983c2edb38f60b84a7f5ade89eed1fdb65363227e737dffbb8acba96e6","0x06c2d6ce83f1dc608f2cd267b351faa80bae0f688b3e2c6689235365ac05d614","0x1954b4ab315a061b176b67c8adb73d8ef4cc795951c506549ee17f0db90cca9a","0x1a738a34c81c0875d1fe2c68fb111bb55194edcf6c879e9ec99b4c93c5bac76b","0x012434d4aa45c5fb67f138a86116447befa784435b50fc1e67c74f07223480ef","0x1da9f41af8143f464c89dfae2b802ab73f0e64bcd71e5a18574bb4afa391a80f","0x1c41b34f51bf6cfddc0572770164eadcbf2fc4e7959f0fc7a4f19dc11780380a","0x0a6692e54ad790aa12bd9e225e116bfe1d068459dcd66eeac3ff646c672a0372","0x01859bc6385d07f9dfec4b8b2c1db0a53f8a05af246bfad33509beb42d9b5694","0x19e876787001790df811f7d7d26212e87b953a8945d632763d9bf154ab4ec167","0x01e702b7c67449f857e75e6df7251cce8f6c871aed86f988024c2e6139022c39","0x008b6178e573502eac46923d9df263b57cafa83bb14e7b91080370cf82750f75","0x2ea063d2aad0c7bcadf7fd7493e0cb8352c308a4e4101f128a7c4eb6dd80b118","0x099650fcf5f0c4f8f75189d335f9f176f8d1355ac6a31274782c21345d1f9c2a","0x1b8b6888ec0de5154a5ec2b3ebd4ace865dc035253532ebed5abf575a9e89763","0x024869a9548b8bf6cfe27150c22c88f7df4f0886b6a1f83ccf8e9e0e446901de","0x1aab445b8c2ffd0ae8081d9d6870eb3b1b5a3d60d80c2fdfd820d0aec21c6cb1","0x02a9d09ae2a2cdf547dd84338d33f5212f3189f27fbcf6f19cd10dbb4fcfd783","0x1b0cab4d1a473f0960033080337857646b3cbecca1272e94a563405bcd834256","0x1a49dd69fe18bb0c700d0aba9d697f11cb77bbf50ef1312b0ade6101b6b5970c","0x17a899e0aaba06df5f640dee973615b2a1c2b1a302c36432c0e496c0e1fc12d4","0x29416ace9513e527f7896ed30c14f92cbab613f3eebe6c87f810369c846023f3","0x13aca814f98cc1ba1c8818827876a6b782a579ab0494e03e190ebf6bd448e005","0x00000000000000000000000000000000d00591628e7f3bc935d0615c0808e684","0x0e1e573fd4e227709e85770ce6b1ec54c62a4563a360a85cafa285ef0de23f65","0x0df2626fd4c3b1352933f185d2ea12e6bfafced47ecea438cade894cc6e2db56","0x024a1e3b18a149a7643d0a7413a9f9a859534acb1075a49d79f80ab4b54d2a54","0x1ddc4265b93c17d06fa34332906e26b193c22fca27979dfe1dc7a3481ca26368","0x162ace72663cfa6de2e9f04e51dc9b391a9842df5c390ea45c830cb9ffe41170","0x0495b2a1fdf4505e043a1f14d28d3183875c756190b4f3d573ddcca45271c578","0x108711fd3a535631ffedab15afa2b45462d0109de6a5ce207b728da7fb0cc861","0x12f61ffde0a5cdd06d99615a9a13e9c35c9acf021c34d945a43911d6b5bc7357","0x1892fe8746226c4ff0c22f46b1b5af461256b39da8b35f6ce23b5274ee36d249","0x1e2fdd10ab9f0acf73eafd32c95774c8c81298393531e594203d931326b1313b","0x23ccbb9a111ba94ef713cb1ee0f93a4b7dce7cd4c1b06bbb5e3fd3b15f2b902d","0x00000000000000000000000000000012c0034de11daf4073d7347808aeaa15c3","0x00000000000000000000000000000000002467b5b5f10cf216361cdc1e6ec924","0x00000000000000000000000000000009d0e5bd1b7ed299b7150dd860562b575f","0x00000000000000000000000000000000000121e299f7c5b7b9a264a0237ba9c0","0x000000000000000000000000000000e52730fdae3a174391fede8b22ca59d266","0x000000000000000000000000000000000011e9a259a74f701d565dfbc05db520","0x000000000000000000000000000000e7574bc9af75e9f84a887d120d72b60507","0x000000000000000000000000000000000006f7685fea564d498d183eb56236b0"] \ No newline at end of file diff --git a/cpp/bin-test/README.md b/cpp/bin-test/README.md new file mode 100644 index 0000000000..667ad3b9a2 --- /dev/null +++ b/cpp/bin-test/README.md @@ -0,0 +1,10 @@ +# bb.js Binary Test + +This test runs a sequence of commands that tests a Noir double recursion circuit verifies (src/main.nr). +The circuit has already been compiled and its witness generated in nargo via `nargo compile && nargo execute witness`. + +To test: + +``` +./bin-test.sh +``` diff --git a/cpp/bin-test/Verifier.toml b/cpp/bin-test/Verifier.toml new file mode 100644 index 0000000000..e37ed611d9 --- /dev/null +++ b/cpp/bin-test/Verifier.toml @@ -0,0 +1 @@ +return = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] diff --git a/cpp/bin-test/bin-test.sh b/cpp/bin-test/bin-test.sh new file mode 100755 index 0000000000..756c130ee8 --- /dev/null +++ b/cpp/bin-test/bin-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Script is assumed to be run from +set -eu + +bb() { + ../build/bin/bb "$@" -v +} + +bb gates +bb prove -o proof +bb write_vk -o vk +bb verify -k vk -p proof \ No newline at end of file diff --git a/ts/test/README.md b/cpp/bin-test/src/main.nr similarity index 58% rename from ts/test/README.md rename to cpp/bin-test/src/main.nr index 827c1d5144..7c5b528966 100644 --- a/ts/test/README.md +++ b/cpp/bin-test/src/main.nr @@ -1,29 +1,18 @@ -# Binary Test - -Run: - -``` -./bin-test.sh -``` - -To run a sequence of commands that ultimately tests the following Noir double recursion circuit verifies. - -```rust use dep::std; fn main( - verification_key : [Field; 114], - proof : [Field; 94], - public_inputs : [Field; 1], - key_hash : Field, + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, input_aggregation_object : [Field; 16], proof_b : [Field; 94], ) -> pub [Field; 16] { let output_aggregation_object_a = std::verify_proof( - verification_key, - proof, - public_inputs, - key_hash, + verification_key, + proof, + public_inputs, + key_hash, input_aggregation_object ); @@ -41,4 +30,3 @@ fn main( } output } -``` diff --git a/ts/test/target/main.json b/cpp/bin-test/target/main.json similarity index 100% rename from ts/test/target/main.json rename to cpp/bin-test/target/main.json diff --git a/ts/test/target/witness.tr b/cpp/bin-test/target/witness.tr similarity index 100% rename from ts/test/target/witness.tr rename to cpp/bin-test/target/witness.tr diff --git a/cpp/cmake/threading.cmake b/cpp/cmake/threading.cmake index 758d5f6653..ff60f240a1 100644 --- a/cpp/cmake/threading.cmake +++ b/cpp/cmake/threading.cmake @@ -1,8 +1,10 @@ if(MULTITHREADING) message(STATUS "Multithreading is enabled.") + add_compile_options(-pthread) + add_link_options(-pthread) if(WASM) - add_compile_options(--target=wasm32-wasi-threads -pthread) - add_link_options(--target=wasm32-wasi-threads -pthread) + add_compile_options(--target=wasm32-wasi-threads) + add_link_options(--target=wasm32-wasi-threads) endif() #add_compile_options(-fsanitize=thread) #add_link_options(-fsanitize=thread) diff --git a/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert b/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert index bef1b4565b..07160f75fa 100644 --- a/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert +++ b/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert @@ -16,9 +16,9 @@ WORKDIR /usr/src/barretenberg/cpp COPY . . # Build everything to ensure everything builds. All tests will be run from the result of this build. RUN cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON && cmake --build --preset default -RUN cd build && ./bin/grumpkin_srs_gen 1048576 && cd ../ FROM alpine:3.18 RUN apk update && apk add curl openmp COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db -COPY --from=builder /usr/src/barretenberg/cpp/build/bin/*_tests /usr/src/barretenberg/cpp/build/bin/ \ No newline at end of file +COPY --from=builder /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin +COPY --from=builder /usr/src/barretenberg/cpp/bin-test /usr/src/barretenberg/cpp/bin-test \ No newline at end of file diff --git a/cpp/scripts/bb-tests b/cpp/scripts/bb-tests deleted file mode 100644 index 0bdd2508bb..0000000000 --- a/cpp/scripts/bb-tests +++ /dev/null @@ -1,15 +0,0 @@ -crypto_aes128_tests -crypto_blake2s_tests -crypto_blake3s_tests -crypto_ecdsa_tests -crypto_pedersen_commitment_tests -crypto_schnorr_tests -crypto_sha256_tests -ecc_tests -numeric_tests -plonk_tests -polynomials_tests -join_split_example_proofs_inner_proof_data_tests -join_split_example_proofs_notes_tests -srs_tests -transcript_tests \ No newline at end of file diff --git a/cpp/scripts/bb-tests.sh b/cpp/scripts/bb-tests.sh new file mode 100755 index 0000000000..697d6a7bad --- /dev/null +++ b/cpp/scripts/bb-tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# This script runs all test suites that have not been broken out into their own jobs for parallelisation. +# Might be better to list exclusions here rather than inclusions as risky to maintain. +set -e + +$(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null + +IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert:cache-$COMMIT_HASH + +docker pull $IMAGE_URI + +TESTS=( + crypto_aes128_tests + crypto_blake2s_tests + crypto_blake3s_tests + crypto_ecdsa_tests + crypto_pedersen_commitment_tests + crypto_schnorr_tests + crypto_sha256_tests + ecc_tests + numeric_tests + plonk_tests + polynomials_tests + join_split_example_proofs_inner_proof_data_tests + join_split_example_proofs_notes_tests + srs_tests + transcript_tests +) +TESTS_STR="${TESTS[@]}" + +docker run --rm -t $IMAGE_URI /bin/sh -c "\ + set -e; \ + cd /usr/src/barretenberg/cpp; \ + (cd srs_db && ./download_ignition.sh 1); \ + cd build; \ + ./bin/grumpkin_srs_gen 1048576; \ + for BIN in $TESTS_STR; do ./bin/\$BIN; done" diff --git a/cpp/scripts/bin-test.sh b/cpp/scripts/bin-test.sh new file mode 100755 index 0000000000..b344ea4002 --- /dev/null +++ b/cpp/scripts/bin-test.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Executes the bb binary test script. +set -eu + +$(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null + +IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert:cache-$COMMIT_HASH + +docker pull $IMAGE_URI + +docker run --rm -t $IMAGE_URI /bin/sh -c "\ + set -e; \ + cd /usr/src/barretenberg/cpp/bin-test; \ + ./bin-test.sh" diff --git a/cpp/scripts/build_libacvm_backend.sh b/cpp/scripts/build_libacvm_backend.sh deleted file mode 100755 index ed42572df2..0000000000 --- a/cpp/scripts/build_libacvm_backend.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -eu - -BB_TARGETS=( - libenv.a - libcommon.a - libcrypto_blake2s.a - libcrypto_pedersen_hash.a - libcrypto_pedersen_commitment.a - libcrypto_keccak.a - libcrypto_schnorr.a - libcrypto_generators.a - libnumeric.a -) - -CMD="cmake --preset wasm && cmake --build --preset wasm" -for target in "${BB_TARGETS[@]}"; do CMD="$CMD --target $target"; done -eval $CMD - -cd ./build-wasm/lib - -LIBS=( - $PWD/libenv.a - $PWD/libcommon.a - $PWD/libcrypto_blake2s.a - $PWD/libcrypto_pedersen_hash.a - $PWD/libcrypto_pedersen_commitment.a - $PWD/libcrypto_keccak.a - $PWD/libcrypto_schnorr.a - $PWD/libcrypto_generators.a - $PWD/libnumeric.a - $PWD/../../src/wasi-sdk-20.0/share/wasi-sysroot/lib/wasm32-wasi/libc++.a - $PWD/../../src/wasi-sdk-20.0/share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a -) - -rm -rf scratch -mkdir -p scratch -cd scratch - -for LIB_FILE_PATH in "${LIBS[@]}"; do - LIB=$(basename $LIB_FILE_PATH) - echo Extracting lib: $LIB - mkdir $LIB - cd $LIB - ar x $LIB_FILE_PATH - cd .. -done - -rm -f ../libacvm_backend.a -#../../../src/wasi-sdk-12.0/bin/ar rcs ../libxyz.a libcrypto_blake2s.a/* libc++.a/* libc++abi.a/* libcrypto_pedersen_commitment.a/* -find . -type f -print0 | xargs -0 ../../../src/wasi-sdk-20.0/bin/ar rcs ../libacvm_backend.a diff --git a/cpp/scripts/run_tests b/cpp/scripts/run_tests index 8a178f3568..7459879b2c 100755 --- a/cpp/scripts/run_tests +++ b/cpp/scripts/run_tests @@ -1,4 +1,8 @@ #!/bin/bash +# This is the default test runner which takes the as arguments: +# 1. The number of ignition transcripts to download. +# 2. The set of gtest binary names to run. +# 3-n. The arguments to pass to the gtest binaries. set -e NUM_TRANSCRIPTS=$1 diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 092c65b6a8..852ee14059 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -67,6 +67,7 @@ add_subdirectory(barretenberg/serialize) add_subdirectory(barretenberg/solidity_helpers) add_subdirectory(barretenberg/wasi) add_subdirectory(barretenberg/grumpkin_srs_gen) +add_subdirectory(barretenberg/bb) if(BENCHMARKS) add_subdirectory(barretenberg/benchmark) diff --git a/cpp/src/barretenberg/bb/CMakeLists.txt b/cpp/src/barretenberg/bb/CMakeLists.txt new file mode 100644 index 0000000000..42ccf9bf15 --- /dev/null +++ b/cpp/src/barretenberg/bb/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable( + bb + main.cpp +) + +target_link_libraries( + bb + PRIVATE + barretenberg + env +) \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/exec_pipe.hpp b/cpp/src/barretenberg/bb/exec_pipe.hpp new file mode 100644 index 0000000000..945901a810 --- /dev/null +++ b/cpp/src/barretenberg/bb/exec_pipe.hpp @@ -0,0 +1,22 @@ +#pragma once +#include +#include +#include + +inline std::vector exec_pipe(std::string const& command) +{ + FILE* pipe = popen(command.c_str(), "r"); + if (!pipe) { + throw std::runtime_error("popen() failed!"); + } + + std::vector result; + while (!feof(pipe)) { + uint8_t buffer[128]; + size_t count = fread(buffer, 1, sizeof(buffer), pipe); + result.insert(result.end(), buffer, buffer + count); + } + + pclose(pipe); + return result; +} \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/file_io.hpp b/cpp/src/barretenberg/bb/file_io.hpp new file mode 100644 index 0000000000..ee5814fafa --- /dev/null +++ b/cpp/src/barretenberg/bb/file_io.hpp @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include + +inline std::vector read_file(const std::string& filename) +{ + std::ifstream file(filename, std::ios::binary); + if (!file) { + throw std::runtime_error(format("Unable to open file: ", filename)); + } + std::vector fileData((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + return fileData; +} + +inline void write_file(const std::string& filename, std::vector const& data) +{ + std::ofstream file(filename, std::ios::binary); + if (!file) { + throw std::runtime_error("Failed to open data file for writing"); + } + file.write((char*)data.data(), (std::streamsize)data.size()); + file.close(); +} \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/get_bytecode.hpp b/cpp/src/barretenberg/bb/get_bytecode.hpp new file mode 100644 index 0000000000..4c27c7bcb4 --- /dev/null +++ b/cpp/src/barretenberg/bb/get_bytecode.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "exec_pipe.hpp" + +/** + * We can assume for now we're running on a unix like system and use the following to extract the bytecode. + * Maybe we should consider bytecode being output into its own independent file alongside the JSON? + */ +inline std::vector get_bytecode(const std::string& jsonPath) +{ + std::string command = + "awk -F'\"bytecode\":' '{print $2}' " + jsonPath + " | awk -F'\"' '{print $2}' | base64 -d | gunzip"; + return exec_pipe(command); +} \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/get_crs.hpp b/cpp/src/barretenberg/bb/get_crs.hpp new file mode 100644 index 0000000000..6fbabc6409 --- /dev/null +++ b/cpp/src/barretenberg/bb/get_crs.hpp @@ -0,0 +1,84 @@ +#pragma once +#include "exec_pipe.hpp" +#include "file_io.hpp" +#include "vinfo.hpp" +#include +#include +#include +#include +#include + +inline std::vector download_g1_data(size_t num_points) +{ + size_t g1_start = 28; + size_t g1_end = g1_start + num_points * 64 - 1; + std::string command = "curl -s -H \"Range: bytes=" + std::to_string(g1_start) + "-" + std::to_string(g1_end) + + "\" 'https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/monomial/transcript00.dat'"; + + return exec_pipe(command); +} + +inline std::vector download_g2_data() +{ + size_t g2_start = 28 + 5040000 * 64; + size_t g2_end = g2_start + 128 - 1; + std::string command = "curl -s -H \"Range: bytes=" + std::to_string(g2_start) + "-" + std::to_string(g2_end) + + "\" 'https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/sealed/transcript00.dat'"; + + return exec_pipe(command); +} + +inline std::vector get_g1_data(const std::filesystem::path& path, size_t num_points) +{ + std::filesystem::create_directories(path); + + std::ifstream size_file(path / "size"); + size_t size = 0; + if (size_file) { + size_file >> size; + size_file.close(); + } + if (size >= num_points) { + vinfo("using cached crs at: ", path); + auto data = read_file(path / "g1.dat"); + auto points = std::vector(num_points); + barretenberg::srs::IO::read_affine_elements_from_buffer( + points.data(), (char*)data.data(), num_points * 64); + return points; + } + + std::ofstream new_size_file(path / "size"); + if (!new_size_file) { + throw std::runtime_error("Failed to open size file for writing"); + } + new_size_file << num_points; + new_size_file.close(); + + vinfo("downloading crs..."); + auto data = download_g1_data(num_points); + + write_file(path / "g1.dat", data); + + auto points = std::vector(num_points); + barretenberg::srs::IO::read_affine_elements_from_buffer( + points.data(), (char*)data.data(), data.size()); + return points; +} + +inline barretenberg::g2::affine_element get_g2_data(const std::filesystem::path& path) +{ + std::filesystem::create_directories(path); + + try { + auto data = read_file(path / "g2.dat"); + barretenberg::g2::affine_element g2_point; + barretenberg::srs::IO::read_affine_elements_from_buffer(&g2_point, (char*)data.data(), 128); + return g2_point; + } catch (std::exception&) { + auto data = download_g2_data(); + write_file(path / "g2.dat", data); + barretenberg::g2::affine_element g2_point; + barretenberg::srs::IO::read_affine_elements_from_buffer(&g2_point, (char*)data.data(), 128); + return g2_point; + } +} \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/main.cpp b/cpp/src/barretenberg/bb/main.cpp new file mode 100644 index 0000000000..bb7ae1e94b --- /dev/null +++ b/cpp/src/barretenberg/bb/main.cpp @@ -0,0 +1,183 @@ +#include "barretenberg/bb/get_crs.hpp" +#include "file_io.hpp" +#include "get_bytecode.hpp" +#include +#include +#include +#include +#include +#include +#include + +using namespace barretenberg; + +uint32_t MAX_CIRCUIT_SIZE = 1 << 19; +auto CRS_PATH = "./crs"; +bool verbose = false; + +void init() +{ + // Must +1! + auto g1_data = get_g1_data(CRS_PATH, MAX_CIRCUIT_SIZE + 1); + auto g2_data = get_g2_data(CRS_PATH); + srs::init_crs_factory(g1_data, g2_data); +} + +acir_format::WitnessVector get_witness(std::string const& witness_path) +{ + auto witness_data = read_file(witness_path); + // We need to prefix the number of fields to comply with serialization format. + // TODO: Make noir side output witness data prefixed. + return from_buffer( + join({ to_buffer((uint32_t)witness_data.size() / 32), witness_data })); +} + +acir_format::acir_format get_contraint_system(std::string const& json_path) +{ + auto bytecode = get_bytecode(json_path); + return from_buffer(bytecode.data()); +} + +void proveAndVerify(const std::string& jsonPath, const std::string& witnessPath, bool recursive) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto constraint_system = get_contraint_system(jsonPath); + auto witness = get_witness(witnessPath); + auto proof = acir_composer->create_proof(srs::get_crs_factory(), constraint_system, witness, recursive); + auto verified = acir_composer->verify_proof(proof, recursive); + info("verified: ", verified); +} + +void prove(const std::string& jsonPath, const std::string& witnessPath, bool recursive, const std::string& outputPath) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto constraint_system = get_contraint_system(jsonPath); + auto witness = get_witness(witnessPath); + auto proof = acir_composer->create_proof(srs::get_crs_factory(), constraint_system, witness, recursive); + write_file(outputPath, proof); + info("proof written to: ", outputPath); +} + +void gateCount(const std::string& jsonPath) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto constraint_system = get_contraint_system(jsonPath); + acir_composer->create_circuit(constraint_system); + info("gates: ", acir_composer->get_total_circuit_size()); +} + +bool verify(const std::string& proof_path, bool recursive, const std::string& vk_path) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto vk_data = from_buffer(read_file(vk_path)); + acir_composer->load_verification_key(barretenberg::srs::get_crs_factory(), std::move(vk_data)); + auto verified = acir_composer->verify_proof(read_file(proof_path), recursive); + info("verified: ", verified); + return verified; +} + +void writeVk(const std::string& jsonPath, const std::string& outputPath) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto constraint_system = get_contraint_system(jsonPath); + acir_composer->init_proving_key(srs::get_crs_factory(), constraint_system); + auto vk = acir_composer->init_verification_key(); + write_file(outputPath, to_buffer(*vk)); + info("vk written to: ", outputPath); +} + +void contract(const std::string& output_path, const std::string& vk_path) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto vk_data = from_buffer(read_file(vk_path)); + acir_composer->load_verification_key(barretenberg::srs::get_crs_factory(), std::move(vk_data)); + auto contract = acir_composer->get_solidity_verifier(); + if (output_path == "-") { + info(contract); + } else { + write_file(output_path, { contract.begin(), contract.end() }); + info("contract written to: ", output_path); + } +} + +void proofAsFields(const std::string& proof_path, std::string const& vk_path, const std::string& output_path) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto vk_data = from_buffer(read_file(vk_path)); + auto data = acir_composer->serialize_proof_into_fields(read_file(proof_path), vk_data.num_public_inputs); + auto json = format("[", join(map(data, [](auto fr) { return format("\"", fr, "\""); })), "]"); + write_file(output_path, { json.begin(), json.end() }); + info("proof as fields written to: ", output_path); +} + +void vkAsFields(const std::string& vk_path, const std::string& output_path) +{ + auto acir_composer = new acir_proofs::AcirComposer(MAX_CIRCUIT_SIZE, verbose); + auto vk_data = from_buffer(read_file(vk_path)); + acir_composer->load_verification_key(barretenberg::srs::get_crs_factory(), std::move(vk_data)); + auto data = acir_composer->serialize_verification_key_into_fields(); + + // We need to move vk_hash to the front... + std::rotate(data.begin(), data.end() - 1, data.end()); + + auto json = format("[", join(map(data, [](auto fr) { return format("\"", fr, "\""); })), "]"); + write_file(output_path, { json.begin(), json.end() }); + info("vk as fields written to: ", output_path); +} + +bool flagPresent(std::vector& args, const std::string& flag) +{ + return std::find(args.begin(), args.end(), flag) != args.end(); +} + +std::string getOption(std::vector& args, const std::string& option, const std::string& defaultValue) +{ + auto itr = std::find(args.begin(), args.end(), option); + return (itr != args.end() && std::next(itr) != args.end()) ? *(std::next(itr)) : defaultValue; +} + +int main(int argc, char* argv[]) +{ + std::vector args(argv + 1, argv + argc); + verbose = flagPresent(args, "-v") || flagPresent(args, "--verbose"); + + if (args.empty()) { + std::cerr << "No command provided.\n"; + return 1; + } + + std::string command = args[0]; + + std::string json_path = getOption(args, "-j", "./target/main.json"); + std::string witness_path = getOption(args, "-w", "./target/witness.tr"); + std::string proof_path = getOption(args, "-p", "./proofs/proof"); + std::string vk_path = getOption(args, "-k", "./target/vk"); + bool recursive = flagPresent(args, "-r") || flagPresent(args, "--recursive"); + init(); + + if (command == "prove_and_verify") { + proveAndVerify(json_path, witness_path, recursive); + } else if (command == "prove") { + std::string output_path = getOption(args, "-o", "./proofs/proof"); + prove(json_path, witness_path, recursive, output_path); + } else if (command == "gates") { + gateCount(json_path); + } else if (command == "verify") { + verify(proof_path, recursive, vk_path); + } else if (command == "contract") { + std::string output_path = getOption(args, "-o", "./target/contract.sol"); + contract(output_path, vk_path); + } else if (command == "write_vk") { + std::string output_path = getOption(args, "-o", "./target/vk"); + writeVk(json_path, output_path); + } else if (command == "proof_as_fields") { + std::string output_path = getOption(args, "-o", proof_path + "_fields.json"); + proofAsFields(proof_path, vk_path, output_path); + } else if (command == "vk_as_fields") { + std::string output_path = getOption(args, "-o", vk_path + "_fields.json"); + vkAsFields(vk_path, output_path); + } else { + std::cerr << "Unknown command: " << command << "\n"; + return -1; + } +} \ No newline at end of file diff --git a/cpp/src/barretenberg/bb/vinfo.hpp b/cpp/src/barretenberg/bb/vinfo.hpp new file mode 100644 index 0000000000..3125123276 --- /dev/null +++ b/cpp/src/barretenberg/bb/vinfo.hpp @@ -0,0 +1,11 @@ +#pragma once +#include + +extern bool verbose; + +template inline void vinfo(Args... args) +{ + if (verbose) { + info(args...); + } +} \ No newline at end of file diff --git a/cpp/src/barretenberg/common/parallel_for_omp.cpp b/cpp/src/barretenberg/common/parallel_for_omp.cpp index 8a5ce92412..9739776527 100644 --- a/cpp/src/barretenberg/common/parallel_for_omp.cpp +++ b/cpp/src/barretenberg/common/parallel_for_omp.cpp @@ -3,7 +3,9 @@ void parallel_for_omp(size_t num_iterations, const std::function& func) { +#ifndef NO_OMP_MULTITHREADING #pragma omp parallel for +#endif for (size_t i = 0; i < num_iterations; ++i) { func(i); } diff --git a/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp b/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp index 5ff94a3ecc..d95467e44a 100644 --- a/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp +++ b/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.cpp @@ -11,9 +11,10 @@ namespace acir_proofs { -AcirComposer::AcirComposer(size_t size_hint) +AcirComposer::AcirComposer(size_t size_hint, bool verbose) : composer_(/*p_key=*/0, /*v_key=*/0) , size_hint_(size_hint) + , verbose_(verbose) {} void AcirComposer::create_circuit(acir_format::acir_format& constraint_system) @@ -33,7 +34,7 @@ void AcirComposer::create_circuit(acir_format::acir_format& constraint_system) void AcirComposer::init_proving_key(std::shared_ptr const& crs_factory, acir_format::acir_format& constraint_system) { - info("building circuit... ", size_hint_); + vinfo("building circuit... ", size_hint_); builder_ = acir_format::Builder(size_hint_); acir_format::create_circuit(builder_, constraint_system); @@ -46,7 +47,7 @@ void AcirComposer::init_proving_key(std::shared_ptr AcirComposer::create_proof( // Release prior memory first. composer_ = acir_format::Composer(/*p_key=*/0, /*v_key=*/0); - info("building circuit..."); + vinfo("building circuit..."); create_circuit_with_witness(builder_, constraint_system, witness); composer_ = [&]() { @@ -73,7 +74,7 @@ std::vector AcirComposer::create_proof( } }(); if (!proving_key_) { - info("computing proving key..."); + vinfo("computing proving key..."); proving_key_ = composer_.compute_proving_key(builder_); } @@ -83,7 +84,7 @@ std::vector AcirComposer::create_proof( witness.clear(); witness.shrink_to_fit(); - info("creating proof..."); + vinfo("creating proof..."); std::vector proof; if (is_recursive) { auto prover = composer_.create_prover(builder_); @@ -92,12 +93,13 @@ std::vector AcirComposer::create_proof( auto prover = composer_.create_ultra_with_keccak_prover(builder_); proof = prover.construct_proof().proof_data; } - info("done."); + vinfo("done."); return proof; } std::shared_ptr AcirComposer::init_verification_key() { + vinfo("computing verification key..."); return verification_key_ = composer_.compute_verification_key(builder_); } @@ -112,7 +114,7 @@ void AcirComposer::load_verification_key(std::shared_ptr const& proof, bool is_recursive) { if (!verification_key_) { - info("computing verification key..."); + vinfo("computing verification key..."); verification_key_ = composer_.compute_verification_key(builder_); } diff --git a/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp b/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp index f32fd98828..3b25c26f2d 100644 --- a/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp +++ b/cpp/src/barretenberg/dsl/acir_proofs/acir_composer.hpp @@ -9,7 +9,7 @@ namespace acir_proofs { class AcirComposer { public: - AcirComposer(size_t size_hint = 0); + AcirComposer(size_t size_hint = 0, bool verbose = true); void create_circuit(acir_format::acir_format& constraint_system); @@ -46,6 +46,14 @@ class AcirComposer { size_t circuit_subgroup_size_; std::shared_ptr proving_key_; std::shared_ptr verification_key_; + bool verbose_ = true; + + template inline void vinfo(Args... args) + { + if (verbose_) { + info(args...); + } + } }; } // namespace acir_proofs diff --git a/cpp/src/barretenberg/grumpkin_srs_gen/grumpkin_srs_gen.cpp b/cpp/src/barretenberg/grumpkin_srs_gen/grumpkin_srs_gen.cpp index a6f8f059f4..4f5ac39443 100644 --- a/cpp/src/barretenberg/grumpkin_srs_gen/grumpkin_srs_gen.cpp +++ b/cpp/src/barretenberg/grumpkin_srs_gen/grumpkin_srs_gen.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -25,6 +26,9 @@ int main(int argc, char** argv) // https://github.com/AztecProtocol/ignition-verification/blob/master/Transcript_spec.md const size_t subgroup_size = (size_t)atoi(args[1].c_str()); const std::string srs_path = (args.size() > 2) ? args[2] : "../srs_db/grumpkin/"; + // Why is the full path derived inside the io code!? The above should have monomial on the end and io should + // write the files to the dir that was given. + std::filesystem::create_directories(std::filesystem::path(srs_path) / "monomial"); std::vector srs(subgroup_size); diff --git a/flake.nix b/flake.nix index 1d34c0fb70..6a672cbf05 100644 --- a/flake.nix +++ b/flake.nix @@ -42,7 +42,7 @@ shellDefaults = { nativeBuildInputs = [ pkgs.starship - pkgs.llvmPackages_12.llvm + pkgs.llvmPackages_15.llvm ]; shellHook = '' @@ -52,19 +52,15 @@ in rec { packages = { - llvm11 = pkgs.barretenberg; - llvm12 = pkgs.barretenberg.override { - llvmPackages = pkgs.llvmPackages_12; + llvm15 = pkgs.barretenberg.override { + llvmPackages = pkgs.llvmPackages_15; }; - llvm13 = pkgs.barretenberg.override { - llvmPackages = pkgs.llvmPackages_13; - }; - llvm14 = pkgs.barretenberg.override { - llvmPackages = pkgs.llvmPackages_14; + llvm16 = pkgs.barretenberg.override { + llvmPackages = pkgs.llvmPackages_16; }; wasm32 = pkgs.barretenberg-wasm; - default = packages.llvm11; + default = packages.llvm15; } // crossTargets; # Provide legacyPackages with our overlay so we can run diff --git a/ts/bin-test/.gitignore b/ts/bin-test/.gitignore new file mode 100644 index 0000000000..ecce843009 --- /dev/null +++ b/ts/bin-test/.gitignore @@ -0,0 +1,3 @@ +proof +vk +crs \ No newline at end of file diff --git a/ts/bin-test/Nargo.toml b/ts/bin-test/Nargo.toml new file mode 100644 index 0000000000..670888e37c --- /dev/null +++ b/ts/bin-test/Nargo.toml @@ -0,0 +1,5 @@ +[package] +authors = [""] +compiler_version = "0.6.0" + +[dependencies] \ No newline at end of file diff --git a/ts/bin-test/Prover.toml b/ts/bin-test/Prover.toml new file mode 100644 index 0000000000..3b4ca3c198 --- /dev/null +++ b/ts/bin-test/Prover.toml @@ -0,0 +1,6 @@ +input_aggregation_object = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"] +key_hash = "0x284158f92a5305f662f78fc36a397fb8eb44d229fd22152e2dc085cad142c3c2" +proof = ["0x000000000000000000000000000000000000000000000000000000000000000a","0x0000000000000000000000000000005e77a294b0829c1233b25f34cbd1e36ca5","0x00000000000000000000000000000000001efb564c6d131a2005503e7bc96dfd","0x0000000000000000000000000000003a2960d64558302ab11263ac1d4e99c792","0x000000000000000000000000000000000027934be1b834b8444d8974e4c1c9bb","0x000000000000000000000000000000a5e281184b833e3567ce8e285c80bd7dfc","0x00000000000000000000000000000000002ef660bd670bea9dc8e18192cb71fa","0x00000000000000000000000000000075b29302806ec08bb2c7af1b5463fc34fa","0x00000000000000000000000000000000001138c220233f7b40034a4f49a23ae6","0x000000000000000000000000000000c24fb0b91d6ea29b55a925f221c5b285d8","0x000000000000000000000000000000000013ff3e12b86654ca896bfd6bbedd69","0x0000000000000000000000000000005709282fede94015f85bce4c39d859e34a","0x00000000000000000000000000000000000fb8a86b7540bfdc1c2784d7943400","0x00000000000000000000000000000020bf9ff7ac6ddadf43c1f9128f13f66481","0x000000000000000000000000000000000012f42d353e8a008c1c65650aea9720","0x0000000000000000000000000000009b8c079fcd0a17aecbda82b255ac26131b","0x000000000000000000000000000000000027fe6ea46f3898befbae77137e493e","0x0000000000000000000000000000002a66a58be32207d7ac2e318e6d3235edac","0x00000000000000000000000000000000000fa3dfdf2bbf7c51f39b861dc44be6","0x0000000000000000000000000000003746eb9ded01fcafcc65c5d87f49141ee5","0x00000000000000000000000000000000001e65f8c6b1af063d4103022b38cd3e","0x00000000000000000000000000000046c520b61b4608d1bc2c98ca800765ebd7","0x000000000000000000000000000000000020434f43987d0f71d0a1aa2ed8f270","0x000000000000000000000000000000827b6b7c3b2a9c71a45a253a2a298c47f4","0x000000000000000000000000000000000009e45e0d42b0e22cbde0f4667e6288","0x000000000000000000000000000000c8150ed84dd7b794ce5427fe99040bcd3d","0x00000000000000000000000000000000002696a5d48bf45b5a80619ef91013d4","0x0000000000000000000000000000003a1caa16acc8da5032b2e836770312009d","0x0000000000000000000000000000000000237a8423952c1c64e1e7c75da9d7cf","0x0000000000000000000000000000000d8eb5fa6490a4cd67943b646d05bd0859","0x0000000000000000000000000000000000159ebdb4a5c764c0346287984ed47d","0x000000000000000000000000000000e862c821c535a49e93959d08dc9f2645b5","0x00000000000000000000000000000000000c440edae454a8865dc27c8de51090","0x000000000000000000000000000000a6973dd133a0e974b564e76d185a4b06b0","0x000000000000000000000000000000000016248ed7566da68af6f2bc248763b4","0x000000000000000000000000000000a568fd8430c974e995915c9265ac74617d","0x000000000000000000000000000000000006e205349a7913be4af0af8778a0fd","0x00000000000000000000000000000009fd63b6ca1767490d4ce191e7332fbdd6","0x00000000000000000000000000000000000f95d28c7e720dc455fd46a532731e","0x00000000000000000000000000000008d1b9d51b2425ddf4a15bc5307ea911b4","0x000000000000000000000000000000000001131845742cefc926b7d2b7dc4b9c","0x0000000000000000000000000000008dbc181365f1a3db87a66d527ca9d81ca5","0x00000000000000000000000000000000000a6f78cdcd1e2177580e6c89c23235","0x0000000000000000000000000000004723acbe295108f00ff760c0671d2d4bbf","0x000000000000000000000000000000000006058d93abb1d596501ee4c3f62971","0x08bacf9fdaba383e584559b8cd64ae8c04e670d9203f90c6b49efac7f00f5003","0x18541473055ebbcaefe15759125b820ed1c6b932af2659c5280bdf70bd5c09cc","0x161e0a0cb1aa6028cabb8ccb98646a9b0976618cad99bb1145c4d25cecef50be","0x0d353ffc0833fd6e1947133f5391544ed7dde0fbfa0109ec7a54baafb117b1ca","0x1a5209fd1dcf2705b7081b4e3bf7b2c33dd00ac4b2becfdf8ee7927703ea0357","0x1d247635110c48df6f62387026c5823f0eb9d843848fe7b8e1a9a96b1c6ad763","0x1cc4a7a8be5edc32432191b0ee2a9051d3b6384313c6b9e5efe8cd8712c872f2","0x2c8b6fa617041faeb2e814b39c288ff607ac03d746f3c0e622860720dfb24b83","0x1ecc99a77fda5d79a6426b18049876b36ad1a1aba693518b1b976360630c2f55","0x2f75dc15bb6fdd3d9762fe74485c5ead7a5476c11cd44ed9f43324028cd2dd68","0x0e20add7931c78604ef7986fe7b286ab582842a23b4c09e8ec03d8d88a31969c","0x2467bb747466b69b6b4deeaac4a82e32ca7585194cd838912a65d12f912b5c6c","0x23edab06b87cf9fd4a5f0161287283d97a9bcdbdd68779e08cad3e763420bd20","0x2817c054ad1ac5454f58ff525196ed920ba54fbb4d86820a5a414aaa61d7d1b1","0x12d63d1f6ed0a080694a209534ee08e4758b0382f9bab7e13aafcbcb62ecc8d0","0x153104c35caab490767364a7db8bca01043c63f358f20edd6205c544cf4a61ea","0x178bcc674a84c8a0839ca8ba82298b1d92edc463b82965d9895bbebe3ba7fb04","0x1224834d4b8a36290e11b8b153d81062ba503c36d6e7ef41916b647517a6e632","0x13112373ea4e5bf7e041a7312167b4f82653ead2f5e5e3d4d07bafd79ca690b6","0x26b7669e3463c6d162363b2cd0e8f6720aa97f9cdb04a8340fce7ead2421af56","0x120d09593529a665d992bf009fc6268a9088c95f401784f939d5ed1649a4e779","0x1c415baf2638f0c09def30dfcf650d56b0508544769813d1d807b1b114632d38","0x1e9c2353141304d0ab1874f27602ce733f01e5b4d5cf6acdff5dab2a80c0c652","0x20f6eaf701ed18e0b841b9051ca08f8fcdb346253506c1ca26b3a4a3ed1e5f6c","0x2351b29aefc72cf0c56afd17c33e50ac5c64a695943e18c64e099e1d597bf886","0x19e6940b385edcb090c5eccd28c74c3a219f24d41760bcd5b0b1b837a805941e","0x2cd7e4b967101d6ee0f2a33521762cace8ffe35930bc210554e8307df664c899","0x041f06de46e4862d5d59c363c119a79629261d6aa18aa737c288ac7f4bfb4153","0x2dc39620da58c2822418179ba6f61de6d31ee938c79a5ca15c473aef7ca1e824","0x00000000000000000000000000000000ffbd168649f4e00f0baef4ec3a08615f","0x18fbeff26a87cb38f373584bbd02d016fed78aefc6462811a23006679509b3a9","0x1888e78ad37d146406e710ae2dbd244877263b133875d090f7615a1e9c0ac083","0x2196fbe28ce9ce0e0e202bbf1268cabdcd0a2c03588e118765ba1ee1a16f2dc7","0x0137bc731354b1531dbdcbfc83802605035f69f937f9a7311a57e6d7126368ba","0x19f38da8f0717fe78812addd655ef59411805d70eb731d5da309ad111698e8d0","0x155452e2824d5bd4fd8f8e5feaa4bd7abe783613d6b78cf88377a48e9f7e70c2","0x2396966b07a6e535a9ae30883a97e854ff2425c6dcfa34bda164394ba919191f","0x09374f47b862065ac0ac49ceb02b5cc0d925af1980ab2bd5f4d9df555e8c4c91","0x26366e50b5c7244ffc3ecdf50a65180742b1c53092659bd1db852bdd726d52f3","0x12d13ee6d1faa21b7f810c64e31d7af08409f2ff2a669b3c7e4e82d1964e5954","0x2fd05defcf5fc010bb13908b3d573636ed9609163c210b3864f9cf59aa2f5fb6","0x00000000000000000000000000000046955fdfd58ca9013b39025ae688416131","0x00000000000000000000000000000000001d335d2fb9857cbc49e72cf34e86a5","0x0000000000000000000000000000000c6a8930092b36c72dbd0a7f4b65533c19","0x00000000000000000000000000000000000d099ff72ffae0f73756528d629a5e","0x0000000000000000000000000000008c8d80c3f2886519cb37a563f88f166cb8","0x00000000000000000000000000000000000393e9f6fdc31492e4b3da33fa5fe4","0x000000000000000000000000000000417fb818a6933554bf3ff602f1f450728d","0x00000000000000000000000000000000002074eb75888a752047676f72f5343f"] +public_inputs = ["0x000000000000000000000000000000000000000000000000000000000000000a"] +verification_key = ["0x21082ca216cbbf4e1c6e4f4594dd508c996dfbe1174efb98b11509c6e306460b","0x0000000000000000000000000000000000000000000000000000000000000010","0x0000000000000000000000000000000000000000000000000000000000000005","0x0000000000000000000000000000000000000000000000000000000000000010","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000004cf4015c3a5297f556c3b72581f2dca64d","0x00000000000000000000000000000000000a67b44462aa65528a3e3b181e0bcd","0x00000000000000000000000000000091507f347e13f13eec9d9f327ac25ada11","0x00000000000000000000000000000000001993946f40247aa93aedba75857f3e","0x0000000000000000000000000000005d340a5ecb1a33c0b7055734ef91200c97","0x00000000000000000000000000000000001eebbe1207643a8bd1669b999e8226","0x0000000000000000000000000000006b27d5d1ffba12754d0718481e1a9a419a","0x00000000000000000000000000000000002f08a6a07ed616c588bcf4e3555c00","0x0000000000000000000000000000003cbc8e573c1299e8ba491bd2218a413bd7","0x0000000000000000000000000000000000192b586ec6fb3b1b6d063a00a86c65","0x000000000000000000000000000000c4516b3cffabe3dcdd074d74f595c81c04","0x000000000000000000000000000000000021142418da600cf97a5248cbd45524","0x000000000000000000000000000000c292117b1a17fefe9de0bfd9edf1a84bf9","0x000000000000000000000000000000000002d6fd9e84dbe74b7531e1801405a1","0x000000000000000000000000000000459a3b2a0b768da45ac7af7f2aec40fc42","0x0000000000000000000000000000000000293c6ab3c06a0669af13393a82c60a","0x0000000000000000000000000000006c845044cca9a2d9dbf94039a11d999aaa","0x00000000000000000000000000000000000efe5ad29f99fce939416b6638dff2","0x000000000000000000000000000000587f768022c11ac8e37cd9dce243d01ef2","0x00000000000000000000000000000000000a44bf49517a4b66ae6b51eee6ac68","0x00000000000000000000000000000059d49ef10107e88711fc0919e244e17a08","0x0000000000000000000000000000000000132d159fdf1907b0619b9809904594","0x00000000000000000000000000000016d9bd1186bcef7a31846ce703eb4cb5b2","0x0000000000000000000000000000000000291c00ed4a7689fec327330104b85c","0x0000000000000000000000000000004b6c55389300451eb2a2deddf244129e7a","0x000000000000000000000000000000000018c3e78f81e83b52719158e4ac4c2f","0x0000000000000000000000000000008d7beb75f905a5894e18d27c42c62fd797","0x00000000000000000000000000000000000002e9c902fe5cd49b64563cadf3bb","0x0000000000000000000000000000000d9e28aa6d00e046852781a5f20816645c","0x00000000000000000000000000000000002cbce7beee3076b78dace04943d69d","0x000000000000000000000000000000fd915d11bfedbdc0e59de09e5b28952080","0x00000000000000000000000000000000002bc27ec2e1612ea284b08bcc55b6f2","0x000000000000000000000000000000be6ed4f4d252a79059e505f9abc1bdf3ed","0x00000000000000000000000000000000000ad34b5e8db72a5acf4427546c7294","0x00000000000000000000000000000090a049f42a3852acd45e6f521f24b4900e","0x00000000000000000000000000000000001e5b26790a26eb340217dd9ad28dbf","0x000000000000000000000000000000ac27e570ae50bc180509764eb3fef94815","0x0000000000000000000000000000000000155a0f51fec78c33ffceb7364d69d7","0x000000000000000000000000000000b644999713a8d3c66e9054aa5726324c76","0x00000000000000000000000000000000001c1c4720bed44a591d97cbc72b6e44","0x000000000000000000000000000000058cc5ad51753faec2a5908155d472e429","0x00000000000000000000000000000000000f7261cf55a71f4d0d7b961dda9ddb","0x0000000000000000000000000000004a36df78f0d50144437ef26f8bbfe69ac1","0x00000000000000000000000000000000001b7b1a10c1e638ce11d8c84b831aca","0x000000000000000000000000000000826ba5b1d1ddd8d6bb960f01cd1321a169","0x0000000000000000000000000000000000163a9c8b67447afccc64e9ccba9d9e","0x0000000000000000000000000000007653a773088aba5c6b1337f435188d72c4","0x000000000000000000000000000000000019256311d43dbc795f746c63b20966","0x000000000000000000000000000000df58a7bad9afe3651be67bc6c298092e11","0x00000000000000000000000000000000001fa51a0d75363b3af4e259e0dbb2c5","0x000000000000000000000000000000c8b5836b29551d41dbc04bdb1fcf1a1868","0x000000000000000000000000000000000021915198840ad9c3666122b2837aea","0x0000000000000000000000000000005df0e69d7efdbc7898b3762f0a0ed976ad","0x00000000000000000000000000000000000cee6b75dcf02a07c50939e8ca3cf3","0x00000000000000000000000000000066a493be1ea69d2b335152719acd54d735","0x000000000000000000000000000000000027e49262bd388ce2d0f193988f3b8f","0x000000000000000000000000000000dd783bff1a1cfc999bb29859cfb16c46fc","0x000000000000000000000000000000000002c397073c8abce6d4140c9b961209","0x000000000000000000000000000000750599be670db593af86e1923fe8a1bb18","0x00000000000000000000000000000000002b7bba2d1efffce0d033f596b4d030","0x0000000000000000000000000000008ffb571a4b3cf83533f3f71b99a04f6e6b","0x00000000000000000000000000000000002c71c58b66498f903b3bbbda3d05ce","0x0000000000000000000000000000002afaefbcbd080c84dcea90b54f4e0a858f","0x0000000000000000000000000000000000039dce37f94d1bbd97ccea32a224fe","0x00000000000000000000000000000075783c73cfe56847d848fd93b63bf32083","0x000000000000000000000000000000000027dc44977efe6b3746a290706f4f72","0x000000000000000000000000000000de0cbf2edc8f085b16d73652b15eced8f5","0x00000000000000000000000000000000000a5366266dd7b71a10b356030226a2","0x00000000000000000000000000000000a7588ec4d6809c90bb451005a3de3077","0x0000000000000000000000000000000000136097d79e1b0ae373255e8760c499","0x000000000000000000000000000000f2595d77bdf72e4acdb0b0b43969860d98","0x000000000000000000000000000000000013dd7515ccac4095302d204f06f0bf","0x000000000000000000000000000000057fe211dad1b706e49a3b55920fac20ec","0x000000000000000000000000000000000016ff3501369121d410b445929239ba","0x000000000000000000000000000000eb8007673c1ed10b834a695adf0068522a","0x00000000000000000000000000000000001e190987ebd9cf480f608b82134a00","0x0000000000000000000000000000000944f94301aa6da3016a226de04de52f4c","0x00000000000000000000000000000000001e44194e60f0ab4ee0f77adc50f422","0x0000000000000000000000000000006c2c7bea37dfbd20be6bed19efd743397a","0x00000000000000000000000000000000002a017d0d9f40d0aeb5c8152ffddec5","0x0000000000000000000000000000007f43efe5631bf48c872c317bed3b8bf12b","0x000000000000000000000000000000000027579be0883627093cf8bdec0b72e7","0x000000000000000000000000000000cef6108b89e89b35679431d113f3be7dff","0x00000000000000000000000000000000000ddb2d01ec88ed69144177a4af3850","0x0000000000000000000000000000000083e7ab1f26781948b36d131759f7c8c9","0x00000000000000000000000000000000000a7fe830f1cb7a5d49d71877dd226a","0x0000000000000000000000000000001834ecd1ce1e8e80812bdd95f960a45e57","0x00000000000000000000000000000000002db7a5185064e6501ef61e989895a0","0x000000000000000000000000000000363f0c994e91cecad25835338edee2294f","0x00000000000000000000000000000000002eea648c8732596b1314fe2a4d2f05","0x000000000000000000000000000000b2671d2ae51d31c1210433c3972bb64578","0x00000000000000000000000000000000000ab49886c2b94bd0bd3f6ed1dbbe2c"] +proof_b = ["0x000000000000000000000000000000000000000000000000000000000000000a","0x000000000000000000000000000000522e2d3071a75aa35d1e477d9e0ad3c0c2","0x000000000000000000000000000000000027bd4377f2ede7bc0133dde7d3b79d","0x000000000000000000000000000000df15ed61667d6fc6b99b97daafc3f7eddb","0x000000000000000000000000000000000003572ca7295a3ee92dc2ddafed48cd","0x000000000000000000000000000000b5dfb839be2c47c3d0e289df3c482bf286","0x00000000000000000000000000000000002471c02fbda062e36bcc7fbdf42dce","0x000000000000000000000000000000e3cbbbc33fb43fb006bd9f8e02dfd4cf9b","0x00000000000000000000000000000000000b3eb6b7a756351688c2561977d618","0x00000000000000000000000000000058d410d526cbd3adbee65868596758007f","0x0000000000000000000000000000000000289c7fe794a87811176d6b8a3973b3","0x000000000000000000000000000000deebf1d6b009435d734b2399d3558eb3f7","0x000000000000000000000000000000000023b6573225d811337c37b16691b872","0x000000000000000000000000000000c29b8cb5048472631403ee526a725ac163","0x0000000000000000000000000000000000206bff7bf596fde59255e7b85f9c7a","0x000000000000000000000000000000d8907ebb05228e706b57826cfc8207af57","0x0000000000000000000000000000000000305f614425315c05fc891c9a92a743","0x000000000000000000000000000000f183e5285136ab6c87d28dcfb65a99b02c","0x00000000000000000000000000000000000383ca0c47e2c56d39f5b58b9726a4","0x000000000000000000000000000000cc11844c28848bcdb1575af5bbae6eafa5","0x000000000000000000000000000000000018b1f820411130433f38ede2bd9158","0x000000000000000000000000000000821bd5681fdbbc82311485f9750ecda390","0x0000000000000000000000000000000000064257d786e839c16aa159b3672cc8","0x0000000000000000000000000000000e5205d207323e06ea8a18111dff8354af","0x00000000000000000000000000000000001254044ff7e569e4002f38956d2762","0x0000000000000000000000000000004591d851f6226ffe1a8a63456ee13411f7","0x00000000000000000000000000000000002b118f2b6639c3f776ed6847f98863","0x000000000000000000000000000000a0a0f63e73dd651c139b2fc3f45e9f4a94","0x00000000000000000000000000000000002669baf309d743d8c94871745bb19a","0x0000000000000000000000000000004cafdee2031bda8c4a2be55862c864524e","0x000000000000000000000000000000000002e68b1c1d2454113f78a184434cf2","0x000000000000000000000000000000899c0497e76b6b345776d9990c8eee4160","0x00000000000000000000000000000000000ec802d07823d277acf631b5c451f3","0x000000000000000000000000000000d5f1fa88434b81dd239ca62a3d168ff20e","0x000000000000000000000000000000000028511b798a4e506da8219fefcfe462","0x000000000000000000000000000000597adcfba2064c09a9e57b37d6a50fe775","0x00000000000000000000000000000000001f691d6d4cbed7b749f55e9af17403","0x00000000000000000000000000000071c78d719253bf3165591474d0a27a50ac","0x000000000000000000000000000000000024858bf4aff0e08df3c03fae341fc0","0x000000000000000000000000000000d0e80eafe0f0d2c1f760bd98087a069da0","0x0000000000000000000000000000000000266239c233e34815ca720e2e378f21","0x000000000000000000000000000000ad6462e3eca1c9a94e4dd30f3cecba48ad","0x0000000000000000000000000000000000147e1bff29ff6979f76ab6d840ded4","0x00000000000000000000000000000047cd629558a91f9db60c63944fa3835cdb","0x00000000000000000000000000000000002531925eaa902131ef11542fb5b20a","0x198e99c9dbc6f3ca902d080fdafb51410ee129edf20015c8337964f3f92b0376","0x2f04d8358d5740b6fa3aca9893cac185d641f2a00089b2bc428401ac21343d2c","0x2d5e2a67dee4e227ca84367a7d7ecd4860b1586a0d1eb799a41ee1042857e46a","0x2651bde5af62489c373d5fa812d6140b60df4569c6184d0d38f6f55dd49ec439","0x10e9e9d0cb817c09034cf3a4dbc9a44ed7a2618fd0281bf0d07a30b12facc6ea","0x11256980eccf0e654c61db759c8d71b04cd9a7c74d44165beaca2978aae075a9","0x2360ce983c2edb38f60b84a7f5ade89eed1fdb65363227e737dffbb8acba96e6","0x06c2d6ce83f1dc608f2cd267b351faa80bae0f688b3e2c6689235365ac05d614","0x1954b4ab315a061b176b67c8adb73d8ef4cc795951c506549ee17f0db90cca9a","0x1a738a34c81c0875d1fe2c68fb111bb55194edcf6c879e9ec99b4c93c5bac76b","0x012434d4aa45c5fb67f138a86116447befa784435b50fc1e67c74f07223480ef","0x1da9f41af8143f464c89dfae2b802ab73f0e64bcd71e5a18574bb4afa391a80f","0x1c41b34f51bf6cfddc0572770164eadcbf2fc4e7959f0fc7a4f19dc11780380a","0x0a6692e54ad790aa12bd9e225e116bfe1d068459dcd66eeac3ff646c672a0372","0x01859bc6385d07f9dfec4b8b2c1db0a53f8a05af246bfad33509beb42d9b5694","0x19e876787001790df811f7d7d26212e87b953a8945d632763d9bf154ab4ec167","0x01e702b7c67449f857e75e6df7251cce8f6c871aed86f988024c2e6139022c39","0x008b6178e573502eac46923d9df263b57cafa83bb14e7b91080370cf82750f75","0x2ea063d2aad0c7bcadf7fd7493e0cb8352c308a4e4101f128a7c4eb6dd80b118","0x099650fcf5f0c4f8f75189d335f9f176f8d1355ac6a31274782c21345d1f9c2a","0x1b8b6888ec0de5154a5ec2b3ebd4ace865dc035253532ebed5abf575a9e89763","0x024869a9548b8bf6cfe27150c22c88f7df4f0886b6a1f83ccf8e9e0e446901de","0x1aab445b8c2ffd0ae8081d9d6870eb3b1b5a3d60d80c2fdfd820d0aec21c6cb1","0x02a9d09ae2a2cdf547dd84338d33f5212f3189f27fbcf6f19cd10dbb4fcfd783","0x1b0cab4d1a473f0960033080337857646b3cbecca1272e94a563405bcd834256","0x1a49dd69fe18bb0c700d0aba9d697f11cb77bbf50ef1312b0ade6101b6b5970c","0x17a899e0aaba06df5f640dee973615b2a1c2b1a302c36432c0e496c0e1fc12d4","0x29416ace9513e527f7896ed30c14f92cbab613f3eebe6c87f810369c846023f3","0x13aca814f98cc1ba1c8818827876a6b782a579ab0494e03e190ebf6bd448e005","0x00000000000000000000000000000000d00591628e7f3bc935d0615c0808e684","0x0e1e573fd4e227709e85770ce6b1ec54c62a4563a360a85cafa285ef0de23f65","0x0df2626fd4c3b1352933f185d2ea12e6bfafced47ecea438cade894cc6e2db56","0x024a1e3b18a149a7643d0a7413a9f9a859534acb1075a49d79f80ab4b54d2a54","0x1ddc4265b93c17d06fa34332906e26b193c22fca27979dfe1dc7a3481ca26368","0x162ace72663cfa6de2e9f04e51dc9b391a9842df5c390ea45c830cb9ffe41170","0x0495b2a1fdf4505e043a1f14d28d3183875c756190b4f3d573ddcca45271c578","0x108711fd3a535631ffedab15afa2b45462d0109de6a5ce207b728da7fb0cc861","0x12f61ffde0a5cdd06d99615a9a13e9c35c9acf021c34d945a43911d6b5bc7357","0x1892fe8746226c4ff0c22f46b1b5af461256b39da8b35f6ce23b5274ee36d249","0x1e2fdd10ab9f0acf73eafd32c95774c8c81298393531e594203d931326b1313b","0x23ccbb9a111ba94ef713cb1ee0f93a4b7dce7cd4c1b06bbb5e3fd3b15f2b902d","0x00000000000000000000000000000012c0034de11daf4073d7347808aeaa15c3","0x00000000000000000000000000000000002467b5b5f10cf216361cdc1e6ec924","0x00000000000000000000000000000009d0e5bd1b7ed299b7150dd860562b575f","0x00000000000000000000000000000000000121e299f7c5b7b9a264a0237ba9c0","0x000000000000000000000000000000e52730fdae3a174391fede8b22ca59d266","0x000000000000000000000000000000000011e9a259a74f701d565dfbc05db520","0x000000000000000000000000000000e7574bc9af75e9f84a887d120d72b60507","0x000000000000000000000000000000000006f7685fea564d498d183eb56236b0"] \ No newline at end of file diff --git a/ts/bin-test/README.md b/ts/bin-test/README.md new file mode 100644 index 0000000000..667ad3b9a2 --- /dev/null +++ b/ts/bin-test/README.md @@ -0,0 +1,10 @@ +# bb.js Binary Test + +This test runs a sequence of commands that tests a Noir double recursion circuit verifies (src/main.nr). +The circuit has already been compiled and its witness generated in nargo via `nargo compile && nargo execute witness`. + +To test: + +``` +./bin-test.sh +``` diff --git a/ts/bin-test/Verifier.toml b/ts/bin-test/Verifier.toml new file mode 100644 index 0000000000..e37ed611d9 --- /dev/null +++ b/ts/bin-test/Verifier.toml @@ -0,0 +1 @@ +return = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] diff --git a/ts/test/bin-test.sh b/ts/bin-test/bin-test.sh similarity index 100% rename from ts/test/bin-test.sh rename to ts/bin-test/bin-test.sh diff --git a/ts/bin-test/src/main.nr b/ts/bin-test/src/main.nr new file mode 100644 index 0000000000..7c5b528966 --- /dev/null +++ b/ts/bin-test/src/main.nr @@ -0,0 +1,32 @@ +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} diff --git a/ts/bin-test/target/main.json b/ts/bin-test/target/main.json new file mode 100644 index 0000000000..e75bd0d9aa --- /dev/null +++ b/ts/bin-test/target/main.json @@ -0,0 +1 @@ +{"backend":"dummy-backend-bb.js","abi":{"parameters":[{"name":"verification_key","type":{"kind":"array","length":114,"type":{"kind":"field"}},"visibility":"private"},{"name":"proof","type":{"kind":"array","length":94,"type":{"kind":"field"}},"visibility":"private"},{"name":"public_inputs","type":{"kind":"array","length":1,"type":{"kind":"field"}},"visibility":"private"},{"name":"key_hash","type":{"kind":"field"},"visibility":"private"},{"name":"input_aggregation_object","type":{"kind":"array","length":16,"type":{"kind":"field"}},"visibility":"private"},{"name":"proof_b","type":{"kind":"array","length":94,"type":{"kind":"field"}},"visibility":"private"}],"param_witnesses":{"input_aggregation_object":[211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226],"key_hash":[210],"proof":[115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208],"proof_b":[227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320],"public_inputs":[209],"verification_key":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114]},"return_type":{"kind":"array","length":16,"type":{"kind":"field"}},"return_witnesses":[337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352]},"bytecode":"H4sIAAAAAAAA/+3WQ7PcWQDG4fOObTNj287YMxl7JmPbtm3Htm1bXyG2zefWzSaLLFK3KotUTtXT1auurnp//9NdSh4ppexWSm7hVm7jdu7gTu7ibu7hXu7jfh7gQR6iZtmwswWvkLXvt2QrtmYbtmU7tmcHdmQndmYXdq38zmV39mBP9mJv9mFf9mN/DuBADuJgDuFQqnEYh3MER3IUR3MMx3Icx3MCJ3ISJ3MKp3Iap3MGZ3IWZ3MO53Ie53MBF3IRF3MJ1bmUy7icK7iSq7iaa7iW67ieG7iRm7iZGtis2KzYrNis2KzYrNis2KzYrNis2KzYrNis2KzYrNTkYSr2f5THeJwneJKneJpneJbneJ4XeJGXeHntjhWf+Sqv8Tpv8CZv8Tbv8C7v8T4f8CEf8TGf8Cmf8Tlf8CVf8TXf8C3f8T0/8CM/8TO/8Cu/8Tt/8Cd/8Tf/8C//8T+1qE0d6lKP+jSgIY1oTBOa0ozmtKAlrWhNG9rSjvZ0oCOd6EwXutKN7vSgJ73oTR/60o/+DGAggxjMEIYyjOGMYCSjGM2YUvkMjWVcqfKJHqPH6DF6jB6jx+gxeoweo8foMXqMHqPH6DE1StXP5jth07oTxjOBiUxiMlOYyjSmM4OZzGI2c5jLPOazgIUsYjFLWMoylrOClaxidWU+8RINRUPRUDQUDUVD0VA0FA1FQ9FQNBQNRUOp+C3UUDQUDUVD0VA0FA1FQ9FQNBQNRUPRUDQUDaUaGoqGoqFoKBqKhqKhaCgaioaioWgoGoqGoqFoKBqKhqKhaCgaioaioWgoGoqGoqFoKBqKhqKhVC/r3AlVfaY36v+C9Z41mprLcKgIAAA=","proving_key":[],"verification_key":[],"gates":505501} \ No newline at end of file diff --git a/ts/bin-test/target/witness.tr b/ts/bin-test/target/witness.tr new file mode 100644 index 0000000000000000000000000000000000000000..2bbbfa65084682ecb8cf51b69cfb95d1786b0893 GIT binary patch literal 10240 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 b