Skip to content

Commit

Permalink
Merge branch 'master' into constant-brillig-execution
Browse files Browse the repository at this point in the history
* master:
  feat: Optimize equality checks between a boolean and constant (#2201)
  feat: Issue warning for signed integers (#2185)
  chore: Add `noir_wasm` testing workflow (#1921)
  • Loading branch information
TomAFrench committed Aug 7, 2023
2 parents 06a55c6 + 478c026 commit e6ee884
Show file tree
Hide file tree
Showing 37 changed files with 4,046 additions and 26 deletions.
137 changes: 135 additions & 2 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,90 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Build Wasm
# 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

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

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
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
- name: Package artifacts
run: |
mkdir dist
cp ./target/release/nargo ./dist/nargo
7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nargo
path: ./dist/*
retention-days: 3

build-wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -25,3 +107,54 @@ jobs:
- name: Build wasm package
run: |
nix build -L .#wasm
- name: Dereference symlink
run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: noir_wasm
path: ${{ env.UPLOAD_PATH }}
retention-days: 3

test:
needs: [build-wasm, build-nargo]
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout noir-lang/noir
uses: actions/checkout@v3

- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noir_wasm
path: ./crates/wasm/dist

- name: Download nargo binary
uses: actions/download-artifact@v3
with:
name: nargo
path: ./nargo

- name: Compile test program with Nargo CLI
working-directory: ./crates/wasm/noir-script
run: |
nargo_binary=${{ github.workspace }}/nargo/nargo
chmod +x $nargo_binary
$nargo_binary compile
- name: Install dependencies
working-directory: ./crates/wasm
run: yarn install

- name: Install playwright deps
working-directory: ./crates/wasm
run: |
npx playwright install
npx playwright install-deps
- name: Run tests
working-directory: ./crates/wasm
run: yarn test:browser

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"}],"param_witnesses":{"x":[1]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/81SWwoDIQyMj+5nz5L4WONfr1Kpe/8jtLB+pLJ/jdABiUSYzGS8AcAGJ8zn2FENfMOO+hg14p5SL6FTpCeG2jhjym1nYsqcX4Fj7Jy41FYLVkqx05FrPPCEUeSyggt/A7kL7yB6WnMUNaPU68TdT9nJ922BJ5jmzHu8X/RUh68IyS3g9aD3+Vf59voZoaD8652aSaPEG568Nu0xBQAA","proving_key":null,"verification_key":null}
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"}],"param_witnesses":{"x":[1]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/6WOwQ3AMAgDQyaCAAn8ukqjkv1H6KNUivrtSZbtj+VaSqnlATJDauftRzr+g2DbYuwiMVoQ04nNpymKzm5kpKZXM+YwseHTBzoJBy11XjkGn487N8yEX77gAAAA","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1W2wqDMAyN98nE/UprW23f9iuT6f9/wja0kIkvw9OhYEBS83CSnJOW1ER0o8mi9xfPPmL/PkbM32evRKv10DWDVPIhGtdbI7TpWyutNNY8G6vUYLXtXO864aRWgxyNU6OYzOdIFrhim8kIiBUD+03AWF4PbhGYywSHJXi96co5ZjE/E3mAnmiRZ8ljvRKDJg8hUhoANyPcwIbqO8NrJBjk4Tg9H+Xf+s3Bc3MQPZq96nE9gB55ANyKwrxfCbjOAjg3QK1lBezxX8sVkMuv5erCzudytRGzmAlF45a07+Xq03eJ1yjocoXkNGY18svj7QUuV6DaPg8AAA==","proving_key":null,"verification_key":null}
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":1},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+WU0QrDIAxFY6X9nsQkNXnbr0xm//8TNmgFGXurg5UdkIs+XGOuZAGABXbCa02Hhm7fzqDT26GMq0jNqRLTHZMXUxQtq5GRmj6SMVcTy148o5NwpU2dN9zp7+h98RwUBnpNA9/7zR7GP+lhHFfXlfJIv5rHfIE84gdfPAfNA2ts86/9nXeejHS7tqgFAAA=","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[],"param_witnesses":{},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+2Uy27CMBBFB5JCobwKhUKh9BecFzi7/kpRw/9/QmXVixHF3cy1ZEvOJiMWlzN3ovNBRCX9fXr2/WnflTrVdXcuu6IqvlTZXnSj6uZy0oUuGt18l7qqOl3rc3tpz6ot6qorrk1bXdXv02NZSvhkjO8/ZiV7CiQz5+2zOb/zW2bfAw870c3/3PY4u/Mb9M99HKnvITcj3Mfva+8MfyPFIoPv1MUpzc4pPlkhmTnvA5uTrISZuS0UnTugsGWV2w8EfCOvskJ36uKUZg8pPlkhmTnvI5uTrISZQ1soOndEYcvK7D3C38irrNCdujil2WOKT1ZIZs77xOYkK2Hm2BaKzp1Q2LIye0/wN/IqK3SnLk5p9pTikxWSmfPO2JxkJcyc3kCjcucUtqzM3nP8jbzKCt2pi1OavaD4ZIVk5rzPbE6yEmYubKHo3CWFLSuz9xJ/I6+yQnfq4pRmryg+WSGZOe8Lm5OshJkrWyg6d01hy8rsvcbfyKus0J26OKXZG4pPVkhmzvvK5iQrYebGForO3VLYsjJ7b/E38iordKcuTmn2juKTFZKZ876xOclKmLmzhaJz9xS2rMzee/yNvMoK3amLU5p9oPhkhWTmvO9sTrISZh5soejcI4UtK7P3EX8jr7JCd3rv+QEAi3N45i4AAA==","proving_key":null,"verification_key":null}
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[],"param_witnesses":{},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+2Uy27CMBBFB5JCobwKhdI/6NLOgzi7/kqjhv//hCqqF6M0ZjPXki3Zm1hZ3Jy5E50PIvqk/2dmn1/2WapbVfVN0etSf6ui7Uytqrq7GW10beqfwpRlbyrTtF3bqFZXZa/vdVve1d+ZsSwlPBnje8SsZEcjmTnvnN3ziXeZfS48zESj74x73E28g37cx5LmHnIzwv38vubO8DtSLDL4Tl2c0uyc4pMVkpnzPrF7kpUwM7eFonMXFLascvuDgHfkVVboTl2c0uwlxScrJDPnfWb3JCth5tIWis5dUdiyGuZe4XfkVVboTl2c0uw1xScrJDPnfWH3JCth5toWis7dUNiyGube4HfkVVboTl2c0uwtxScrJDPn3bF7kpUwczuCRuXuKWxZDXPv8TvyKit0py5OafaB4pMVkpnzvrJ7kpUw82ALReceKWxZDXMf8TvyKit0py5OafaJ4pMVkpnzvrF7kpUw82QLReeeKWxZDXOf8TvyKit0py5OafaF4pMVkpnzvrN7kpUw82ILRedeKWxZDXNf8TvyKit0p1PnF6lyuYaMJQAA","proving_key":null,"verification_key":null}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1XWW6DMBAdzBaW0p8exMYQzF+vUlS4/wWqVjRjdaBupYgxChIjIVsOeX6ezbxnAHiBm4X4rC3A8RVHuc1UwIclHXS5sGuP2EoQTOvziKxlOAp8ZktIPOh/PuF3rAIyF/hO+M87wR84mYNnRbgAn09kAuy5JiuCyU34O5EFOuYDNxIYlPWmoYe9LZaW16YZu3pUWr3Juh9MK5t2uBplVGva99poPZrGdP3Qd7JXjR7V1PZ6nG4WMmBNSCziO6MMXcHjTxLFyZnyjcm8wDGDn4K2dpRiiglX2hjseWxjiJjjQxuebVrRau+MrIUOX9vfUvDYEMDhFIu9tbBiRqwEjleknJwp35TM10k1m00mDwW1yBeXH73eXr6ClHrAvQBf8vs694U/RovP20f26V7SQYAf3zLHbTfpYG/h3LF2Sodttot0mJ1EpUMO/qUDLaKt0iEDviaSw/G+Sjg5U76FY35Kh7vtlA6zFYxYJeOZ9ypSRs6LIn0i81M6bMQs0aHcuBU8tnQoMVjMMfIqHTh9KgjH9e022xc2nM0FohgAAA==","proving_key":null,"verification_key":null}
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1VW27EIAx0II9FrfYsEGADf71Ko5L7X6Bqla5RLUr70TgrZbUjRSCSDIONPQoAnuEKiU+JBscXHPU2mIaPS1fkcnGPO3IbQThzzFuypnAU+KzoST7oPx/wM1cNmQv8Rv7xTfMLj6roPBMtwBcT3QP7XdNnwskt+OsiCwzMO24kMCnlpnKHvTOX1Rfn0jQmY82rHuMcvHZ+vgQTjA/+bQzWpuDCFOc46WicTWbx0ablCsnAtaCwlu+MWtaSx39JDKdmqrcj8yccFXwXdMZRiqkjWmljyOfJjaFlzg9teLlptcXeiqzJSqzzuwF2bAiUswz+1sLqgLewbuH0glFzRe7hnD4Xz0DWHk7Pw3kTp1+FU6evdRNup6dFtNXpe+BrSAMcz+k5NVO9JzJ/OP2/cR9Or7fBnICvSAXRWF7GFZ+KOUARABAAAA==","proving_key":null,"verification_key":null}
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/+1USxLCIAxNf9huPAvhU8LOq8hI738ERwcdrOwaHBZmkwyLl7yX8BYAWOA7hpQvKctjgV2GpeVqTHQqosarVD6QlcaGlZDQkr0p0jqSIeeDd9Kj0RE36/WWwHpGrIGP4xOrK2jZMWvJOXM+71io+8JNiAqcYNdnr+O58MbavMaSxgq4E/Adfy3eE/+OZAb5PsoWNRXAa06/MBQBdQzllNV/QzmIKZKg3LgztG0oD94z/44+DKVlTftsxvzzvOIOhKdrBcIJAAA=","proving_key":null,"verification_key":null}
{"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/81TMQ7DIAw0JGTsW2wMwWz9SlHJ/59QqaISStlipNxixHC+O9sbADj4x9Lqs1W8BjIdF+MeQk2+EtMLfS4SMcSyCwlFiW8vzFWCpFxywkyBKx0x89HIrCLXoufxy2UGWRrlLDU193rXwdsOdmKb4AlOfc45PgZ/qs1nDGmdwOtAb/ln+Xb6M8KO8taZ2k5jfzw/fADLYG+4cQUAAA==","proving_key":null,"verification_key":null}
Binary file not shown.
Loading

0 comments on commit e6ee884

Please sign in to comment.