diff --git a/.github/workflows/auto-pr-rebuild-script.yml b/.github/workflows/auto-pr-rebuild-script.yml index 7b551b0aece..d81c9820c3e 100644 --- a/.github/workflows/auto-pr-rebuild-script.yml +++ b/.github/workflows/auto-pr-rebuild-script.yml @@ -16,20 +16,21 @@ jobs: steps: - name: Check if artifacts should be published id: check - run: | - if [ ${{ github.ref_name }} == "master" ]; then - # Always publish on master - echo "publish=true" >> "$GITHUB_OUTPUT" - else - # Only publish on PRs if label is set - HAS_ARTIFACT_LABEL=$(gh pr view $PR --repo $REPO_URL --json labels | jq '.labels | any(.name == "publish-acir")') - echo "publish=$HAS_ARTIFACT_LABEL" >> "$GITHUB_OUTPUT" - fi + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { REF_NAME } = process.env; + if (REF_NAME == "master") { + return true; + } + + const labels = context.payload.pull_request.labels.map(label => label.name); + return labels.includes('publish-acir'); + result-encoding: string env: - GH_TOKEN: ${{ github.token }} - PR: ${{ github.event.pull_request.number }} - REPO_URL: ${{ github.repositoryUrl }} - + REF_NAME: ${{ github.ref_name }} + build-nargo: name: Build nargo binary runs-on: ubuntu-22.04 @@ -44,7 +45,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 3fa070106cd..97736e2415e 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -32,7 +32,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 with: targets: ${{ matrix.target }} components: clippy, rustfmt diff --git a/.github/workflows/gates_report.yml b/.github/workflows/gates_report.yml index e2d6bdd56b7..41a68c65852 100644 --- a/.github/workflows/gates_report.yml +++ b/.github/workflows/gates_report.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/publish-acvm.yml b/.github/workflows/publish-acvm.yml index 3f4641a690c..ded669f13d0 100644 --- a/.github/workflows/publish-acvm.yml +++ b/.github/workflows/publish-acvm.yml @@ -18,9 +18,7 @@ jobs: ref: ${{ inputs.acvm-ref }} - name: Setup toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: 1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 # These steps are in a specific order so crate dependencies are updated first - name: Publish acir_field diff --git a/.github/workflows/publish-nargo.yml b/.github/workflows/publish-nargo.yml index fa642de8a4f..59d4fe4cc48 100644 --- a/.github/workflows/publish-nargo.yml +++ b/.github/workflows/publish-nargo.yml @@ -45,7 +45,7 @@ jobs: echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 with: targets: ${{ matrix.target }} @@ -128,7 +128,7 @@ jobs: ref: ${{ inputs.tag || env.GITHUB_REF }} - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 with: targets: ${{ matrix.target }} @@ -177,6 +177,7 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ./nargo-${{ matrix.target }}.tar.gz asset_name: nargo-${{ matrix.target }}.tar.gz + prerelease: true overwrite: true tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch) @@ -198,4 +199,4 @@ jobs: overwrite: true tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }} - \ No newline at end of file + diff --git a/.github/workflows/test-abi_wasm.yml b/.github/workflows/test-abi_wasm.yml index 7fecb66fd7f..adc229b6b88 100644 --- a/.github/workflows/test-abi_wasm.yml +++ b/.github/workflows/test-abi_wasm.yml @@ -15,23 +15,17 @@ concurrency: jobs: build: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build noirc_abi_wasm run: | diff --git a/.github/workflows/test-acvm-js.yml b/.github/workflows/test-acvm-js.yml index c69f4995198..9e17be5a26f 100644 --- a/.github/workflows/test-acvm-js.yml +++ b/.github/workflows/test-acvm-js.yml @@ -19,15 +19,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v20 + - name: Setup Nix + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-22.11 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build acvm-js run: | diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index f3bb953f676..3def7442f96 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 - uses: Swatinem/rust-cache@v2 with: @@ -45,40 +45,22 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build wasm package run: | nix build -L .#noir_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noir-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV @@ -91,40 +73,17 @@ jobs: build-noirc: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v3 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Restore nix store cache - uses: actions/cache/restore@v3 - id: cache - with: - path: ${{ env.CACHED_PATH }} - key: ${{ runner.os }}-flake-abi-wasm-${{ hashFiles('*.lock') }} - - # Based on https://github.com/marigold-dev/deku/blob/b5016f0cf4bf6ac48db9111b70dd7fb49b969dfd/.github/workflows/build.yml#L26 - - name: Copy cache into nix store - if: steps.cache.outputs.cache-hit == 'true' - # We don't check the signature because we're the one that created the cache - run: | - for narinfo in ${{ env.CACHED_PATH }}/*.narinfo; do - path=$(head -n 1 "$narinfo" | awk '{print $2}') - nix copy --no-check-sigs --from "file://${{ env.CACHED_PATH }}" "$path" - done + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build noirc_abi_wasm run: | @@ -132,18 +91,6 @@ jobs: cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm - - name: Export cache from nix store - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - run: | - nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noirc-abi-wasm-cargo-artifacts - - - uses: actions/cache/save@v3 - # Don't create cache entries for the merge queue. - if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} - with: - path: ${{ env.CACHED_PATH }} - key: ${{ steps.cache.outputs.cache-primary-key }} - - name: Dereference symlink run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV diff --git a/.github/workflows/test-noir-js.yml b/.github/workflows/test-noir-js.yml index 8f1862bdfdc..e74f2ee6015 100644 --- a/.github/workflows/test-noir-js.yml +++ b/.github/workflows/test-noir-js.yml @@ -21,7 +21,7 @@ jobs: uses: ./.github/actions/setup - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 with: targets: wasm32-unknown-unknown diff --git a/.github/workflows/test-noir_wasm.yml b/.github/workflows/test-noir_wasm.yml index eea4074e00a..caafe6b91db 100644 --- a/.github/workflows/test-noir_wasm.yml +++ b/.github/workflows/test-noir_wasm.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 - uses: Swatinem/rust-cache@v2 with: @@ -49,23 +49,17 @@ jobs: build-wasm: runs-on: ubuntu-latest - env: - CACHED_PATH: /tmp/nix-cache steps: - name: Checkout sources uses: actions/checkout@v4 - name: Setup Nix - uses: cachix/install-nix-action@v22 + uses: ./.github/actions/nix with: - nix_path: nixpkgs=channel:nixos-23.05 - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: barretenberg - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: ${{ vars.NIX_CACHE_NAME }} + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - name: Build wasm package run: | diff --git a/.github/workflows/test-rust-workspace.yml b/.github/workflows/test-rust-workspace.yml index e5a94aaac4b..eccd7585fcf 100644 --- a/.github/workflows/test-rust-workspace.yml +++ b/.github/workflows/test-rust-workspace.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v4 - name: Setup toolchain - uses: dtolnay/rust-toolchain@1.66.0 + uses: dtolnay/rust-toolchain@1.71.1 with: targets: ${{ matrix.target }} diff --git a/Cargo.lock b/Cargo.lock index 09f2708da11..abe785a4b1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,6 +7,7 @@ name = "acir" version = "0.30.0" dependencies = [ "acir_field", + "base64", "bincode", "brillig", "flate2", @@ -2405,7 +2406,6 @@ name = "nargo" version = "0.18.0" dependencies = [ "acvm", - "base64", "codespan-reporting", "fm", "iter-extended", @@ -2488,6 +2488,7 @@ dependencies = [ "fm", "nargo", "noirc_frontend", + "semver", "serde", "thiserror", "toml", @@ -2625,7 +2626,6 @@ name = "noirc_driver" version = "0.18.0" dependencies = [ "acvm", - "base64", "build-data", "clap", "fm", @@ -3687,9 +3687,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 78b15287060..95f18043fd6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,9 +47,29 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/noir-lang/noir/" [workspace.dependencies] + +# ACVM workspace dependencies +acir = { path = "acvm-repo/acir", default-features = false } +acvm = { path = "acvm-repo/acvm" } +acir_field = { path = "acvm-repo/acir_field", default-features = false } +stdlib = { package = "acvm_stdlib", path = "acvm-repo/stdlib", default-features = false } +brillig = { path = "acvm-repo/brillig", default-features = false } +brillig_vm = { path = "acvm-repo/brillig_vm", default-features = false } +acvm_blackbox_solver = { path = "acvm-repo/blackbox_solver", default-features = false } +barretenberg_blackbox_solver = { path = "acvm-repo/barretenberg_blackbox_solver", default-features = false } + +# Noir compiler workspace dependencies arena = { path = "compiler/utils/arena" } fm = { path = "compiler/fm" } iter-extended = { path = "compiler/utils/iter-extended" } +noirc_driver = { path = "compiler/noirc_driver" } +noirc_errors = { path = "compiler/noirc_errors" } +noirc_evaluator = { path = "compiler/noirc_evaluator" } +noirc_frontend = { path = "compiler/noirc_frontend" } +noirc_printable_type = { path = "compiler/noirc_printable_type" } +noir_wasm = { path = "compiler/wasm" } + +# Noir tooling workspace dependencies nargo = { path = "tooling/nargo" } nargo_fmt = { path = "tooling/nargo_fmt" } nargo_cli = { path = "tooling/nargo_cli" } @@ -58,12 +78,22 @@ noir_lsp = { path = "tooling/lsp" } noir_debugger = { path = "tooling/debugger" } noirc_abi = { path = "tooling/noirc_abi" } bb_abstraction_leaks = { path = "tooling/bb_abstraction_leaks" } -noirc_driver = { path = "compiler/noirc_driver" } -noirc_errors = { path = "compiler/noirc_errors" } -noirc_evaluator = { path = "compiler/noirc_evaluator" } -noirc_frontend = { path = "compiler/noirc_frontend" } -noirc_printable_type = { path = "compiler/noirc_printable_type" } -noir_wasm = { path = "compiler/wasm" } + +# LSP +async-lsp = { version = "0.0.5", default-features = false } +lsp-types = "0.94" +tower = "0.4" + +# Wasm +wasm-bindgen = { version = "=0.2.86", features = ["serde-serialize"] } +wasm-bindgen-test = "0.3.36" +wasm-bindgen-futures = "0.4.36" +console_error_panic_hook = "0.1.7" +gloo-utils = { version = "0.1", features = ["serde"] } +js-sys = "0.3.62" +getrandom = "0.2" + + cfg-if = "1.0.0" clap = { version = "4.3.19", features = ["derive"] } codespan = { version = "0.11.1", features = ["serialization"] } @@ -74,31 +104,18 @@ chumsky = { git = "https://github.com/jfecher/chumsky", rev = "ad9d312", default "std", ] } dirs = "4" -lsp-types = "0.94" serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0" smol_str = { version = "0.1.17", features = ["serde"] } thiserror = "1.0.21" toml = "0.7.2" -tower = "0.4" url = "2.2.0" -wasm-bindgen = { version = "=0.2.86", features = ["serde-serialize"] } -wasm-bindgen-test = "0.3.33" -js-sys = "0.3.62" base64 = "0.21.2" fxhash = "0.2.1" -acir = { path = "acvm-repo/acir", default-features = false } -acvm = { path = "acvm-repo/acvm" } -acir_field = { path = "acvm-repo/acir_field", default-features = false } -stdlib = { package = "acvm_stdlib", path = "acvm-repo/stdlib", default-features = false } -brillig = { path = "acvm-repo/brillig", default-features = false } -brillig_vm = { path = "acvm-repo/brillig_vm", default-features = false } -acvm_blackbox_solver = { path = "acvm-repo/blackbox_solver", default-features = false } -barretenberg_blackbox_solver = { path = "acvm-repo/barretenberg_blackbox_solver", default-features = false } - +build-data = "0.1.3" bincode = "1.3.3" - hex = "0.4.2" +const_format = "0.2.30" num-bigint = "0.4" num-traits = "0.2" diff --git a/README.md b/README.md index 22ace1fd3b4..c48c9110187 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Concretely the following items are on the road map: ## Minimum Rust version -This crate's minimum supported rustc version is 1.66.0. +This crate's minimum supported rustc version is 1.71.1. ## Working on this project diff --git a/acvm-repo/acir/Cargo.toml b/acvm-repo/acir/Cargo.toml index af6429a3a3d..871f7c514c1 100644 --- a/acvm-repo/acir/Cargo.toml +++ b/acvm-repo/acir/Cargo.toml @@ -19,6 +19,7 @@ serde.workspace = true thiserror.workspace = true flate2 = "1.0.24" bincode.workspace = true +base64.workspace = true [dev-dependencies] serde_json = "1.0" diff --git a/acvm-repo/acir/src/circuit/mod.rs b/acvm-repo/acir/src/circuit/mod.rs index 3171cb57d16..99ab389e31e 100644 --- a/acvm-repo/acir/src/circuit/mod.rs +++ b/acvm-repo/acir/src/circuit/mod.rs @@ -9,9 +9,10 @@ use thiserror::Error; use std::{io::prelude::*, num::ParseIntError, str::FromStr}; +use base64::Engine; use flate2::Compression; +use serde::{de::Error as DeserializationError, Deserialize, Deserializer, Serialize, Serializer}; -use serde::{Deserialize, Serialize}; use std::collections::BTreeSet; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default)] @@ -125,7 +126,7 @@ impl Circuit { PublicInputs(public_inputs) } - pub fn write(&self, writer: W) -> std::io::Result<()> { + fn write(&self, writer: W) -> std::io::Result<()> { let buf = bincode::serialize(self).unwrap(); let mut encoder = flate2::write::GzEncoder::new(writer, Compression::default()); encoder.write_all(&buf)?; @@ -133,13 +134,46 @@ impl Circuit { Ok(()) } - pub fn read(reader: R) -> std::io::Result { + fn read(reader: R) -> std::io::Result { let mut gz_decoder = flate2::read::GzDecoder::new(reader); let mut buf_d = Vec::new(); gz_decoder.read_to_end(&mut buf_d)?; bincode::deserialize(&buf_d) .map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidInput, err)) } + + pub fn serialize_circuit(circuit: &Circuit) -> Vec { + let mut circuit_bytes: Vec = Vec::new(); + circuit.write(&mut circuit_bytes).expect("expected circuit to be serializable"); + circuit_bytes + } + + pub fn deserialize_circuit(serialized_circuit: &[u8]) -> std::io::Result { + Circuit::read(serialized_circuit) + } + + // Serialize and base64 encode circuit + pub fn serialize_circuit_base64(circuit: &Circuit, s: S) -> Result + where + S: Serializer, + { + let circuit_bytes = Circuit::serialize_circuit(circuit); + let encoded_b64 = base64::engine::general_purpose::STANDARD.encode(circuit_bytes); + s.serialize_str(&encoded_b64) + } + + // Deserialize and base64 decode circuit + pub fn deserialize_circuit_base64<'de, D>(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let bytecode_b64: String = serde::Deserialize::deserialize(deserializer)?; + let circuit_bytes = base64::engine::general_purpose::STANDARD + .decode(bytecode_b64) + .map_err(D::Error::custom)?; + let circuit = Self::deserialize_circuit(&circuit_bytes).map_err(D::Error::custom)?; + Ok(circuit) + } } impl std::fmt::Display for Circuit { @@ -229,9 +263,8 @@ mod tests { }; fn read_write(circuit: Circuit) -> (Circuit, Circuit) { - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); - let got_circuit = Circuit::read(&*bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); + let got_circuit = Circuit::deserialize_circuit(&bytes).unwrap(); (circuit, got_circuit) } @@ -277,7 +310,7 @@ mod tests { encoder.write_all(bad_circuit).unwrap(); encoder.finish().unwrap(); - let deserialization_result = Circuit::read(&*zipped_bad_circuit); + let deserialization_result = Circuit::deserialize_circuit(&zipped_bad_circuit); assert!(deserialization_result.is_err()); } } diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 2a25129df48..ff69ba34437 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -42,8 +42,7 @@ fn addition_circuit() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 144, 187, 13, 192, 32, 12, 68, 249, 100, 32, 27, @@ -73,8 +72,7 @@ fn fixed_base_scalar_mul_circuit() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 138, 91, 10, 0, 48, 12, 194, 178, 215, 215, 46, 189, @@ -101,8 +99,7 @@ fn pedersen_circuit() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 138, 9, 10, 0, 64, 8, 2, 103, 15, 250, 255, 139, @@ -143,8 +140,7 @@ fn schnorr_verify_circuit() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 210, 87, 78, 2, 1, 20, 134, 209, 177, 247, 222, 123, @@ -197,8 +193,7 @@ fn simple_brillig_foreign_call() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 143, 49, 10, 64, 33, 12, 67, 99, 63, 124, 60, 142, @@ -271,8 +266,7 @@ fn complex_brillig_foreign_call() { ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 83, 219, 10, 128, 48, 8, 117, 174, 139, 159, 179, @@ -310,8 +304,7 @@ fn memory_op_circuit() { return_values: PublicInputs([Witness(4)].into()), ..Circuit::default() }; - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); + let bytes = Circuit::serialize_circuit(&circuit); let expected_serialization: Vec = vec![ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 146, 49, 14, 0, 32, 8, 3, 139, 192, 127, 240, 7, diff --git a/acvm-repo/acvm_js/Cargo.toml b/acvm-repo/acvm_js/Cargo.toml index b63b0b7be6e..c224b029726 100644 --- a/acvm-repo/acvm_js/Cargo.toml +++ b/acvm-repo/acvm_js/Cargo.toml @@ -21,22 +21,23 @@ cfg-if = "1.0.0" [target.'cfg(target_arch = "wasm32")'.dependencies] acvm = { path = "../acvm", default-features = false } barretenberg_blackbox_solver = { path = "../barretenberg_blackbox_solver", default-features = false } -wasm-bindgen = { version = "0.2.86", features = ["serde-serialize"] } -wasm-bindgen-futures = "0.4.36" +wasm-bindgen.workspace = true +wasm-bindgen-futures.workspace = true +console_error_panic_hook.workspace = true +gloo-utils.workspace = true +js-sys.workspace = true + serde = { version = "1.0.136", features = ["derive"] } log = "0.4.17" wasm-logger = "0.2.0" -console_error_panic_hook = "0.1.7" -gloo-utils = { version = "0.1", features = ["serde"] } -js-sys.workspace = true const-str = "0.5.5" [build-dependencies] -build-data = "0.1.3" +build-data.workspace = true pkg-config = "0.3" [dev-dependencies] -wasm-bindgen-test = "0.3.36" +wasm-bindgen-test.workspace = true [features] default = ["bn254"] diff --git a/acvm-repo/acvm_js/src/execute.rs b/acvm-repo/acvm_js/src/execute.rs index ebbfc4297c3..81e2a11ed5a 100644 --- a/acvm-repo/acvm_js/src/execute.rs +++ b/acvm-repo/acvm_js/src/execute.rs @@ -64,7 +64,8 @@ pub async fn execute_circuit_with_black_box_solver( foreign_call_handler: ForeignCallHandler, ) -> Result { console_error_panic_hook::set_once(); - let circuit: Circuit = Circuit::read(&*circuit).expect("Failed to deserialize circuit"); + let circuit: Circuit = + Circuit::deserialize_circuit(&circuit).expect("Failed to deserialize circuit"); let mut acvm = ACVM::new(&solver.0, &circuit.opcodes, initial_witness.into()); diff --git a/acvm-repo/acvm_js/src/public_witness.rs b/acvm-repo/acvm_js/src/public_witness.rs index 46e4b788772..8dc66c435b3 100644 --- a/acvm-repo/acvm_js/src/public_witness.rs +++ b/acvm-repo/acvm_js/src/public_witness.rs @@ -30,7 +30,8 @@ pub fn get_return_witness( witness_map: JsWitnessMap, ) -> Result { console_error_panic_hook::set_once(); - let circuit: Circuit = Circuit::read(&*circuit).expect("Failed to deserialize circuit"); + let circuit: Circuit = + Circuit::deserialize_circuit(&circuit).expect("Failed to deserialize circuit"); let witness_map = WitnessMap::from(witness_map); let return_witness = @@ -50,7 +51,8 @@ pub fn get_public_parameters_witness( solved_witness: JsWitnessMap, ) -> Result { console_error_panic_hook::set_once(); - let circuit: Circuit = Circuit::read(&*circuit).expect("Failed to deserialize circuit"); + let circuit: Circuit = + Circuit::deserialize_circuit(&circuit).expect("Failed to deserialize circuit"); let witness_map = WitnessMap::from(solved_witness); let public_params_witness = @@ -70,7 +72,8 @@ pub fn get_public_witness( solved_witness: JsWitnessMap, ) -> Result { console_error_panic_hook::set_once(); - let circuit: Circuit = Circuit::read(&*circuit).expect("Failed to deserialize circuit"); + let circuit: Circuit = + Circuit::deserialize_circuit(&circuit).expect("Failed to deserialize circuit"); let witness_map = WitnessMap::from(solved_witness); let public_witness = diff --git a/acvm-repo/barretenberg_blackbox_solver/Cargo.toml b/acvm-repo/barretenberg_blackbox_solver/Cargo.toml index c189c11cd10..2f81a52db74 100644 --- a/acvm-repo/barretenberg_blackbox_solver/Cargo.toml +++ b/acvm-repo/barretenberg_blackbox_solver/Cargo.toml @@ -34,12 +34,12 @@ wasmer = { version = "3.3", default-features = false, features = [ "js-default", ] } -getrandom = { version = "0.2", features = ["js"] } -wasm-bindgen-futures = "0.4.36" +getrandom = { workspace = true, features = ["js"] } +wasm-bindgen-futures.workspace = true js-sys.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -getrandom = "0.2" +getrandom.workspace = true wasmer = "3.3" [build-dependencies] diff --git a/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs b/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs index c19554eb6bc..c816e5b4d1b 100644 --- a/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs +++ b/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs @@ -57,8 +57,7 @@ impl Pedersen for Barretenberg { #[test] fn pedersen_hash_to_point() -> Result<(), Error> { let barretenberg = Barretenberg::new(); - let (x, y) = barretenberg - .encrypt(vec![FieldElement::from(1 as u128), FieldElement::from(1 as u128)], 1)?; + let (x, y) = barretenberg.encrypt(vec![FieldElement::one(), FieldElement::one()], 1)?; let expected_x = FieldElement::from_hex( "0x12afb43195f5c621d1d2cabb5f629707095c5307fd4185a663d4e80bb083e878", ) diff --git a/compiler/integration-tests/circuits/main/Nargo.toml b/compiler/integration-tests/circuits/main/Nargo.toml index 664e817cc84..cc5a0a357fa 100644 --- a/compiler/integration-tests/circuits/main/Nargo.toml +++ b/compiler/integration-tests/circuits/main/Nargo.toml @@ -2,6 +2,4 @@ name = "main" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/compiler/integration-tests/circuits/recursion/Nargo.toml b/compiler/integration-tests/circuits/recursion/Nargo.toml index 5469c07c7de..276ba1b34e0 100644 --- a/compiler/integration-tests/circuits/recursion/Nargo.toml +++ b/compiler/integration-tests/circuits/recursion/Nargo.toml @@ -2,6 +2,4 @@ name = "recursion" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/compiler/noirc_driver/Cargo.toml b/compiler/noirc_driver/Cargo.toml index 31c0f695d0f..09044b39323 100644 --- a/compiler/noirc_driver/Cargo.toml +++ b/compiler/noirc_driver/Cargo.toml @@ -8,7 +8,7 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -build-data = "0.1.3" +build-data.workspace = true [dependencies] clap.workspace = true @@ -20,5 +20,4 @@ acvm.workspace = true iter-extended.workspace = true fm.workspace = true serde.workspace = true -base64.workspace = true fxhash.workspace = true diff --git a/compiler/noirc_driver/src/contract.rs b/compiler/noirc_driver/src/contract.rs index d8688780a1f..ae55d239cf3 100644 --- a/compiler/noirc_driver/src/contract.rs +++ b/compiler/noirc_driver/src/contract.rs @@ -8,7 +8,6 @@ use noirc_errors::debug_info::DebugInfo; use noirc_evaluator::errors::SsaReport; use super::debug::DebugFile; -use crate::program::{deserialize_circuit, serialize_circuit}; /// Describes the types of smart contract functions that are allowed. /// Unlike the similar enum in noirc_frontend, 'open' and 'unconstrained' @@ -62,7 +61,10 @@ pub struct ContractFunction { pub abi: Abi, - #[serde(serialize_with = "serialize_circuit", deserialize_with = "deserialize_circuit")] + #[serde( + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" + )] pub bytecode: Circuit, pub debug: DebugInfo, diff --git a/compiler/noirc_driver/src/program.rs b/compiler/noirc_driver/src/program.rs index a940f6b20b8..8d509d3bf68 100644 --- a/compiler/noirc_driver/src/program.rs +++ b/compiler/noirc_driver/src/program.rs @@ -3,11 +3,9 @@ use std::collections::BTreeMap; use acvm::acir::circuit::Circuit; use fm::FileId; -use base64::Engine; use noirc_errors::debug_info::DebugInfo; use noirc_evaluator::errors::SsaReport; -use serde::{de::Error as DeserializationError, ser::Error as SerializationError}; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Serialize}; use super::debug::DebugFile; @@ -20,32 +18,13 @@ pub struct CompiledProgram { /// Used to short-circuit compilation in the case of the source code not changing since the last compilation. pub hash: u64, - #[serde(serialize_with = "serialize_circuit", deserialize_with = "deserialize_circuit")] + #[serde( + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" + )] pub circuit: Circuit, pub abi: noirc_abi::Abi, pub debug: DebugInfo, pub file_map: BTreeMap, pub warnings: Vec, } - -pub(crate) fn serialize_circuit(circuit: &Circuit, s: S) -> Result -where - S: Serializer, -{ - let mut circuit_bytes: Vec = Vec::new(); - circuit.write(&mut circuit_bytes).map_err(S::Error::custom)?; - - let encoded_b64 = base64::engine::general_purpose::STANDARD.encode(circuit_bytes); - s.serialize_str(&encoded_b64) -} - -pub(crate) fn deserialize_circuit<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - let bytecode_b64: String = serde::Deserialize::deserialize(deserializer)?; - let circuit_bytes = - base64::engine::general_purpose::STANDARD.decode(bytecode_b64).map_err(D::Error::custom)?; - let circuit = Circuit::read(&*circuit_bytes).map_err(D::Error::custom)?; - Ok(circuit) -} diff --git a/compiler/noirc_frontend/src/ast/statement.rs b/compiler/noirc_frontend/src/ast/statement.rs index 9fe78f40c59..7d19a079203 100644 --- a/compiler/noirc_frontend/src/ast/statement.rs +++ b/compiler/noirc_frontend/src/ast/statement.rs @@ -1,9 +1,14 @@ use std::fmt::Display; +use std::sync::atomic::{AtomicU32, Ordering}; use crate::lexer::token::SpannedToken; use crate::parser::{ParserError, ParserErrorReason}; use crate::token::Token; -use crate::{Expression, ExpressionKind, IndexExpression, MemberAccessExpression, UnresolvedType}; +use crate::{ + BlockExpression, Expression, ExpressionKind, IndexExpression, MemberAccessExpression, + MethodCallExpression, UnresolvedType, +}; +use acvm::FieldElement; use iter_extended::vecmap; use noirc_errors::{Span, Spanned}; @@ -478,12 +483,123 @@ impl LValue { } } +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum ForRange { + Range(/*start:*/ Expression, /*end:*/ Expression), + Array(Expression), +} + +impl ForRange { + /// Create a 'for' expression taking care of desugaring a 'for e in array' loop + /// into the following if needed: + /// + /// { + /// let fresh1 = array; + /// for fresh2 in 0 .. std::array::len(fresh1) { + /// let elem = fresh1[fresh2]; + /// ... + /// } + /// } + pub(crate) fn into_for( + self, + identifier: Ident, + block: Expression, + for_loop_span: Span, + ) -> StatementKind { + /// Counter used to generate unique names when desugaring + /// code in the parser requires the creation of fresh variables. + /// The parser is stateless so this is a static global instead. + static UNIQUE_NAME_COUNTER: AtomicU32 = AtomicU32::new(0); + + match self { + ForRange::Range(..) => { + unreachable!() + } + ForRange::Array(array) => { + let array_span = array.span; + let start_range = ExpressionKind::integer(FieldElement::zero()); + let start_range = Expression::new(start_range, array_span); + + let next_unique_id = UNIQUE_NAME_COUNTER.fetch_add(1, Ordering::Relaxed); + let array_name = format!("$i{next_unique_id}"); + let array_span = array.span; + let array_ident = Ident::new(array_name, array_span); + + // let fresh1 = array; + let let_array = Statement { + kind: StatementKind::Let(LetStatement { + pattern: Pattern::Identifier(array_ident.clone()), + r#type: UnresolvedType::unspecified(), + expression: array, + }), + span: array_span, + }; + + // array.len() + let segments = vec![array_ident]; + let array_ident = + ExpressionKind::Variable(Path { segments, kind: PathKind::Plain }); + + let end_range = ExpressionKind::MethodCall(Box::new(MethodCallExpression { + object: Expression::new(array_ident.clone(), array_span), + method_name: Ident::new("len".to_string(), array_span), + arguments: vec![], + })); + let end_range = Expression::new(end_range, array_span); + + let next_unique_id = UNIQUE_NAME_COUNTER.fetch_add(1, Ordering::Relaxed); + let index_name = format!("$i{next_unique_id}"); + let fresh_identifier = Ident::new(index_name.clone(), array_span); + + // array[i] + let segments = vec![Ident::new(index_name, array_span)]; + let index_ident = + ExpressionKind::Variable(Path { segments, kind: PathKind::Plain }); + + let loop_element = ExpressionKind::Index(Box::new(IndexExpression { + collection: Expression::new(array_ident, array_span), + index: Expression::new(index_ident, array_span), + })); + + // let elem = array[i]; + let let_elem = Statement { + kind: StatementKind::Let(LetStatement { + pattern: Pattern::Identifier(identifier), + r#type: UnresolvedType::unspecified(), + expression: Expression::new(loop_element, array_span), + }), + span: array_span, + }; + + let block_span = block.span; + let new_block = BlockExpression(vec![ + let_elem, + Statement { kind: StatementKind::Expression(block), span: block_span }, + ]); + let new_block = Expression::new(ExpressionKind::Block(new_block), block_span); + let for_loop = Statement { + kind: StatementKind::For(ForLoopStatement { + identifier: fresh_identifier, + range: ForRange::Range(start_range, end_range), + block: new_block, + span: for_loop_span, + }), + span: for_loop_span, + }; + + let block = ExpressionKind::Block(BlockExpression(vec![let_array, for_loop])); + StatementKind::Expression(Expression::new(block, for_loop_span)) + } + } + } +} + #[derive(Debug, PartialEq, Eq, Clone)] pub struct ForLoopStatement { pub identifier: Ident, - pub start_range: Expression, - pub end_range: Expression, + pub range: ForRange, pub block: Expression, + pub span: Span, } impl Display for StatementKind { @@ -575,10 +691,11 @@ impl Display for Pattern { impl Display for ForLoopStatement { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "for {} in {} .. {} {}", - self.identifier, self.start_range, self.end_range, self.block - ) + let range = match &self.range { + ForRange::Range(start, end) => format!("{start}..{end}"), + ForRange::Array(expr) => expr.to_string(), + }; + + write!(f, "for {} in {range} {}", self.identifier, self.block) } } diff --git a/compiler/noirc_frontend/src/hir/aztec_library.rs b/compiler/noirc_frontend/src/hir/aztec_library.rs index ad286a0ab91..fa51a09d4f9 100644 --- a/compiler/noirc_frontend/src/hir/aztec_library.rs +++ b/compiler/noirc_frontend/src/hir/aztec_library.rs @@ -280,7 +280,7 @@ fn transform_module( // Check for a user defined storage struct let storage_defined = check_for_storage_definition(&module); - if storage_defined && check_for_compute_note_hash_and_nullifier_definition(&module) { + if storage_defined && !check_for_compute_note_hash_and_nullifier_definition(&module) { let crate_graph = &context.crate_graph[crate_id]; return Err(( DefCollectorErrorKind::AztecComputeNoteHashAndNullifierNotFound { diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs index e59ab3e59f9..95ee08b29c5 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -757,7 +757,7 @@ fn resolve_trait_methods( for item in &unresolved_trait.trait_def.items { if let TraitItem::Function { name, - generics: _, + generics, parameters, return_type, where_clause: _, @@ -769,14 +769,14 @@ fn resolve_trait_methods( Type::TypeVariable(the_trait.self_type_typevar.clone(), TypeVariableKind::Normal); let mut resolver = Resolver::new(interner, &path_resolver, def_maps, file); + resolver.add_generics(generics); resolver.set_self_type(Some(self_type)); let arguments = vecmap(parameters, |param| resolver.resolve_type(param.1.clone())); let resolved_return_type = resolver.resolve_type(return_type.get_type().into_owned()); + let generics = resolver.get_generics().to_vec(); let name = name.clone(); - // TODO - let generics: Generics = vec![]; let span: Span = name.span(); let default_impl_list: Vec<_> = unresolved_trait .fns_with_default_impl diff --git a/compiler/noirc_frontend/src/hir/def_collector/errors.rs b/compiler/noirc_frontend/src/hir/def_collector/errors.rs index 2abacbc64da..5fc0d236ee5 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/errors.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/errors.rs @@ -67,6 +67,7 @@ pub enum DefCollectorErrorKind { TraitImplOrphaned { span: Span }, // Aztec feature flag errors + // TODO(benesjan): https://github.com/AztecProtocol/aztec-packages/issues/2905 #[cfg(feature = "aztec")] #[error("Aztec dependency not found. Please add aztec as a dependency in your Cargo.toml")] AztecNotFound {}, diff --git a/compiler/noirc_frontend/src/hir/resolution/resolver.rs b/compiler/noirc_frontend/src/hir/resolution/resolver.rs index b3796418ab3..72597ae97ba 100644 --- a/compiler/noirc_frontend/src/hir/resolution/resolver.rs +++ b/compiler/noirc_frontend/src/hir/resolution/resolver.rs @@ -36,10 +36,11 @@ use crate::{ StatementKind, }; use crate::{ - ArrayLiteral, ContractFunctionType, Distinctness, FunctionVisibility, Generics, LValue, - NoirStruct, NoirTypeAlias, Path, PathKind, Pattern, Shared, StructType, Type, TypeAliasType, - TypeBinding, TypeVariable, UnaryOp, UnresolvedGenerics, UnresolvedTraitConstraint, - UnresolvedType, UnresolvedTypeData, UnresolvedTypeExpression, Visibility, ERROR_IDENT, + ArrayLiteral, ContractFunctionType, Distinctness, ForRange, FunctionVisibility, Generics, + LValue, NoirStruct, NoirTypeAlias, Path, PathKind, Pattern, Shared, StructType, Type, + TypeAliasType, TypeBinding, TypeVariable, UnaryOp, UnresolvedGenerics, + UnresolvedTraitConstraint, UnresolvedType, UnresolvedTypeData, UnresolvedTypeExpression, + Visibility, ERROR_IDENT, }; use fm::FileId; use iter_extended::vecmap; @@ -1007,23 +1008,37 @@ impl<'a> Resolver<'a> { HirStatement::Assign(stmt) } StatementKind::For(for_loop) => { - let start_range = self.resolve_expression(for_loop.start_range); - let end_range = self.resolve_expression(for_loop.end_range); - let (identifier, block) = (for_loop.identifier, for_loop.block); - - // TODO: For loop variables are currently mutable by default since we haven't - // yet implemented syntax for them to be optionally mutable. - let (identifier, block) = self.in_new_scope(|this| { - let decl = this.add_variable_decl( - identifier, - false, - true, - DefinitionKind::Local(None), - ); - (decl, this.resolve_expression(block)) - }); + match for_loop.range { + ForRange::Range(start_range, end_range) => { + let start_range = self.resolve_expression(start_range); + let end_range = self.resolve_expression(end_range); + let (identifier, block) = (for_loop.identifier, for_loop.block); + + // TODO: For loop variables are currently mutable by default since we haven't + // yet implemented syntax for them to be optionally mutable. + let (identifier, block) = self.in_new_scope(|this| { + let decl = this.add_variable_decl( + identifier, + false, + true, + DefinitionKind::Local(None), + ); + (decl, this.resolve_expression(block)) + }); - HirStatement::For(HirForStatement { start_range, end_range, block, identifier }) + HirStatement::For(HirForStatement { + start_range, + end_range, + block, + identifier, + }) + } + range @ ForRange::Array(_) => { + let for_stmt = + range.into_for(for_loop.identifier, for_loop.block, for_loop.span); + self.resolve_stmt(for_stmt) + } + } } StatementKind::Error => HirStatement::Error, } diff --git a/compiler/noirc_frontend/src/hir/type_check/expr.rs b/compiler/noirc_frontend/src/hir/type_check/expr.rs index 00534cc3aa2..645082c3713 100644 --- a/compiler/noirc_frontend/src/hir/type_check/expr.rs +++ b/compiler/noirc_frontend/src/hir/type_check/expr.rs @@ -266,6 +266,7 @@ impl<'interner> TypeChecker<'interner> { Box::new(method.return_type.clone()), Box::new(Type::Unit), ); + let (typ, bindings) = typ.instantiate(self.interner); self.interner.store_instantiation_bindings(*expr_id, bindings); typ @@ -293,9 +294,9 @@ impl<'interner> TypeChecker<'interner> { argument_types: &mut [(Type, ExprId, noirc_errors::Span)], ) { let expected_object_type = match function_type { - Type::Function(args, _, _) => args.get(0), + Type::Function(args, _, _) => args.first(), Type::Forall(_, typ) => match typ.as_ref() { - Type::Function(args, _, _) => args.get(0), + Type::Function(args, _, _) => args.first(), typ => unreachable!("Unexpected type for function: {typ}"), }, typ => unreachable!("Unexpected type for function: {typ}"), diff --git a/compiler/noirc_frontend/src/hir_def/traits.rs b/compiler/noirc_frontend/src/hir_def/traits.rs index 3965cb2412f..0fbe5520b3f 100644 --- a/compiler/noirc_frontend/src/hir_def/traits.rs +++ b/compiler/noirc_frontend/src/hir_def/traits.rs @@ -1,3 +1,5 @@ +use std::rc::Rc; + use crate::{ graph::CrateId, node_interner::{FuncId, TraitId, TraitMethodId}, @@ -9,7 +11,7 @@ use noirc_errors::Span; #[derive(Clone, Debug, PartialEq, Eq)] pub struct TraitFunction { pub name: Ident, - pub generics: Generics, + pub generics: Vec<(Rc, TypeVariable, Span)>, pub arguments: Vec, pub return_type: Type, pub span: Span, diff --git a/compiler/noirc_frontend/src/lexer/lexer.rs b/compiler/noirc_frontend/src/lexer/lexer.rs index 2576b7a08ab..4a5ea56d8bc 100644 --- a/compiler/noirc_frontend/src/lexer/lexer.rs +++ b/compiler/noirc_frontend/src/lexer/lexer.rs @@ -6,17 +6,13 @@ use super::{ }; use acvm::FieldElement; use noirc_errors::{Position, Span}; -use std::str::Chars; -use std::{ - iter::{Peekable, Zip}, - ops::RangeFrom, -}; +use std::str::CharIndices; /// The job of the lexer is to transform an iterator of characters (`char_iter`) /// into an iterator of `SpannedToken`. Each `Token` corresponds roughly to 1 word or operator. /// Tokens are tagged with their location in the source file (a `Span`) for use in error reporting. pub struct Lexer<'a> { - char_iter: Peekable, RangeFrom>>, + chars: CharIndices<'a>, position: Position, done: bool, skip_comments: bool, @@ -41,13 +37,7 @@ impl<'a> Lexer<'a> { } pub fn new(source: &'a str) -> Self { - Lexer { - // We zip with the character index here to ensure the first char has index 0 - char_iter: source.chars().zip(0..).peekable(), - position: 0, - done: false, - skip_comments: true, - } + Lexer { chars: source.char_indices(), position: 0, done: false, skip_comments: true } } pub fn skip_comments(mut self, flag: bool) -> Self { @@ -57,21 +47,21 @@ impl<'a> Lexer<'a> { /// Iterates the cursor and returns the char at the new cursor position fn next_char(&mut self) -> Option { - let (c, index) = self.char_iter.next()?; - self.position = index; - Some(c) + let (position, ch) = self.chars.next()?; + self.position = position as u32; + Some(ch) } /// Peeks at the next char. Does not iterate the cursor fn peek_char(&mut self) -> Option { - self.char_iter.peek().map(|(c, _)| *c) + self.chars.clone().next().map(|(_, ch)| ch) } /// Peeks at the character two positions ahead. Does not iterate the cursor fn peek2_char(&mut self) -> Option { - let mut chars = self.char_iter.clone(); + let mut chars = self.chars.clone(); chars.next(); - chars.next().map(|(c, _)| c) + chars.next().map(|(_, ch)| ch) } /// Peeks at the next char and returns true if it is equal to the char argument diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index ef5f72df4a2..c527951ea0a 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -953,7 +953,10 @@ impl NodeInterner { ) -> Option> { let impls = self.trait_implementation_map.get(&trait_id)?; for (existing_object_type, impl_id) in impls { - if object_type.try_unify(existing_object_type).is_ok() { + let object_type = object_type.instantiate_named_generics(self); + let existing_object_type = existing_object_type.instantiate_named_generics(self); + + if object_type.try_unify(&existing_object_type).is_ok() { return Some(self.get_trait_implementation(*impl_id)); } } diff --git a/compiler/noirc_frontend/src/parser/mod.rs b/compiler/noirc_frontend/src/parser/mod.rs index 4b76e2020b5..a6c631895cd 100644 --- a/compiler/noirc_frontend/src/parser/mod.rs +++ b/compiler/noirc_frontend/src/parser/mod.rs @@ -11,17 +11,13 @@ mod labels; #[allow(clippy::module_inception)] mod parser; -use std::sync::atomic::{AtomicU32, Ordering}; - use crate::token::{Keyword, Token}; use crate::{ast::ImportStatement, Expression, NoirStruct}; use crate::{ - BlockExpression, ExpressionKind, ForLoopStatement, Ident, IndexExpression, LetStatement, - MethodCallExpression, NoirFunction, NoirTrait, NoirTraitImpl, NoirTypeAlias, Path, PathKind, - Pattern, Recoverable, Statement, StatementKind, TypeImpl, UnresolvedType, UseTree, + Ident, LetStatement, NoirFunction, NoirTrait, NoirTraitImpl, NoirTypeAlias, Recoverable, + StatementKind, TypeImpl, UseTree, }; -use acvm::FieldElement; use chumsky::prelude::*; use chumsky::primitive::Container; pub use errors::ParserError; @@ -29,11 +25,6 @@ pub use errors::ParserErrorReason; use noirc_errors::Span; pub use parser::parse_program; -/// Counter used to generate unique names when desugaring -/// code in the parser requires the creation of fresh variables. -/// The parser is stateless so this is a static global instead. -static UNIQUE_NAME_COUNTER: AtomicU32 = AtomicU32::new(0); - #[derive(Debug, Clone)] pub(crate) enum TopLevelStatement { Function(NoirFunction), @@ -478,106 +469,6 @@ impl Precedence { } } -enum ForRange { - Range(/*start:*/ Expression, /*end:*/ Expression), - Array(Expression), -} - -impl ForRange { - /// Create a 'for' expression taking care of desugaring a 'for e in array' loop - /// into the following if needed: - /// - /// { - /// let fresh1 = array; - /// for fresh2 in 0 .. std::array::len(fresh1) { - /// let elem = fresh1[fresh2]; - /// ... - /// } - /// } - fn into_for(self, identifier: Ident, block: Expression, for_loop_span: Span) -> StatementKind { - match self { - ForRange::Range(start_range, end_range) => { - StatementKind::For(ForLoopStatement { identifier, start_range, end_range, block }) - } - ForRange::Array(array) => { - let array_span = array.span; - let start_range = ExpressionKind::integer(FieldElement::zero()); - let start_range = Expression::new(start_range, array_span); - - let next_unique_id = UNIQUE_NAME_COUNTER.fetch_add(1, Ordering::Relaxed); - let array_name = format!("$i{next_unique_id}"); - let array_span = array.span; - let array_ident = Ident::new(array_name, array_span); - - // let fresh1 = array; - let let_array = Statement { - kind: StatementKind::Let(LetStatement { - pattern: Pattern::Identifier(array_ident.clone()), - r#type: UnresolvedType::unspecified(), - expression: array, - }), - span: array_span, - }; - - // array.len() - let segments = vec![array_ident]; - let array_ident = - ExpressionKind::Variable(Path { segments, kind: PathKind::Plain }); - - let end_range = ExpressionKind::MethodCall(Box::new(MethodCallExpression { - object: Expression::new(array_ident.clone(), array_span), - method_name: Ident::new("len".to_string(), array_span), - arguments: vec![], - })); - let end_range = Expression::new(end_range, array_span); - - let next_unique_id = UNIQUE_NAME_COUNTER.fetch_add(1, Ordering::Relaxed); - let index_name = format!("$i{next_unique_id}"); - let fresh_identifier = Ident::new(index_name.clone(), array_span); - - // array[i] - let segments = vec![Ident::new(index_name, array_span)]; - let index_ident = - ExpressionKind::Variable(Path { segments, kind: PathKind::Plain }); - - let loop_element = ExpressionKind::Index(Box::new(IndexExpression { - collection: Expression::new(array_ident, array_span), - index: Expression::new(index_ident, array_span), - })); - - // let elem = array[i]; - let let_elem = Statement { - kind: StatementKind::Let(LetStatement { - pattern: Pattern::Identifier(identifier), - r#type: UnresolvedType::unspecified(), - expression: Expression::new(loop_element, array_span), - }), - span: array_span, - }; - - let block_span = block.span; - let new_block = BlockExpression(vec![ - let_elem, - Statement { kind: StatementKind::Expression(block), span: block_span }, - ]); - let new_block = Expression::new(ExpressionKind::Block(new_block), block_span); - let for_loop = Statement { - kind: StatementKind::For(ForLoopStatement { - identifier: fresh_identifier, - start_range, - end_range, - block: new_block, - }), - span: for_loop_span, - }; - - let block = ExpressionKind::Block(BlockExpression(vec![let_array, for_loop])); - StatementKind::Expression(Expression::new(block, for_loop_span)) - } - } - } -} - impl std::fmt::Display for TopLevelStatement { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index cee824a51c9..6d934421783 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -26,8 +26,8 @@ use super::{ foldl_with_span, labels::ParsingRuleLabel, parameter_name_recovery, parameter_recovery, parenthesized, then_commit, then_commit_ignore, top_level_statement_recovery, ExprParser, - ForRange, NoirParser, ParsedModule, ParsedSubModule, ParserError, ParserErrorReason, - Precedence, TopLevelStatement, + NoirParser, ParsedModule, ParsedSubModule, ParserError, ParserErrorReason, Precedence, + TopLevelStatement, }; use super::{spanned, Item, ItemKind}; use crate::ast::{ @@ -38,11 +38,11 @@ use crate::parser::{force, ignore_then_commit, statement_recovery}; use crate::token::{Attribute, Attributes, Keyword, SecondaryAttribute, Token, TokenKind}; use crate::{ BinaryOp, BinaryOpKind, BlockExpression, ConstrainKind, ConstrainStatement, Distinctness, - FunctionDefinition, FunctionReturnType, FunctionVisibility, Ident, IfExpression, - InfixExpression, LValue, Lambda, Literal, NoirFunction, NoirStruct, NoirTrait, NoirTraitImpl, - NoirTypeAlias, Path, PathKind, Pattern, Recoverable, Statement, TraitBound, TraitImplItem, - TraitItem, TypeImpl, UnaryOp, UnresolvedTraitConstraint, UnresolvedTypeExpression, UseTree, - UseTreeKind, Visibility, + ForLoopStatement, ForRange, FunctionDefinition, FunctionReturnType, FunctionVisibility, Ident, + IfExpression, InfixExpression, LValue, Lambda, Literal, NoirFunction, NoirStruct, NoirTrait, + NoirTraitImpl, NoirTypeAlias, Path, PathKind, Pattern, Recoverable, Statement, TraitBound, + TraitImplItem, TraitItem, TypeImpl, UnaryOp, UnresolvedTraitConstraint, + UnresolvedTypeExpression, UseTree, UseTreeKind, Visibility, }; use chumsky::prelude::*; @@ -1482,7 +1482,9 @@ where .then_ignore(keyword(Keyword::In)) .then(for_range(expr_no_constructors)) .then(block_expr(statement)) - .map_with_span(|((identifier, range), block), span| range.into_for(identifier, block, span)) + .map_with_span(|((identifier, range), block), span| { + StatementKind::For(ForLoopStatement { identifier, range, block, span }) + }) } /// The 'range' of a for loop. Either an actual range `start .. end` or an array expression. diff --git a/compiler/wasm/Cargo.toml b/compiler/wasm/Cargo.toml index b527e2de203..9ece26c6df4 100644 --- a/compiler/wasm/Cargo.toml +++ b/compiler/wasm/Cargo.toml @@ -22,16 +22,15 @@ wasm-bindgen.workspace = true serde.workspace = true js-sys.workspace = true cfg-if.workspace = true - -console_error_panic_hook = "0.1.7" -gloo-utils = { version = "0.1", features = ["serde"] } +console_error_panic_hook.workspace = true +gloo-utils.workspace = true log = "0.4.17" wasm-logger = "0.2.0" # This is an unused dependency, we are adding it # so that we can enable the js feature in getrandom. -getrandom = { version = "*", features = ["js"] } +getrandom = { workspace = true, features = ["js"] } [build-dependencies] -build-data = "0.1.3" +build-data.workspace = true diff --git a/compiler/wasm/fixtures/deps/lib-a/Nargo.toml b/compiler/wasm/fixtures/deps/lib-a/Nargo.toml index 3a02ccc1086..fa40b736619 100644 --- a/compiler/wasm/fixtures/deps/lib-a/Nargo.toml +++ b/compiler/wasm/fixtures/deps/lib-a/Nargo.toml @@ -2,7 +2,6 @@ name="lib_a" type="lib" authors = [""] -compiler_version = "0.1" [dependencies] lib_b = { path = "../lib-b" } diff --git a/compiler/wasm/fixtures/deps/lib-b/Nargo.toml b/compiler/wasm/fixtures/deps/lib-b/Nargo.toml index 99db61e4bfa..904b6e14b90 100644 --- a/compiler/wasm/fixtures/deps/lib-b/Nargo.toml +++ b/compiler/wasm/fixtures/deps/lib-b/Nargo.toml @@ -2,6 +2,5 @@ name="lib_b" type="lib" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/compiler/wasm/fixtures/deps/noir-script/Nargo.toml b/compiler/wasm/fixtures/deps/noir-script/Nargo.toml index 0df22c2be7e..7c8182a02ae 100644 --- a/compiler/wasm/fixtures/deps/noir-script/Nargo.toml +++ b/compiler/wasm/fixtures/deps/noir-script/Nargo.toml @@ -2,7 +2,6 @@ name="noir_wasm_testing" type="bin" authors = [""] -compiler_version = "0.1" [dependencies] lib_a = { path="../lib-a" } diff --git a/compiler/wasm/fixtures/simple/noir-script/Nargo.toml b/compiler/wasm/fixtures/simple/noir-script/Nargo.toml index a8d4eb100f2..75499a08245 100644 --- a/compiler/wasm/fixtures/simple/noir-script/Nargo.toml +++ b/compiler/wasm/fixtures/simple/noir-script/Nargo.toml @@ -2,6 +2,5 @@ name="noir_wasm_testing" type="bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/compiler/wasm/src/circuit.rs b/compiler/wasm/src/circuit.rs index 97f9ef9cf18..fdd9a7d9a20 100644 --- a/compiler/wasm/src/circuit.rs +++ b/compiler/wasm/src/circuit.rs @@ -6,7 +6,7 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn acir_read_bytes(bytes: Vec) -> JsValue { console_error_panic_hook::set_once(); - let circuit = Circuit::read(&*bytes).unwrap(); + let circuit = Circuit::deserialize_circuit(&bytes).unwrap(); ::from_serde(&circuit).unwrap() } @@ -14,7 +14,5 @@ pub fn acir_read_bytes(bytes: Vec) -> JsValue { pub fn acir_write_bytes(acir: JsValue) -> Vec { console_error_panic_hook::set_once(); let circuit: Circuit = JsValueSerdeExt::into_serde(&acir).unwrap(); - let mut bytes = Vec::new(); - circuit.write(&mut bytes).unwrap(); - bytes + Circuit::serialize_circuit(&circuit) } diff --git a/cspell.json b/cspell.json index 4df858ffcfa..90d3963566d 100644 --- a/cspell.json +++ b/cspell.json @@ -15,6 +15,7 @@ "bitand", "blackbox", "brillig", + "cachix", "callsite", "callsites", "canonicalize", @@ -23,6 +24,7 @@ "clippy", "codegen", "codegens", + "codespan", "coeff", "combinators", "comptime", @@ -95,6 +97,7 @@ "sdiv", "secp256k1", "secp256r1", + "serde", "signedness", "smol", "splitn", diff --git a/docs/docs/getting_started/00_nargo_installation.md b/docs/docs/getting_started/00_nargo_installation.md index 802c8380239..725c5f4d373 100644 --- a/docs/docs/getting_started/00_nargo_installation.md +++ b/docs/docs/getting_started/00_nargo_installation.md @@ -205,7 +205,7 @@ code . #### Building and testing Assuming you are using `direnv` to populate your environment, building and testing the project can be done -with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `rust-toolchain.toml`, which is 1.71.1 at the time of this writing. If you want to build the entire project in an isolated sandbox, you can use Nix commands: diff --git a/docs/docs/getting_started/02_breakdown.md b/docs/docs/getting_started/02_breakdown.md index bc0e742fb4e..9a17f5d6360 100644 --- a/docs/docs/getting_started/02_breakdown.md +++ b/docs/docs/getting_started/02_breakdown.md @@ -66,7 +66,7 @@ The package section requires a number of fields including: - `name` (**required**) - the name of the package - `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract - `authors` (optional) - authors of the project -- `compiler_version` (optional) - specifies the version of the compiler to use. This is not currently enforced by the compiler, but will be in future versions. +- `compiler_version` - specifies the version of the compiler to use. This is enforced by the compiler and follow's [Rust's versioning](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field), so a `compiler_version = 0.18.0` will enforce Nargo version 0.18.0, `compiler_version = ^0.18.0` will enforce anything above 0.18.0 but below 0.19.0, etc. For more information, see how [Rust handles these operators](https://docs.rs/semver/latest/semver/enum.Op.html) - `description` (optional) - `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) - `backend` (optional) diff --git a/docs/docs/migration_notes.md b/docs/docs/migration_notes.md index 48a8abcf22e..e87eb1feaba 100644 --- a/docs/docs/migration_notes.md +++ b/docs/docs/migration_notes.md @@ -6,6 +6,14 @@ keywords: [Noir, notes, migration, updating, upgrading] Noir is in full-speed development. Things break fast, wild, and often. This page attempts to leave some notes on errors you might encounter when upgrading and how to resolve them until proper patches are built. +## ≥0.19 + +### Enforcing `compiler_version` + +From this version on, the compiler will check for the `compiler_version` field in `Nargo.toml`, and will error if it doesn't match the current Nargo version in use. + +To update, please make sure this field in `Nargo.toml` matches the output of `nargo --version`. + ## ≥0.14 The index of the [for loops](./language_concepts/02_control_flow.md#loops) is now of type `u64` instead of `Field`. An example refactor would be: diff --git a/docs/docs/noir_js/getting_started/01_tiny_noir_app.md b/docs/docs/noir_js/getting_started/01_tiny_noir_app.md index ea1a29a8197..c51ed61de52 100644 --- a/docs/docs/noir_js/getting_started/01_tiny_noir_app.md +++ b/docs/docs/noir_js/getting_started/01_tiny_noir_app.md @@ -6,6 +6,8 @@ keywords: [how to, guide, javascript, typescript, noir, barretenberg, zero-knowl NoirJS works both on the browser and on the server, and works for both ESM and CJS module systems. In this page, we will learn how can we write a simple test and a simple web app to verify the standard Noir example. +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + ## Before we start :::note @@ -45,7 +47,7 @@ Go back to the previous folder and start a new project by running run `npm init` We'll need two `npm` packages. These packages will provide us the methods we need to run and verify proofs: ```bash -npm i @noir-lang/backend_barretenberg@^0.17.0 @noir-lang/noir_js@^0.17.0 +npm i @noir-lang/backend_barretenberg@^0.17.0 @noir-lang/noir_js@^0.17.0 ``` To serve our page, we can use a build tool such as `vite`. Because we're gonna use some `wasm` files, we need to install a plugin as well. Run: @@ -249,6 +251,8 @@ if (verification) display('logs', 'Verifying proof... ✅'); By saving, your app will refresh and here's our complete Tiny Noir App! +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + ## Further Reading You can see how noirjs is used in a full stack Next.js hardhat application in the [noir-starter repo here](https://github.com/noir-lang/noir-starter/tree/main/next-hardhat). The example shows how to calculate a proof in the browser and verify it with a deployed Solidity verifier contract from noirjs. diff --git a/docs/docs/noir_js/reference/01_noirjs.md b/docs/docs/noir_js/reference/01_noirjs.md index d9e5a0c6115..0d6d5abbbff 100644 --- a/docs/docs/noir_js/reference/01_noirjs.md +++ b/docs/docs/noir_js/reference/01_noirjs.md @@ -58,10 +58,12 @@ await noirInstance.init(); This async method allows to execute a circuit to get its witness and return value. [`generateFinalProof`](#generatefinalproof) calls it for you, but you can call it directly (i.e. to feed directly to a backend, or to get the return value). +You can optionally provide a foreignCallHandler, to handle functions that should run outside of the prover (e.g. `std::println`) + ### Syntax ```js -async execute(inputs) +async execute(inputs, foreignCallHandler) ``` ### Parameters @@ -69,6 +71,7 @@ async execute(inputs) | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------ | | `inputs` | Object | An object containing the inputs to your circuit. | +| `foreignCallHandler` (optional) | Function | A function handling the foreign call from your circuit | ### Returns @@ -81,6 +84,7 @@ async execute(inputs) ```js const { witness, returnValue } = await noir.execute(inputs) +const { witness, returnValue } = await noir.execute(inputs, (name, args) => console.log(`Received foreign call ${name} with arguments ${args}`)) ``` ## `generateFinalProof` diff --git a/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx b/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx index b482d9afc65..76745196681 100644 --- a/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx +++ b/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx @@ -151,7 +151,7 @@ example: fn main() { let x = [163, 117, 178, 149]; // some random bytes - let hash = std::hash::mimc_bn254(x); + let hash = std::hash::mimc::mimc_bn254(x); } ``` diff --git a/flake.nix b/flake.nix index 5eeb50a6132..fa60b8b2882 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ rustToolchain = fenix.packages.${system}.fromToolchainFile { file = ./rust-toolchain.toml; - sha256 = "sha256-Zk2rxv6vwKFkTTidgjPm6gDsseVmmljVt201H7zuDkk="; + sha256 = "sha256-R0F0Risbr74xg9mEYydyebx/z0Wu6HI0/KWwrV30vZo="; }; craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; diff --git a/noir_stdlib/Nargo.toml b/noir_stdlib/Nargo.toml index 9b7a79ad2a6..d2f8ebcb636 100644 --- a/noir_stdlib/Nargo.toml +++ b/noir_stdlib/Nargo.toml @@ -2,6 +2,4 @@ name = "std" type = "lib" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/noir_stdlib/src/field.nr b/noir_stdlib/src/field.nr index 3959f1ea175..0c6e282f449 100644 --- a/noir_stdlib/src/field.nr +++ b/noir_stdlib/src/field.nr @@ -82,3 +82,20 @@ pub fn modulus_be_bytes() -> [u8] {} #[builtin(modulus_le_bytes)] pub fn modulus_le_bytes() -> [u8] {} + +// Convert a 32 byte array to a field element +pub fn bytes32_to_field(bytes32 : [u8; 32]) -> Field { + // Convert it to a field element + let mut v = 1; + let mut high = 0 as Field; + let mut low = 0 as Field; + + for i in 0..16 { + high = high + (bytes32[15 - i] as Field) * v; + low = low + (bytes32[16 + 15 - i] as Field) * v; + v = v * 256; + } + + // Abuse that a % p + b % p = (a + b) % p and that low < p + low + high * v +} \ No newline at end of file diff --git a/noir_stdlib/src/hash.nr b/noir_stdlib/src/hash.nr index f4a1ec7c599..fdd303e81d8 100644 --- a/noir_stdlib/src/hash.nr +++ b/noir_stdlib/src/hash.nr @@ -1,4 +1,5 @@ mod poseidon; +mod mimc; #[foreign(sha256)] pub fn sha256(_input : [u8; N]) -> [u8; 32] {} @@ -20,135 +21,20 @@ pub fn pedersen_hash(input : [Field; N]) -> Field { #[foreign(pedersen_hash)] pub fn pedersen_hash_with_separator(_input : [Field; N], _separator : u32) -> Field {} -#[foreign(hash_to_field_128_security)] -pub fn hash_to_field(_input : [Field; N]) -> Field {} - -#[foreign(keccak256)] -pub fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] {} +pub fn hash_to_field(_input : [Field; N]) -> Field { + let mut inputs_as_bytes = []; + + for i in 0..N { + let input_bytes = _input[i].to_le_bytes(32); + for i in 0..32 { + inputs_as_bytes = inputs_as_bytes.push_back(input_bytes[i]); + } + } -// mimc-p/p implementation -// constants are (publicly generated) random numbers, for instance using keccak as a ROM. -// You must use constants generated for the native field -// Rounds number should be ~ log(p)/log(exp) -// For 254 bit primes, exponent 7 and 91 rounds seems to be recommended -fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field { - //round 0 - let mut t = x + k; - let mut h = t.pow_32(exp); - //next rounds - for i in 1 .. constants.len() { - t = h + k + constants[i]; - h = t.pow_32(exp); - }; - h + k + let hashed_input = blake2s(inputs_as_bytes); + crate::field::bytes32_to_field(hashed_input) } -global MIMC_BN254_ROUNDS = 91; - -//mimc implementation with hardcoded parameters for BN254 curve. -#[field(bn254)] -pub fn mimc_bn254(array: [Field; N]) -> Field { - //mimc parameters - let exponent = 7; - //generated from seed "mimc" using keccak256 - let constants: [Field; MIMC_BN254_ROUNDS] = [ - 0, - 20888961410941983456478427210666206549300505294776164667214940546594746570981, - 15265126113435022738560151911929040668591755459209400716467504685752745317193, - 8334177627492981984476504167502758309043212251641796197711684499645635709656, - 1374324219480165500871639364801692115397519265181803854177629327624133579404, - 11442588683664344394633565859260176446561886575962616332903193988751292992472, - 2558901189096558760448896669327086721003508630712968559048179091037845349145, - 11189978595292752354820141775598510151189959177917284797737745690127318076389, - 3262966573163560839685415914157855077211340576201936620532175028036746741754, - 17029914891543225301403832095880481731551830725367286980611178737703889171730, - 4614037031668406927330683909387957156531244689520944789503628527855167665518, - 19647356996769918391113967168615123299113119185942498194367262335168397100658, - 5040699236106090655289931820723926657076483236860546282406111821875672148900, - 2632385916954580941368956176626336146806721642583847728103570779270161510514, - 17691411851977575435597871505860208507285462834710151833948561098560743654671, - 11482807709115676646560379017491661435505951727793345550942389701970904563183, - 8360838254132998143349158726141014535383109403565779450210746881879715734773, - 12663821244032248511491386323242575231591777785787269938928497649288048289525, - 3067001377342968891237590775929219083706800062321980129409398033259904188058, - 8536471869378957766675292398190944925664113548202769136103887479787957959589, - 19825444354178182240559170937204690272111734703605805530888940813160705385792, - 16703465144013840124940690347975638755097486902749048533167980887413919317592, - 13061236261277650370863439564453267964462486225679643020432589226741411380501, - 10864774797625152707517901967943775867717907803542223029967000416969007792571, - 10035653564014594269791753415727486340557376923045841607746250017541686319774, - 3446968588058668564420958894889124905706353937375068998436129414772610003289, - 4653317306466493184743870159523234588955994456998076243468148492375236846006, - 8486711143589723036499933521576871883500223198263343024003617825616410932026, - 250710584458582618659378487568129931785810765264752039738223488321597070280, - 2104159799604932521291371026105311735948154964200596636974609406977292675173, - 16313562605837709339799839901240652934758303521543693857533755376563489378839, - 6032365105133504724925793806318578936233045029919447519826248813478479197288, - 14025118133847866722315446277964222215118620050302054655768867040006542798474, - 7400123822125662712777833064081316757896757785777291653271747396958201309118, - 1744432620323851751204287974553233986555641872755053103823939564833813704825, - 8316378125659383262515151597439205374263247719876250938893842106722210729522, - 6739722627047123650704294650168547689199576889424317598327664349670094847386, - 21211457866117465531949733809706514799713333930924902519246949506964470524162, - 13718112532745211817410303291774369209520657938741992779396229864894885156527, - 5264534817993325015357427094323255342713527811596856940387954546330728068658, - 18884137497114307927425084003812022333609937761793387700010402412840002189451, - 5148596049900083984813839872929010525572543381981952060869301611018636120248, - 19799686398774806587970184652860783461860993790013219899147141137827718662674, - 19240878651604412704364448729659032944342952609050243268894572835672205984837, - 10546185249390392695582524554167530669949955276893453512788278945742408153192, - 5507959600969845538113649209272736011390582494851145043668969080335346810411, - 18177751737739153338153217698774510185696788019377850245260475034576050820091, - 19603444733183990109492724100282114612026332366576932662794133334264283907557, - 10548274686824425401349248282213580046351514091431715597441736281987273193140, - 1823201861560942974198127384034483127920205835821334101215923769688644479957, - 11867589662193422187545516240823411225342068709600734253659804646934346124945, - 18718569356736340558616379408444812528964066420519677106145092918482774343613, - 10530777752259630125564678480897857853807637120039176813174150229243735996839, - 20486583726592018813337145844457018474256372770211860618687961310422228379031, - 12690713110714036569415168795200156516217175005650145422920562694422306200486, - 17386427286863519095301372413760745749282643730629659997153085139065756667205, - 2216432659854733047132347621569505613620980842043977268828076165669557467682, - 6309765381643925252238633914530877025934201680691496500372265330505506717193, - 20806323192073945401862788605803131761175139076694468214027227878952047793390, - 4037040458505567977365391535756875199663510397600316887746139396052445718861, - 19948974083684238245321361840704327952464170097132407924861169241740046562673, - 845322671528508199439318170916419179535949348988022948153107378280175750024, - 16222384601744433420585982239113457177459602187868460608565289920306145389382, - 10232118865851112229330353999139005145127746617219324244541194256766741433339, - 6699067738555349409504843460654299019000594109597429103342076743347235369120, - 6220784880752427143725783746407285094967584864656399181815603544365010379208, - 6129250029437675212264306655559561251995722990149771051304736001195288083309, - 10773245783118750721454994239248013870822765715268323522295722350908043393604, - 4490242021765793917495398271905043433053432245571325177153467194570741607167, - 19596995117319480189066041930051006586888908165330319666010398892494684778526, - 837850695495734270707668553360118467905109360511302468085569220634750561083, - 11803922811376367215191737026157445294481406304781326649717082177394185903907, - 10201298324909697255105265958780781450978049256931478989759448189112393506592, - 13564695482314888817576351063608519127702411536552857463682060761575100923924, - 9262808208636973454201420823766139682381973240743541030659775288508921362724, - 173271062536305557219323722062711383294158572562695717740068656098441040230, - 18120430890549410286417591505529104700901943324772175772035648111937818237369, - 20484495168135072493552514219686101965206843697794133766912991150184337935627, - 19155651295705203459475805213866664350848604323501251939850063308319753686505, - 11971299749478202793661982361798418342615500543489781306376058267926437157297, - 18285310723116790056148596536349375622245669010373674803854111592441823052978, - 7069216248902547653615508023941692395371990416048967468982099270925308100727, - 6465151453746412132599596984628739550147379072443683076388208843341824127379, - 16143532858389170960690347742477978826830511669766530042104134302796355145785, - 19362583304414853660976404410208489566967618125972377176980367224623492419647, - 1702213613534733786921602839210290505213503664731919006932367875629005980493, - 10781825404476535814285389902565833897646945212027592373510689209734812292327, - 4212716923652881254737947578600828255798948993302968210248673545442808456151, - 7594017890037021425366623750593200398174488805473151513558919864633711506220, - 18979889247746272055963929241596362599320706910852082477600815822482192194401, - 13602139229813231349386885113156901793661719180900395818909719758150455500533, - ]; +#[foreign(keccak256)] +pub fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] {} - let mut r = 0; - for elem in array { - let h = mimc(elem, r, constants, exponent); - r = r + elem + h; - } - r -} diff --git a/noir_stdlib/src/hash/mimc.nr b/noir_stdlib/src/hash/mimc.nr new file mode 100644 index 00000000000..7f778df14c1 --- /dev/null +++ b/noir_stdlib/src/hash/mimc.nr @@ -0,0 +1,126 @@ +// mimc-p/p implementation +// constants are (publicly generated) random numbers, for instance using keccak as a ROM. +// You must use constants generated for the native field +// Rounds number should be ~ log(p)/log(exp) +// For 254 bit primes, exponent 7 and 91 rounds seems to be recommended +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field { + //round 0 + let mut t = x + k; + let mut h = t.pow_32(exp); + //next rounds + for i in 1 .. constants.len() { + t = h + k + constants[i]; + h = t.pow_32(exp); + }; + h + k +} + +global MIMC_BN254_ROUNDS = 91; + +//mimc implementation with hardcoded parameters for BN254 curve. +#[field(bn254)] +pub fn mimc_bn254(array: [Field; N]) -> Field { + //mimc parameters + let exponent = 7; + //generated from seed "mimc" using keccak256 + let constants: [Field; MIMC_BN254_ROUNDS] = [ + 0, + 20888961410941983456478427210666206549300505294776164667214940546594746570981, + 15265126113435022738560151911929040668591755459209400716467504685752745317193, + 8334177627492981984476504167502758309043212251641796197711684499645635709656, + 1374324219480165500871639364801692115397519265181803854177629327624133579404, + 11442588683664344394633565859260176446561886575962616332903193988751292992472, + 2558901189096558760448896669327086721003508630712968559048179091037845349145, + 11189978595292752354820141775598510151189959177917284797737745690127318076389, + 3262966573163560839685415914157855077211340576201936620532175028036746741754, + 17029914891543225301403832095880481731551830725367286980611178737703889171730, + 4614037031668406927330683909387957156531244689520944789503628527855167665518, + 19647356996769918391113967168615123299113119185942498194367262335168397100658, + 5040699236106090655289931820723926657076483236860546282406111821875672148900, + 2632385916954580941368956176626336146806721642583847728103570779270161510514, + 17691411851977575435597871505860208507285462834710151833948561098560743654671, + 11482807709115676646560379017491661435505951727793345550942389701970904563183, + 8360838254132998143349158726141014535383109403565779450210746881879715734773, + 12663821244032248511491386323242575231591777785787269938928497649288048289525, + 3067001377342968891237590775929219083706800062321980129409398033259904188058, + 8536471869378957766675292398190944925664113548202769136103887479787957959589, + 19825444354178182240559170937204690272111734703605805530888940813160705385792, + 16703465144013840124940690347975638755097486902749048533167980887413919317592, + 13061236261277650370863439564453267964462486225679643020432589226741411380501, + 10864774797625152707517901967943775867717907803542223029967000416969007792571, + 10035653564014594269791753415727486340557376923045841607746250017541686319774, + 3446968588058668564420958894889124905706353937375068998436129414772610003289, + 4653317306466493184743870159523234588955994456998076243468148492375236846006, + 8486711143589723036499933521576871883500223198263343024003617825616410932026, + 250710584458582618659378487568129931785810765264752039738223488321597070280, + 2104159799604932521291371026105311735948154964200596636974609406977292675173, + 16313562605837709339799839901240652934758303521543693857533755376563489378839, + 6032365105133504724925793806318578936233045029919447519826248813478479197288, + 14025118133847866722315446277964222215118620050302054655768867040006542798474, + 7400123822125662712777833064081316757896757785777291653271747396958201309118, + 1744432620323851751204287974553233986555641872755053103823939564833813704825, + 8316378125659383262515151597439205374263247719876250938893842106722210729522, + 6739722627047123650704294650168547689199576889424317598327664349670094847386, + 21211457866117465531949733809706514799713333930924902519246949506964470524162, + 13718112532745211817410303291774369209520657938741992779396229864894885156527, + 5264534817993325015357427094323255342713527811596856940387954546330728068658, + 18884137497114307927425084003812022333609937761793387700010402412840002189451, + 5148596049900083984813839872929010525572543381981952060869301611018636120248, + 19799686398774806587970184652860783461860993790013219899147141137827718662674, + 19240878651604412704364448729659032944342952609050243268894572835672205984837, + 10546185249390392695582524554167530669949955276893453512788278945742408153192, + 5507959600969845538113649209272736011390582494851145043668969080335346810411, + 18177751737739153338153217698774510185696788019377850245260475034576050820091, + 19603444733183990109492724100282114612026332366576932662794133334264283907557, + 10548274686824425401349248282213580046351514091431715597441736281987273193140, + 1823201861560942974198127384034483127920205835821334101215923769688644479957, + 11867589662193422187545516240823411225342068709600734253659804646934346124945, + 18718569356736340558616379408444812528964066420519677106145092918482774343613, + 10530777752259630125564678480897857853807637120039176813174150229243735996839, + 20486583726592018813337145844457018474256372770211860618687961310422228379031, + 12690713110714036569415168795200156516217175005650145422920562694422306200486, + 17386427286863519095301372413760745749282643730629659997153085139065756667205, + 2216432659854733047132347621569505613620980842043977268828076165669557467682, + 6309765381643925252238633914530877025934201680691496500372265330505506717193, + 20806323192073945401862788605803131761175139076694468214027227878952047793390, + 4037040458505567977365391535756875199663510397600316887746139396052445718861, + 19948974083684238245321361840704327952464170097132407924861169241740046562673, + 845322671528508199439318170916419179535949348988022948153107378280175750024, + 16222384601744433420585982239113457177459602187868460608565289920306145389382, + 10232118865851112229330353999139005145127746617219324244541194256766741433339, + 6699067738555349409504843460654299019000594109597429103342076743347235369120, + 6220784880752427143725783746407285094967584864656399181815603544365010379208, + 6129250029437675212264306655559561251995722990149771051304736001195288083309, + 10773245783118750721454994239248013870822765715268323522295722350908043393604, + 4490242021765793917495398271905043433053432245571325177153467194570741607167, + 19596995117319480189066041930051006586888908165330319666010398892494684778526, + 837850695495734270707668553360118467905109360511302468085569220634750561083, + 11803922811376367215191737026157445294481406304781326649717082177394185903907, + 10201298324909697255105265958780781450978049256931478989759448189112393506592, + 13564695482314888817576351063608519127702411536552857463682060761575100923924, + 9262808208636973454201420823766139682381973240743541030659775288508921362724, + 173271062536305557219323722062711383294158572562695717740068656098441040230, + 18120430890549410286417591505529104700901943324772175772035648111937818237369, + 20484495168135072493552514219686101965206843697794133766912991150184337935627, + 19155651295705203459475805213866664350848604323501251939850063308319753686505, + 11971299749478202793661982361798418342615500543489781306376058267926437157297, + 18285310723116790056148596536349375622245669010373674803854111592441823052978, + 7069216248902547653615508023941692395371990416048967468982099270925308100727, + 6465151453746412132599596984628739550147379072443683076388208843341824127379, + 16143532858389170960690347742477978826830511669766530042104134302796355145785, + 19362583304414853660976404410208489566967618125972377176980367224623492419647, + 1702213613534733786921602839210290505213503664731919006932367875629005980493, + 10781825404476535814285389902565833897646945212027592373510689209734812292327, + 4212716923652881254737947578600828255798948993302968210248673545442808456151, + 7594017890037021425366623750593200398174488805473151513558919864633711506220, + 18979889247746272055963929241596362599320706910852082477600815822482192194401, + 13602139229813231349386885113156901793661719180900395818909719758150455500533, + ]; + + let mut r = 0; + for elem in array { + let h = mimc(elem, r, constants, exponent); + r = r + elem + h; + } + r +} diff --git a/noir_stdlib/src/merkle.nr b/noir_stdlib/src/merkle.nr index 02bb54a0315..2dc9c9814b4 100644 --- a/noir_stdlib/src/merkle.nr +++ b/noir_stdlib/src/merkle.nr @@ -14,8 +14,7 @@ pub fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) } else { (current, hash_path[i]) }; - // TODO(Kev): This should be changed to use pedersen_hash - current = crate::hash::pedersen_commitment([hash_left, hash_right])[0]; + current = crate::hash::pedersen_hash([hash_left, hash_right]); }; current } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 63f41db96a1..b6f7edc4bde 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.66.1" +channel = "1.71.1" components = [ "rust-src" ] targets = [ "wasm32-unknown-unknown", "wasm32-wasi", "aarch64-apple-darwin" ] profile = "default" diff --git a/tooling/backend_interface/Cargo.toml b/tooling/backend_interface/Cargo.toml index 587dcf41005..14b1609dd4a 100644 --- a/tooling/backend_interface/Cargo.toml +++ b/tooling/backend_interface/Cargo.toml @@ -32,4 +32,4 @@ test-binary = "3.0.1" [build-dependencies] build-target = "0.4.0" -const_format = "0.2.30" +const_format.workspace = true diff --git a/tooling/backend_interface/src/proof_system.rs b/tooling/backend_interface/src/proof_system.rs index c4fc6e743e5..95da1462d4e 100644 --- a/tooling/backend_interface/src/proof_system.rs +++ b/tooling/backend_interface/src/proof_system.rs @@ -23,7 +23,7 @@ impl Backend { // Create a temporary file for the circuit let circuit_path = temp_directory.join("circuit").with_extension("bytecode"); - let serialized_circuit = serialize_circuit(circuit); + let serialized_circuit = Circuit::serialize_circuit(circuit); write_to_file(&serialized_circuit, &circuit_path); GatesCommand { crs_path: self.crs_directory(), bytecode_path: circuit_path } @@ -57,7 +57,7 @@ impl Backend { // Create a temporary file for the circuit // let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); - let serialized_circuit = serialize_circuit(circuit); + let serialized_circuit = Circuit::serialize_circuit(circuit); write_to_file(&serialized_circuit, &bytecode_path); // Create proof and store it in the specified path @@ -97,7 +97,7 @@ impl Backend { // Create a temporary file for the circuit let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); - let serialized_circuit = serialize_circuit(circuit); + let serialized_circuit = Circuit::serialize_circuit(circuit); write_to_file(&serialized_circuit, &bytecode_path); // Create the verification key and write it to the specified path @@ -130,7 +130,7 @@ impl Backend { // Create a temporary file for the circuit // let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); - let serialized_circuit = serialize_circuit(circuit); + let serialized_circuit = Circuit::serialize_circuit(circuit); write_to_file(&serialized_circuit, &bytecode_path); // Create the verification key and write it to the specified path @@ -174,11 +174,3 @@ pub(super) fn write_to_file(bytes: &[u8], path: &Path) -> String { Ok(_) => display.to_string(), } } - -// TODO: See nargo/src/artifacts/mod.rs -// TODO: This method should live in ACVM and be the default method for serializing/deserializing circuits -pub(super) fn serialize_circuit(circuit: &Circuit) -> Vec { - let mut circuit_bytes: Vec = Vec::new(); - circuit.write(&mut circuit_bytes).unwrap(); - circuit_bytes -} diff --git a/tooling/backend_interface/src/smart_contract.rs b/tooling/backend_interface/src/smart_contract.rs index 08f67e7b9bc..5dac57c4072 100644 --- a/tooling/backend_interface/src/smart_contract.rs +++ b/tooling/backend_interface/src/smart_contract.rs @@ -1,4 +1,4 @@ -use super::proof_system::{serialize_circuit, write_to_file}; +use super::proof_system::write_to_file; use crate::{ cli::{ContractCommand, WriteVkCommand}, Backend, BackendError, @@ -16,7 +16,7 @@ impl Backend { // Create a temporary file for the circuit let bytecode_path = temp_directory_path.join("circuit").with_extension("bytecode"); - let serialized_circuit = serialize_circuit(circuit); + let serialized_circuit = Circuit::serialize_circuit(circuit); write_to_file(&serialized_circuit, &bytecode_path); // Create the verification key and write it to the specified path diff --git a/tooling/bb_abstraction_leaks/Cargo.toml b/tooling/bb_abstraction_leaks/Cargo.toml index 86164ba11c3..972c78831a7 100644 --- a/tooling/bb_abstraction_leaks/Cargo.toml +++ b/tooling/bb_abstraction_leaks/Cargo.toml @@ -14,4 +14,4 @@ acvm.workspace = true [build-dependencies] build-target = "0.4.0" -const_format = "0.2.30" +const_format.workspace = true diff --git a/tooling/debugger/src/context.rs b/tooling/debugger/src/context.rs index 025e6404bcb..f8f573930c0 100644 --- a/tooling/debugger/src/context.rs +++ b/tooling/debugger/src/context.rs @@ -111,7 +111,7 @@ impl<'a, B: BlackBoxFunctionSolver> DebugContext<'a, B> { } pub(super) fn step_into_opcode(&mut self) -> DebugCommandResult { - if matches!(self.brillig_solver, Some(_)) { + if self.brillig_solver.is_some() { self.step_brillig_opcode() } else { match self.acvm.step_into_brillig_opcode() { diff --git a/tooling/lsp/Cargo.toml b/tooling/lsp/Cargo.toml index f6585690985..a1d58a0de49 100644 --- a/tooling/lsp/Cargo.toml +++ b/tooling/lsp/Cargo.toml @@ -22,7 +22,7 @@ serde.workspace = true serde_json.workspace = true tower.workspace = true cfg-if.workspace = true -async-lsp = { version = "0.0.5", default-features = false, features = ["omni-trait"] } +async-lsp = { workspace = true, features = ["omni-trait"] } [target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] wasm-bindgen.workspace = true diff --git a/tooling/lsp/src/notifications/mod.rs b/tooling/lsp/src/notifications/mod.rs index 633c88b420a..93fa8baf6ac 100644 --- a/tooling/lsp/src/notifications/mod.rs +++ b/tooling/lsp/src/notifications/mod.rs @@ -3,7 +3,7 @@ use std::ops::ControlFlow; use async_lsp::{ErrorCode, LanguageClient, ResponseError}; use nargo::prepare_package; use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::check_crate; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; use noirc_errors::{DiagnosticKind, FileDiagnostic}; use crate::types::{ @@ -88,7 +88,11 @@ pub(super) fn on_did_save_text_document( return ControlFlow::Continue(()); } }; - let workspace = match resolve_workspace_from_toml(&toml_path, PackageSelection::All) { + let workspace = match resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) { Ok(workspace) => workspace, Err(err) => { // If we found a manifest, but the workspace is invalid, we raise an error about it diff --git a/tooling/lsp/src/requests/code_lens_request.rs b/tooling/lsp/src/requests/code_lens_request.rs index 700002d2030..7794fb8444f 100644 --- a/tooling/lsp/src/requests/code_lens_request.rs +++ b/tooling/lsp/src/requests/code_lens_request.rs @@ -4,7 +4,7 @@ use async_lsp::{ErrorCode, LanguageClient, ResponseError}; use nargo::{package::Package, prepare_package, workspace::Workspace}; use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::check_crate; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::hir::FunctionNameMatch; use crate::{ @@ -67,11 +67,15 @@ fn on_code_lens_request_inner( return Ok(None); } }; - let workspace = - resolve_workspace_from_toml(&toml_path, PackageSelection::All).map_err(|err| { - // If we found a manifest, but the workspace is invalid, we raise an error about it - ResponseError::new(ErrorCode::REQUEST_FAILED, err) - })?; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; let mut lenses: Vec = vec![]; diff --git a/tooling/lsp/src/requests/test_run.rs b/tooling/lsp/src/requests/test_run.rs index 30a3015eb75..962fe99a49b 100644 --- a/tooling/lsp/src/requests/test_run.rs +++ b/tooling/lsp/src/requests/test_run.rs @@ -6,7 +6,7 @@ use nargo::{ prepare_package, }; use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::{check_crate, CompileOptions}; +use noirc_driver::{check_crate, CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::hir::FunctionNameMatch; use crate::{ @@ -38,12 +38,15 @@ fn on_test_run_request_inner( let crate_name = params.id.crate_name(); let function_name = params.id.function_name(); - let workspace = - resolve_workspace_from_toml(&toml_path, PackageSelection::Selected(crate_name.clone())) - .map_err(|err| { - // If we found a manifest, but the workspace is invalid, we raise an error about it - ResponseError::new(ErrorCode::REQUEST_FAILED, err) - })?; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::Selected(crate_name.clone()), + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; // Since we filtered on crate name, this should be the only item in the iterator match workspace.into_iter().next() { diff --git a/tooling/lsp/src/requests/tests.rs b/tooling/lsp/src/requests/tests.rs index a5988b54f06..6b94b921a06 100644 --- a/tooling/lsp/src/requests/tests.rs +++ b/tooling/lsp/src/requests/tests.rs @@ -4,7 +4,7 @@ use async_lsp::{ErrorCode, LanguageClient, ResponseError}; use lsp_types::{LogMessageParams, MessageType}; use nargo::prepare_package; use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::check_crate; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; use crate::{ get_non_stdlib_asset, get_package_tests_in_crate, @@ -40,11 +40,15 @@ fn on_tests_request_inner( } }; - let workspace = - resolve_workspace_from_toml(&toml_path, PackageSelection::All).map_err(|err| { - // If we found a manifest, but the workspace is invalid, we raise an error about it - ResponseError::new(ErrorCode::REQUEST_FAILED, err) - })?; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; let package_tests: Vec<_> = workspace .into_iter() diff --git a/tooling/nargo/Cargo.toml b/tooling/nargo/Cargo.toml index eda15ff2594..e6674c043d7 100644 --- a/tooling/nargo/Cargo.toml +++ b/tooling/nargo/Cargo.toml @@ -23,5 +23,4 @@ noirc_printable_type.workspace = true iter-extended.workspace = true serde.workspace = true thiserror.workspace = true -base64.workspace = true codespan-reporting.workspace = true diff --git a/tooling/nargo/build.rs b/tooling/nargo/build.rs index cf52e8b2627..4fa7f58892a 100644 --- a/tooling/nargo/build.rs +++ b/tooling/nargo/build.rs @@ -2,8 +2,8 @@ use rustc_version::{version, Version}; fn check_rustc_version() { assert!( - version().unwrap() >= Version::parse("1.66.0").unwrap(), - "The minimal supported rustc version is 1.66.0." + version().unwrap() >= Version::parse("1.71.1").unwrap(), + "The minimal supported rustc version is 1.71.1." ); } diff --git a/tooling/nargo/src/artifacts/contract.rs b/tooling/nargo/src/artifacts/contract.rs index 4f1ae0e10a0..f9e8d45b02e 100644 --- a/tooling/nargo/src/artifacts/contract.rs +++ b/tooling/nargo/src/artifacts/contract.rs @@ -37,8 +37,8 @@ pub struct PreprocessedContractFunction { pub abi: Abi, #[serde( - serialize_with = "super::serialize_circuit", - deserialize_with = "super::deserialize_circuit" + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" )] pub bytecode: Circuit, } diff --git a/tooling/nargo/src/artifacts/mod.rs b/tooling/nargo/src/artifacts/mod.rs index d25c65afd98..180a900fd81 100644 --- a/tooling/nargo/src/artifacts/mod.rs +++ b/tooling/nargo/src/artifacts/mod.rs @@ -3,34 +3,6 @@ //! These artifacts are intended to remain independent of any applications being built on top of Noir. //! Should any projects require/desire a different artifact format, it's expected that they will write a transformer //! to generate them using these artifacts as a starting point. -use acvm::acir::circuit::Circuit; -use base64::Engine; -use serde::{ - de::Error as DeserializationError, ser::Error as SerializationError, Deserializer, Serializer, -}; - pub mod contract; pub mod debug; pub mod program; - -// TODO: move these down into ACVM. -fn serialize_circuit(circuit: &Circuit, s: S) -> Result -where - S: Serializer, -{ - let mut circuit_bytes: Vec = Vec::new(); - circuit.write(&mut circuit_bytes).map_err(S::Error::custom)?; - let encoded_b64 = base64::engine::general_purpose::STANDARD.encode(circuit_bytes); - s.serialize_str(&encoded_b64) -} - -fn deserialize_circuit<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - let bytecode_b64: String = serde::Deserialize::deserialize(deserializer)?; - let circuit_bytes = - base64::engine::general_purpose::STANDARD.decode(bytecode_b64).map_err(D::Error::custom)?; - let circuit = Circuit::read(&*circuit_bytes).map_err(D::Error::custom)?; - Ok(circuit) -} diff --git a/tooling/nargo/src/artifacts/program.rs b/tooling/nargo/src/artifacts/program.rs index 5988f3f59cb..890b6c55f7d 100644 --- a/tooling/nargo/src/artifacts/program.rs +++ b/tooling/nargo/src/artifacts/program.rs @@ -21,8 +21,8 @@ pub struct PreprocessedProgram { pub abi: Abi, #[serde( - serialize_with = "super::serialize_circuit", - deserialize_with = "super::deserialize_circuit" + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" )] pub bytecode: Circuit, } diff --git a/tooling/nargo/src/errors.rs b/tooling/nargo/src/errors.rs index 0c920716f2a..ba52d127e9e 100644 --- a/tooling/nargo/src/errors.rs +++ b/tooling/nargo/src/errors.rs @@ -91,7 +91,7 @@ fn extract_locations_from_error( _ => None, }?; - if let Some(OpcodeLocation::Brillig { acir_index, .. }) = opcode_locations.get(0) { + if let Some(OpcodeLocation::Brillig { acir_index, .. }) = opcode_locations.first() { opcode_locations.insert(0, OpcodeLocation::Acir(*acir_index)); } diff --git a/tooling/nargo/src/package.rs b/tooling/nargo/src/package.rs index 16f65d329ba..94c7c5b9c98 100644 --- a/tooling/nargo/src/package.rs +++ b/tooling/nargo/src/package.rs @@ -43,6 +43,8 @@ impl Dependency { #[derive(Clone)] pub struct Package { + // A semver string which specifies the compiler version required to compile this package + pub compiler_required_version: Option, pub root_dir: PathBuf, pub package_type: PackageType, pub entry_path: PathBuf, diff --git a/tooling/nargo_cli/Cargo.toml b/tooling/nargo_cli/Cargo.toml index a1440dc2ecb..1a08514dc5f 100644 --- a/tooling/nargo_cli/Cargo.toml +++ b/tooling/nargo_cli/Cargo.toml @@ -15,7 +15,7 @@ path = "src/main.rs" [build-dependencies] rustc_version = "0.4.0" -build-data = "0.1.3" +build-data.workspace = true toml.workspace = true [dependencies] @@ -40,14 +40,9 @@ prettytable-rs = "0.10" rayon = "1.8.0" thiserror.workspace = true tower.workspace = true -async-lsp = { version = "0.0.5", default-features = false, features = [ - "client-monitor", - "stdio", - "tracing", - "tokio", -] } -const_format = "0.2.30" -hex = "0.4.2" +async-lsp = { workspace = true, features = ["client-monitor", "stdio", "tracing", "tokio"] } +const_format.workspace = true +hex.workspace = true termcolor = "1.1.2" color-eyre = "0.6.2" tokio = { version = "1.0", features = ["io-std"] } diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index c6682cff13e..0d1acca6ee9 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -6,8 +6,8 @@ use std::{env, fs}; fn check_rustc_version() { assert!( - version().unwrap() >= Version::parse("1.66.0").unwrap(), - "The minimal supported rustc version is 1.66.0." + version().unwrap() >= Version::parse("1.71.1").unwrap(), + "The minimal supported rustc version is 1.71.1." ); } diff --git a/tooling/nargo_cli/src/cli/check_cmd.rs b/tooling/nargo_cli/src/cli/check_cmd.rs index 30309f88f32..79f199381fa 100644 --- a/tooling/nargo_cli/src/cli/check_cmd.rs +++ b/tooling/nargo_cli/src/cli/check_cmd.rs @@ -6,7 +6,9 @@ use iter_extended::btree_map; use nargo::{package::Package, prepare_package}; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::{AbiParameter, AbiType, MAIN_RETURN_NAME}; -use noirc_driver::{check_crate, compute_function_abi, CompileOptions}; +use noirc_driver::{ + check_crate, compute_function_abi, CompileOptions, NOIR_ARTIFACT_VERSION_STRING, +}; use noirc_frontend::{ graph::{CrateId, CrateName}, hir::Context, @@ -39,7 +41,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; for package in &workspace { check_package(package, &args.compile_options)?; diff --git a/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs b/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs index 856970544b8..59143526b24 100644 --- a/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs +++ b/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs @@ -13,7 +13,7 @@ use clap::Args; use nargo::package::Package; use nargo::workspace::Workspace; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::CompileOptions; +use noirc_driver::{CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::graph::CrateName; /// Generates a Solidity verifier smart contract for the program @@ -40,7 +40,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let (np_language, opcode_support) = backend.get_backend_info()?; for package in &workspace { diff --git a/tooling/nargo_cli/src/cli/compile_cmd.rs b/tooling/nargo_cli/src/cli/compile_cmd.rs index d018cf79651..156359dab04 100644 --- a/tooling/nargo_cli/src/cli/compile_cmd.rs +++ b/tooling/nargo_cli/src/cli/compile_cmd.rs @@ -61,7 +61,12 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_owned()), + )?; let circuit_dir = workspace.target_directory_path(); let (binary_packages, contract_packages): (Vec<_>, Vec<_>) = workspace diff --git a/tooling/nargo_cli/src/cli/debug_cmd.rs b/tooling/nargo_cli/src/cli/debug_cmd.rs index 2c46af96bbb..1d344058312 100644 --- a/tooling/nargo_cli/src/cli/debug_cmd.rs +++ b/tooling/nargo_cli/src/cli/debug_cmd.rs @@ -7,7 +7,7 @@ use nargo::package::Package; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::input_parser::{Format, InputValue}; use noirc_abi::InputMap; -use noirc_driver::{CompileOptions, CompiledProgram}; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::graph::CrateName; use super::compile_cmd::compile_bin_package; @@ -41,7 +41,11 @@ pub(crate) fn run( ) -> Result<(), CliError> { let toml_path = get_package_manifest(&config.program_dir)?; let selection = args.package.map_or(PackageSelection::DefaultOrAll, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let target_dir = &workspace.target_directory_path(); let (np_language, opcode_support) = backend.get_backend_info()?; diff --git a/tooling/nargo_cli/src/cli/execute_cmd.rs b/tooling/nargo_cli/src/cli/execute_cmd.rs index 3f05b5b75f2..3a0da2b1134 100644 --- a/tooling/nargo_cli/src/cli/execute_cmd.rs +++ b/tooling/nargo_cli/src/cli/execute_cmd.rs @@ -8,7 +8,7 @@ use nargo::package::Package; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::input_parser::{Format, InputValue}; use noirc_abi::InputMap; -use noirc_driver::{CompileOptions, CompiledProgram}; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::graph::CrateName; use super::compile_cmd::compile_bin_package; @@ -48,7 +48,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let target_dir = &workspace.target_directory_path(); let (np_language, opcode_support) = backend.get_backend_info()?; diff --git a/tooling/nargo_cli/src/cli/fmt_cmd.rs b/tooling/nargo_cli/src/cli/fmt_cmd.rs index 31b45cc092a..42fe5a0d362 100644 --- a/tooling/nargo_cli/src/cli/fmt_cmd.rs +++ b/tooling/nargo_cli/src/cli/fmt_cmd.rs @@ -3,6 +3,7 @@ use std::{fs::DirEntry, path::Path}; use clap::Args; use fm::FileManager; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::NOIR_ARTIFACT_VERSION_STRING; use noirc_errors::CustomDiagnostic; use noirc_frontend::hir::def_map::parse_file; @@ -15,7 +16,11 @@ pub(crate) struct FormatCommand {} pub(crate) fn run(_args: FormatCommand, config: NargoConfig) -> Result<(), CliError> { let toml_path = get_package_manifest(&config.program_dir)?; - let workspace = resolve_workspace_from_toml(&toml_path, PackageSelection::All)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let config = nargo_fmt::Config::read(&config.program_dir) .map_err(|err| CliError::Generic(err.to_string()))?; diff --git a/tooling/nargo_cli/src/cli/info_cmd.rs b/tooling/nargo_cli/src/cli/info_cmd.rs index 50021e842c4..de0c63c3ab3 100644 --- a/tooling/nargo_cli/src/cli/info_cmd.rs +++ b/tooling/nargo_cli/src/cli/info_cmd.rs @@ -4,7 +4,9 @@ use clap::Args; use iter_extended::vecmap; use nargo::package::Package; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::{CompileOptions, CompiledContract, CompiledProgram}; +use noirc_driver::{ + CompileOptions, CompiledContract, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING, +}; use noirc_frontend::graph::CrateName; use prettytable::{row, table, Row}; use rayon::prelude::*; @@ -47,7 +49,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let (binary_packages, contract_packages): (Vec<_>, Vec<_>) = workspace .into_iter() diff --git a/tooling/nargo_cli/src/cli/init_cmd.rs b/tooling/nargo_cli/src/cli/init_cmd.rs index 9d7700a6598..e53c2e4cdc9 100644 --- a/tooling/nargo_cli/src/cli/init_cmd.rs +++ b/tooling/nargo_cli/src/cli/init_cmd.rs @@ -73,7 +73,7 @@ pub(crate) fn initialize_project( name = "{package_name}" type = "{package_type}" authors = [""] -compiler_version = "{NOIRC_VERSION}" +compiler_version = ">={NOIRC_VERSION}" [dependencies]"# ); diff --git a/tooling/nargo_cli/src/cli/prove_cmd.rs b/tooling/nargo_cli/src/cli/prove_cmd.rs index af300b7ebe0..3586e73ff2e 100644 --- a/tooling/nargo_cli/src/cli/prove_cmd.rs +++ b/tooling/nargo_cli/src/cli/prove_cmd.rs @@ -4,7 +4,7 @@ use nargo::package::Package; use nargo::workspace::Workspace; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::input_parser::Format; -use noirc_driver::{CompileOptions, CompiledProgram}; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::graph::CrateName; use super::compile_cmd::compile_bin_package; @@ -51,7 +51,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let (np_language, opcode_support) = backend.get_backend_info()?; for package in &workspace { diff --git a/tooling/nargo_cli/src/cli/test_cmd.rs b/tooling/nargo_cli/src/cli/test_cmd.rs index 4ba2fc35766..e117d8555a5 100644 --- a/tooling/nargo_cli/src/cli/test_cmd.rs +++ b/tooling/nargo_cli/src/cli/test_cmd.rs @@ -8,7 +8,7 @@ use nargo::{ prepare_package, }; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; -use noirc_driver::CompileOptions; +use noirc_driver::{CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::{graph::CrateName, hir::FunctionNameMatch}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; @@ -51,7 +51,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let pattern = match &args.test_name { Some(name) => { diff --git a/tooling/nargo_cli/src/cli/verify_cmd.rs b/tooling/nargo_cli/src/cli/verify_cmd.rs index 6ae2b78fd0c..8c6d92b3d2f 100644 --- a/tooling/nargo_cli/src/cli/verify_cmd.rs +++ b/tooling/nargo_cli/src/cli/verify_cmd.rs @@ -11,7 +11,7 @@ use nargo::package::Package; use nargo::workspace::Workspace; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::input_parser::Format; -use noirc_driver::{CompileOptions, CompiledProgram}; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; use noirc_frontend::graph::CrateName; /// Given a proof and a program, verify whether the proof is valid @@ -42,7 +42,11 @@ pub(crate) fn run( let default_selection = if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; let selection = args.package.map_or(default_selection, PackageSelection::Selected); - let workspace = resolve_workspace_from_toml(&toml_path, selection)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; let (np_language, opcode_support) = backend.get_backend_info()?; for package in &workspace { diff --git a/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml index a8c9b4ad344..2eaf67246e1 100644 --- a/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml @@ -2,6 +2,4 @@ name = "assert_constant_fail" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml index 055c23234ce..9fcdcc10bb7 100644 --- a/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml @@ -2,6 +2,4 @@ name = "assert_eq_struct" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml index 181af302d8f..7ce776e5ce6 100644 --- a/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_assert_fail" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml index db1c3480387..191121e59b7 100644 --- a/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml @@ -2,6 +2,5 @@ name = "constrain_typo" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml index 0ccb94aff1a..a32696d3370 100644 --- a/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml @@ -4,6 +4,5 @@ type = "bin" # Testing that this file is missing and doesn't fallback to default `main.nr` file entry = "src/foobarbaz.nr" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml index 6a49afec2c4..afe5a5134ca 100644 --- a/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml @@ -2,7 +2,5 @@ name = "dep_impl_primitive" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] bad_impl = { path = "../../test_libraries/bad_impl" } diff --git a/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml index 2404e68e180..8334a38eb4b 100644 --- a/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml @@ -2,7 +2,5 @@ name = "depend_on_bin" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] bin_dep = { path = "../../test_libraries/bin_dep" } diff --git a/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml index 55e36368845..aad13c7d97f 100644 --- a/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml @@ -2,6 +2,5 @@ name = "divide_by_zero" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml index d3b69d8c41b..22ff18075cd 100644 --- a/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml @@ -2,6 +2,5 @@ name = "div_by_zero_modulo" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml index 58a60a38a0c..30a7eb62645 100644 --- a/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml @@ -2,6 +2,5 @@ name = "div_by_zero_numerator_witness" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml index 08dbe74f018..e4968f6182d 100644 --- a/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml @@ -2,6 +2,5 @@ name = "div_by_zero_witness" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml index 7c2c50884fe..18352cb34b5 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml @@ -2,6 +2,5 @@ name = "dup_trait_implementation_4" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml index b5bacc433f3..40b7c3d0269 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml @@ -2,6 +2,5 @@ name = "dup_trait_implementation_5" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml index d8b44af47c2..078a336c282 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_1" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml index b37256a1292..41e1a3b3fd9 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_2" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml index c9a0de11174..1388f3c83ee 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_3" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml index 5e4af3a29ae..43e8096548b 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_4" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml index 2d8c9aad7ec..0af8ef88cea 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_5" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml index 5107c10b41d..dd5f13438ec 100644 --- a/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml @@ -2,6 +2,4 @@ name = "dup_trait_items_6" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml index 56f65941b52..a4c82c70642 100644 --- a/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml @@ -2,6 +2,5 @@ name = "duplicate_declaration" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml index 52a547e8d7b..7f1c2c097a4 100644 --- a/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml @@ -2,6 +2,5 @@ name = "dyn_index_fail_nested_array" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml index c68615052c1..2c44a5356c3 100644 --- a/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml @@ -2,6 +2,5 @@ name = "dynamic_index_failure" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml index f6bc2dd70e2..94934f13e56 100644 --- a/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml @@ -2,6 +2,4 @@ name = "field_modulo" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml index f29ec0408ea..ed607023878 100644 --- a/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml @@ -2,6 +2,4 @@ name = "integer_literal_overflow" type = "bin" authors = [""] -compiler_version = "0.16.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml index 69b56a2e7d0..99d184acdcf 100644 --- a/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml @@ -2,7 +2,5 @@ name = "invalid_dependency_name" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] bad_name = { path = "../../test_libraries/bad_name" } diff --git a/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml index c71c86c664b..d6e4e632f95 100644 --- a/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml @@ -2,6 +2,4 @@ name = "multiple_contracts" type = "contract" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml index 7e699d4bbe0..9aa843d16dc 100644 --- a/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml @@ -2,6 +2,4 @@ name = "multiple_primary_attributes_fail" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml index 5136fad35ce..05db8252f3b 100644 --- a/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml @@ -2,6 +2,4 @@ name = "mutability_regression_2911" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml index 47df960cc33..89f30bb1ba5 100644 --- a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml @@ -2,8 +2,6 @@ name = "orphaned_trait_impl" type = "bin" authors = [""] -compiler_version = "0.12.0" - [dependencies] crate1 = { path = "crate1" } crate2 = { path = "crate2" } diff --git a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml index b28e0e840c4..de1eddf2cf0 100644 --- a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml @@ -2,6 +2,4 @@ name = "crate1" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml index a90a5dcceea..c86c5edf51a 100644 --- a/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml @@ -2,6 +2,4 @@ name = "crate2" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml index 25bdea70129..612e3e7aaf6 100644 --- a/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml @@ -2,6 +2,4 @@ name = "overflowing_assignment" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml index e48565a2111..a279bfb053a 100644 --- a/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml @@ -2,6 +2,4 @@ name = "overlapping_generic_impls" type = "bin" authors = [""] -compiler_version = "0.18.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml index 7c4dbd0c994..88382674780 100644 --- a/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml @@ -2,6 +2,4 @@ name = "" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml index f8d0a85db4a..4882b83b8bf 100644 --- a/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml @@ -2,6 +2,4 @@ name = "hyphenated-name" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml index 872c8f2030d..7c5e7f70774 100644 --- a/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml @@ -3,6 +3,5 @@ name = "primary_attribute_struct" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml index b8b1a2417dc..349698cc32d 100644 --- a/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml @@ -2,6 +2,5 @@ name = "radix_non_constant_length" type = "bin" authors = [""] -compiler_version = "0.10.2" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml index fee471dffd7..fc159b7efc1 100644 --- a/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml @@ -2,6 +2,5 @@ name = "slice_access_failure" type = "bin" authors = [""] -compiler_version = "0.10.2" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml index fc7eb87be49..5134032264c 100644 --- a/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml @@ -2,6 +2,4 @@ name = "slice_insert_failure" type = "bin" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml index 795a4d863cb..1e13dfe6483 100644 --- a/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml @@ -2,6 +2,4 @@ name = "slice_remove_failure" type = "bin" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml index 411f048a93b..8d0e1aca4a9 100644 --- a/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml @@ -2,6 +2,4 @@ name = "a" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml index 1af8ef961cc..f316511340f 100644 --- a/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml @@ -2,6 +2,4 @@ name = "b" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml b/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml index 1af8ef961cc..f316511340f 100644 --- a/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml @@ -2,6 +2,4 @@ name = "b" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml b/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml index 99340cf80b5..ed5e9ec0910 100644 --- a/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml @@ -2,7 +2,6 @@ name = "simple_contract" type = "contract" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml b/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml index c17e430c703..fb1969acc43 100644 --- a/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml @@ -2,6 +2,5 @@ name = "no_entry_points" type = "contract" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml b/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml index 99340cf80b5..ed5e9ec0910 100644 --- a/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml @@ -2,7 +2,6 @@ name = "simple_contract" type = "contract" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml index 96b221d6c9b..78b0e5b7b18 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml @@ -2,6 +2,5 @@ name = "attributes_multiple" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml index 0f00e7d9c73..e05ccb8d925 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml @@ -2,6 +2,5 @@ name = "attributes_struct" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml index cc1c9a8d8f7..ed2a51c0fb0 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml @@ -2,6 +2,4 @@ name = "auto_deref" type = "bin" authors = [""] -compiler_version = "0.16.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml index 7c5aebabb95..cb5a7f3f2bd 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_cast" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml index a8e7cd167d2..fb17e881f4c 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_field_binary_operations" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml index 09b851e7c5c..cd550ce0252 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_integer_binary_operations" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml index b27417dba8f..7bac4a06607 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_modulo" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml index 6c62900468a..a18b769550d 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml @@ -2,6 +2,4 @@ name = "brillig_to_bits" type = "bin" authors = [""] -compiler_version = "0.7.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml index 0ff85ab80bb..86ddff27910 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml @@ -2,6 +2,5 @@ name = "closure_explicit_types" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml index 6ded8f92d55..74710a6ac2a 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml @@ -2,6 +2,5 @@ name = "comptime_recursion_regression" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml index 15221af78c8..7d215a22496 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml @@ -2,6 +2,4 @@ name = "comptime_sort" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml index 2729aca911c..1a62c5af20c 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_547" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml index fab92005fba..b440cb26e46 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_579" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml index e886f083a6c..f2b13c4d547 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_to_bits" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml index 178be37f780..fdb0df17112 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml @@ -3,6 +3,5 @@ name = "ec_baby_jubjub" description = "Baby Jubjub sanity checks" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml index 0f05b6e5759..58d8a993e16 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml @@ -2,6 +2,5 @@ name = "generators" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml index 09a0e342a71..968fc5300e6 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml @@ -2,6 +2,4 @@ name = "higher_order_fn_selector" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml index 070af7d82c2..ef9bdce2640 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml @@ -2,6 +2,5 @@ name = "impl_with_where_clause" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml index 25722866d9b..073456fa7f6 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml @@ -2,6 +2,5 @@ name = "inner_outer_cl" type = "bin" authors = [""] -compiler_version = "0.7.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml index 615bc6254e2..4786a87ff65 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml @@ -2,6 +2,4 @@ name = "instruction_deduplication" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml index 60e0310eab2..539c536b944 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml @@ -2,6 +2,4 @@ name = "intrinsic_die" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml index 45f9a53edeb..def6e33b39a 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml @@ -2,6 +2,4 @@ name = "let_stmt" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml index c4224b7e23c..793ae612730 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml @@ -2,6 +2,5 @@ name = "main_return" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml index c8a3ce73a5e..835c945c3b8 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml @@ -2,6 +2,5 @@ name = "numeric_generics" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml index 553efccd746..d9bec3c3096 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml @@ -2,6 +2,4 @@ name = "option" type = "bin" authors = [""] -compiler_version = "0.7.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml index b95c3998483..0310e55ed7e 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml @@ -2,6 +2,5 @@ name = "references_aliasing" type = "bin" authors = [""] -compiler_version = "0.5.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml index 3e995a0acd6..6b9f9a24038 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml @@ -2,6 +2,4 @@ name = "regression_2099" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml index 4e1b06d927f..4f778574417 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml @@ -2,6 +2,5 @@ name = "ret_fn_ret_cl" type = "bin" authors = [""] -compiler_version = "0.7.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml index 9874c8cb6a8..4f1811cc669 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_array_param" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml index f35a196ab59..13178336eea 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_program_no_body" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml index 864cd03beb3..1db9099be7e 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_range" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml index df379491dc9..aaccd85a444 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml @@ -2,6 +2,4 @@ name = "specialization" type = "bin" authors = [""] -compiler_version = "0.16.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml index 31f7ab5d9b4..6b9bbd9b65f 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml @@ -2,6 +2,4 @@ name = "str_as_bytes" type = "bin" authors = [""] -compiler_version = "0.9.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml index 9fe822eca93..ef47f3b4ba1 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml @@ -2,6 +2,4 @@ name = "to_bits" type = "bin" authors = [""] -compiler_version = "0.7.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml index 459cf96bab7..bd31596297a 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml @@ -2,6 +2,4 @@ name = "trait_allowed_item_name_matches" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml index 585dcde7351..79d78c1aa51 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml @@ -2,6 +2,4 @@ name = "trait_associated_member_names_clashes" type = "bin" authors = [""] -compiler_version = "0.16.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml index 7fcb4d0281e..938e224ec02 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_default_implementation" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml index 74be9decefc..1bb7522d6e1 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml @@ -2,6 +2,4 @@ name = "trait_function_calls" type = "bin" authors = [""] -compiler_version = "0.15.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml index 9da56eebf35..c1b5d0aaa6c 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_generics" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr b/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr index ccda969f930..504132eea8d 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr @@ -25,7 +25,12 @@ fn main() { // the first matching one instead of erroring assert(z.foo() == 32); - // Ensure we can call a generic impl + call_impl_with_generic_struct(); + call_impl_with_generic_function(); +} + +// Ensure we can call a generic impl +fn call_impl_with_generic_struct() { let x: u8 = 7; let y: i8 = 8; let s2_u8 = S2 { x }; @@ -43,3 +48,15 @@ struct S2 { x: T } impl T2 for S2 { fn t2(self) -> Self { self } } + +fn call_impl_with_generic_function() { + assert(3.t3(7) == 7); +} + +trait T3 { + fn t3(self, x: T) -> T; +} + +impl T3 for u32 { + fn t3(self, y: U) -> U { y } +} diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml index 89d83e18f66..efa176099cf 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_multi_module_test" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml index 7ab5a62b5ba..1ccf15adc14 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_override_implementation" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_self/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_self/Nargo.toml index 0dfaea44862..71c541ccd4f 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_self/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_self/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_self" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_self/trait_self/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_self/trait_self/Nargo.toml index 0dfaea44862..71c541ccd4f 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_self/trait_self/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_self/trait_self/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_self" type = "bin" authors = [""] -compiler_version = "0.10.5" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml index 9f17579976b..1bbde8bfd79 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml @@ -2,6 +2,5 @@ name = "trait_where_clause" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml index 75fb80c4bfa..a33e8681807 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml @@ -2,6 +2,5 @@ name = "traits" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml index 65ad7c1c70c..8ab6f708b8a 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml @@ -2,6 +2,5 @@ name = "unary_operators" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml index a42660e8bb7..48d0f5938d8 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml @@ -2,6 +2,4 @@ name = "unconstrained_empty" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml index 35fcd4bf339..7a15bd803c0 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml @@ -2,6 +2,5 @@ name = "unit" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml index 61456b3a320..1447f07d81d 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml @@ -2,6 +2,5 @@ name = "unused_variables" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml b/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml index f628d5e27e1..e4c3889c685 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml +++ b/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml @@ -2,6 +2,5 @@ name = "vectors" type = "bin" authors = [""] -compiler_version = "0.7.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml b/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml index 0ccf7ff8c9c..3adf969538c 100644 --- a/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml @@ -2,6 +2,4 @@ name = "1327_concrete_in_generic" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml b/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml index 29053e36f7c..a0fd8d98027 100644 --- a/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml @@ -2,6 +2,5 @@ name = "1_mul" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml b/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml index 6b28c58bea2..f689c97f760 100644 --- a/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml @@ -2,6 +2,5 @@ name = "2_div" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml b/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml index dca0a0d9931..0bd2caef024 100644 --- a/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml @@ -2,6 +2,5 @@ name = "3_add" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml b/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml index 149c3a6f7e5..b282bfe6287 100644 --- a/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml @@ -2,6 +2,5 @@ name = "4_sub" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml b/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml index a59347066c9..dd9a21b44bf 100644 --- a/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml @@ -2,6 +2,5 @@ name = "5_over" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/6/Nargo.toml b/tooling/nargo_cli/tests/execution_success/6/Nargo.toml index b0353fb6ae5..9774a5d8c47 100644 --- a/tooling/nargo_cli/tests/execution_success/6/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/6/Nargo.toml @@ -2,6 +2,5 @@ name = "6" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/6/src/main.nr b/tooling/nargo_cli/tests/execution_success/6/src/main.nr index 152d3da40bd..4cc8886df04 100644 --- a/tooling/nargo_cli/tests/execution_success/6/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/6/src/main.nr @@ -15,6 +15,6 @@ fn main(x: [u8; 5], result: pub [u8; 32]) { assert(digest == result); let y = [12, 45, 78, 41]; - let h = std::hash::mimc_bn254(y); + let h = std::hash::mimc::mimc_bn254(y); assert(h == 18226366069841799622585958305961373004333097209608110160936134895615261821931); } diff --git a/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml b/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml index 4a6d8e1f401..c75df3e468e 100644 --- a/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml @@ -2,6 +2,5 @@ name = "6_array" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/7/Nargo.toml b/tooling/nargo_cli/tests/execution_success/7/Nargo.toml index 9321253ec03..f69f89468d7 100644 --- a/tooling/nargo_cli/tests/execution_success/7/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/7/Nargo.toml @@ -2,6 +2,5 @@ name = "7" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml b/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml index ea899378643..cec14ff7d6a 100644 --- a/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml @@ -2,6 +2,5 @@ name = "7_function" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml b/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml index 7bacc45d7d1..c9160aa2592 100644 --- a/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml @@ -2,6 +2,5 @@ name = "arithmetic_binary_operations" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml b/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml index 17b38706704..25684b00377 100644 --- a/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml @@ -2,6 +2,5 @@ name = "array_dynamic" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml b/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml index 4a9bd6293c0..1020d4905b1 100644 --- a/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml @@ -2,6 +2,5 @@ name = "array_eq" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml b/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml index b54cea7cc17..24ac6ff7f13 100644 --- a/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml @@ -2,6 +2,5 @@ name = "array_len" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml b/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml index 0539cceb542..2e4bbdf97ee 100644 --- a/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml @@ -2,6 +2,5 @@ name = "array_neq" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml b/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml index f5f469c5a5f..28e9c65a0dc 100644 --- a/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml @@ -2,6 +2,4 @@ name = "array_sort" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml b/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml index 17ed9362bef..7780d53459e 100644 --- a/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml @@ -2,6 +2,5 @@ name = "assert" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml b/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml index 641cb1b00e0..c6a1daaed19 100644 --- a/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml @@ -2,6 +2,5 @@ name = "assert_statement" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml b/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml index 2ca969eeb93..4ef7b3aa5a6 100644 --- a/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml @@ -2,6 +2,5 @@ name = "assign_ex" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml b/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml index 71a98db6635..e9a28577079 100644 --- a/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml @@ -2,6 +2,5 @@ name = "bit_and" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml b/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml index 9b7aa319406..81272be4e98 100644 --- a/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml @@ -2,6 +2,5 @@ name = "bit_shifts_comptime" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml b/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml index 3f9058f1946..f60c7dbe658 100644 --- a/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml @@ -2,6 +2,5 @@ name = "bit_shifts_runtime" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml b/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml index c2521450344..fe42e1efa11 100644 --- a/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml @@ -2,6 +2,5 @@ name = "bool_not" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml b/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml index a878c1acb38..e139a7a2947 100644 --- a/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml @@ -2,6 +2,5 @@ name = "bool_or" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml index 42b3c71aad3..aef4fd56d4f 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_acir_as_brillig" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml index abaa6680f84..a4433e380a9 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_arrays" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml index c6a27b47e79..b7d9231ab75 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_assert" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml index 8fc7df96fc3..a497b6f48cc 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_blake2s" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml index 9b6b4bd357b..7cc53a33a8a 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_calls" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml index 0c60f6218eb..e360f2d6338 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_calls_array" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml index f99445381d3..1553cd525ff 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_calls_conditionals" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml index 7432f303349..6a8be620fee 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_conditional" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml index 96ffe8f1c92..972dd9ce93b 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_ecdsa" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml index fd94bfb3a60..decd9a9412a 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_fns_as_values" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml index a7d75459f7e..7cfcc745f0d 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_hash_to_field" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml index 1c7603a5660..8196884fe2b 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_identity_function" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml index 358c7c63a60..8cacf2186b8 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_keccak" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml index c43a806784a..1212397c4db 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_loop" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml index 4ce5518efb5..c36c8a0a2bd 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml @@ -2,6 +2,4 @@ name = "brillig_nested_arrays" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml index 3a558b737d8..d84338cdbb4 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml @@ -2,6 +2,4 @@ name = "brillig_nested_slices" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml index 38a0872adfb..ef882ea8da0 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_not" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml index 0b03be79ef8..13bd913cef7 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_oracle" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml index f6f34dcc650..6327caa0a09 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_pedersen" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml index 32dd1a6c858..087eeefd5ac 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_recursion" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml index 7f47fab9d9a..0f64b862ba0 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_references" type = "bin" authors = [""] -compiler_version = "0.5.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml index a580584f7f9..eefd041b899 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_scalar_mul" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml index 3defa68f561..1b598abbf74 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_schnorr" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml index 6aebe1ed5ad..7140fa0fd0b 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_sha256" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml index 51d81efb6ae..5f6caad088a 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml @@ -2,6 +2,4 @@ name = "brillig_slices" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml index 21c5104e6a8..df6c818c90f 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_to_be_bytes" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml index 10c2abeee29..991f3d1e46c 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_to_bytes_integration" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml index e1ba633bff1..c2ce8ad01b5 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_to_le_bytes" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml index 79686cab2ea..f74a2a82964 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_top_level" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml b/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml index c7045d0b816..f23ecc787d0 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml @@ -2,6 +2,5 @@ name = "brillig_unitialised_arrays" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml b/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml index 65a878d776a..6571019494e 100644 --- a/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml @@ -2,6 +2,5 @@ name = "cast_bool" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml b/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml index f70cde6f878..01936c7be65 100644 --- a/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml @@ -2,6 +2,4 @@ name = "closures_mut_ref" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml index af1efa03e82..28ca01332df 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_1" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml b/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml index 1401a715eef..153c5d38b99 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_2" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml b/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml index 9fddef0e86f..987b51ae126 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_421" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml b/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml index 902408f5d56..ed11341c5b0 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_661" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml b/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml index 24c16982cc4..92f5a869bc4 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml @@ -2,6 +2,5 @@ name = "conditional_regression_short_circuit" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml b/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml index a8cc75072b1..35cf2e080c1 100644 --- a/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml @@ -3,6 +3,5 @@ name = "custom_entry" type = "bin" entry = "src/foobarbaz.nr" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml b/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml index edc03c152cf..9550d50cf15 100644 --- a/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml @@ -2,6 +2,4 @@ name = "debug_logs" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml b/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml index 6b1dd65ba32..8b75d71ae12 100644 --- a/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml @@ -2,7 +2,6 @@ name = "diamond_deps_0" type = "bin" authors = [""] -compiler_version = "0.7.1" [dependencies] dep1 = { path = "../../test_libraries/diamond_deps_1" } diff --git a/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml b/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml index b7de54ea5cc..3f1b1386ba7 100644 --- a/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml @@ -2,6 +2,5 @@ name = "distinct_keyword" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml b/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml index 61aaabfcf5b..a4edd2e4288 100644 --- a/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml @@ -2,6 +2,4 @@ name = "double_verify_proof" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml index 0f8111dc9f6..58fdf96f0e3 100644 --- a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml @@ -3,6 +3,5 @@ name = "ecdsa_secp256k1" description = "ECDSA secp256k1 verification" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml index 738b049060a..87e8d529566 100644 --- a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml @@ -3,6 +3,5 @@ name = "ecdsa_secp256r1" description = "ECDSA secp256r1 verification" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml b/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml index 039da3a7074..0f545c2febc 100644 --- a/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml @@ -3,6 +3,5 @@ name = "eddsa" description = "Eddsa verification" type = "bin" authors = [""] -compiler_version = "0.3.2" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml b/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml index f625d7e41f2..37487d0043c 100644 --- a/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml @@ -2,6 +2,5 @@ name = "field_attribute" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml b/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml index 18bdae1ab08..19c8ff28ec7 100644 --- a/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml @@ -2,6 +2,5 @@ name = "generics" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml b/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml index 2452ad8edb3..3b4d6be2353 100644 --- a/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml @@ -2,6 +2,5 @@ name = "global_consts" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml b/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml index d78b59118f9..a00a7bdc050 100644 --- a/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml @@ -2,6 +2,5 @@ name = "hash_to_field" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr b/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr index ffc334179ee..2b7d59cd8b6 100644 --- a/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr @@ -2,4 +2,4 @@ use dep::std; fn main(input : Field) -> pub Field { std::hash::hash_to_field([input]) -} +} \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml b/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml index 9dc419d1678..8f8a79e7e83 100644 --- a/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml @@ -2,6 +2,5 @@ name = "higher_order_functions" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml b/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml index fc5fffa2185..2f0dc93d120 100644 --- a/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml @@ -2,6 +2,5 @@ name = "if_else_chain" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/import/Nargo.toml b/tooling/nargo_cli/tests/execution_success/import/Nargo.toml index 858c2a29840..c92328f106c 100644 --- a/tooling/nargo_cli/tests/execution_success/import/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/import/Nargo.toml @@ -2,6 +2,5 @@ name = "import" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml b/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml index 3cec63d465b..6e639b64f58 100644 --- a/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml @@ -2,6 +2,5 @@ name = "integer_array_indexing" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml b/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml index ab1a04b7c07..7e48c3b342c 100644 --- a/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml @@ -2,6 +2,5 @@ name = "keccak256" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml b/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml index 1a4e3657464..c1cedb6c657 100644 --- a/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml @@ -2,6 +2,5 @@ name = "main_bool_arg" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml b/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml index 3eb97c30cac..f09458411d8 100644 --- a/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml @@ -2,6 +2,5 @@ name = "merkle_insert" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml b/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml index 3f69ad1cffb..0656908c063 100644 --- a/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml +++ b/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml @@ -1,11 +1,11 @@ -old_root = "0x200fbe381993186866de8eb5a9cc33845de6b084be3ff67f6e34d35b8a786157" -old_leaf = "0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0" +old_root = "0x2131c74af6250d1246797588ff075b672e3d2e6805f9c6b313ade8f6b9e12802" +old_leaf = "0x2df8b940e5890e4e1377e05373fae69a1d754f6935e6a780b666947431f2cdcd" old_hash_path = [ - "0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0", - "0x0b5e9666e7323ce925c28201a97ddf4144ac9d148448ed6f49f9008719c1b85b", - "0x22ec636f8ad30ef78c42b7fe2be4a4cacf5a445cfb5948224539f59a11d70775", + "0x03542cb720369f19a74fd05b4edfbedb27a78514ad3283f1b3270a1656cced8e", + "0x1278272f6e617666b18c52349c4bbe94249a8ab59add2ee0a142168a92b7ffc2", + "0x2547cfd7699ad1f331fb77b30a3445c6043a4c62b5b1215356b2924607bf937b", ] -new_root = "0x029ead881a6684995190589a67874f188f33a433211df82f56c1351c96530387" -leaf = "0x085ca53be9c9d95b57e6e5fc91c5d531ad9e63e85dd71af7e35562991774b435" +new_root = "0x25e2a8ee5b85e5b546ae27832b9b53f5fae5b371e3e7f8cddda839f41669fc68" +leaf = "0x23fe6c8f2426b793f0f156f57efbecbea52e951af761634a85e80cc1a9fb5003" index = "0" mimc_input = [12, 45, 78, 41] diff --git a/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr b/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr index 3de10520037..87b8533c274 100644 --- a/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr @@ -1,4 +1,5 @@ use dep::std; +use dep::std::hash::mimc; fn main( old_root: Field, @@ -14,7 +15,7 @@ fn main( let calculated_root = std::merkle::compute_merkle_root(leaf, index, old_hash_path); assert(new_root == calculated_root); - let h = std::hash::mimc_bn254(mimc_input); + let h = mimc::mimc_bn254(mimc_input); // Regression test for PR #891 std::println(h); assert(h == 18226366069841799622585958305961373004333097209608110160936134895615261821931); diff --git a/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml b/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml index f626c2967cc..b2916487e8c 100644 --- a/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml @@ -2,6 +2,5 @@ name = "mock_oracle" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml b/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml index b4f9b469ea8..ab1d6e962d7 100644 --- a/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml @@ -2,6 +2,5 @@ name = "modules" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml b/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml index 5acf61a71a7..bfcfe08fa79 100644 --- a/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml @@ -2,6 +2,5 @@ name = "modules_more" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml b/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml index 5a1309a2a9d..256eeef058f 100644 --- a/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml @@ -2,6 +2,5 @@ name = "modulus" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml b/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml index 5be06d0f8af..72642bebc15 100644 --- a/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml @@ -2,6 +2,5 @@ name = "nested_array_dynamic" type = "bin" authors = [""] -compiler_version = "0.11.1" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml b/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml index bd5dfb8bef4..02d2e6e6a4e 100644 --- a/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml @@ -2,6 +2,4 @@ name = "nested_arrays_from_brillig" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml b/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml index 00dfbffbe45..c8925ed97b4 100644 --- a/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml @@ -2,6 +2,4 @@ name = "nested_slice_dynamic" type = "bin" authors = [""] -compiler_version = "0.13.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml b/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml index 3fc0bd9b79e..65fd3b5cf59 100644 --- a/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml @@ -2,6 +2,5 @@ name = "pedersen_check" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml b/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml index d23bb7cb919..a8e2b3d5a2c 100644 --- a/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml @@ -3,6 +3,5 @@ name = "poseidon_bn254_hash" description = "Poseidon 254-bit permutation test on 3 elements with alpha = 5" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml b/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml index df1da360206..de4b1a44668 100644 --- a/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml @@ -3,6 +3,5 @@ name = "poseidonsponge_x5_254" description = "Variable-length Poseidon-128 sponge test on 7 elements with alpha = 5" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml b/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml index ee6f7a28e0f..b5b4a9fdf61 100644 --- a/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml @@ -2,6 +2,5 @@ name = "pred_eq" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/references/Nargo.toml b/tooling/nargo_cli/tests/execution_success/references/Nargo.toml index b52fdcf77f0..c4be4d4218d 100644 --- a/tooling/nargo_cli/tests/execution_success/references/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/references/Nargo.toml @@ -2,6 +2,5 @@ name = "references" type = "bin" authors = [""] -compiler_version = "0.5.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml b/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml index 91497e10342..0f6961c41d3 100644 --- a/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml @@ -2,6 +2,5 @@ name = "regression" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml b/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml index 33bd007d898..fb2b3c42fdd 100644 --- a/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml @@ -2,6 +2,5 @@ name = "regression_2854" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml b/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml index 0361b28fd1e..93a0ba6f25a 100644 --- a/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml @@ -2,6 +2,5 @@ name = "regression_mem_op_predicate" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml b/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml index 9d9bb35778d..aed6aa06714 100644 --- a/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml @@ -2,6 +2,5 @@ name = "regression_method_cannot_be_found" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml b/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml index 55bf6395b34..926114ec374 100644 --- a/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml @@ -2,6 +2,5 @@ name = "scalar_mul" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml b/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml index 3ba59b7010e..aa24a2f3caf 100644 --- a/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml @@ -2,6 +2,5 @@ name = "schnorr" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml b/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml index 97ca07f03d4..255d2156ef6 100644 --- a/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml @@ -2,6 +2,5 @@ name = "sha256" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/sha2_blocks/Nargo.toml b/tooling/nargo_cli/tests/execution_success/sha2_blocks/Nargo.toml deleted file mode 100644 index 9aa46c465e9..00000000000 --- a/tooling/nargo_cli/tests/execution_success/sha2_blocks/Nargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "sha2_blocks" -type = "bin" -authors = [""] -compiler_version = "0.1" - -[dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/sha2_blocks/Prover.toml b/tooling/nargo_cli/tests/execution_success/sha2_blocks/Prover.toml deleted file mode 100644 index 3fe435ea07f..00000000000 --- a/tooling/nargo_cli/tests/execution_success/sha2_blocks/Prover.toml +++ /dev/null @@ -1,4 +0,0 @@ -# From https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA256.pdf and https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA512.pdf -x = [0x61, 0x62, 0x63] # "abc" -result256 = [0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad] -result512 = [0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr b/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr deleted file mode 100644 index a491530dd7d..00000000000 --- a/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr +++ /dev/null @@ -1,34 +0,0 @@ -// Test Noir implementations of SHA256 and SHA512 on one- and two-block (padded) messages. -use dep::std; - -fn main(x: [u8; 3], result256: [u8; 32], result512: [u8; 64]) { - // One-block tests. - let mut digest256 = std::sha256::digest(x); - assert(digest256 == result256); - - let mut digest512 = std::sha512::digest(x); - assert(digest512 == result512); - - // Two-block SHA256 test. Taken from https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA256.pdf - let y: [u8; 56] = [97, 98, 99, 100, 98, 99, 100, 101, 99, 100, 101, 102, 100, 101, 102, 103, 101, 102, 103, - 104, 102, 103, 104, 105, 103, 104, 105, 106, 104, 105, 106, 107, 105, 106, 107, 108, 106, - 107, 108, 109, 107, 108, 109, 110, 108, 109, 110, 111, 109, 110, 111, 112, 110, 111, 112, - 113]; // "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - digest256 = std::sha256::digest(y); - assert(digest256 == [36, 141, 106, 97, 210, 6, 56, 184, 229, 192, 38, 147, 12, 62, 96, 57, 163, 60, 228, 89, 100, - 255, 33, 103, 246, 236, 237, 212, 25, 219, 6, 193]); - - // Two-block SHA256 test. Taken from https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA512.pdf - let z: [u8; 112] = [97, 98, 99, 100, 101, 102, 103, 104, 98, 99, 100, 101, 102, 103, 104, 105, 99, 100, 101, - 102, 103, 104, 105, 106, 100, 101, 102, 103, 104, 105, 106, 107, 101, 102, 103, 104, 105, - 106, 107, 108, 102, 103, 104, 105, 106, 107, 108, 109, 103, 104, 105, 106, 107, 108, 109, - 110, 104, 105, 106, 107, 108, 109, 110, 111, 105, 106, 107, 108, 109, 110, 111, 112, 106, - 107, 108, 109, 110, 111, 112, 113, 107, 108, 109, 110, 111, 112, 113, 114, 108, 109, 110, - 111, 112, 113, 114, 115, 109, 110, 111, 112, 113, 114, 115, 116, 110, 111, 112, 113, 114, - 115, 116, 117]; // "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" - digest512 = std::sha512::digest(z); - assert(digest512 == [142, 149, 155, 117, 218, 227, 19, 218, 140, 244, 247, 40, 20, 252, 20, 63, 143, 119, 121, - 198, 235, 159, 127, 161, 114, 153, 174, 173, 182, 136, 144, 24, 80, 29, 40, 158, 73, 0, 247, - 228, 51, 27, 153, 222, 196, 181, 67, 58, 199, 211, 41, 238, 182, 221, 38, 84, 94, 150, 229, - 91, 135, 75, 233, 9]); -} diff --git a/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml b/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml index 849b6220db7..efd691fce58 100644 --- a/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml @@ -2,6 +2,5 @@ name = "sha2_byte" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml b/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml index 952e7d88a5a..47676a806e8 100644 --- a/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml @@ -2,6 +2,5 @@ name = "signed_arithmetic" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml b/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml index c1dacecae02..0d631a00b05 100644 --- a/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml @@ -2,6 +2,5 @@ name = "signed_division" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml index 033c9cf1c25..b6d22d82631 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_2d_array" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml index 9afb8c5fd5b..6c5b0e4ca9a 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_add_and_ret_arr" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml index c8fe1e06b4c..be425f22e5c 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_bitwise" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml index 840eb0a7e0b..06685628444 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_comparison" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml index b7b5c5d3dcc..c00e60bdbc0 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_mut" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml index 0ca112cf4b3..52c86b36efb 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_not" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml index d154fbc47f2..cd8422ac482 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_print" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml index 8cf28eb45a7..28967a28a55 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_program_addition" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml index 6c208c1645c..12cbc8da1d3 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml @@ -2,6 +2,4 @@ name = "simple_radix" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml index b710f38d826..7e9579b0af4 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_shield" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml b/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml index 55492a9bf6d..7878e4b8281 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml @@ -1,6 +1,6 @@ # Random test key priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" -note_root = "0x0f8cd7b45fbb4e08f63126f1673ce9e574cfbda70f36c2e5182f9e3dbe6524c0" +note_root = "0x02278fc806225cd696bd502049f7bb98624536de56d09343f8a26ac1876b23a0" index = "0" note_hash_path = [ "0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0", diff --git a/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml b/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml index 09eb46d547e..2e75d5feada 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml @@ -2,6 +2,5 @@ name = "simple_shift_left_right" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml b/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml index 08322784151..a02faeae27a 100644 --- a/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml @@ -2,6 +2,5 @@ name = "slice_dynamic_index" type = "bin" authors = [""] -compiler_version = "0.10.3" [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml b/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml index bc9dcc7729a..3eec413bc07 100644 --- a/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml @@ -2,6 +2,4 @@ name = "slices" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml b/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml index 30df1a2f27e..76a9beb6909 100644 --- a/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml @@ -2,6 +2,5 @@ name = "strings" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml b/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml index 34c3d838538..6622edd0653 100644 --- a/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml @@ -2,6 +2,5 @@ name = "struct" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml b/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml index 7be5ccbb99f..40160fb397f 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml @@ -2,6 +2,4 @@ name = "struct_array_inputs" type = "bin" authors = [""] -compiler_version = "0.6.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml b/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml index 2e886f62689..767f51acda3 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml @@ -2,6 +2,5 @@ name = "struct_fields_ordering" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml b/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml index 455a7b28ddb..7dd6f78b750 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml @@ -2,6 +2,5 @@ name = "struct_inputs" type = "bin" authors = [""] -compiler_version = "0.1" [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml b/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml index a98eda3cd89..082afdf3f10 100644 --- a/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml @@ -2,6 +2,4 @@ name = "submodules" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml b/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml index c0837a335f8..e9d2e30b4c4 100644 --- a/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml @@ -2,6 +2,4 @@ name = "to_be_bytes" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml b/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml index 65f95d159c8..1e117b83883 100644 --- a/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml @@ -2,6 +2,4 @@ name = "to_bytes_consistent" type = "bin" authors = [""] -compiler_version = "0.10.3" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml b/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml index fd1c714b123..c89c32eb06c 100644 --- a/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml @@ -2,6 +2,4 @@ name = "to_bytes_integration" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml b/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml index 34cf8a5afc7..3d02c3510fd 100644 --- a/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml @@ -2,6 +2,4 @@ name = "to_le_bytes" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml b/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml index 1a7ef7ee8a2..afd89f0c3a1 100644 --- a/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml @@ -2,6 +2,4 @@ name = "trait_as_return_type" type = "bin" authors = [""] -compiler_version = "0.10.5" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml b/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml index dad2ca8fed2..845498737c1 100644 --- a/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml @@ -2,6 +2,4 @@ name = "trait_impl_base_type" type = "bin" authors = [""] -compiler_version = "0.10.5" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml index a13ed98b632..555c3b38b98 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml @@ -2,8 +2,6 @@ name = "traits_in_crates_1" type = "bin" authors = [""] -compiler_version = "0.12.0" - [dependencies] crate1 = { path = "crate1" } crate2 = { path = "crate2" } diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml index 0a94742b76a..f49603ba203 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml @@ -2,7 +2,5 @@ name = "crate1" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] crate2 = { path = "../crate2" } diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml index a90a5dcceea..c86c5edf51a 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml @@ -2,6 +2,4 @@ name = "crate2" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml index 8b5bc49e0bb..11a86a08402 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml @@ -2,8 +2,6 @@ name = "traits_in_crates_2" type = "bin" authors = [""] -compiler_version = "0.12.0" - [dependencies] crate1 = { path = "crate1" } crate2 = { path = "crate2" } diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml index b28e0e840c4..de1eddf2cf0 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml @@ -2,6 +2,4 @@ name = "crate1" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml index 51c201372ee..885d41f0a27 100644 --- a/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml @@ -2,7 +2,5 @@ name = "crate2" type = "lib" authors = [""] -compiler_version = "0.12.0" - [dependencies] crate1 = { path = "../crate1" } diff --git a/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml b/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml index 7cc7bc85393..f4af6cfe6e3 100644 --- a/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml @@ -2,6 +2,4 @@ name = "tuple_inputs" type = "bin" authors = [""] -compiler_version = "0.14.1" - [dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml b/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml index 54603e9a96b..f6ed9f1e649 100644 --- a/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml @@ -2,6 +2,4 @@ name = "tuples" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml b/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml index e828f6913e0..a12df601a91 100644 --- a/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml @@ -2,6 +2,4 @@ name = "type_aliases" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml b/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml index 411f048a93b..8d0e1aca4a9 100644 --- a/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml @@ -2,6 +2,4 @@ name = "a" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml b/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml index 1af8ef961cc..f316511340f 100644 --- a/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml @@ -2,6 +2,4 @@ name = "b" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml b/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml index 411f048a93b..8d0e1aca4a9 100644 --- a/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml @@ -2,6 +2,4 @@ name = "a" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml b/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml index 1af8ef961cc..f316511340f 100644 --- a/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml @@ -2,6 +2,4 @@ name = "b" type = "bin" authors = [""] -compiler_version = "0.8.0" - [dependencies] diff --git a/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml b/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml index ea15f5eb6c5..ddf3b6d86c5 100644 --- a/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml +++ b/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml @@ -2,6 +2,4 @@ name = "xor" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml b/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml index dd56e682004..3d2cf2c6096 100644 --- a/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml +++ b/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml @@ -2,6 +2,4 @@ name = "should_fail_with_mismatch" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml b/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml index 78d98bc87a3..21bce3d2b2d 100644 --- a/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml +++ b/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml @@ -2,6 +2,4 @@ name = "should_fail_with_match" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml b/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml index ccb03576323..62ffe95922d 100644 --- a/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml +++ b/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml @@ -2,6 +2,4 @@ name = "bad_impl" type = "lib" authors = [""] -compiler_version = "0.7.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml b/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml index 313e2411e83..74f6f66524d 100644 --- a/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml +++ b/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml @@ -2,6 +2,4 @@ name = "bad-name" type = "lib" authors = [""] -compiler_version = "0.7.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml b/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml index aa7125bf5b5..7cc99c1c5c5 100644 --- a/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml +++ b/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml @@ -2,6 +2,4 @@ name = "bin_dep" type = "bin" authors = [""] -compiler_version = "0.7.1" - [dependencies] diff --git a/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml b/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml index 7069390334c..f7770e07469 100644 --- a/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml +++ b/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml @@ -2,7 +2,5 @@ name = "diamond_deps_1" type = "lib" authors = [""] -compiler_version = "0.7.1" - [dependencies] dep2 = { path = "../diamond_deps_2" } diff --git a/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml b/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml index 4b8ece297d3..2dbba1b7a9e 100644 --- a/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml +++ b/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml @@ -2,6 +2,4 @@ name = "diamond_deps_2" type = "lib" authors = [""] -compiler_version = "0.7.1" - [dependencies] diff --git a/tooling/nargo_fmt/build.rs b/tooling/nargo_fmt/build.rs index f2e23f9b8c1..3da07715e4e 100644 --- a/tooling/nargo_fmt/build.rs +++ b/tooling/nargo_fmt/build.rs @@ -40,6 +40,12 @@ fn generate_formatter_tests(test_file: &mut File, test_data_dir: &Path) { let input_source_path = file.path(); let input_source = std::fs::read_to_string(input_source_path).unwrap(); + let config = input_source + .lines() + .flat_map(|line| line.strip_prefix("//@")) + .collect::>() + .join("\n"); + let output_source_path = outputs_dir.join(file_name); let output_source = std::fs::read_to_string(output_source_path).unwrap(); @@ -55,7 +61,7 @@ fn format_{test_name}() {{ let (parsed_module, errors) = noirc_frontend::parse_program(&input); assert!(errors.is_empty()); - let config = nargo_fmt::Config::default(); + let config = nargo_fmt::Config::of("{config}").unwrap(); let fmt_text = nargo_fmt::format(&input, parsed_module, &config); diff --git a/tooling/nargo_fmt/src/config.rs b/tooling/nargo_fmt/src/config.rs index b81fc47cf09..c026b1576c6 100644 --- a/tooling/nargo_fmt/src/config.rs +++ b/tooling/nargo_fmt/src/config.rs @@ -45,6 +45,7 @@ config! { max_width: usize, 100, "Maximum width of each line"; tab_spaces: usize, 4, "Number of spaces per tab"; remove_nested_parens: bool, true, "Remove nested parens"; + error_on_lost_comment: bool, true, "Error if unable to get comments"; short_array_element_width_threshold: usize, 10, "Width threshold for an array element to be considered short"; array_width: usize, 100, "Maximum width of an array literal before falling back to vertical formatting"; single_line_if_else_max_width: usize, 50, "Maximum line length for single line if-else expressions"; @@ -52,16 +53,20 @@ config! { impl Config { pub fn read(path: &Path) -> Result { - let mut config = Self::default(); let config_path = path.join("noirfmt.toml"); - let raw_toml = match std::fs::read_to_string(&config_path) { - Ok(t) => t, - Err(err) if err.kind() == std::io::ErrorKind::NotFound => String::new(), + let input = match std::fs::read_to_string(&config_path) { + Ok(input) => input, + Err(cause) if cause.kind() == std::io::ErrorKind::NotFound => String::new(), Err(cause) => return Err(ConfigError::ReadFailed(config_path, cause)), }; - let toml = toml::from_str(&raw_toml).map_err(ConfigError::MalformedFile)?; + Self::of(&input) + } + + pub fn of(s: &str) -> Result { + let mut config = Self::default(); + let toml = toml::from_str(s).map_err(ConfigError::MalformedFile)?; config.fill_from_toml(toml); Ok(config) } diff --git a/tooling/nargo_fmt/src/utils.rs b/tooling/nargo_fmt/src/utils.rs index a13c0298ed7..7bb40956b2e 100644 --- a/tooling/nargo_fmt/src/utils.rs +++ b/tooling/nargo_fmt/src/utils.rs @@ -4,14 +4,6 @@ use noirc_frontend::lexer::Lexer; use noirc_frontend::token::Token; use noirc_frontend::{Expression, Ident}; -pub(crate) fn recover_comment_removed(original: &str, new: String) -> String { - if changed_comment_content(original, &new) { - original.to_string() - } else { - new - } -} - pub(crate) fn changed_comment_content(original: &str, new: &str) -> bool { comments(original).ne(comments(new)) } @@ -132,7 +124,6 @@ impl FindToken for str { Lexer::new(self) .skip_comments(false) .flatten() - .into_iter() .find_map(|spanned| f(spanned.token()).then(|| spanned.to_span().end())) } } diff --git a/tooling/nargo_fmt/src/visitor.rs b/tooling/nargo_fmt/src/visitor.rs index 20eb332f9f3..fd156074ec3 100644 --- a/tooling/nargo_fmt/src/visitor.rs +++ b/tooling/nargo_fmt/src/visitor.rs @@ -89,7 +89,15 @@ impl<'me> FmtVisitor<'me> { #[track_caller] fn push_rewrite(&mut self, rewrite: String, span: Span) { - let rewrite = utils::recover_comment_removed(self.slice(span), rewrite); + let original = self.slice(span); + let changed_comment_content = utils::changed_comment_content(original, &rewrite); + + if changed_comment_content && self.config.error_on_lost_comment { + panic!("not formatted because a comment would be lost: {rewrite:?}"); + } + + let rewrite = if changed_comment_content { original.to_string() } else { rewrite }; + self.format_missing_indent(span.start(), true); self.push_str(&rewrite); } diff --git a/tooling/nargo_fmt/src/visitor/expr.rs b/tooling/nargo_fmt/src/visitor/expr.rs index 604d5ca9caf..b7f59526701 100644 --- a/tooling/nargo_fmt/src/visitor/expr.rs +++ b/tooling/nargo_fmt/src/visitor/expr.rs @@ -13,10 +13,8 @@ use crate::{ impl FmtVisitor<'_> { pub(crate) fn visit_expr(&mut self, expr: Expression, expr_type: ExpressionType) { let span = expr.span; - let rewrite = self.format_expr(expr, expr_type); self.push_rewrite(rewrite, span); - self.last_position = span.end(); } diff --git a/tooling/nargo_fmt/src/visitor/stmt.rs b/tooling/nargo_fmt/src/visitor/stmt.rs index 32f1126cb9d..b6dd67323fa 100644 --- a/tooling/nargo_fmt/src/visitor/stmt.rs +++ b/tooling/nargo_fmt/src/visitor/stmt.rs @@ -1,6 +1,8 @@ use std::iter::zip; -use noirc_frontend::{ConstrainKind, ConstrainStatement, ExpressionKind, Statement, StatementKind}; +use noirc_frontend::{ + ConstrainKind, ConstrainStatement, ExpressionKind, ForRange, Statement, StatementKind, +}; use super::ExpressionType; @@ -55,7 +57,22 @@ impl super::FmtVisitor<'_> { self.push_rewrite(constrain, span); } - StatementKind::For(_) | StatementKind::Assign(_) => { + StatementKind::For(for_stmt) => { + let identifier = self.slice(for_stmt.identifier.span()); + let range = match for_stmt.range { + ForRange::Range(start, end) => format!( + "{}..{}", + self.format_sub_expr(start), + self.format_sub_expr(end) + ), + ForRange::Array(array) => self.format_sub_expr(array), + }; + let block = self.format_sub_expr(for_stmt.block); + + let result = format!("for {identifier} in {range} {block}"); + self.push_rewrite(result, span); + } + StatementKind::Assign(_) => { self.push_rewrite(self.slice(span).to_string(), span); } StatementKind::Error => unreachable!(), diff --git a/tooling/nargo_fmt/tests/expected/for.nr b/tooling/nargo_fmt/tests/expected/for.nr new file mode 100644 index 00000000000..98dff672bef --- /dev/null +++ b/tooling/nargo_fmt/tests/expected/for.nr @@ -0,0 +1,21 @@ +fn for_stmt() { + for elem in self { + ret &= predicate(elem); + } +} + +fn for_stmt() { + for i in 0..(C1 - 1) { + for _j in 1..(C1 - i - 1) { + b *= b; + } + + z *= if b == 1 { 1 } else { c }; + + c *= c; + + t *= if b == 1 { 1 } else { c }; + + b = t; + } +} diff --git a/tooling/nargo_fmt/tests/expected/if.nr b/tooling/nargo_fmt/tests/expected/if.nr index 30a60e50577..39ad7d18cdd 100644 --- a/tooling/nargo_fmt/tests/expected/if.nr +++ b/tooling/nargo_fmt/tests/expected/if.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn main() { let (x,y) = if is_square(gx1) { (x1, sqrt(gx1)) diff --git a/tooling/nargo_fmt/tests/expected/infix.nr b/tooling/nargo_fmt/tests/expected/infix.nr index f930f79ebcb..0688781ba48 100644 --- a/tooling/nargo_fmt/tests/expected/infix.nr +++ b/tooling/nargo_fmt/tests/expected/infix.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn foo() { 40 + 2; !40 + 2; diff --git a/tooling/nargo_fmt/tests/expected/let.nr b/tooling/nargo_fmt/tests/expected/let.nr index dccdb76328c..1c7afc8df5f 100644 --- a/tooling/nargo_fmt/tests/expected/let.nr +++ b/tooling/nargo_fmt/tests/expected/let.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn let_() { let fn_call = my_function(some_function(10, "arg1", another_function()), another_func(20, some_function(), 30)); let array = [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; diff --git a/tooling/nargo_fmt/tests/expected/literals.nr b/tooling/nargo_fmt/tests/expected/literals.nr index abe14c14965..5a9a735337f 100644 --- a/tooling/nargo_fmt/tests/expected/literals.nr +++ b/tooling/nargo_fmt/tests/expected/literals.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn main() { [1, 2, 3, 4, 5]; diff --git a/tooling/nargo_fmt/tests/expected/nested_parens.nr b/tooling/nargo_fmt/tests/expected/nested_parens.nr new file mode 100644 index 00000000000..53eaa63c279 --- /dev/null +++ b/tooling/nargo_fmt/tests/expected/nested_parens.nr @@ -0,0 +1,5 @@ +//@remove_nested_parens=false +fn main() { + ((())); + ((((((((())))))))); +} diff --git a/tooling/nargo_fmt/tests/expected/unary_operators.nr b/tooling/nargo_fmt/tests/expected/unary_operators.nr index 1dd5e4ab945..ffea1713c06 100644 --- a/tooling/nargo_fmt/tests/expected/unary_operators.nr +++ b/tooling/nargo_fmt/tests/expected/unary_operators.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn main() { -1; -/*test*/1; diff --git a/tooling/nargo_fmt/tests/input/for.nr b/tooling/nargo_fmt/tests/input/for.nr new file mode 100644 index 00000000000..99b796df820 --- /dev/null +++ b/tooling/nargo_fmt/tests/input/for.nr @@ -0,0 +1,24 @@ +fn for_stmt() { + for elem in self { + ret &= predicate(elem); + } +} + +fn for_stmt() { + for i in 0..(C1-1) { + + for _j in 1..(C1-i-1) { + + b *= b; + + } + + z *= if b == 1 { 1 } else { c }; + + c *= c; + + t *= if b == 1 { 1 } else { c }; + + b = t; + } +} diff --git a/tooling/nargo_fmt/tests/input/if.nr b/tooling/nargo_fmt/tests/input/if.nr index ab39df006ea..be72eb79a18 100644 --- a/tooling/nargo_fmt/tests/input/if.nr +++ b/tooling/nargo_fmt/tests/input/if.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn main() { let (x,y) = if is_square(gx1) {(x1, sqrt(gx1))} else {(x2, sqrt(gx2))}; diff --git a/tooling/nargo_fmt/tests/input/infix.nr b/tooling/nargo_fmt/tests/input/infix.nr index df57f956097..b16ccd02982 100644 --- a/tooling/nargo_fmt/tests/input/infix.nr +++ b/tooling/nargo_fmt/tests/input/infix.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn foo() { 40 + 2; !40+2; diff --git a/tooling/nargo_fmt/tests/input/let.nr b/tooling/nargo_fmt/tests/input/let.nr index ae23f0150d9..67c4ab8bd52 100644 --- a/tooling/nargo_fmt/tests/input/let.nr +++ b/tooling/nargo_fmt/tests/input/let.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn let_() { let fn_call = my_function(some_function( 10, "arg1", another_function() ),another_func (20, some_function() , 30 )); let array = [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; diff --git a/tooling/nargo_fmt/tests/input/literals.nr b/tooling/nargo_fmt/tests/input/literals.nr index 3490c1e7d0d..fbdc7676845 100644 --- a/tooling/nargo_fmt/tests/input/literals.nr +++ b/tooling/nargo_fmt/tests/input/literals.nr @@ -1,4 +1,4 @@ - +//@error_on_lost_comment=false fn main() { [1,2,3,4,5]; diff --git a/tooling/nargo_fmt/tests/input/nested_parens.nr b/tooling/nargo_fmt/tests/input/nested_parens.nr new file mode 100644 index 00000000000..53eaa63c279 --- /dev/null +++ b/tooling/nargo_fmt/tests/input/nested_parens.nr @@ -0,0 +1,5 @@ +//@remove_nested_parens=false +fn main() { + ((())); + ((((((((())))))))); +} diff --git a/tooling/nargo_fmt/tests/input/unary_operators.nr b/tooling/nargo_fmt/tests/input/unary_operators.nr index e6d42456ef2..4324b8045cc 100644 --- a/tooling/nargo_fmt/tests/input/unary_operators.nr +++ b/tooling/nargo_fmt/tests/input/unary_operators.nr @@ -1,3 +1,4 @@ +//@error_on_lost_comment=false fn main() { -1; -/*test*/1; diff --git a/tooling/nargo_toml/Cargo.toml b/tooling/nargo_toml/Cargo.toml index d3767a0b038..c835ddd936c 100644 --- a/tooling/nargo_toml/Cargo.toml +++ b/tooling/nargo_toml/Cargo.toml @@ -17,5 +17,6 @@ serde.workspace = true thiserror.workspace = true toml.workspace = true url.workspace = true +semver = "1.0.20" [dev-dependencies] diff --git a/tooling/nargo_toml/src/errors.rs b/tooling/nargo_toml/src/errors.rs index 9abeab97b61..fdbdc317bf9 100644 --- a/tooling/nargo_toml/src/errors.rs +++ b/tooling/nargo_toml/src/errors.rs @@ -4,7 +4,8 @@ use nargo::package::PackageType; use noirc_frontend::graph::CrateName; use thiserror::Error; -/// Errors covering situations where a package is either missing or malformed. +/// Errors covering situations where a package is either missing, malformed or does not pass semver +/// validation checks. #[derive(Debug, Error)] pub enum ManifestError { /// Package doesn't have a manifest file @@ -65,4 +66,19 @@ pub enum ManifestError { #[error("No common ancestor between {root} and {current}")] NoCommonAncestor { root: PathBuf, current: PathBuf }, + + #[error(transparent)] + SemverError(SemverError), +} + +#[derive(Error, Debug, PartialEq, Eq, Clone)] +pub enum SemverError { + #[error("Incompatible compiler version in package {package_name}. Required compiler version is {required_compiler_version} but the compiler version is {compiler_version_found}.\n Update the compiler_version field in Nargo.toml to >={compiler_version_found} or compile this project with version {compiler_version_found}")] + IncompatibleVersion { + package_name: CrateName, + required_compiler_version: String, + compiler_version_found: String, + }, + #[error("Could not parse the required compiler version for package {package_name} in Nargo.toml. Error: {error}")] + CouldNotParseRequiredVersion { package_name: String, error: String }, } diff --git a/tooling/nargo_toml/src/lib.rs b/tooling/nargo_toml/src/lib.rs index 5d12c09a81e..223ed2da081 100644 --- a/tooling/nargo_toml/src/lib.rs +++ b/tooling/nargo_toml/src/lib.rs @@ -18,6 +18,7 @@ use serde::Deserialize; mod errors; mod git; +mod semver; pub use errors::ManifestError; use git::clone_git_repo; @@ -163,6 +164,7 @@ impl PackageConfig { }; Ok(Package { + compiler_required_version: self.package.compiler_version.clone(), root_dir: root_dir.to_path_buf(), entry_path, package_type, @@ -228,7 +230,7 @@ struct PackageMetadata { entry: Option, description: Option, authors: Option>, - // If not compiler version is supplied, the latest is used + // If no compiler version is supplied, the latest is used // For now, we state that all packages must be compiled under the same // compiler version. // We also state that ACIR and the compiler will upgrade in lockstep. @@ -391,10 +393,14 @@ pub enum PackageSelection { pub fn resolve_workspace_from_toml( toml_path: &Path, package_selection: PackageSelection, + current_compiler_version: Option, ) -> Result { let nargo_toml = read_toml(toml_path)?; - - toml_to_workspace(nargo_toml, package_selection) + let workspace = toml_to_workspace(nargo_toml, package_selection)?; + if let Some(current_compiler_version) = current_compiler_version { + semver::semver_check_workspace(workspace.clone(), current_compiler_version)?; + } + Ok(workspace) } #[test] @@ -404,7 +410,7 @@ fn parse_standard_toml() { [package] name = "test" authors = ["kev", "foo"] - compiler_version = "0.1" + compiler_version = "*" [dependencies] rand = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} @@ -422,7 +428,7 @@ fn parse_package_toml_no_deps() { [package] name = "test" authors = ["kev", "foo"] - compiler_version = "0.1" + compiler_version = "*" "#; assert!(Config::try_from(String::from(src)).is_ok()); diff --git a/tooling/nargo_toml/src/semver.rs b/tooling/nargo_toml/src/semver.rs new file mode 100644 index 00000000000..8ee80858f31 --- /dev/null +++ b/tooling/nargo_toml/src/semver.rs @@ -0,0 +1,196 @@ +use crate::{errors::SemverError, ManifestError}; +use nargo::{ + package::{Dependency, Package}, + workspace::Workspace, +}; +use semver::{Version, VersionReq}; + +// Check that all of the packages in the workspace are compatible with the current compiler version +pub(crate) fn semver_check_workspace( + workspace: Workspace, + current_compiler_version: String, +) -> Result<(), ManifestError> { + let version = Version::parse(¤t_compiler_version) + .expect("The compiler version is not a valid semver version"); + for package in &workspace.members { + semver_check_package(package, &version).map_err(ManifestError::SemverError)?; + } + + Ok(()) +} + +// Check that a package and all of its dependencies are compatible with the current compiler version +pub(crate) fn semver_check_package( + package: &Package, + compiler_version: &Version, +) -> Result<(), SemverError> { + // Check that this package's compiler version requirements are satisfied + if let Some(version) = &package.compiler_required_version { + let version_req = match VersionReq::parse(version) { + Ok(version_req) => version_req, + Err(err) => { + return Err(SemverError::CouldNotParseRequiredVersion { + package_name: package.name.clone().into(), + error: err.to_string(), + }) + } + }; + if !version_req.matches(compiler_version) { + return Err(SemverError::IncompatibleVersion { + package_name: package.name.clone(), + required_compiler_version: version.clone(), + compiler_version_found: strip_build_meta_data(compiler_version), + }); + }; + } + + // Check that all of this package's dependencies' compiler version requirements are satisfied + for dep in package.dependencies.values() { + match dep { + Dependency::Local { package } | Dependency::Remote { package } => { + semver_check_package(package, compiler_version)?; + } + } + } + + Ok(()) +} + +// Strip the build meta data from the version string since it is ignored by semver. +fn strip_build_meta_data(version: &Version) -> String { + let version_string = version.to_string(); + let mut split = version_string.split('+'); + split.next().expect("split was called on an empty string").to_string() +} + +#[cfg(test)] +mod tests { + use std::{collections::BTreeMap, path::PathBuf, str::FromStr}; + + use nargo::package::PackageType; + use noirc_frontend::graph::CrateName; + + use super::*; + + #[test] + fn test_semver_check_smoke() { + let compiler_version = Version::parse("0.1.0").unwrap(); + + let mut package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0 and required version from the package is 0.1.0\n error: {err:?}") + }; + + package.compiler_required_version = Some("0.2.0".to_string()); + let got_err = match semver_check_package(&package, &compiler_version) { + Ok(_) => panic!("semver check should have failed. compiler version is 0.1.0 and required version from the package is 0.2.0"), + Err(err) => err, + }; + + let expected_version_error = SemverError::IncompatibleVersion { + package_name: CrateName::from_str("test").unwrap(), + required_compiler_version: "0.2.0".to_string(), + compiler_version_found: "0.1.0".to_string(), + }; + assert_eq!(got_err, expected_version_error); + } + + #[test] + fn test_semver_dependency_check_smoke() { + let compiler_version = Version::parse("0.1.0").unwrap(); + + let mut package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + let valid_dependency = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("good_dependency").unwrap(), + dependencies: BTreeMap::new(), + }; + let invalid_dependency = Package { + compiler_required_version: Some("0.2.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("bad_dependency").unwrap(), + dependencies: BTreeMap::new(), + }; + + package.dependencies.insert( + CrateName::from_str("test_dep_valid").unwrap(), + Dependency::Local { package: valid_dependency.clone() }, + ); + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0 and required version from the package is 0.1.0\n error: {err:?}") + }; + + package.dependencies.insert( + CrateName::from_str("test_dep_invalid").unwrap(), + Dependency::Local { package: invalid_dependency.clone() }, + ); + let got_err = match semver_check_package(&package,&compiler_version) { + Ok(_) => panic!("semver check should have failed. compiler version is 0.1.0 and required version from the package is 0.2.0"), + Err(err) => err, + }; + + let expected_version_error = SemverError::IncompatibleVersion { + package_name: CrateName::from_str("bad_dependency").unwrap(), + required_compiler_version: "0.2.0".to_string(), + compiler_version_found: "0.1.0".to_string(), + }; + assert_eq!(got_err, expected_version_error.into()); + } + + #[test] + fn test_semver_carrot() { + let compiler_version = Version::parse("0.2.0").unwrap(); + + let package = Package { + compiler_required_version: Some(">=0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.2.0 and required version from the package is >=0.1.0\n error: {err:?}") + }; + } + + #[test] + fn test_semver_build_data() { + let compiler_version = Version::parse("0.1.0+this-is-ignored-by-semver").unwrap(); + + let package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0+build_data and required version from the package is 0.1.0\n The build data should be ignored\n error: {err:?}") + }; + } +} diff --git a/tooling/noir_js/src/program.ts b/tooling/noir_js/src/program.ts index bf48e15fcad..cfd7a715dfe 100644 --- a/tooling/noir_js/src/program.ts +++ b/tooling/noir_js/src/program.ts @@ -2,7 +2,7 @@ import { Backend, CompiledCircuit, ProofData } from '@noir-lang/types'; import { generateWitness } from './witness_generation.js'; import initAbi, { abiDecode, InputMap, InputValue } from '@noir-lang/noirc_abi'; -import initACVM, { compressWitness } from '@noir-lang/acvm_js'; +import initACVM, { compressWitness, ForeignCallHandler } from '@noir-lang/acvm_js'; export class Noir { constructor( @@ -29,9 +29,12 @@ export class Noir { } // Initial inputs to your program - async execute(inputs: InputMap): Promise<{ witness: Uint8Array; returnValue: InputValue }> { + async execute( + inputs: InputMap, + foreignCallHandler?: ForeignCallHandler, + ): Promise<{ witness: Uint8Array; returnValue: InputValue }> { await this.init(); - const witness = await generateWitness(this.circuit, inputs); + const witness = await generateWitness(this.circuit, inputs, foreignCallHandler); const { return_value: returnValue } = abiDecode(this.circuit.abi, witness); return { witness: compressWitness(witness), returnValue }; } diff --git a/tooling/noir_js/src/witness_generation.ts b/tooling/noir_js/src/witness_generation.ts index f96cddb0eca..e3ddb1a2a21 100644 --- a/tooling/noir_js/src/witness_generation.ts +++ b/tooling/noir_js/src/witness_generation.ts @@ -1,19 +1,25 @@ import { abiEncode, InputMap } from '@noir-lang/noirc_abi'; import { base64Decode } from './base64_decode.js'; -import { executeCircuit, WitnessMap } from '@noir-lang/acvm_js'; +import { executeCircuit, WitnessMap, ForeignCallHandler, ForeignCallInput } from '@noir-lang/acvm_js'; import { CompiledCircuit } from '@noir-lang/types'; +const defaultForeignCallHandler: ForeignCallHandler = (name: string, args: ForeignCallInput[]) => { + throw Error(`Unexpected oracle during execution: ${name}(${args.join(', ')})`); +}; + // Generates the witnesses needed to feed into the chosen proving system -export async function generateWitness(compiledProgram: CompiledCircuit, inputs: InputMap): Promise { +export async function generateWitness( + compiledProgram: CompiledCircuit, + inputs: InputMap, + foreignCallHandler: ForeignCallHandler = defaultForeignCallHandler, +): Promise { // Throws on ABI encoding error const witnessMap = abiEncode(compiledProgram.abi, inputs); // Execute the circuit to generate the rest of the witnesses and serialize // them into a Uint8Array. try { - const solvedWitness = await executeCircuit(base64Decode(compiledProgram.bytecode), witnessMap, () => { - throw Error('unexpected oracle during execution'); - }); + const solvedWitness = await executeCircuit(base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler); return solvedWitness; } catch (err) { throw new Error(`Circuit execution failed: ${err}`); diff --git a/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml b/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml index 742f100681f..f32ec18cae7 100644 --- a/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml +++ b/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml @@ -2,6 +2,4 @@ name = "assert_lt" type = "bin" authors = [""] -compiler_version = "0.1" - [dependencies] diff --git a/tooling/noirc_abi_wasm/Cargo.toml b/tooling/noirc_abi_wasm/Cargo.toml index 130f022dd1f..c78c3ead0c3 100644 --- a/tooling/noirc_abi_wasm/Cargo.toml +++ b/tooling/noirc_abi_wasm/Cargo.toml @@ -18,17 +18,16 @@ iter-extended.workspace = true wasm-bindgen.workspace = true serde.workspace = true js-sys.workspace = true - -console_error_panic_hook = "0.1.7" -gloo-utils = { version = "0.1", features = ["serde"] } +console_error_panic_hook.workspace = true +gloo-utils.workspace = true # This is an unused dependency, we are adding it # so that we can enable the js feature in getrandom. -getrandom = { version = "*", features = ["js"] } +getrandom = { workspace = true, features = ["js"] } [build-dependencies] -build-data = "0.1.3" +build-data.workspace = true [dev-dependencies] -wasm-bindgen-test = "0.3.36" +wasm-bindgen-test.workspace = true