Skip to content

Commit 4b98f61

Browse files
authored
chore: backport #22393 (Update Noir to nightly-2026-04-10) to v4-next (#22485)
## Summary Backport of #22393 (Update Noir to nightly-2026-04-10) to v4-next, plus 3 companion PRs needed for Noir compatibility since v4-next was still on nightly-2026-02-12. ## Companion PRs included Since v4-next hadn't updated Noir since nightly-2026-02-12 (~2 months behind), several intermediate Noir-adaptation PRs were also needed: 1. **#20702** — Remove unnecessary `comptime` qualifier from VK tree constants (Noir broke comptime globals used in non-comptime contexts) 2. **#20798** — Remove unnecessary `let mut` across noir-projects (newer Noir errors on this) 3. **#21801** — Replace deprecated Noir comptime APIs: `add_attribute()` → `add_abi()`, `set_body()`/`set_parameters()`/`set_return_public()` → `function.disable()`, update `fn_has_noinitcheck` to also check `is_fn_only_self()` ## Commits 1. **Cherry-pick with conflict markers** — raw cherry-pick of #22393 2. **Conflict resolution** — version bumps + reformatting resolved 3. **Cherry-pick #20702** — comptime globals + poseidon2 hash fix 4. **Cherry-pick #20798** — unnecessary mut removal (24 files) 5. **Cherry-pick #21801** — macro API migration (4 files) 6. **Remaining fixes** — private_context.nr mut + utils.nr style alignment
2 parents e3dd5a1 + b75ca28 commit 4b98f61

85 files changed

Lines changed: 727 additions & 592 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

avm-transpiler/Cargo.lock

Lines changed: 265 additions & 284 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

