Skip to content

Commit

Permalink
chore!: Update to acvm-backend-barretenberg v0.12.0 (#2377)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom French <tom@tomfren.ch>
  • Loading branch information
kevaundray and TomAFrench authored Aug 31, 2023
1 parent 336396b commit 1467275
Show file tree
Hide file tree
Showing 24 changed files with 270 additions and 665 deletions.
143 changes: 2 additions & 141 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,7 @@ permissions:
contents: write

jobs:
build-barretenberg:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- name: Collect locked barretenberg rev
run: |
echo "BB_REV=$(jq -r .nodes.barretenberg.locked.rev ./flake.lock)" >> $GITHUB_ENV
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/cachix-action@v12
with:
name: barretenberg

# Upload does not work with symlinks, using this workaround:
# https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032
- name: Build barretenberg as libbarretenberg-wasm32
run: |
nix build "github:AztecProtocol/barretenberg/${{ env.BB_REV }}#wasm32"
echo "ARTIFACT_UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ env.ARTIFACT_UPLOAD_PATH }}
retention-days: 3

build-apple-darwin:
needs: [build-barretenberg]
runs-on: macos-latest
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
Expand Down Expand Up @@ -94,22 +58,14 @@ jobs:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ github.workspace }}/libbarretenberg-wasm32

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

- name: Build environment and Compile
env:
BARRETENBERG_BIN_DIR: ${{ github.workspace }}/libbarretenberg-wasm32/bin
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "plonk_bn254_wasm ${{ inputs.features }}"
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.
Expand Down Expand Up @@ -152,7 +108,6 @@ jobs:
tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch)

build-linux:
needs: [build-barretenberg]
runs-on: ubuntu-22.04
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
Expand All @@ -169,8 +124,6 @@ jobs:
[
x86_64-unknown-linux-gnu,
x86_64-unknown-linux-musl,
aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
]

steps:
Expand All @@ -185,23 +138,15 @@ jobs:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ github.workspace }}/libbarretenberg-wasm32

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

- name: Build Nargo
env:
BARRETENBERG_BIN_DIR: ${{ github.workspace }}/libbarretenberg-wasm32/bin
run: |
cargo install cross --version 0.2.5 --force
cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "plonk_bn254_wasm ${{ inputs.features }}"
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.
Expand Down Expand Up @@ -242,87 +187,3 @@ jobs:
asset_name: nargo-${{ matrix.target }}.tar.gz
overwrite: true
tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch)

build-windows:
needs: [build-barretenberg]
runs-on: windows-2022
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-pc-windows-msvc]

steps:
- name: Checkout
uses: actions/checkout@v3
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: Download artifact
uses: actions/download-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ github.workspace }}/libbarretenberg-wasm32

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

- name: Build environment and Compile
env:
BARRETENBERG_BIN_DIR: ${{ github.workspace }}/libbarretenberg-wasm32/bin
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "plonk_bn254_wasm ${{ 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
cp ./target/${{ matrix.target }}/release/nargo.exe ./dist/nargo.exe
7z a -tzip nargo-${{ matrix.target }}.zip ./dist/*
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nargo-${{ matrix.target }}
path: ./dist/*
retention-days: 3

- name: Test built artifact
shell: powershell
run: |
cp ./target/${{ matrix.target }}/release/nargo.exe ~/.cargo/bin/
cd release-tests
yarn install
yarn test
- name: Upload binaries to release tag
uses: svenstaro/upload-release-action@v2
if: ${{ inputs.publish || github.event_name == 'schedule' }}
with:
repo_name: noir-lang/noir
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./nargo-${{ matrix.target }}.zip
asset_name: nargo-${{ matrix.target }}.zip
overwrite: true
tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch)
45 changes: 15 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,43 @@ jobs:
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATH: /tmp/nix-cache
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu
runner: ubuntu-latest
target: x86_64-linux
target: x86_64-unknown-linux-gnu

steps:
- name: Checkout
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-22.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/cachix-action@v12
with:
name: barretenberg

- name: Restore nix store cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATH }}
path: ${{ env.CACHED_PATHS }}
key: ${{ runner.os }}-flake-${{ 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
- name: Run `nix flake check`
run: |
nix flake check -L
- name: Setup toolchain
uses: dtolnay/rust-toolchain@1.66.0
with:
targets: ${{ matrix.target }}

- name: Export cache from nix store
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
run: |
nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd&parallel-compression=true" .#native-cargo-artifacts
- 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_PATH }}
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
49 changes: 1 addition & 48 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,7 @@ concurrency:
cancel-in-progress: true

jobs:
# TODO: Replace this step with downloading a wasm binary from a set release of Barretenberg
build-barretenberg:
runs-on: ubuntu-latest
steps:
- name: Checkout Noir repo
uses: actions/checkout@v3

- name: Collect locked barretenberg rev
run: |
echo "BB_REV=$(jq -r .nodes.barretenberg.locked.rev ./flake.lock)" >> $GITHUB_ENV
echo "BB_REV is ${{ env.BB_REV }}"
- uses: cachix/install-nix-action@v20
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 }}"

# Upload does not work with symlinks, using this workaround:
# https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032
- name: Build barretenberg as libbarretenberg-wasm32
run: |
echo "BB_REV is ${{ env.BB_REV }}"
nix build "github:AztecProtocol/barretenberg/${{ env.BB_REV }}#wasm32"
echo "ARTIFACT_UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ env.ARTIFACT_UPLOAD_PATH }}
retention-days: 3

build-nargo:
needs: [build-barretenberg]
runs-on: ubuntu-22.04
env:
CACHED_PATHS: |
Expand All @@ -67,20 +29,11 @@ jobs:
path: ${{ env.CACHED_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: libbarretenberg-wasm32
path: ${{ github.workspace }}/libbarretenberg-wasm32

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

- name: Build Nargo
env:
BARRETENBERG_BIN_DIR: ${{ github.workspace }}/libbarretenberg-wasm32/bin
run: |
cargo build --package nargo_cli --release --no-default-features --features plonk_bn254_wasm
run: cargo build --package nargo_cli --release

- uses: actions/cache/save@v3
# Don't create cache entries for the merge queue.
Expand Down
Loading

0 comments on commit 1467275

Please sign in to comment.