diff --git a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.cpp b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.cpp index a4b281362f60..c1fd7362e455 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.cpp @@ -112,11 +112,6 @@ void match_nullifiers_to_commitments_and_squash( match_pos = nullified_commitment == new_commitments[hint_pos] ? hint_pos : match_pos; } - for (size_t c_idx = 0; c_idx < MAX_NEW_COMMITMENTS_PER_TX; c_idx++) { - // If there are multiple matches, this picks the last one - match_pos = (nullified_commitments[n_idx] == new_commitments[c_idx]) ? c_idx : match_pos; - } - if (match_pos != MAX_NEW_COMMITMENTS_PER_TX) { // match found! // squash both the nullifier and the commitment diff --git a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.test.cpp b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.test.cpp index e1ef0464373a..829366423c8e 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/private/native_private_kernel_circuit_ordering.test.cpp @@ -222,6 +222,8 @@ TEST_F(native_private_kernel_ordering_tests, native_squash_one_of_one_transient_ previous_kernel.public_inputs.end.new_nullifiers = new_nullifiers; previous_kernel.public_inputs.end.nullified_commitments = nullifier_commitments; + // Correct nullifier_commitment hint for new_nullifiers[0] == 0 is correct due to the default + // initialization of the array. PrivateKernelInputsOrdering private_inputs{ .previous_kernel = previous_kernel }; DummyBuilder builder = @@ -254,7 +256,9 @@ TEST_F(native_private_kernel_ordering_tests, native_squash_one_of_two_transient_ previous_kernel.public_inputs.end.new_nullifiers = new_nullifiers; previous_kernel.public_inputs.end.nullified_commitments = nullifier_commitments; - PrivateKernelInputsOrdering private_inputs{ .previous_kernel = previous_kernel }; + PrivateKernelInputsOrdering private_inputs{ .previous_kernel = previous_kernel, + .nullifier_commitment_hints = + std::array{ 1 } }; DummyBuilder builder = DummyBuilder("native_private_kernel_ordering_tests__native_squash_one_of_two_transient_matches_works"); @@ -289,7 +293,9 @@ TEST_F(native_private_kernel_ordering_tests, native_squash_two_of_two_transient_ previous_kernel.public_inputs.end.new_nullifiers = new_nullifiers; previous_kernel.public_inputs.end.nullified_commitments = nullifier_commitments; - PrivateKernelInputsOrdering private_inputs{ .previous_kernel = previous_kernel }; + PrivateKernelInputsOrdering private_inputs{ .previous_kernel = previous_kernel, + .nullifier_commitment_hints = + std::array{ 1 } }; DummyBuilder builder = DummyBuilder("native_private_kernel_ordering_tests__native_squash_two_of_two_transient_matches_works");