From d4b8fe4e80537bb3ef0288934a8f756165a2b8eb Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Wed, 1 May 2024 23:04:40 +0000 Subject: [PATCH 01/23] WIP --- .github/workflows/ci.yml | 18 ++++++++++++++++++ barretenberg/Earthfile | 7 +++++++ noir/Earthfile | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 barretenberg/Earthfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9f0f8c5699..3d4fde587b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,6 +178,24 @@ jobs: timeout-minutes: 25 run: earthly-ci --no-output ./yarn-project/+test + barretenberg-acir-tests-bb: + needs: build + runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + # Only allow one memory-hunger prover test to use this runner + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: barretenberg-acir-tests-bb-${{ github.actor }}-x86 + - name: "BB Acir Tests" + working-directory: ./noir/ + timeout-minutes: 25 + run: earthly-ci --no-output ./+barretenberg-acir-tests-bb + docs-preview: needs: setup runs-on: ${{ inputs.username || github.actor }}-x86 diff --git a/barretenberg/Earthfile b/barretenberg/Earthfile new file mode 100644 index 00000000000..b6636cb671f --- /dev/null +++ b/barretenberg/Earthfile @@ -0,0 +1,7 @@ +VERSION 0.8 + +acir-tests: + FROM ../build-images+build + WORKDIR /usr/src/barretenberg + COPY ./acir_tests . + SAVE ARTIFACT ./* diff --git a/noir/Earthfile b/noir/Earthfile index 18faae05e2e..45b7f64f0d9 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -81,6 +81,43 @@ build: BUILD +nargo BUILD +packages +build-acir-tests: + FROM +nargo + ENV PATH="/usr/src/noir-repo/target/release:${PATH}" + WORKDIR /usr/src/noir-repo/test_programs + COPY . . + RUN ./rebuild.sh + SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* + +barretenberg-acir-tests-bb: + FROM ../build-images/+build + WORKDIR /usr/src/barretenberg + + COPY ../barretenberg/cpp/+preset-clang-assert/bin/bb /usr/src/barretenberg/cpp/build/bin/bb + COPY +build-acir-tests/ /usr/src/acir_artifacts + COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests + + WORKDIR /usr/src/barretenberg/acir_tests + + ENV TEST_SRC /usr/src/acir_artifacts + # Run every acir test through native bb build prove_then_verify flow for UltraPlonk. + # This ensures we test independent pk construction through real/garbage witness data paths. + RUN FLOW=prove_then_verify ./run_acir_tests.sh + # Construct and separately verify a UltraHonk proof for a single program + RUN FLOW=prove_then_verify_ultra_honk ./run_acir_tests.sh double_verify_nested_proof + # Construct and separately verify a GoblinUltraHonk proof for all acir programs + RUN FLOW=prove_then_verify_goblin_ultra_honk ./run_acir_tests.sh + # Construct and verify a UltraHonk proof for a single program + RUN FLOW=prove_and_verify_ultra_honk ./run_acir_tests.sh double_verify_nested_proof + # Construct and verify a Goblin UltraHonk (GUH) proof for a single arbitrary program + RUN FLOW=prove_and_verify_goblin_ultra_honk ./run_acir_tests.sh 6_array + # Construct and verify a UltraHonk proof for all ACIR programs using the new witness stack workflow + RUN FLOW=prove_and_verify_ultra_honk_program ./run_acir_tests.sh + # This is a "full" Goblin flow. It constructs and verifies four proofs: GoblinUltraHonk, ECCVM, Translator, and merge + RUN FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array + # Run 1_mul through native bb build, all_cmds flow, to test all cli args. + RUN VERBOSE=1 FLOW=all_cmds ./run_acir_tests.sh 1_mul + # TOOD # test-packages # FROM aztecprotocol/noir AS noir From 165bde6d3a0e8930ab7c9102057f4d1e4d605a91 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Wed, 1 May 2024 23:06:31 +0000 Subject: [PATCH 02/23] Remove from CCI --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bbb89ae9a2a..1763502737c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -656,7 +656,6 @@ workflows: - barretenberg-x86_64-linux-clang-fuzzing: *defaults - barretenberg-wasm-linux-clang: *defaults - barretenberg-x86_64-linux-clang-sol: *defaults - - barretenberg-acir-tests-bb: *bb_acir_tests - barretenberg-acir-tests-bb-sol: requires: - barretenberg-x86_64-linux-clang-assert @@ -738,7 +737,6 @@ workflows: - barretenberg-x86_64-linux-clang-fuzzing - barretenberg-wasm-linux-clang - barretenberg-x86_64-linux-clang-sol - - barretenberg-acir-tests-bb - barretenberg-acir-tests-bb-sol - barretenberg-docs - boxes-vanilla From aa848d692e9e097c98a36ad00c6cc7a024189833 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 11:14:16 +0000 Subject: [PATCH 03/23] Fixes --- noir/Earthfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/noir/Earthfile b/noir/Earthfile index 45b7f64f0d9..e57042bead7 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -86,16 +86,16 @@ build-acir-tests: ENV PATH="/usr/src/noir-repo/target/release:${PATH}" WORKDIR /usr/src/noir-repo/test_programs COPY . . + RUN nargo --version RUN ./rebuild.sh SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* barretenberg-acir-tests-bb: FROM ../build-images/+build - WORKDIR /usr/src/barretenberg COPY ../barretenberg/cpp/+preset-clang-assert/bin/bb /usr/src/barretenberg/cpp/build/bin/bb - COPY +build-acir-tests/ /usr/src/acir_artifacts COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests + COPY +build-acir-tests/ /usr/src/acir_artifacts WORKDIR /usr/src/barretenberg/acir_tests @@ -116,7 +116,8 @@ barretenberg-acir-tests-bb: # This is a "full" Goblin flow. It constructs and verifies four proofs: GoblinUltraHonk, ECCVM, Translator, and merge RUN FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array # Run 1_mul through native bb build, all_cmds flow, to test all cli args. - RUN VERBOSE=1 FLOW=all_cmds ./run_acir_tests.sh 1_mul + RUN FLOW=all_cmds ./run_acir_tests.sh 1_mul + # TOOD # test-packages From 999b2cb7836075e44d1ce0055f21346a93061e0f Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 15:36:50 +0000 Subject: [PATCH 04/23] Acir tests migrated --- .github/workflows/ci.yml | 18 +++ barretenberg/Earthfile | 7 + barretenberg/acir_tests/sol-test/src/index.js | 126 ++++++++++-------- barretenberg/cpp/Earthfile | 5 + noir/Earthfile | 17 +++ 5 files changed, 116 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3045befa2ec..b21754862f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,6 +212,24 @@ jobs: timeout-minutes: 25 run: earthly-ci --no-output ./+barretenberg-acir-tests-bb + barretenberg-acir-tests-sol: + needs: build + runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + # Only allow one memory-hunger prover test to use this runner + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: barretenberg-acir-tests-sol-${{ github.actor }}-x86 + - name: "BB Acir Tests" + working-directory: ./noir/ + timeout-minutes: 25 + run: earthly-ci --no-output ./+barretenberg-acir-tests-sol + docs-preview: needs: setup runs-on: ${{ inputs.username || github.actor }}-x86 diff --git a/barretenberg/Earthfile b/barretenberg/Earthfile index b6636cb671f..4c203496ec0 100644 --- a/barretenberg/Earthfile +++ b/barretenberg/Earthfile @@ -5,3 +5,10 @@ acir-tests: WORKDIR /usr/src/barretenberg COPY ./acir_tests . SAVE ARTIFACT ./* + +sol: + FROM ../build-images+build + WORKDIR /usr/src/barretenberg + COPY ./sol . + SAVE ARTIFACT ./* + diff --git a/barretenberg/acir_tests/sol-test/src/index.js b/barretenberg/acir_tests/sol-test/src/index.js index 59d43bea54f..029074c41e1 100644 --- a/barretenberg/acir_tests/sol-test/src/index.js +++ b/barretenberg/acir_tests/sol-test/src/index.js @@ -1,7 +1,7 @@ import fs from "fs"; -const {readFileSync, promises: fsPromises} = fs; -import {spawn} from "child_process"; -import {ethers} from "ethers"; +const { readFileSync, promises: fsPromises } = fs; +import { spawn } from "child_process"; +import { ethers } from "ethers"; import solc from "solc"; const NUMBER_OF_FIELDS_IN_PROOF = 93; @@ -24,7 +24,7 @@ const getEnvVar = (envvar) => { throw new Error(`Missing environment variable ${envvar}`); } return varVal; -} +}; // Test name is passed into environment from `flows/sol.sh` const testName = getEnvVar("TEST_NAME"); @@ -34,46 +34,46 @@ const keyPath = getEnvVar("KEY_PATH"); const verifierPath = getEnvVar("VERIFIER_PATH"); const testPath = getEnvVar("TEST_PATH"); const basePath = getEnvVar("BASE_PATH"); -const encoding = {encoding: "utf8"}; -const [key, test, verifier, base] = await Promise.all( - [ - fsPromises.readFile(keyPath, encoding), - fsPromises.readFile(testPath, encoding), - fsPromises.readFile(verifierPath, encoding), - fsPromises.readFile(basePath, encoding) - ]); +const encoding = { encoding: "utf8" }; +const [key, test, verifier, base] = await Promise.all([ + fsPromises.readFile(keyPath, encoding), + fsPromises.readFile(testPath, encoding), + fsPromises.readFile(verifierPath, encoding), + fsPromises.readFile(basePath, encoding), +]); var input = { - language: 'Solidity', + language: "Solidity", sources: { - 'Key.sol': { - content: key + "Key.sol": { + content: key, }, - 'Test.sol': { - content: test + "Test.sol": { + content: test, }, - 'Verifier.sol': { - content: verifier + "Verifier.sol": { + content: verifier, + }, + "BaseUltraVerifier.sol": { + content: base, }, - 'BaseUltraVerifier.sol': { - content: base - } }, - settings: { // we require the optimizer + settings: { + // we require the optimizer optimizer: { enabled: true, - runs: 200 + runs: 200, }, outputSelection: { - '*': { - '*': ['evm.bytecode.object', 'abi'] - } - } - } + "*": { + "*": ["evm.bytecode.object", "abi"], + }, + }, + }, }; var output = JSON.parse(solc.compile(JSON.stringify(input))); -const contract = output.contracts['Test.sol']['Test']; +const contract = output.contracts["Test.sol"]["Test"]; const bytecode = contract.evm.bytecode.object; const abi = contract.abi; @@ -91,7 +91,7 @@ const launchAnvil = async (port) => { handle.stderr.on("data", (data) => { const str = data.toString(); if (str.includes("error binding")) { - reject("we go again baby") + reject("we go again baby"); } }); @@ -105,23 +105,23 @@ const launchAnvil = async (port) => { }); return handle; -} +}; /** * Deploys the contract * @param {ethers.Signer} signer */ const deploy = async (signer) => { - const factory = new ethers.ContractFactory(abi, bytecode, signer); - const deployment = await factory.deploy(); - const deployed = await deployment.waitForDeployment(); - return await deployed.getAddress(); -} + const factory = new ethers.ContractFactory(abi, bytecode, signer); + const deployment = await factory.deploy(); + const deployed = await deployment.waitForDeployment(); + return await deployed.getAddress(); +}; /** * Takes in a proof as fields, and returns the public inputs, as well as the number of public inputs - * @param {Array} proofAsFields - * @return {Array} [number, Array] + * @param {Array} proofAsFields + * @return {Array} [number, Array] */ const readPublicInputs = (proofAsFields) => { const publicInputs = []; @@ -131,11 +131,11 @@ const readPublicInputs = (proofAsFields) => { publicInputs.push(proofAsFields[i]); } return [numPublicInputs, publicInputs]; -} +}; /** * Get Anvil - * + * * Creates an anvil instance on a random port, and returns the instance and the port * If the port is already allocated, it will try again * @returns {[ChildProcess, Number]} [anvil, port] @@ -149,43 +149,55 @@ const getAnvil = async () => { // yes this looks dangerous, but it relies on 0-10000 being hard to collide on return getAnvil(); } -} +}; + +const getProvider = async (port) => { + while (true) { + try { + const url = `http://127.0.0.1:${port}`; + return new ethers.JsonRpcProvider(url); + } catch (e) { + console.log(e); + await new Promise((resolve) => setTimeout(resolve, 5000)); + } + } +}; const [anvil, randomPort] = await getAnvil(); const killAnvil = () => { anvil.kill(); - console.log(testName, " complete") -} + console.log(testName, " complete"); +}; try { const proofAsFieldsPath = getEnvVar("PROOF_AS_FIELDS"); const proofAsFields = readFileSync(proofAsFieldsPath); - const [numPublicInputs, publicInputs] = readPublicInputs(JSON.parse(proofAsFields.toString())); + const [numPublicInputs, publicInputs] = readPublicInputs( + JSON.parse(proofAsFields.toString()) + ); const proofPath = getEnvVar("PROOF"); const proof = readFileSync(proofPath); - + // Cut the number of public inputs off of the proof string - const proofStr = `0x${proof.toString("hex").substring(64*numPublicInputs)}`; + const proofStr = `0x${proof.toString("hex").substring(64 * numPublicInputs)}`; - const key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; - const provider = new ethers.JsonRpcProvider(`http://localhost:${randomPort}`); + const key = + "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; + const provider = await getProvider(randomPort); const signer = new ethers.Wallet(key, provider); - // deploy + // deploy const address = await deploy(signer); const contract = new ethers.Contract(address, abi, signer); const result = await contract.test(proofStr, publicInputs); if (!result) throw new Error("Test failed"); -} -catch (e) { - console.error(testName, " failed") - console.log(e) +} catch (e) { + console.error(testName, " failed"); + console.log(e); throw e; -} -finally { +} finally { // Kill anvil at the end of running killAnvil(); } - diff --git a/barretenberg/cpp/Earthfile b/barretenberg/cpp/Earthfile index e4057ec965c..e27707114f1 100644 --- a/barretenberg/cpp/Earthfile +++ b/barretenberg/cpp/Earthfile @@ -45,6 +45,11 @@ preset-wasm: SAVE IMAGE --cache-hint END +preset-sol: + FROM +source + RUN cmake --preset clang16 && cmake --build --preset clang16 --target solidity_key_gen solidity_proof_gen + SAVE ARTIFACT build/bin + preset-wasm-threads: FROM +source RUN cmake --preset wasm-threads -Bbuild && cmake --build build --target barretenberg.wasm diff --git a/noir/Earthfile b/noir/Earthfile index e57042bead7..d19da4aff7d 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -119,6 +119,23 @@ barretenberg-acir-tests-bb: RUN FLOW=all_cmds ./run_acir_tests.sh 1_mul +barretenberg-acir-tests-sol: + FROM ../build-images/+build + + COPY ../barretenberg/cpp/+preset-sol/ /usr/src/barretenberg/cpp/build + COPY ../barretenberg/cpp/+preset-clang-assert/bin/bb /usr/src/barretenberg/cpp/build/bin/bb + COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests + COPY ../barretenberg/+sol/ /usr/src/barretenberg/sol + COPY +build-acir-tests/ /usr/src/acir_artifacts + + WORKDIR /usr/src/barretenberg/acir_tests + + ENV TEST_SRC /usr/src/acir_artifacts + + RUN (cd sol-test && yarn) + RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh assert_statement double_verify_proof double_verify_nested_proof + + # TOOD # test-packages # FROM aztecprotocol/noir AS noir From 9d121f909213f9aa26b38b72aaf600450cdac0ef Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 15:39:05 +0000 Subject: [PATCH 05/23] Removed from CCI --- .circleci/config.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8bf3784d8d5..8be96edde14 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -644,12 +644,6 @@ workflows: - barretenberg-x86_64-linux-clang-fuzzing: *defaults - barretenberg-wasm-linux-clang: *defaults - barretenberg-x86_64-linux-clang-sol: *defaults - - barretenberg-acir-tests-bb-sol: - requires: - - barretenberg-x86_64-linux-clang-assert - - barretenberg-x86_64-linux-clang-sol - - noir-compile-acir-tests - <<: *bb_acir_tests - barretenberg-docs: *defaults - bb-js: requires: @@ -724,7 +718,6 @@ workflows: - barretenberg-x86_64-linux-clang-fuzzing - barretenberg-wasm-linux-clang - barretenberg-x86_64-linux-clang-sol - - barretenberg-acir-tests-bb-sol - barretenberg-docs - boxes-vanilla - boxes-react From 56f998e00b574c145384b67e7796efa1bb1550d1 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:06:22 +0000 Subject: [PATCH 06/23] WIP --- .circleci/config.yml | 65 ---------------------------------------- .github/workflows/ci.yml | 17 +++++++++++ noir/Earthfile | 19 ++++++++++++ 3 files changed, 36 insertions(+), 65 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8be96edde14..b61796c63c3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -278,18 +278,6 @@ jobs: command: cond_spot_run_build noir-packages-tests 32 aztec_manifest_key: noir-packages-tests - noir-compile-acir-tests: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build" - command: cond_spot_run_build noir-compile-acir-tests 32 - aztec_manifest_key: noir-compile-acir-tests - avm-transpiler: docker: - image: aztecprotocol/alpine-build-image @@ -302,42 +290,6 @@ jobs: command: cond_spot_run_build avm-transpiler 32 aztec_manifest_key: avm-transpiler - barretenberg-acir-tests-bb: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: cond_spot_run_build barretenberg-acir-tests-bb 32 - aztec_manifest_key: barretenberg-acir-tests-bb - - barretenberg-acir-tests-bb-sol: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: cond_spot_run_build barretenberg-acir-tests-bb-sol 32 - aztec_manifest_key: barretenberg-acir-tests-bb-sol - - bb-js-acir-tests: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: cond_spot_run_build barretenberg-acir-tests-bb.js 32 - aztec_manifest_key: barretenberg-acir-tests-bb.js - l1-contracts: machine: image: default @@ -568,12 +520,6 @@ defaults: &defaults event: fail branch_pattern: "master" -bb_acir_tests: &bb_acir_tests - requires: - - barretenberg-x86_64-linux-clang-assert - - noir-compile-acir-tests - <<: *defaults - defaults_yarn_project_pre_join: &defaults_yarn_project_pre_join requires: - yarn-project-pre-join @@ -629,10 +575,6 @@ workflows: - noir-ecr-manifest - noir-packages <<: *defaults - - noir-compile-acir-tests: - requires: - - noir-ecr-manifest - <<: *defaults # Transpiler - avm-transpiler: *defaults @@ -643,7 +585,6 @@ workflows: - barretenberg-x86_64-linux-clang-assert: *defaults - barretenberg-x86_64-linux-clang-fuzzing: *defaults - barretenberg-wasm-linux-clang: *defaults - - barretenberg-x86_64-linux-clang-sol: *defaults - barretenberg-docs: *defaults - bb-js: requires: @@ -653,11 +594,6 @@ workflows: requires: - bb-js <<: *defaults - - bb-js-acir-tests: - requires: - - bb-js - - noir-compile-acir-tests - <<: *defaults - l1-contracts: *defaults @@ -717,7 +653,6 @@ workflows: - barretenberg-x86_64-linux-clang-assert - barretenberg-x86_64-linux-clang-fuzzing - barretenberg-wasm-linux-clang - - barretenberg-x86_64-linux-clang-sol - barretenberg-docs - boxes-vanilla - boxes-react diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b21754862f0..90edda5b83d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,23 @@ jobs: # limit our parallelism to half our cores run: earthly-ci --no-output +test --hardware_concurrency=64 + bb.js-test: + needs: setup + runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: bb-js-test-${{ github.actor }}-x86 + - name: "bb.js Tests" + working-directory: ./barretenberg/ts/ + timeout-minutes: 25 + run: earthly-ci --no-output ./+test + noir-projects: needs: setup runs-on: ${{ inputs.username || github.actor }}-x86 diff --git a/noir/Earthfile b/noir/Earthfile index d19da4aff7d..c805575b367 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -135,6 +135,25 @@ barretenberg-acir-tests-sol: RUN (cd sol-test && yarn) RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh assert_statement double_verify_proof double_verify_nested_proof +barretenberg-acir-tests-bb.js: + # Playwright not supported on base image ubuntu:noble, results in unmet dependencies + FROM node:18.19.0 + RUN apt update && apt install -y curl jq npm + #RUN apt-get update && apt-get install -y lsof libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libatspi2.0-0 libxdamage1 libxkbcommon0 libpango-1.0-0 libcairo2 + + COPY ../barretenberg/ts/+build/build/ /usr/src/barretenberg/ts + COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests + COPY +build-acir-tests/ /usr/src/acir_artifacts + + WORKDIR /usr/src/barretenberg/acir_tests + + # Build/install ts apps. + RUN cd browser-test-app && yarn && yarn build + RUN cd headless-test && yarn && npx playwright install && npx playwright install-deps + ENV VERBOSE=1 + + RUN BIN=../ts/dest/node/main.js FLOW=prove_then_verify ./run_acir_tests.sh double_verify_proof + # TOOD # test-packages From 1143cab004300c98e810bc0563b6426fabdc7217 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:24:23 +0000 Subject: [PATCH 07/23] WIP --- noir/Earthfile | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/noir/Earthfile b/noir/Earthfile index c805575b367..f87d5fb967d 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -100,6 +100,7 @@ barretenberg-acir-tests-bb: WORKDIR /usr/src/barretenberg/acir_tests ENV TEST_SRC /usr/src/acir_artifacts + ENV VERBOSE=1 # Run every acir test through native bb build prove_then_verify flow for UltraPlonk. # This ensures we test independent pk construction through real/garbage witness data paths. RUN FLOW=prove_then_verify ./run_acir_tests.sh @@ -131,6 +132,7 @@ barretenberg-acir-tests-sol: WORKDIR /usr/src/barretenberg/acir_tests ENV TEST_SRC /usr/src/acir_artifacts + ENV VERBOSE=1 RUN (cd sol-test && yarn) RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh assert_statement double_verify_proof double_verify_nested_proof @@ -138,8 +140,7 @@ barretenberg-acir-tests-sol: barretenberg-acir-tests-bb.js: # Playwright not supported on base image ubuntu:noble, results in unmet dependencies FROM node:18.19.0 - RUN apt update && apt install -y curl jq npm - #RUN apt-get update && apt-get install -y lsof libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libatspi2.0-0 libxdamage1 libxkbcommon0 libpango-1.0-0 libcairo2 + RUN apt update && apt install -y curl jq COPY ../barretenberg/ts/+build/build/ /usr/src/barretenberg/ts COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests @@ -150,9 +151,27 @@ barretenberg-acir-tests-bb.js: # Build/install ts apps. RUN cd browser-test-app && yarn && yarn build RUN cd headless-test && yarn && npx playwright install && npx playwright install-deps + RUN cd ../ts && yarn ENV VERBOSE=1 + # Run double_verify_proof through bb.js on node to check 512k support. RUN BIN=../ts/dest/node/main.js FLOW=prove_then_verify ./run_acir_tests.sh double_verify_proof + # Run a single arbitrary test not involving recursion through bb.js for UltraHonk + RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_ultra_honk ./run_acir_tests.sh 6_array + # Run a single arbitrary test not involving recursion through bb.js for GoblinUltraHonk + RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_goblin_ultra_honk ./run_acir_tests.sh 6_array + # Run a single arbitrary test not involving recursion through bb.js for full Goblin + RUN BIN=../ts/dest/node/main.js FLOW=prove_and_verify_goblin ./run_acir_tests.sh 6_array + # Run 1_mul through bb.js build, all_cmds flow, to test all cli args. + RUN BIN=../ts/dest/node/main.js FLOW=all_cmds ./run_acir_tests.sh 1_mul + # Run double_verify_proof through bb.js on chrome testing multi-threaded browser support. + # TODO: Currently headless webkit doesn't seem to have shared memory so skipping multi-threaded test. + RUN BROWSER=chrome THREAD_MODEL=mt ./run_acir_tests_browser.sh double_verify_proof + # Run 1_mul through bb.js on chrome/webkit testing single threaded browser support. + RUN BROWSER=chrome THREAD_MODEL=st ./run_acir_tests_browser.sh 1_mul + # Commenting for now as fails intermittently. Unreproducable on mainframe. + # See https://github.com/AztecProtocol/aztec-packages/issues/2104 + #RUN BROWSER=webkit THREAD_MODEL=st ./run_acir_tests_browser.sh 1_mul # TOOD From 6d9eb41b86663e62321e0658ec9636d9cd5828c2 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:27:53 +0000 Subject: [PATCH 08/23] Removed more jobs from CCI --- .circleci/config.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cdcda96be38..374aff1dd79 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -193,18 +193,6 @@ jobs: command: build bb.js aztec_manifest_key: bb.js - bb-js-tests: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: cond_spot_run_test bb.js 32 ./scripts/run_tests - aztec_manifest_key: bb.js - # Noir noir-x86_64: docker: @@ -554,10 +542,6 @@ workflows: requires: - barretenberg-wasm-linux-clang <<: *defaults - - bb-js-tests: - requires: - - bb-js - <<: *defaults - l1-contracts: *defaults From b2f20abcb3c8187a0a66ff57b8c831c41b92ea4d Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:33:21 +0000 Subject: [PATCH 09/23] Additional GA runners --- .github/workflows/ci.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94024acf9a7..7d6efccb31b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,12 +219,11 @@ jobs: uses: actions/checkout@v4, with: { ref: "${{ github.event.pull_request.head.sha }}" }, } - # Only allow one memory-hunger prover test to use this runner - uses: ./.github/ci-setup-action with: dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" concurrency_key: barretenberg-acir-tests-bb-${{ github.actor }}-x86 - - name: "BB Acir Tests" + - name: "BB Native Acir Tests" working-directory: ./noir/ timeout-minutes: 25 run: earthly-ci --no-output ./+barretenberg-acir-tests-bb @@ -237,16 +236,32 @@ jobs: uses: actions/checkout@v4, with: { ref: "${{ github.event.pull_request.head.sha }}" }, } - # Only allow one memory-hunger prover test to use this runner - uses: ./.github/ci-setup-action with: dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" concurrency_key: barretenberg-acir-tests-sol-${{ github.actor }}-x86 - - name: "BB Acir Tests" + - name: "BB Solidity Acir Tests" working-directory: ./noir/ timeout-minutes: 25 run: earthly-ci --no-output ./+barretenberg-acir-tests-sol + barretenberg-acir-tests-bb.js: + needs: build + runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: barretenberg-acir-tests-bb-js-${{ github.actor }}-x86 + - name: "BB JS Acir Tests" + working-directory: ./noir/ + timeout-minutes: 25 + run: earthly-ci --no-output ./+barretenberg-acir-tests-bb.js + docs-preview: needs: setup runs-on: ${{ inputs.username || github.actor }}-x86 From 43c4cea13dc25ad7f537663c9ec98242c23a6aa1 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:48:55 +0000 Subject: [PATCH 10/23] Fixed yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d6efccb31b..a552fecb26f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: # limit our parallelism to half our cores run: earthly-ci --no-output +test --hardware_concurrency=64 - bb.js-test: + bb-js-test: needs: setup runs-on: ${{ github.actor }}-x86 steps: From 9d978e86e3d90c0bbbdd434770d82705350a8b70 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 18:50:22 +0000 Subject: [PATCH 11/23] Another fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a552fecb26f..3cf57236b6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -245,7 +245,7 @@ jobs: timeout-minutes: 25 run: earthly-ci --no-output ./+barretenberg-acir-tests-sol - barretenberg-acir-tests-bb.js: + barretenberg-acir-tests-bb-js: needs: build runs-on: ${{ github.actor }}-x86 steps: From 75038cfa2997e49d121ec2caf21ee3a5379098a3 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 20:01:25 +0000 Subject: [PATCH 12/23] Debugging --- noir/noir-repo/test_programs/rebuild.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noir/noir-repo/test_programs/rebuild.sh b/noir/noir-repo/test_programs/rebuild.sh index a3137920fd5..d635fa8f55e 100755 --- a/noir/noir-repo/test_programs/rebuild.sh +++ b/noir/noir-repo/test_programs/rebuild.sh @@ -58,5 +58,7 @@ done # Exit with a failure status if any job failed. if [ ! -z "$exit_status" ]; then + echo "Rebuild failed!" exit $exit_status -fi \ No newline at end of file +fi +echo "Rebuild Succeeded!" \ No newline at end of file From 497a215d0cafddd262c7d23d2f3fc5179c7c854c Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 20:05:48 +0000 Subject: [PATCH 13/23] Set correct artifacts directory --- noir/Earthfile | 1 + 1 file changed, 1 insertion(+) diff --git a/noir/Earthfile b/noir/Earthfile index f87d5fb967d..925ab9b7a60 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -153,6 +153,7 @@ barretenberg-acir-tests-bb.js: RUN cd headless-test && yarn && npx playwright install && npx playwright install-deps RUN cd ../ts && yarn ENV VERBOSE=1 + ENV TEST_SRC /usr/src/acir_artifacts # Run double_verify_proof through bb.js on node to check 512k support. RUN BIN=../ts/dest/node/main.js FLOW=prove_then_verify ./run_acir_tests.sh double_verify_proof From 2f4ecab7889b5d00c78d97d7bd1a84299cdde30a Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 21:03:11 +0000 Subject: [PATCH 14/23] Missing dep --- noir/Earthfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/Earthfile b/noir/Earthfile index 925ab9b7a60..f77074a1079 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -140,7 +140,7 @@ barretenberg-acir-tests-sol: barretenberg-acir-tests-bb.js: # Playwright not supported on base image ubuntu:noble, results in unmet dependencies FROM node:18.19.0 - RUN apt update && apt install -y curl jq + RUN apt update && apt install -y curl jq lsof COPY ../barretenberg/ts/+build/build/ /usr/src/barretenberg/ts COPY ../barretenberg/+acir-tests/ /usr/src/barretenberg/acir_tests From f703f920e74bb4f64450ec85346d8af70fed53bb Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 21:40:25 +0000 Subject: [PATCH 15/23] Fix --- noir/Earthfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/Earthfile b/noir/Earthfile index f77074a1079..f418559d618 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -88,7 +88,7 @@ build-acir-tests: COPY . . RUN nargo --version RUN ./rebuild.sh - SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* + SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts barretenberg-acir-tests-bb: FROM ../build-images/+build From 2aedbb7eb52b0d04f661adeaa6a30813acc7d7a4 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Thu, 2 May 2024 21:50:21 +0000 Subject: [PATCH 16/23] Fix --- noir/Earthfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir/Earthfile b/noir/Earthfile index f418559d618..f77074a1079 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -88,7 +88,7 @@ build-acir-tests: COPY . . RUN nargo --version RUN ./rebuild.sh - SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts + SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* barretenberg-acir-tests-bb: FROM ../build-images/+build From ea6a6f3f29815a50b39c64df889419eb3f297a6d Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 08:09:44 +0000 Subject: [PATCH 17/23] Increased test timeout --- barretenberg/ts/Earthfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/barretenberg/ts/Earthfile b/barretenberg/ts/Earthfile index fce0ab36807..75e3e71b1b4 100644 --- a/barretenberg/ts/Earthfile +++ b/barretenberg/ts/Earthfile @@ -45,4 +45,5 @@ build: test: BUILD +test-prettier-format - RUN yarn test + # We frequently get tests timing out in GA, increase the timeout here + RUN yarn test --testTimeout=30000 From d2b0018bd40461e7c33815f9084a21bf0533526d Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 08:24:37 +0000 Subject: [PATCH 18/23] Fixes --- barretenberg/ts/Earthfile | 2 +- noir/Earthfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/barretenberg/ts/Earthfile b/barretenberg/ts/Earthfile index 75e3e71b1b4..981dda905d7 100644 --- a/barretenberg/ts/Earthfile +++ b/barretenberg/ts/Earthfile @@ -46,4 +46,4 @@ build: test: BUILD +test-prettier-format # We frequently get tests timing out in GA, increase the timeout here - RUN yarn test --testTimeout=30000 + RUN yarn test --testTimeout=300000 diff --git a/noir/Earthfile b/noir/Earthfile index f77074a1079..f2a0853662f 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -98,6 +98,7 @@ barretenberg-acir-tests-bb: COPY +build-acir-tests/ /usr/src/acir_artifacts WORKDIR /usr/src/barretenberg/acir_tests + RUN rm -rf ./acir_tests ENV TEST_SRC /usr/src/acir_artifacts ENV VERBOSE=1 From f2cc2f3862708c3c28a1532244765f651cf17626 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 09:07:52 +0000 Subject: [PATCH 19/23] Another fix attempt --- noir/Earthfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noir/Earthfile b/noir/Earthfile index f2a0853662f..9e839ab7e3e 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -20,6 +20,7 @@ nargo: ENV COMMIT_HASH=$(find . -type f -exec sha256sum {} ';' | sort | sha256sum | awk '{print $1}') COPY ./scripts/bootstrap_native.sh ./scripts/bootstrap_native.sh RUN ./scripts/bootstrap_native.sh + RUN /usr/src/noir-repo/target/release/nargo --version RUN echo CONTENT HASH $COMMIT_HASH | tee .content-hash SAVE ARTIFACT /usr/src/noir-repo/target/release/nargo nargo SAVE ARTIFACT /usr/src/noir-repo/target/release/acvm acvm @@ -85,8 +86,7 @@ build-acir-tests: FROM +nargo ENV PATH="/usr/src/noir-repo/target/release:${PATH}" WORKDIR /usr/src/noir-repo/test_programs - COPY . . - RUN nargo --version + RUN /usr/src/noir-repo/target/release/nargo --version RUN ./rebuild.sh SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* From b67ddb7d195ca9c6df843a999eaf192464960771 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 10:50:19 +0000 Subject: [PATCH 20/23] Fixes --- noir/Earthfile | 8 +++++--- noir/noir-repo/test_programs/rebuild.sh | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/noir/Earthfile b/noir/Earthfile index 9e839ab7e3e..184e6caee72 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -20,7 +20,6 @@ nargo: ENV COMMIT_HASH=$(find . -type f -exec sha256sum {} ';' | sort | sha256sum | awk '{print $1}') COPY ./scripts/bootstrap_native.sh ./scripts/bootstrap_native.sh RUN ./scripts/bootstrap_native.sh - RUN /usr/src/noir-repo/target/release/nargo --version RUN echo CONTENT HASH $COMMIT_HASH | tee .content-hash SAVE ARTIFACT /usr/src/noir-repo/target/release/nargo nargo SAVE ARTIFACT /usr/src/noir-repo/target/release/acvm acvm @@ -83,11 +82,14 @@ build: BUILD +packages build-acir-tests: - FROM +nargo + FROM ../build-images/+build + COPY +nargo/ /usr/src/noir-repo/target/release ENV PATH="/usr/src/noir-repo/target/release:${PATH}" WORKDIR /usr/src/noir-repo/test_programs + COPY ./noir-repo/test_programs/ /usr/src/noir-repo/test_programs/ RUN /usr/src/noir-repo/target/release/nargo --version - RUN ./rebuild.sh + # Switch off parallel compilation, it causes problems in Earthly + RUN ./rebuild.sh true SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* barretenberg-acir-tests-bb: diff --git a/noir/noir-repo/test_programs/rebuild.sh b/noir/noir-repo/test_programs/rebuild.sh index d635fa8f55e..6c8c6192801 100755 --- a/noir/noir-repo/test_programs/rebuild.sh +++ b/noir/noir-repo/test_programs/rebuild.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -e +NO_PARALLEL=${1:-} + process_dir() { local dir=$1 local current_dir=$2 @@ -21,6 +23,8 @@ process_dir() { fi mkdir $current_dir/acir_artifacts/$dir_name/target + ls -l ./target + mv ./target/*.gz $current_dir/acir_artifacts/$dir_name/target/ cd $current_dir @@ -46,10 +50,17 @@ done # Process each directory in parallel pids=() +if [ -z $NO_PARALLEL ]; then for dir in "${dirs_to_process[@]}"; do process_dir "$dir" "$current_dir" & pids+=($!) done +else +for dir in "${dirs_to_process[@]}"; do + process_dir "$dir" "$current_dir" + pids+=($!) +done +fi # Check the exit status of each background job. for pid in "${pids[@]}"; do From 4ebce82323773c21affebad79749f48737a337e3 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 11:17:08 +0000 Subject: [PATCH 21/23] New workflow --- .github/workflows/ci.yml | 22 +++++++++++++++++++--- noir/noir-repo/test_programs/rebuild.sh | 2 -- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cf57236b6a..369074f09b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -211,9 +211,25 @@ jobs: timeout-minutes: 25 run: earthly-ci --no-output ./yarn-project/+prover-client-test - barretenberg-acir-tests-bb: + build-acir-tests: needs: build runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: build-acir-tests-${{ github.actor }}-x86 + - name: "Build Acir Tests" + timeout-minutes: 25 + run: earthly-ci --no-output ./noir/+build-acir-tests + + barretenberg-acir-tests-bb: + needs: build-acir-tests + runs-on: ${{ github.actor }}-x86 steps: - { uses: actions/checkout@v4, @@ -229,7 +245,7 @@ jobs: run: earthly-ci --no-output ./+barretenberg-acir-tests-bb barretenberg-acir-tests-sol: - needs: build + needs: build-acir-tests runs-on: ${{ github.actor }}-x86 steps: - { @@ -246,7 +262,7 @@ jobs: run: earthly-ci --no-output ./+barretenberg-acir-tests-sol barretenberg-acir-tests-bb-js: - needs: build + needs: build-acir-tests runs-on: ${{ github.actor }}-x86 steps: - { diff --git a/noir/noir-repo/test_programs/rebuild.sh b/noir/noir-repo/test_programs/rebuild.sh index 6c8c6192801..51e97278281 100755 --- a/noir/noir-repo/test_programs/rebuild.sh +++ b/noir/noir-repo/test_programs/rebuild.sh @@ -23,8 +23,6 @@ process_dir() { fi mkdir $current_dir/acir_artifacts/$dir_name/target - ls -l ./target - mv ./target/*.gz $current_dir/acir_artifacts/$dir_name/target/ cd $current_dir From b66dc3b89143cb6dd340130e4bac93ac192000b5 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 13:20:36 +0000 Subject: [PATCH 22/23] Comment --- noir/Earthfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noir/Earthfile b/noir/Earthfile index 184e6caee72..6a28c59e6c8 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -88,7 +88,8 @@ build-acir-tests: WORKDIR /usr/src/noir-repo/test_programs COPY ./noir-repo/test_programs/ /usr/src/noir-repo/test_programs/ RUN /usr/src/noir-repo/target/release/nargo --version - # Switch off parallel compilation, it causes problems in Earthly + # We run this with parallel compilation switched off, which isn't ideal. + # There seems to be problems with this when running under Earthly RUN ./rebuild.sh true SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* From 28b87566962e6e65f052185cae77a351d7d9e2c8 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Fri, 3 May 2024 14:08:34 +0000 Subject: [PATCH 23/23] Comments --- noir/Earthfile | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/noir/Earthfile b/noir/Earthfile index 6a28c59e6c8..8a4db6aee43 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -89,7 +89,7 @@ build-acir-tests: COPY ./noir-repo/test_programs/ /usr/src/noir-repo/test_programs/ RUN /usr/src/noir-repo/target/release/nargo --version # We run this with parallel compilation switched off, which isn't ideal. - # There seems to be problems with this when running under Earthly + # There seems to be problems with this when running under Earthly, see bottom of this file* RUN ./rebuild.sh true SAVE ARTIFACT /usr/src/noir-repo/test_programs/acir_artifacts/* @@ -214,3 +214,43 @@ barretenberg-acir-tests-bb.js: # # Don't waste time pushing a huge container back to ECR as nothing needs the output. # FROM scratch # COPY --from=0 /usr/src/noir/README.md /usr/src/noir/README.md + + + +#* Analysis of compiling Acir tests inside/outside Earthly +# Each test run compiles the full suite, either in series or in parallel, either inside or outside Earthly. +# Each test prints the contents of the target directory of the eddsa circuit after compilation +# You can see that the 'Inside Earthly Parallel' run has an acir.gz file of a different size +# This results in a proof that fails verification +# +# Outside Earthly Parallel + +# [eddsa] Circuit witness successfully solved +# [eddsa] Witness saved to /mnt/user-data/phil/aztec3-packages/noir/noir-repo/test_programs/execution_success/eddsa/target/witness.gz +# total 2544 +# -rw-rw-r-- 1 phil phil 904034 May 3 10:40 acir.gz +# -rw-rw-r-- 1 phil phil 1696442 May 3 10:40 witness.gz + +# Outside Earthly Series + +# [eddsa] Circuit witness successfully solved +# [eddsa] Witness saved to /mnt/user-data/phil/aztec3-packages/noir/noir-repo/test_programs/execution_success/eddsa/target/witness.gz +# total 2544 +# -rw-rw-r-- 1 phil phil 904034 May 3 10:43 acir.gz +# -rw-rw-r-- 1 phil phil 1696442 May 3 10:43 witness.gz + +# Inside Earthly Parallel + +# +build-acir-tests | [eddsa] Circuit witness successfully solved +# +build-acir-tests | [eddsa] Witness saved to /usr/src/noir-repo/test_programs/execution_success/eddsa/target/witness.gz +# +build-acir-tests | total 2472 +# +build-acir-tests | -rw-r--r-- 1 root root 830340 May 3 10:47 acir.gz +# +build-acir-tests | -rw-r--r-- 1 root root 1696442 May 3 10:47 witness.gz + +# Inside Earthly Series + +# +build-acir-tests | [eddsa] Circuit witness successfully solved +# +build-acir-tests | [eddsa] Witness saved to /usr/src/noir-repo/test_programs/execution_success/eddsa/target/witness.gz +# +build-acir-tests | total 2544 +# +build-acir-tests | -rw-r--r-- 1 root root 904034 May 3 10:50 acir.gz +# +build-acir-tests | -rw-r--r-- 1 root root 1696442 May 3 10:51 witness.gz