barretenberg/acir_tests/bootstrap.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ function build {
108108
rm -rf acir_tests/{diamond_deps_0,workspace,workspace_default_member,regression_7323}
109109
# These use folding, which is not currently supported.
110110
rm -rf acir_tests/{fold_call_witness_condition,fold_after_inlined_calls,fold_complex_outputs,fold_basic_nested_call,fold_numeric_generic_poseidon,fold_fibonacci,fold_basic,fold_2_to_17,fold_distinct_return}
111-
# These are breaking with:
112-
# Failed to solve program: 'Failed to solve blackbox function: embedded_curve_add, reason: Infinite input: embedded_curve_add(infinity, infinity)'
113-
rm -rf acir_tests/{regression_5045,regression_7744}
114111
# The following test fails because it uses CallData/ReturnData with UltraBuilder, which is not supported
115112
rm -rf acir_tests/{regression_7612,regression_7143,databus_composite_calldata,databus_two_calldata_simple,databus_two_calldata,databus}
116113
# Mark tests that are expected to fail with a failing_ prefix.

barretenberg/cpp/pil/vm2/constants_gen.pil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ namespace constants;
165165
pol UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE = 144;
166166
pol GRUMPKIN_ONE_X = 1;
167167
pol GRUMPKIN_ONE_Y = 17631683881184975370165255887551781615748388533673675138860;
168-
pol DOM_SEP__NOTE_HASH_NONCE = 1721808740;
169-
pol DOM_SEP__UNIQUE_NOTE_HASH = 226850429;
170168
pol DOM_SEP__SILOED_NOTE_HASH = 3361878420;
169+
pol DOM_SEP__UNIQUE_NOTE_HASH = 226850429;
170+
pol DOM_SEP__NOTE_HASH_NONCE = 1721808740;
171171
pol DOM_SEP__SILOED_NULLIFIER = 57496191;
172172
pol DOM_SEP__PUBLIC_LEAF_SLOT = 1247650290;
173173
pol DOM_SEP__PUBLIC_STORAGE_MAP_SLOT = 4015149901;

barretenberg/cpp/src/barretenberg/vm2/common/aztec_constants.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@
257257
#define UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN 3
258258
#define UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE 144
259259
#define DEFAULT_MAX_DEBUG_LOG_MEMORY_READS 125000
260-
#define DOM_SEP__NOTE_HASH_NONCE 1721808740UL
261-
#define DOM_SEP__UNIQUE_NOTE_HASH 226850429UL
262260
#define DOM_SEP__SILOED_NOTE_HASH 3361878420UL
261+
#define DOM_SEP__UNIQUE_NOTE_HASH 226850429UL
262+
#define DOM_SEP__NOTE_HASH_NONCE 1721808740UL
263263
#define DOM_SEP__SILOED_NULLIFIER 57496191UL
264264
#define DOM_SEP__PUBLIC_LEAF_SLOT 1247650290UL
265265
#define DOM_SEP__PUBLIC_STORAGE_MAP_SLOT 4015149901UL

barretenberg/cpp/src/barretenberg/vm2/generated/relations/note_hash_tree_check_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ void note_hash_tree_checkImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
1818
const auto constants_NOTE_HASH_TREE_HEIGHT = FF(42);
1919
const auto constants_AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX = FF(169);
2020
const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NOTE_HASHES_ROW_IDX = FF(386);
21-
const auto constants_DOM_SEP__NOTE_HASH_NONCE = FF(1721808740);
22-
const auto constants_DOM_SEP__UNIQUE_NOTE_HASH = FF(226850429);
2321
const auto constants_DOM_SEP__SILOED_NOTE_HASH = FF(3361878420UL);
22+
const auto constants_DOM_SEP__UNIQUE_NOTE_HASH = FF(226850429);
23+
const auto constants_DOM_SEP__NOTE_HASH_NONCE = FF(1721808740);
2424
const auto note_hash_tree_check_READ = (FF(1) - in.get(C::note_hash_tree_check_write));
2525
const auto note_hash_tree_check_PREV_LEAF_VALUE_UNIQUE_NOTE_HASH_DIFF =
2626
(in.get(C::note_hash_tree_check_prev_leaf_value) - in.get(C::note_hash_tree_check_unique_note_hash));

docs/examples/contracts/nft/src/main.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub contract NFTPunk {
2121
struct Storage<Context> {
2222
admin: PublicImmutable<AztecAddress, Context>,
2323
minter: PublicImmutable<AztecAddress, Context>,
24-
nfts: Map<Field, DelayedPublicMutable<bool, 2, Context>, Context>,
24+
nfts: Map<Field, DelayedPublicMutable<bool, 2u64, Context>, Context>,
2525
owners: Owned<PrivateSet<NFTNote, Context>, Context>,
2626
}
2727
#[external("public")]

noir-projects/aztec-nr/aztec/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ type = "lib"
77
[dependencies]
88
protocol_types = { path = "../../noir-protocol-circuits/crates/types" }
99
sha256 = { tag = "v0.3.0", git = "https://github.com/noir-lang/sha256" }
10-
poseidon = { tag = "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
10+
poseidon = { tag = "v0.3.0", git = "https://github.com/noir-lang/poseidon" }

noir-projects/aztec-nr/aztec/src/context/private_context.nr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ impl PrivateContext {
11211121
args_hash: Field,
11221122
is_static_call: bool,
11231123
) -> ReturnsHash {
1124-
let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;
1124+
let is_static_call = is_static_call | self.inputs.call_context.is_static_call;
11251125
let start_side_effect_counter = self.side_effect_counter;
11261126

11271127
// Safety: The oracle simulates the private call and returns the value of the side effects counter after
@@ -1288,7 +1288,7 @@ impl PrivateContext {
12881288
) {
12891289
let counter = self.next_counter();
12901290

1291-
let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;
1291+
let is_static_call = is_static_call | self.inputs.call_context.is_static_call;
12921292

12931293
assert_valid_public_call_data(calldata_hash);
12941294

noir-projects/aztec-nr/aztec/src/context/public_context.nr

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ impl PublicContext {
131131
///
132132
pub fn note_hash_exists(_self: Self, note_hash: Field, leaf_index: u64) -> bool {
133133
// Safety: AVM opcodes are constrained by the AVM itself
134-
unsafe { avm::note_hash_exists(note_hash, leaf_index) } == 1
134+
unsafe {
135+
avm::note_hash_exists(note_hash, leaf_index)
136+
}
135137
}
136138

137139
/// Checks if a specific L1-to-L2 message exists in the L1-to-L2 message tree at a particular leaf index.
@@ -153,7 +155,9 @@ impl PublicContext {
153155
///
154156
pub fn l1_to_l2_msg_exists(_self: Self, msg_hash: Field, msg_leaf_index: Field) -> bool {
155157
// Safety: AVM opcodes are constrained by the AVM itself TODO(alvaro): Make l1l2msg leaf index a u64 upstream
156-
unsafe { avm::l1_to_l2_msg_exists(msg_hash, msg_leaf_index as u64) } == 1
158+
unsafe {
159+
avm::l1_to_l2_msg_exists(msg_hash, msg_leaf_index as u64)
160+
}
157161
}
158162

159163
/// Returns `true` if an `unsiloed_nullifier` has been emitted by `contract_address`.
@@ -204,7 +208,9 @@ impl PublicContext {
204208
pub fn nullifier_exists_unsafe(_self: Self, unsiloed_nullifier: Field, contract_address: AztecAddress) -> bool {
205209
let siloed_nullifier = compute_siloed_nullifier(contract_address, unsiloed_nullifier);
206210
// Safety: AVM opcodes are constrained by the AVM itself
207-
unsafe { avm::nullifier_exists(siloed_nullifier) } == 1
211+
unsafe {
212+
avm::nullifier_exists(siloed_nullifier)
213+
}
208214
}
209215

210216
/// Consumes a message sent from Ethereum (L1) to Aztec (L2) -- effectively marking it as "read".
@@ -662,7 +668,9 @@ impl PublicContext {
662668
///
663669
pub fn is_static_call(_self: Self) -> bool {
664670
// Safety: AVM opcodes are constrained by the AVM itself
665-
unsafe { avm::is_static_call() } == 1
671+
unsafe {
672+
avm::is_static_call()
673+
}
666674
}
667675

668676
/// Reads raw field values from public storage. Reads N consecutive storage slots starting from the given slot.

noir-projects/aztec-nr/aztec/src/history/test.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) unconstrained fn create_note() -> (TestEnvironment, HintedNote<MockNo
1616
let note_owner = env.create_light_account();
1717

1818
let note_message = env.private_context(|context| {
19-
let mut mock_note = MockNote::new(69);
19+
let mock_note = MockNote::new(69);
2020

2121
lifecycle_create_note(
2222
context,

0 commit comments

Comments
 (0)