From 5a3fb60140561ef0504cb86bd297d48eae82bf3b Mon Sep 17 00:00:00 2001 From: Jonathan Bursztyn Date: Tue, 19 Sep 2023 00:19:01 +0100 Subject: [PATCH] chore: noirjs integration testing (#2744) --- .github/workflows/test-integration.yml | 1 + .github/workflows/track-acvm.yml | 8 ++++---- compiler/integration-tests/package.json | 5 ++--- .../browser/compile_prove_verify.test.ts | 15 +++++++-------- yarn.lock | 7 +++---- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index e72e7d81498..662b024d6b7 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -86,6 +86,7 @@ jobs: - name: Setup `integration-tests` run: | yarn workspace @noir-lang/source-resolver build + yarn workspace @noir-lang/noir_js build - name: Run `integration-tests` run: | diff --git a/.github/workflows/track-acvm.yml b/.github/workflows/track-acvm.yml index 52c1906f153..6d02fdc2f1a 100644 --- a/.github/workflows/track-acvm.yml +++ b/.github/workflows/track-acvm.yml @@ -3,8 +3,8 @@ name: Track ACVM for Integration Tests on: pull_request: paths: - - 'Cargo.lock' - - 'yarn.lock' + - "Cargo.lock" + - "yarn.lock" jobs: check_matching_version: @@ -17,10 +17,10 @@ jobs: run: | # Extract acvm version from the current Cargo.lock CURRENT_VERSION=$(awk '/name = "acvm"/ {getline; print $3}' Cargo.lock | tr -d '"') - INTEGRATION_TEST_VERSION=$(yarn workspace integration-tests info @noir-lang/acvm_js --json | jq .children.Version | tr -d '"') + INTEGRATION_TEST_VERSION=$(yarn workspace @noir-lang/noir_js info @noir-lang/acvm_js --json | jq .children.Version | tr -d '"') echo "Current ACVM Version: $CURRENT_VERSION" - echo "Integration Test ACVM Version: $INTEGRATION_TEST_VERSION" + echo "Integration Test ACVM Version (Noir JS): $INTEGRATION_TEST_VERSION" if [ "$CURRENT_VERSION" != "$INTEGRATION_TEST_VERSION" ]; then exit 1 diff --git a/compiler/integration-tests/package.json b/compiler/integration-tests/package.json index a3727026f62..4272c6d24c4 100644 --- a/compiler/integration-tests/package.json +++ b/compiler/integration-tests/package.json @@ -7,15 +7,14 @@ "build": "echo Integration Test build step", "test": "yarn test:browser", "test:browser": "web-test-runner", - "test:integration:browser": "web-test-runner test//integration/browser/**/*.test.ts", + "test:integration:browser": "web-test-runner test/integration/browser/**/*.test.ts", "test:integration:browser:watch": "web-test-runner test/integration/browser/**/*.test.ts --watch", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, "dependencies": { "@aztec/bb.js": "^0.6.7", - "@noir-lang/acvm_js": "^0.26.1", + "@noir-lang/noir_js": "workspace:*", "@noir-lang/noir_wasm": "workspace:*", - "@noir-lang/noirc_abi": "workspace:*", "@noir-lang/source-resolver": "workspace:*", "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", diff --git a/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts b/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts index 1388923506c..5b390d566a8 100644 --- a/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts +++ b/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts @@ -4,18 +4,17 @@ import newCompiler, { compile, init_log_level as compilerLogLevel, } from "@noir-lang/noir_wasm"; -import { decompressSync as gunzip } from "fflate"; -import newABICoder, { abiEncode } from "@noir-lang/noirc_abi"; -import initACVM, { - executeCircuit, - WitnessMap, - compressWitness, -} from "@noir-lang/acvm_js"; - import { Barretenberg, RawBuffer, Crs } from "@aztec/bb.js"; +import { acvm, noirc } from "@noir-lang/noir_js"; +import { decompressSync as gunzip } from "fflate"; import * as TOML from "smol-toml"; +const { default: initACVM, executeCircuit, compressWitness } = acvm; +const { default: newABICoder, abiEncode } = noirc; + +type WitnessMap = acvm.WitnessMap; + await newCompiler(); await newABICoder(); await initACVM(); diff --git a/yarn.lock b/yarn.lock index d3f2274737e..afba4a47a91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -385,14 +385,14 @@ __metadata: languageName: node linkType: hard -"@noir-lang/acvm_js@npm:0.26.1, @noir-lang/acvm_js@npm:^0.26.1": +"@noir-lang/acvm_js@npm:0.26.1": version: 0.26.1 resolution: "@noir-lang/acvm_js@npm:0.26.1" checksum: ae8cb6e31610cd8aa392855342d0c953a1bc4cd9e07236340341afa5815696a69a6635c38241f1d6a5dd30c5a8ae49234f2ba8b71d46c5d1a46756ff6f4dde3a languageName: node linkType: hard -"@noir-lang/noir_js@workspace:tooling/noir_js": +"@noir-lang/noir_js@workspace:*, @noir-lang/noir_js@workspace:tooling/noir_js": version: 0.0.0-use.local resolution: "@noir-lang/noir_js@workspace:tooling/noir_js" dependencies: @@ -4282,9 +4282,8 @@ __metadata: resolution: "integration-tests@workspace:compiler/integration-tests" dependencies: "@aztec/bb.js": ^0.6.7 - "@noir-lang/acvm_js": ^0.26.1 + "@noir-lang/noir_js": "workspace:*" "@noir-lang/noir_wasm": "workspace:*" - "@noir-lang/noirc_abi": "workspace:*" "@noir-lang/source-resolver": "workspace:*" "@web/dev-server-esbuild": ^0.3.6 "@web/test-runner": ^0.15.3