diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr index 562b2c66699..fb9ebb60c9f 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr @@ -9,7 +9,11 @@ use dep::types::{ address::AztecAddress, traits::{Empty, is_empty}, transaction::tx_request::TxRequest }; -fn validate_array_prepended(dest: [T; N], source: [T; N], num_source_items: u32) where T: Eq { +fn validate_array_prepended( + dest: [T; N], + source: [T; N], + num_source_items: u32 +) where T: Eq { let mut proceed = true; for i in 0..source.len() { proceed &= i != num_source_items; @@ -19,7 +23,7 @@ fn validate_array_prepended(dest: [T; N], source: [T; N], num_source_items } } -fn validate_array_appended( +fn validate_array_appended( dest: [T; N], source: [T; M], num_source_items: u32, @@ -43,7 +47,7 @@ fn validate_array_appended( } // Similar to validate_array_appended, except that the contract address of the dest items will also be checked. -fn validate_array_appended_scoped( +fn validate_array_appended_scoped( dest: [ST; N], source: [T; M], num_source_items: u32, @@ -73,7 +77,7 @@ fn validate_array_appended_scoped( } // Similar to validate_array_appended, except that the souce items will be appended to dest in reversed order. -fn validate_array_appended_reversed( +fn validate_array_appended_reversed( dest: [T; N], source: [T; M], num_source_items: u32, diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr index e601fc98569..9d1869537ef 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/tests/private_call_data_validator_builder/validate_arrays.nr @@ -1,6 +1,6 @@ use crate::tests::private_call_data_validator_builder::PrivateCallDataValidatorBuilder; -fn unshift_empty_item(vec: &mut BoundedVec) { +fn unshift_empty_item(vec: &mut BoundedVec) { let len = vec.len(); let empty_item = vec.storage[len]; let first_item = vec.get(0); diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/mutable_data_read_request.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/mutable_data_read_request.nr index e54a6cc4580..0d708dcaa79 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/mutable_data_read_request.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/mutable_data_read_request.nr @@ -15,7 +15,7 @@ impl LeafDataReadHint { } } -fn validate_pending_read_requests( +fn validate_pending_read_requests( read_requests: [PublicDataRead; READ_REQUEST_LEN], data_writes: [PublicDataUpdateRequest; PENDING_VALUE_LEN], hints: [PendingReadHint; NUM_PENDING_READS] @@ -40,7 +40,7 @@ fn validate_pending_read_requests( +fn validate_leaf_data_read_requests( read_requests: [PublicDataRead; READ_REQUEST_LEN], leaf_data_hints: [H; NUM_LEAF_DATA_HINTS], hints: [LeafDataReadHint; NUM_LEAF_DATA_READS] @@ -60,7 +60,7 @@ fn validate_leaf_data_read_requests( +fn ensure_all_read_requests_are_verified( read_requests: [PublicDataRead; READ_REQUEST_LEN], read_request_statuses: [ReadRequestStatus; READ_REQUEST_LEN], pending_read_hints: [PendingReadHint; NUM_PENDING_READS], @@ -85,7 +85,14 @@ fn ensure_all_read_requests_are_verified( +pub fn reset_mutable_data_read_requests< + let READ_REQUEST_LEN: u32, + let PENDING_VALUE_LEN: u32, + H, + let NUM_LEAF_DATA_HINTS: u32, + let NUM_PENDING_READS: u32, + let NUM_LEAF_DATA_READS: u32 +>( read_requests: [PublicDataRead; READ_REQUEST_LEN], read_request_statuses: [ReadRequestStatus; READ_REQUEST_LEN], data_writes: [PublicDataUpdateRequest; PENDING_VALUE_LEN], @@ -150,7 +157,7 @@ mod tests { TestLeafDataHint { leaf_slot: 5, value: 50 }, ]; - fn create_pending_read_requests(data_write_indices: [u32; N]) -> ([PublicDataRead; N], [PendingReadHint; N]) { + fn create_pending_read_requests(data_write_indices: [u32; N]) -> ([PublicDataRead; N], [PendingReadHint; N]) { let read_requests = data_write_indices.map( |data_write_index: u32| PublicDataRead { leaf_slot: data_writes[data_write_index].leaf_slot, value: data_writes[data_write_index].new_value } ); @@ -161,7 +168,7 @@ mod tests { (read_requests, hints.storage) } - fn create_leaf_data_read_requests(data_hint_indices: [u32; N]) -> ([PublicDataRead; N], [LeafDataReadHint; N]) { + fn create_leaf_data_read_requests(data_hint_indices: [u32; N]) -> ([PublicDataRead; N], [LeafDataReadHint; N]) { let read_requests = data_hint_indices.map( |data_hint_index: u32| PublicDataRead { leaf_slot: leaf_data_hints[data_hint_index].leaf_slot, value: leaf_data_hints[data_hint_index].value } ); diff --git a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/non_existent_read_request.nr b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/non_existent_read_request.nr index 24f81ffebb4..e91a6e267ed 100644 --- a/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/non_existent_read_request.nr +++ b/noir-projects/noir-protocol-circuits/crates/reset-kernel-lib/src/reset/non_existent_read_request.nr @@ -4,12 +4,12 @@ use dep::types::{ traits::{Empty, is_empty} }; -trait NonMembershipHint where LEAF_PREIMAGE: IndexedTreeLeafPreimage { +trait NonMembershipHint where LEAF_PREIMAGE: IndexedTreeLeafPreimage { fn low_leaf_preimage(self) -> LEAF_PREIMAGE; fn membership_witness(self) -> MembershipWitness; } -fn check_no_matching_pending_value( +fn check_no_matching_pending_value( read_request: ScopedReadRequest, sorted_pending_values: BoundedVec, next_value_index: u32 @@ -30,7 +30,7 @@ fn check_no_matching_pending_value( } } -fn check_is_read_before_pending_value( +fn check_is_read_before_pending_value( read_request: ScopedReadRequest, sorted_pending_values: BoundedVec, next_value_index: u32 @@ -51,14 +51,14 @@ fn check_is_read_before_pending_value( // Unlike regular read requests, which can be reset at any time between two function executions. // Non existent read requests can only be verified at the end, after all pending values are present. // The values in read_requests and in sorted_pending_values should've been siloed before calling this. -pub fn reset_non_existent_read_requests( +pub fn reset_non_existent_read_requests( siloed_read_requests: [ScopedReadRequest; N], non_membership_hints: [NON_MEMBERSHIP_HINT; N], tree_root: Field, sorted_pending_values: BoundedVec, next_pending_value_indices: [u32; N] -) where - T: OrderedValue, +) where + T: OrderedValue, NON_MEMBERSHIP_HINT: NonMembershipHint, LEAF_PREIMAGE: IndexedTreeLeafPreimage { for i in 0..siloed_read_requests.len() { @@ -176,7 +176,7 @@ mod tests { ) } - fn get_non_membership_hints(leaf_indices: [Field; N]) -> ([TestNonMembershipHint; N], Field) { + fn get_non_membership_hints(leaf_indices: [Field; N]) -> ([TestNonMembershipHint; N], Field) { let tree = build_tree(); let hints = leaf_indices.map( |leaf_index| TestNonMembershipHint {