Skip to content

Commit

Permalink
Merge branch 'master' into tf/explicit-package-type-handling
Browse files Browse the repository at this point in the history
* master:
  chore: fix npm token for abi_wasm publishing (#2633)
  chore(ci): switch to using `Swatinem/rust-cache` action (#2671)
  feat: compile circuits and query circuit sizes in parallel for `nargo info` (#2665)
  chore(ci): use mock backend for all tests (#2670)
  chore!: Restrict packages to contain at most a single contract (#2668)
  chore: Embed a file map into `CompiledProgram`/`CompiledContract` (#2666)
  feat: Compile workspace packages in parallel (#2612)
  fix(wasm): Avoid requesting stdlib paths from the source-resolver (#2650)
  chore: add abi_wasm to release-please (#2664)
  chore: refactor `execute_cmd` (#2656)
  chore: defer reporting of errors until after compilation and optimization is finished (#2659)
  fix: fix compilation using `aztec` feature flag (#2663)
  fix: remove duplicate file extension in stack trace (#2655)
  chore: use `DebugArtifact`s instead of `FileManager` to report errors (#2641)
  chore: Fix clippy warnings for rust version 1.67.0 (#2661)
  fix(wasm): Apply transformation map to circuit debug information in `noir_wasm` (#2635)
  fix: Fix `update_acir` deleting all debug information (#2643)
  • Loading branch information
TomAFrench committed Sep 13, 2023
2 parents c017d1f + 8e93a5f commit 85cdda6
Show file tree
Hide file tree
Showing 58 changed files with 514 additions and 480 deletions.
27 changes: 6 additions & 21 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
name: cargo clippy
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/

strategy:
fail-fast: false
Expand All @@ -36,29 +29,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Restore cargo cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable # We do not use MSRV so we can benefit from newer lints
targets: ${{ matrix.target }}
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Run `cargo clippy`
run: cargo clippy --workspace --locked --release

- name: Run `cargo fmt`
run: cargo fmt --all --check

- uses: actions/cache/save@v3
# Write a cache entry even if the tests fail but don't create any for the merge queue.
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Release ABI Wasm
name: Publish ABI Wasm

on:
push:
tags:
- "*"
workflow_dispatch:

jobs:
Expand All @@ -13,7 +16,13 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v20
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: "https://registry.npmjs.org"
node-version: 18.15

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-23.05
github_access_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
50 changes: 12 additions & 38 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
runs-on: macos-latest
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
Expand All @@ -52,28 +46,21 @@ jobs:
echo "SDKROOT=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV
- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build environment and Compile
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"
- 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_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down Expand Up @@ -111,12 +98,6 @@ jobs:
runs-on: ubuntu-22.04
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
fail-fast: false
matrix:
Expand All @@ -128,17 +109,17 @@ jobs:
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Install Cross
uses: taiki-e/install-action@v2
with:
Expand All @@ -147,13 +128,6 @@ jobs:
- name: Build Nargo
run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"

- 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_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *" # Run nightly at 2 AM UTC

jobs:
wasm-packages-build-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -100,8 +100,8 @@ jobs:
working-directory: ./compiler/integration-tests
run: |
yarn test:browser
- name: Alert on nightly test failure
- name: Alert on nightly test failure
uses: JasonEtco/create-an-issue@v2
if: ${{ failure() && github.event_name == 'schedule' }}
env:
Expand All @@ -110,4 +110,4 @@ jobs:
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
update_existing: true
filename: .github/NIGHTLY_TEST_FAILURE.md
filename: .github/NIGHTLY_TEST_FAILURE.md
27 changes: 6 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/

strategy:
fail-fast: false
Expand All @@ -37,24 +30,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Restore nix store cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Run tests
run: cargo test --workspace --locked --release

- uses: actions/cache/save@v3
# Write a cache entry even if the tests fail but don't create any for the merge queue.
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
26 changes: 6 additions & 20 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ concurrency:
jobs:
build-nargo:
runs-on: ubuntu-22.04
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
Expand All @@ -29,25 +22,18 @@ jobs:
- name: Checkout Noir repo
uses: actions/checkout@v4

- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build Nargo
run: cargo build --package nargo_cli --release

- 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_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"mkhl.direnv",
"jnoortheen.nix-ide",
"rust-lang.rust-analyzer",
"redhat.vscode-yaml"
"redhat.vscode-yaml",
"esbenp.prettier-vscode"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "${workspaceRoot}/.github/workflows/*.yml"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ACIR Supported OPCODES:
- Sha256
- Blake2s
- Schnorr signature verification
- MerkleMembership
- Pedersen
- HashToField

Expand Down
12 changes: 9 additions & 3 deletions compiler/fm/src/file_reader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rust_embed::RustEmbed;
use std::io::Error;
use std::io::{Error, ErrorKind};
use std::path::Path;

// Based on the environment, we either read files using the rust standard library or we
Expand Down Expand Up @@ -34,15 +34,17 @@ cfg_if::cfg_if! {
}

pub(crate) fn read_file_to_string(path_to_file: &Path) -> Result<String, Error> {
use std::io::ErrorKind;

let path_str = path_to_file.to_str().unwrap();
match StdLibAssets::get(path_str) {

Some(std_lib_asset) => {
Ok(std::str::from_utf8(std_lib_asset.data.as_ref()).unwrap().to_string())
},

None if is_stdlib_asset(path_to_file) => {
Err(Error::new(ErrorKind::NotFound, "invalid stdlib path"))
}

None => match read_file(path_str) {
Ok(buffer) => Ok(buffer),
Err(_) => Err(Error::new(ErrorKind::Other, "could not read file using wasm")),
Expand All @@ -60,6 +62,10 @@ cfg_if::cfg_if! {
Ok(std::str::from_utf8(std_lib_asset.data.as_ref()).unwrap().to_string())
},

None if is_stdlib_asset(path_to_file) => {
Err(Error::new(ErrorKind::NotFound, "invalid stdlib path"))
}

None => std::fs::read_to_string(path_to_file)

}
Expand Down
2 changes: 1 addition & 1 deletion compiler/fm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
mod file_map;
mod file_reader;

pub use file_map::{File, FileId, FileMap};
pub use file_map::{File, FileId, FileMap, PathString};
use file_reader::is_stdlib_asset;

use std::{
Expand Down
Loading

0 comments on commit 85cdda6

Please sign in to comment.