diff --git a/.github/workflows/pull-noir.yml b/.github/workflows/pull-noir.yml index 1b56629ad53c..1248328c4c87 100644 --- a/.github/workflows/pull-noir.yml +++ b/.github/workflows/pull-noir.yml @@ -99,6 +99,11 @@ jobs: # We don't really need the sync commit on our side, and don't need .gitrepo at all except just in time for the command. git checkout origin/master -- noir/noir-repo/.aztec-sync-commit noir/noir-repo/.gitrepo git commit -am "[$LINES changes] $COMMIT_MESSAGE" + + # There's various changes which we need to make to account for CI differences so we run this script to apply them. + noir/scripts/sync-fixup.sh + git commit -am "chore: apply sync fixes" + git push origin $STAGING_BRANCH --force else echo "Problems syncing noir. Needs manual attention, might be a merge conflict." diff --git a/noir/README.md b/noir/README.md index 4a4eb2616639..c604644e712c 100644 --- a/noir/README.md +++ b/noir/README.md @@ -13,21 +13,8 @@ Syncing from aztec-packages into noir currently attempts to revert any changes i To start the sync run [this action](https://github.com/AztecProtocol/aztec-packages/actions/workflows/pull-noir.yml) manually (click the "Run Workflow" button in the top right). aztec-bot will then open a new PR which does the initial sync, this will have merge conflicts with master which will need to be resolved. -Most of these will be due to simultaneous development in the two repositories but there are a few cases which are due to the sync process: -1. Replace the dependency on `@aztec/bb.js` in `noir-lang/noir_js_backend_barretenberg` to use the version built in this repository: - a. To do this, search for instances of `"@aztec/bb.js":` within package.json files and replacing the versions with `"portal:../../../../barretenberg/ts"` (number of directories to go up by may vary) -2. Run `yarn install` in `noir/noir-repo` in order to update `yarn.lock`. -3. Run a search and replace on `require_command wasm-opt` to `#require_command wasm-opt` - -We need to do this as `noir-lang/noir` uses a fixed version of barretenberg but in aztec-packages we test against the version of barretenberg built from the same commit. - ## Syncing from aztec-packages to Noir. When syncing from aztec-packages to Noir it's important to check that the latest release of `bb` uses the same ACIR serialization format as the current master commit. This is because Noir uses a released version of barretenberg rather than being developed in sync with it, it's then not possible to sync if there's been serialization changes since the last release. To start the sync run [this action](https://github.com/AztecProtocol/aztec-packages/actions/workflows/mirror-noir-subrepo.yml) manually (click the "Run Workflow" button in the top right). aztec-bot will then open a new PR in the `noir-lang/noir` repository which does the initial sync, this will have merge conflicts with master which will need to be resolved. - -Most of these will be due to simultaneous development in the two repositories but there are a few cases which are due to the sync process: -1. Replace the dependency on `@aztec/bb.js` in `noir-lang/noir_js_backend_barretenberg` to use the latest `aztec-packages` release version -2. Run `yarn install` in order to update `yarn.lock`. -3. Run a search and replace on `#require_command wasm-opt` to `require_command wasm-opt` \ No newline at end of file diff --git a/noir/noir-repo/acvm-repo/acvm_js/build.sh b/noir/noir-repo/acvm-repo/acvm_js/build.sh index ee93413ab85a..c07d2d8a4c1d 100755 --- a/noir/noir-repo/acvm-repo/acvm_js/build.sh +++ b/noir/noir-repo/acvm-repo/acvm_js/build.sh @@ -25,7 +25,7 @@ function run_if_available { require_command jq require_command cargo require_command wasm-bindgen -# require_command wasm-opt +#require_command wasm-opt self_path=$(dirname "$(readlink -f "$0")") pname=$(cargo read-manifest | jq -r '.name') diff --git a/noir/scripts/sync-fixup.sh b/noir/scripts/sync-fixup.sh new file mode 100755 index 000000000000..50d14c228cb9 --- /dev/null +++ b/noir/scripts/sync-fixup.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eu + +cd $(dirname $0)/../noir-repo + +tmp=$(mktemp) +BACKEND_BARRETENBERG_PACKAGE_JSON=./tooling/noir_js_backend_barretenberg/package.json +jq '.dependencies."@aztec/bb.js" = "portal:../../../../barretenberg/ts"' $BACKEND_BARRETENBERG_PACKAGE_JSON > $tmp && mv $tmp $BACKEND_BARRETENBERG_PACKAGE_JSON + +# update yarn.lock +yarn install + +# Remove requirement for `wasm-opt` to be installed +sed -i "s/^require_command wasm-opt/#require_command wasm-opt/" ./tooling/noirc_abi_wasm/build.sh +sed -i "s/^require_command wasm-opt/#require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh