@@ -209,12 +209,9 @@ namespace tx;
209209 is_revertible,
210210 read_pi_start_offset,
211211 read_pi_length_offset,
212- sel_non_revertible_append_note_hash,
213- sel_non_revertible_append_nullifier,
214- sel_non_revertible_append_l2_l1_msg,
215- sel_revertible_append_note_hash,
216- sel_revertible_append_nullifier,
217- sel_revertible_append_l2_l1_msg,
212+ sel_append_note_hash,
213+ sel_append_nullifier,
214+ sel_append_l2_l1_msg,
218215 next_phase_on_revert
219216 }
220217 in
@@ -228,12 +225,9 @@ namespace tx;
228225 precomputed.is_revertible,
229226 precomputed.read_pi_start_offset,
230227 precomputed.read_pi_length_offset,
231- precomputed.sel_non_revertible_append_note_hash,
232- precomputed.sel_non_revertible_append_nullifier,
233- precomputed.sel_non_revertible_append_l2_l1_msg,
234- precomputed.sel_revertible_append_note_hash,
235- precomputed.sel_revertible_append_nullifier,
236- precomputed.sel_revertible_append_l2_l1_msg,
228+ precomputed.sel_append_note_hash,
229+ precomputed.sel_append_nullifier,
230+ precomputed.sel_append_l2_l1_msg,
237231 precomputed.next_phase_on_revert
238232 };
239233
@@ -465,18 +459,16 @@ namespace tx;
465459 /***************************************************************************
466460 * Private Side Effect Insertions
467461 **************************************************************************/
468- pol commit sel_revertible_append_note_hash; // @boolean
469- pol commit sel_non_revertible_append_note_hash; // @boolean
470- pol commit sel_revertible_append_nullifier; // @boolean
471- pol commit sel_non_revertible_append_nullifier; // @boolean
472- pol commit sel_revertible_append_l2_l1_msg; // @boolean
473- pol commit sel_non_revertible_append_l2_l1_msg; // @boolean
474- // The 6 above selectors are booleans thanks to #[READ_PHASE_SPEC] on active rows.
462+ pol commit sel_append_note_hash; // @boolean
463+ pol commit sel_append_nullifier; // @boolean
464+ pol commit sel_append_l2_l1_msg; // @boolean
465+ // The 3 above selectors are booleans thanks to #[READ_PHASE_SPEC] on active rows.
475466 // Furthermore, phase spec guarantees that they are mutually exclusive.
467+ // Whether such an append is revertible or not is determined by `is_revertible`.
476468
477469 // A tree selector means we need to get the tree value
478- pol commit is_tree_insert_phase; // @boolean on active rows (follows from mutual exclusivity of the 6 above selectors)
479- is_tree_insert_phase = sel_revertible_append_note_hash + sel_non_revertible_append_note_hash + sel_revertible_append_nullifier + sel_non_revertible_append_nullifier ;
470+ pol commit is_tree_insert_phase; // @boolean on active rows (follows from mutual exclusivity of the above selectors)
471+ is_tree_insert_phase = sel_append_note_hash + sel_append_nullifier ;
480472 pol commit leaf_value;
481473 // Shared column to track the inverse of the remaining side effects for note hashes, nullifiers, and L2 to L1 messages
482474 pol commit remaining_side_effects_inv;
@@ -491,7 +483,7 @@ namespace tx;
491483
492484 // ===== NOTE HASHES =====
493485 pol commit sel_try_note_hash_append; // @boolean (follows from definition)
494- sel_try_note_hash_append = (sel - is_padded) * (sel_revertible_append_note_hash + sel_non_revertible_append_note_hash) ;
486+ sel_try_note_hash_append = (sel - is_padded) * sel_append_note_hash ;
495487
496488 // If we are at the maximum emitted note hashes, we must revert
497489 pol REMAINING_NOTE_HASH_WRITES = constants.MAX_NOTE_HASHES_PER_TX - prev_num_note_hashes_emitted;
@@ -509,7 +501,9 @@ namespace tx;
509501 prev_note_hash_tree_size,
510502 prev_note_hash_tree_root,
511503 precomputed.zero, // Already siloed. (No need to pass address.)
512- sel_revertible_append_note_hash, // Not unique for revertible note hashes.
504+ is_revertible, // Used as `sel_unique`: revertible note hashes need to be made unique with a nonce.
505+ // On rows where sel_note_hash_append == 1 (NR_NOTE_INSERTION or R_NOTE_INSERTION),
506+ // is_revertible is exactly the discriminator we want.
513507 prev_num_note_hashes_emitted,
514508 discard, // from tx_discard.pil virtual trace
515509 next_note_hash_tree_root
@@ -532,7 +526,7 @@ namespace tx;
532526
533527 // ===== NULLIFIERS =====
534528 pol commit sel_try_nullifier_append; // @boolean (follows from definition)
535- sel_try_nullifier_append = (sel - is_padded) * (sel_revertible_append_nullifier + sel_non_revertible_append_nullifier) ;
529+ sel_try_nullifier_append = (sel - is_padded) * sel_append_nullifier ;
536530
537531 pol commit nullifier_limit_error; // @boolean
538532 nullifier_limit_error * (1 - nullifier_limit_error) = 0;
@@ -594,7 +588,7 @@ namespace tx;
594588
595589 // ===== L2 - L1 Messages =====
596590 pol commit sel_try_l2_l1_msg_append; // @boolean (follows from definition)
597- sel_try_l2_l1_msg_append = (sel - is_padded) * (sel_revertible_append_l2_l1_msg + sel_non_revertible_append_l2_l1_msg) ;
591+ sel_try_l2_l1_msg_append = (sel - is_padded) * sel_append_l2_l1_msg ;
598592
599593 pol commit l2_l1_msg_contract_address;
600594 pol commit l2_l1_msg_recipient;
0 commit comments