Skip to content

chore: Bump Noir reference#12608

Closed
AztecBot wants to merge 1 commit intonoir-sync-reworkfrom
bump-noir
Closed

chore: Bump Noir reference#12608
AztecBot wants to merge 1 commit intonoir-sync-reworkfrom
bump-noir

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 10, 2025

Automated pull of nightly from the noir programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove unnecessary trait bounds (noir-lang/noir#7635)
feat: add optional oracle resolver url in acvm_cli (noir-lang/noir#7630)
chore: Rename StructDefinition to TypeDefinition (noir-lang/noir#7614)
fix: Error on infinitely recursive types (noir-lang/noir#7579)
fix: update error message to display 128 bits as valid bit size (noir-lang/noir#7626)
chore: update docs to reflect u128 type (noir-lang/noir#7623)
feat: array concat method (noir-lang/noir#7199)
END_COMMIT_OVERRIDE

@aakoshh aakoshh mentioned this pull request Mar 10, 2025
8 tasks
@aakoshh aakoshh closed this Mar 11, 2025
@aakoshh aakoshh deleted the bump-noir branch March 11, 2025 11:12
aakoshh added a commit that referenced this pull request Mar 14, 2025
# Check out Noir during build

Changes the way we sync the code from Noir away from having a
periodically synced copy of the codebase, to checking out the code
during the build based on a tag/branch/commit indicated by a file or env
var.

The following new files were added:
* `noir/noir-repo-ref` contains the reference in Noir that should be
checked out
*
[noir/scripts/sync.sh](https://github.com/AztecProtocol/aztec-packages/blob/noir-sync-rework/noir/scripts/sync.sh)
performs the checkouts; the `init` command does the initial checkout and
the `update` command switches to new branches
* `noir/bootstrap.sh` performs an `init` and `update` before every
command except `clean`

TODO:
- [x] Sync during the build
- [x] Detect the need to switch branches
- [x] Create a patch file from local commits
- [x] Apply the patch file during checkouts 
- [x] Fix patch creation to only include non-empty commits because `git
am` stops at them, and with `git am --allow-empty` it just fails
- [x] Add to the git hooks something to prevent the user from switching
branches without creating and committing a patch file, if there are
commits in `noir-repo`. (Currently an error is returned by `sync.sh` but
if we created a patch file, it should be committed on the aztec-packages
branch we switched away from).\
- [x] Update the daily workflow to update `noir-repo-ref` to the next
release.
- [x] Test the `pull-noir` workflow:
* Action that create the PR:
https://github.com/AztecProtocol/aztec-packages/actions/runs/13768222542
* PR that bumps the ref:
#12608


## Rationale

Currently there is a two-way sync between Noir and aztec-packages, with
automated workflows running daily to push changes between the `master`
branches by opening (or appending to already open) sync PRs. The two-way
sync was required because for example frequent changes in the `bb`
interface were easier to update in this repo and pushed back to Noir,
than to have to wait for a release cycle.

The problem we frequently encounter with the sync from Noir is that some
of the integration tests in aztec-packages break due to subtle changes
in the compiler, which we don't know about until we open the sync PR. At
that point we're looking at a potentially long list of changes (every
commit on `master` since the last sync), and it's not clear which one is
the culprit. We bisect the build to find a failure, fix it in the PR,
but this often just reveals the next bug to be fixed.

This process can take days, and during that time the sync process has to
be paused - if it runs it just makes the PR bigger, with potentially
more bugs. Regardless of whether we pause it or let it append to the PR,
no new features or fixes get merged into aztec-packages until all the
bugs are squashed.

Instead what we wish to achieve here is that we can:
1. Point aztec-packages at an integration/release branch, or nightly
tags to be synced from, and if there is a problem then we can cherry
pick changes from `master` onto the release branch so that the good
stuff can go in.
2. Initiate CI runs against arbitrary branches on Noir, so that we can
test smaller change sets before they are synced to aztec-packages, to
see their effect in isolation.

## Example

The following example shows:
1. Initialising `noir-repo` to a tag
2. Creating a file and commit
3. Trying to switch branch is rejected because the commit is not in the
patch
4. Creating a patch
5. Switching to a branch
6. Creating another commit and adding it to the patch
7. Switching to a commit
8. See both commits are re-applied

```console
% rm -rf noir-repo                                                                                                                                                                                 
% cat noir-repo-ref                                                                                                                                                                                
nightly-2025-03-07
% scripts/sync.sh init                                                                                                                                                                             
Cloning into 'noir-repo'...
...
Note: switching to '37be49fd081f33dc7256d23cee8ccc0719c50a82'.
...
HEAD is now at 37be49fd08 chore!: convert `TraitMethodNotInScope` to error (#7427)
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @algolia/autocomplete-core@npm:1.9.3 doesn't provide @algolia/client-search (pbc410), requested by @algolia/autocomplete-shared
...
➤ YN0000: Done with warnings in 20s 227ms
[detached HEAD 6cee7cd4d6] Noir local fixup commit.
 4 files changed, 8 insertions(+), 9 deletions(-)
[detached HEAD 94cffa4cb1] Noir local patch commit.
% ./scripts/sync.sh info                                                         
Fixup commit:             30d08b921c71edb1c75491e459df6d54917c5e51
Checkout commit:          37be49fd081f33dc7256d23cee8ccc0719c50a82
Wanted:                   nightly-2025-03-07
Needs switch:             no
Needs patch:              no
Detached:                 yes
On branch:                no
Branch name:              n/a
Has wanted tag:           yes
Has tag commit:           yes
Has patch commit:         yes
Last commit is patch:     yes
Has fixup and patch:      yes
% cd noir-repo                                                                                                                                                                                  
% git status                                                                                                                                                                                    
Not currently on any branch.
nothing to commit, working tree clean
% echo "Hello" > hello.txt && git add . && git commit -m "Hello"                                                                                                                                
[detached HEAD 6053b5e04c] Hello
 1 file changed, 1 insertion(+)
 create mode 100644 hello.txt                                                                                                                                                                           
% cd ..                                                                                                                                                                                         
% NOIR_REPO_REF=master scripts/sync.sh update                                                                                                                                                      
noir-repo is on a detached HEAD and the last commit is not the patch marker commit;
switching from nightly-2025-03-07 to master could meand losing those commits.
Please use the 'make-patch' command to create a noir-repo.patch file and commit it in aztec-packages, 
so that it is applied after each checkout; make sure to commit the patch on the branch where it should be.
% scripts/sync.sh make-patch                                                                                                                                                                       
../patches/0001-Noir-local-patch-commit.patch
../patches/0002-Hello.patch
[detached HEAD 28f53e097b] Noir local patch commit.
% NOIR_REPO_REF=master scripts/sync.sh update                                                                                                                                                      
...
From https://github.com/noir-lang/noir
 * branch                  master     -> FETCH_HEAD
Warning: you are leaving 4 commits behind, not connected to
any of your branches:

  28f53e097b Noir local patch commit.
  6053b5e04c Hello
  94cffa4cb1 Noir local patch commit.
  6cee7cd4d6 Noir local fixup commit.

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> 28f53e097b

branch 'master' set up to track 'origin/master'.
Switched to a new branch 'master'
Already up to date.
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @algolia/autocomplete-core@npm:1.9.3 doesn't provide @algolia/client-search (pbc410), requested by @algolia/autocomplete-shared
...
➤ YN0000: Done with warnings in 2s 686ms
[master 7cee0c05bb] Noir local fixup commit.
 4 files changed, 8 insertions(+), 9 deletions(-)
Applying: Hello
[master ad6812fae7] Noir local patch commit.
% cd noir-repo                                                                                                                                                                                  
% echo "World" > world.txt && git add . && git commit -m "World"                                                                                                                                    
[master 16f0054dc9] World
 1 file changed, 1 insertion(+)
 create mode 100644 world.txt
% cd ..                                                                                                                                                                                                                                                                                                                                                                  
% cat .noir-repo-last-ref                                                                                                                                                                          
master                                                                                                                                                          
% scripts/sync.sh make-patch                                                                                                                                                                       
../patches/0001-Hello.patch
../patches/0002-Noir-local-patch-commit.patch
../patches/0003-World.patch
[master 2cc18fd434] Noir local patch commit.
% cat noir-repo.patch                                                                                                                                                                              
From 6a8c19cd6fd70e4b982ec8ca10b4b70363636f97 Mon Sep 17 00:00:00 2001
From: aakoshh <akosh@aztecprotocol.com>
Date: Fri, 7 Mar 2025 23:46:36 +0000
Subject: [PATCH 1/3] Hello

---
 hello.txt | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 hello.txt

diff --git a/hello.txt b/hello.txt
new file mode 100644
index 0000000000..e965047ad7
--- /dev/null
+++ b/hello.txt
@@ -0,0 +1 @@
+Hello
-- 
9.43.0

From 16f0054dc961105cdb264d6ace10ff9061b7b96d Mon Sep 17 00:00:00 2001
From: aakoshh <akosh@aztecprotocol.com>
Date: Fri, 7 Mar 2025 23:49:19 +0000
Subject: [PATCH 3/3] World

---
 world.txt | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 world.txt

diff --git a/world.txt b/world.txt
new file mode 100644
index 0000000000..216e97ce08
--- /dev/null
+++ b/world.txt
@@ -0,0 +1 @@
+World
-- 
2.43.0

% export NOIR_REPO_REF=a9de769f3743733ac754a5d6c4e147ba8283a336                                                                                                                                    
% scripts/sync.sh update                                                                                                                                                                           
...
From https://github.com/noir-lang/noir
 * branch                  a9de769f3743733ac754a5d6c4e147ba8283a336 -> FETCH_HEAD
Note: switching to 'a9de769f3743733ac754a5d6c4e147ba8283a336'.
...

HEAD is now at a9de769f37 feat: add optional oracle resolver url in `acvm_cli` (#7630)
➤ YN0000: ┌ Resolution step
...
➤ YN0000: └ Completed in 1s 219ms
➤ YN0000: Done with warnings in 2s 643ms
[detached HEAD 53cbe7bae4] Noir local fixup commit.
 4 files changed, 8 insertions(+), 9 deletions(-)
Applying: Hello
Applying: World
[detached HEAD c4921bc4a8] Noir local patch commit.
% ls noir-repo/*.txt                                                                                                                                                                           16s 
noir-repo/hello.txt  noir-repo/world.txt
%                                                                                                                                                                                                  

```

---------

Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants