You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/accumulated_data/assert_array_appended.nr
Copy file name to clipboardExpand all lines: noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/accumulated_data/assert_sorted_padded_transformed_array.nr
+58-44Lines changed: 58 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ use types::{
6
6
utils::arrays::ClaimedLengthArray,
7
7
};
8
8
9
-
/// Validates that the `sorted_padded_transformed_array` is sorted in ascending order by counter and that all
9
+
/// Validates that the `output_array` is sorted in ascending order by counter and that all
10
10
/// transformations and padding are correctly applied.
11
11
///
12
12
/// ### Arguments
13
13
/// - `original_array`: The original array of unsorted items with a claimed length.
14
-
/// - `padded_items`: The array of padded items to be added to the `sorted_padded_transformed_array`.
15
-
/// - `sorted_padded_transformed_array`: The array of items that have been sorted, padded, and transformed.
14
+
/// - `padded_items`: The array of padded items to be added to the `output_array`.
15
+
/// - `output_array`: The array of items that have been sorted, padded, and transformed.
16
16
/// - `assert_transformed`: A user-provided assertion function that verifies the transformation of each item.
17
17
///
18
18
/// ### Argument requirements:
@@ -23,28 +23,28 @@ use types::{
23
23
/// - `assert_transformed` must guarantee that the transformed value is empty if and only if the original item is empty.
24
24
///
25
25
/// This function checks that:
26
-
/// 1. Each item in the `original_array` is correctly transformed and placed in the `sorted_padded_transformed_array`.
27
-
/// 2. The items within the `sorted_padded_transformed_array` are sorted in ascending order by their counters.
26
+
/// 1. Each item in the `original_array` is correctly transformed and placed in the `output_array`.
27
+
/// 2. The items within the `output_array` are sorted in ascending order by their counters.
28
28
/// 3. The items in the `padded_items` within the range [original_array.length, CappedSize) are correctly padded to the
29
-
/// `sorted_padded_transformed_array` after the `original_array.length` items from `original_array`.
30
-
/// 4. All items within the claimed length in the `sorted_padded_transformed_array` must have non-zero counter.
31
-
/// 5. All items beyond the claimed length in the `sorted_padded_transformed_array` must have zero counter.
29
+
/// `output_array` after the `original_array.length` items from `original_array`.
30
+
/// 4. All items within the claimed length in the `output_array` must have non-zero counter.
31
+
/// 5. All items beyond the claimed length in the `output_array` must have zero counter.
32
32
///
33
33
/// ### Notes:
34
34
/// 1. `CappedSize` must be large enough to cover all valid items in `original_array`
35
35
/// (i.e. `CappedSize >= original_array.length`).
36
36
/// 2. Items in `padded_items` with index < `original_array.length` or >= `CappedSize` are ignored.
37
37
/// 3. `is_transformed` does not need to validate counters. This function ensures that each item in
38
-
/// `sorted_padded_transformed_array` has the same counter as its corresponding item in either `original_array` or
38
+
/// `output_array` has the same counter as its corresponding item in either `original_array` or
39
39
/// `padded_items`.
40
40
/// 4. This function can only be called at most once per side effect type. Once padded items have been added to the
41
-
/// `sorted_padded_transformed_array`, the array cannot be used again as the `original_array` for this function.
42
-
/// 5. The items beyond `CappedSize` in the `sorted_padded_transformed_array` must have a counter of 0, but their values
41
+
/// `output_array`, the array cannot be used again as the `original_array` for this function.
42
+
/// 5. The items beyond `CappedSize` in the `output_array` must have a counter of 0, but their values
43
43
/// are not checked here. However, if any of them are not nullish, the tail circuits will fail to validate that the
44
44
/// array is "dense trimmed". The non-nullish values cannot be used for squashing, since they are beyond the claimed
45
45
/// length of the array.
46
46
///
47
-
/// Expected structure of the output `sorted_padded_transformed_array`:
47
+
/// Expected structure of the output `output_array`:
Copy file name to clipboardExpand all lines: noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/accumulated_data/assert_sorted_padded_transformed_array/check_padded_items.nr
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,24 @@
1
1
usetypes::traits::Empty;
2
2
3
-
// Utility to check the padded items provided by the user.
4
-
// - Checks that all items outside the range [num_original_items, CappedSize) are empty.
5
-
// - Checks that non-empty items within the range are consecutive.
6
-
// Note: Technically, values outside this range could be non-empty, since they are ignored. However, enforcing emptiness
7
-
// helps prevent unexpected output if the array is misconfigured.
3
+
/// Utility to validate the layout of the padded items provided by the user.
4
+
///
5
+
/// Our target (created in a later fn): [<-- original ("kept") items -->|<-- padding -->|0, ..., 0]
6
+
/// ^ ^
7
+
/// | |
8
+
/// `num_original_items` `capped_size`: the number of elements this reset
Copy file name to clipboardExpand all lines: noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/accumulated_data/assert_sorted_transformed_array/get_order_hints.nr
Copy file name to clipboardExpand all lines: noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_call_data_validator.nr
0 commit comments