diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index f92036fe1e6..96a177a9bde 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: schedule: - cron: "0 2 * * *" # Run nightly at 2 AM UTC - + jobs: wasm-packages-build-test: runs-on: ubuntu-latest @@ -100,8 +100,8 @@ jobs: working-directory: ./compiler/integration-tests run: | yarn test:browser - - - name: Alert on nightly test failure + + - name: Alert on nightly test failure uses: JasonEtco/create-an-issue@v2 if: ${{ failure() && github.event_name == 'schedule' }} env: @@ -110,4 +110,4 @@ jobs: WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} with: update_existing: true - filename: .github/NIGHTLY_TEST_FAILURE.md \ No newline at end of file + filename: .github/NIGHTLY_TEST_FAILURE.md diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 64ae238015f..710e88b34df 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,7 +6,8 @@ "mkhl.direnv", "jnoortheen.nix-ide", "rust-lang.rust-analyzer", - "redhat.vscode-yaml" + "redhat.vscode-yaml", + "esbenp.prettier-vscode" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.vscode/settings.json b/.vscode/settings.json index 6c6ec87be51..171d36f4e04 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,4 +16,7 @@ "yaml.schemas": { "https://json.schemastore.org/github-workflow.json": "${workspaceRoot}/.github/workflows/*.yml" }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/compiler/fm/src/file_reader.rs b/compiler/fm/src/file_reader.rs index df4e49b919a..1a9b31ed949 100644 --- a/compiler/fm/src/file_reader.rs +++ b/compiler/fm/src/file_reader.rs @@ -1,5 +1,5 @@ use rust_embed::RustEmbed; -use std::io::Error; +use std::io::{Error, ErrorKind}; use std::path::Path; // Based on the environment, we either read files using the rust standard library or we @@ -34,8 +34,6 @@ cfg_if::cfg_if! { } pub(crate) fn read_file_to_string(path_to_file: &Path) -> Result { - use std::io::ErrorKind; - let path_str = path_to_file.to_str().unwrap(); match StdLibAssets::get(path_str) { @@ -43,6 +41,10 @@ cfg_if::cfg_if! { Ok(std::str::from_utf8(std_lib_asset.data.as_ref()).unwrap().to_string()) }, + None if is_stdlib_asset(path_to_file) => { + Err(Error::new(ErrorKind::NotFound, "invalid stdlib path")) + } + None => match read_file(path_str) { Ok(buffer) => Ok(buffer), Err(_) => Err(Error::new(ErrorKind::Other, "could not read file using wasm")), @@ -60,6 +62,10 @@ cfg_if::cfg_if! { Ok(std::str::from_utf8(std_lib_asset.data.as_ref()).unwrap().to_string()) }, + None if is_stdlib_asset(path_to_file) => { + Err(Error::new(ErrorKind::NotFound, "invalid stdlib path")) + } + None => std::fs::read_to_string(path_to_file) } 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 5d90bc85fd5..e48a75acb51 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 @@ -12,7 +12,7 @@ import initACVM, { compressWitness, } from "@noir-lang/acvm_js"; -// @ts-ignore +// @ts-ignore import { Barretenberg, RawBuffer, Crs } from '@aztec/bb.js'; import * as TOML from 'smol-toml' @@ -49,11 +49,11 @@ const numberOfThreads = navigator.hardwareConcurrency || 1; let suite = Mocha.Suite.create(mocha.suite, "Noir end to end test"); -suite.timeout(60*10e3);//10mins +suite.timeout(60*20e3);//20mins test_cases.forEach((testInfo) => { const test_name = testInfo.case.split("/").pop(); - const mochaTest = new Mocha.Test(`${test_name} (Compile, Execute, Proove, Verify)`, async () => { + const mochaTest = new Mocha.Test(`${test_name} (Compile, Execute, Prove, Verify)`, async () => { const base_relative_path = "../../../../.."; const test_case = testInfo.case; @@ -67,7 +67,7 @@ test_cases.forEach((testInfo) => { expect(noir_source).to.be.a.string; initialiseResolver((id: String) => { - console.log("Resoving:", id); + console.log("Resolving:", id); return noir_source; }); @@ -132,6 +132,7 @@ test_cases.forEach((testInfo) => { const acirComposer = await api.acirNewAcirComposer(CIRCUIT_SIZE); + // This took ~6.5 minutes! const proof = await api.acirCreateProof( acirComposer, acirUint8Array, @@ -139,7 +140,7 @@ test_cases.forEach((testInfo) => { isRecursive ); - + // And this took ~5 minutes! const verified = await api.acirVerifyProof(acirComposer, proof, isRecursive); expect(verified).to.be.true; diff --git a/compiler/integration-tests/web-test-runner.config.mjs b/compiler/integration-tests/web-test-runner.config.mjs index 8d7b77df63b..1f8b74c3b3b 100644 --- a/compiler/integration-tests/web-test-runner.config.mjs +++ b/compiler/integration-tests/web-test-runner.config.mjs @@ -1,20 +1,19 @@ -import { fileURLToPath } from 'url'; +import { fileURLToPath } from "url"; import { esbuildPlugin } from "@web/dev-server-esbuild"; -import { webdriverLauncher } from '@web/test-runner-webdriver'; +import { webdriverLauncher } from "@web/test-runner-webdriver"; export default { browsers: [ webdriverLauncher({ - automationProtocol: 'webdriver', + automationProtocol: "webdriver", capabilities: { - browserName: 'firefox', - 'moz:firefoxOptions': { - args: ['-headless'], + browserName: "firefox", + "moz:firefoxOptions": { + args: ["-headless"], }, }, }), - -], + ], plugins: [ esbuildPlugin({ ts: true, @@ -27,6 +26,6 @@ export default { ui: "bdd", }, }, - rootDir: fileURLToPath(new URL('./../..', import.meta.url)), - + rootDir: fileURLToPath(new URL("./../..", import.meta.url)), + testsFinishTimeout: 60 * 20e3, // 20 minutes }; diff --git a/compiler/integration-tests/yarn.lock b/compiler/integration-tests/yarn.lock index f15cdd37080..4afb20e071e 100644 --- a/compiler/integration-tests/yarn.lock +++ b/compiler/integration-tests/yarn.lock @@ -231,7 +231,7 @@ fastq "^1.6.0" "@noir-lang/acvm_js@./../../.packages/acvm_js": - version "0.25.0" + version "0.26.0" "@noir-lang/noir-source-resolver@^1.1.4": version "1.1.4" @@ -239,7 +239,7 @@ integrity sha512-jmUcEoRXRSyhPyOqeDGi3E/7rYRVyqiNR0YQkwqH2G/WyvlHL2o2Ltk2N9iYKMNm1la0ri35Nz9OvIeeXjI4wA== "@noir-lang/noir_wasm@./../../.packages/noir_wasm": - version "0.10.5" + version "0.11.1" "@noir-lang/noirc_abi@./../../.packages/noirc_abi_wasm": version "0.8.0" @@ -832,7 +832,7 @@ picomatch "^2.2.2" source-map "^0.7.3" -"@web/test-runner-core@^0.11.0", "@web/test-runner-core@^0.11.1": +"@web/test-runner-core@^0.11.1": version "0.11.4" resolved "https://registry.yarnpkg.com/@web/test-runner-core/-/test-runner-core-0.11.4.tgz#590994c3fc69337e2c5411bf11c293dd061cc07a" integrity sha512-E7BsKAP8FAAEsfj4viASjmuaYfOw4UlKP9IFqo4W20eVyd1nbUWU3Amq4Jksh7W/j811qh3VaFNjDfCwklQXMg== @@ -874,17 +874,6 @@ picomatch "^2.2.2" v8-to-istanbul "^9.0.1" -"@web/test-runner-coverage-v8@^0.7.0": - version "0.7.1" - resolved "https://registry.yarnpkg.com/@web/test-runner-coverage-v8/-/test-runner-coverage-v8-0.7.1.tgz#b09c73f3e49ef6256cb589a5d7b09d1e28aef9b2" - integrity sha512-R0laTOxbLg7kVKHCBILEmja3w1ihlwkB+eRc7J06/ByyZoQVWxkM9SrTAUx7qCFI6o738Jj24a6TfIDbu3CwSA== - dependencies: - "@web/test-runner-core" "^0.11.0" - istanbul-lib-coverage "^3.0.0" - lru-cache "^8.0.4" - picomatch "^2.2.2" - v8-to-istanbul "^9.0.1" - "@web/test-runner-mocha@^0.7.5": version "0.7.5" resolved "https://registry.yarnpkg.com/@web/test-runner-mocha/-/test-runner-mocha-0.7.5.tgz#696f8cb7f5118a72bd7ac5778367ae3bd3fb92cd" @@ -893,15 +882,6 @@ "@types/mocha" "^8.2.0" "@web/test-runner-core" "^0.10.20" -"@web/test-runner-playwright@^0.10.0": - version "0.10.1" - resolved "https://registry.yarnpkg.com/@web/test-runner-playwright/-/test-runner-playwright-0.10.1.tgz#f9fc29dbd771bcb65dcebe826b257d10fb8a8ec5" - integrity sha512-/sEfuKc60UT0gXdn7M6lFddh+nCepO73gLPe2Og7jfoFv2tDkkk41RYBG75jx11RMVOJ6+i1peluLZSVxLlcEg== - dependencies: - "@web/test-runner-core" "^0.11.0" - "@web/test-runner-coverage-v8" "^0.7.0" - playwright "^1.22.2" - "@web/test-runner-webdriver@^0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@web/test-runner-webdriver/-/test-runner-webdriver-0.7.0.tgz#cbe64cddbc84e4a7739f2211b3aa85bbe83bf9cd" @@ -3189,18 +3169,6 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -playwright-core@1.37.1: - version "1.37.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.37.1.tgz#cb517d52e2e8cb4fa71957639f1cd105d1683126" - integrity sha512-17EuQxlSIYCmEMwzMqusJ2ztDgJePjrbttaefgdsiqeLWidjYz9BxXaTaZWxH1J95SHGk6tjE+dwgWILJoUZfA== - -playwright@^1.22.2: - version "1.37.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.37.1.tgz#6e488d82d7d98b9127c5db9c701f9c956ab47e76" - integrity sha512-bgUXRrQKhT48zHdxDYQTpf//0xDfDd5hLeEhjuSw8rXEGoT9YeElpfvs/izonTNY21IQZ7d3s22jLxYaAnubbQ== - dependencies: - playwright-core "1.37.1" - portfinder@^1.0.32: version "1.0.32" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81" diff --git a/compiler/wasm/test/browser/index.test.ts b/compiler/wasm/test/browser/index.test.ts index 9cc49069bfd..da00d595aa0 100644 --- a/compiler/wasm/test/browser/index.test.ts +++ b/compiler/wasm/test/browser/index.test.ts @@ -31,5 +31,5 @@ describe("noir wasm compilation", () => { expect(wasmCircuitBase64).to.equal(cliCircuitBase64); - }).timeout(10e3); + }).timeout(20e3); // 20 seconds });