Skip to content

Commit b8088f7

Browse files
authored
Merge branch 'v5-next' into merge-train/fairies-v5
2 parents 100b2fc + 9e53e1f commit b8088f7

4 files changed

Lines changed: 38 additions & 91 deletions

File tree

avm-transpiler/Cargo.lock

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

noir-projects/aztec-nr/aztec/src/note/note_getter.nr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ where
258258
};
259259
}
260260

261-
BoundedVec::from_parts(confirmed_notes_bvec_storage, hinted_notes.len())
261+
// We can use `from_parts_unchecked` instead of `from_parts` because we know that `confirmed_notes_bvec_storage`
262+
// contains all zeroes past `hinted_notes.len()` due to how it was initialized.
263+
BoundedVec::from_parts_unchecked(confirmed_notes_bvec_storage, hinted_notes.len())
262264
}
263265

264266
pub unconstrained fn view_note<Note>(owner: Option<AztecAddress>, storage_slot: Field) -> HintedNote<Note>

noir-projects/aztec-nr/aztec/src/utils/array/subbvec.nr

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ pub fn subbvec<T, let SrcMaxLen: u32, let DstMaxLen: u32>(
1919
bvec: BoundedVec<T, SrcMaxLen>,
2020
offset: u32,
2121
) -> BoundedVec<T, DstMaxLen> {
22-
// The new storage array is a subarray of the original one (which has zeroed storage past len), so elements past
23-
// the new len remain zeroed: `subarray` does not allow extending arrays past their original length.
24-
BoundedVec::from_parts(array::subarray(bvec.storage(), offset), bvec.len() - offset)
22+
// from_parts_unchecked does not verify that the elements past len are zeroed, but that is not an issue in our case
23+
// because we're constructing the new storage array as a subarray of the original one (which should have zeroed
24+
// storage past len), guaranteeing correctness. This is because `subarray` does not allow extending arrays past
25+
// their original length.
26+
BoundedVec::from_parts_unchecked(array::subarray(bvec.storage(), offset), bvec.len() - offset)
2527
}
2628

2729
mod test {

noir/noir-repo

Submodule noir-repo updated 1074 files

0 commit comments

Comments
 (0)