508TEST(TxExecutionConstrainingTest, WriteTreeValue)
512 auto pub_inputs_col = test_public_inputs.
to_columns();
515 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
520 { C::tx_start_phase, 1 },
522 { C::tx_read_pi_length_offset,
526 { C::tx_is_tree_insert_phase, 1 },
527 { C::tx_leaf_value, test_public_inputs.previousNonRevertibleAccumulatedData.nullifiers[0] },
528 { C::tx_prev_num_nullifiers_emitted, 0 },
529 { C::tx_next_num_nullifiers_emitted, 1 },
530 { C::tx_end_phase, 1 } },
535 { C::tx_start_phase, 1 },
537 { C::tx_read_pi_length_offset,
541 { C::tx_is_tree_insert_phase, 1 },
542 { C::tx_leaf_value, test_public_inputs.previousNonRevertibleAccumulatedData.noteHashes[0] },
543 { C::tx_prev_num_note_hashes_emitted, 0 },
544 { C::tx_next_num_note_hashes_emitted, 1 },
545 { C::tx_end_phase, 1 } },
550 { C::tx_start_phase, 1 },
551 { C::tx_read_pi_length_offset,
556 { C::tx_sel_non_revertible_append_l2_l1_msg, 1 },
557 { C::tx_l2_l1_msg_content,
558 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].message.content },
559 { C::tx_l2_l1_msg_recipient,
560 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].message.recipient },
561 { C::tx_l2_l1_msg_contract_address,
562 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].contractAddress },
563 { C::tx_end_phase, 1 } },
569 { C::tx_start_phase, 1 },
570 { C::tx_is_padded, 1 },
572 { C::tx_end_phase, 1 } },
577 { C::tx_start_phase, 1 },
579 { C::tx_read_pi_length_offset,
583 { C::tx_is_tree_insert_phase, 1 },
584 { C::tx_leaf_value, test_public_inputs.previousRevertibleAccumulatedData.nullifiers[0] },
585 { C::tx_prev_num_nullifiers_emitted, 1 },
586 { C::tx_next_num_nullifiers_emitted, 2 },
587 { C::tx_end_phase, 1 } },
592 { C::tx_start_phase, 1 },
594 { C::tx_read_pi_length_offset,
598 { C::tx_is_tree_insert_phase, 1 },
599 { C::tx_leaf_value, test_public_inputs.previousRevertibleAccumulatedData.noteHashes[0] },
600 { C::tx_prev_num_note_hashes_emitted, 1 },
601 { C::tx_next_num_note_hashes_emitted, 2 },
602 { C::tx_end_phase, 1 } },
607 { C::tx_start_phase, 1 },
609 { C::tx_read_pi_length_offset,
614 { C::tx_sel_revertible_append_l2_l1_msg, 1 },
615 { C::tx_l2_l1_msg_content,
616 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].message.content },
617 { C::tx_l2_l1_msg_recipient,
618 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].message.recipient },
619 { C::tx_l2_l1_msg_contract_address,
620 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].contractAddress },
621 { C::tx_end_phase, 1 } },
627 { C::tx_start_phase, 1 },
628 { C::tx_is_padded, 1 },
630 { C::tx_end_phase, 1 } },
636 { C::tx_is_padded, 1 },
637 { C::tx_start_phase, 1 },
638 { C::tx_end_phase, 1 } },
643 public_inputs_builder.process_public_inputs_aux_precomputed(
trace);
653TEST(TxExecutionConstrainingTest, CollectFees)
662 auto second_setup_call_request = test_public_inputs.publicSetupCallRequests[1];
663 auto app_logic_call_request = test_public_inputs.publicAppLogicCallRequests[0];
664 auto teardown_call_request = test_public_inputs.publicTeardownCallRequest;
668 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
673 { C::tx_start_tx, 1 },
675 { C::tx_is_padded, 1 },
676 { C::tx_is_tree_insert_phase, 1 },
677 { C::tx_sel_non_revertible_append_nullifier, 1 },
678 { C::tx_sel_can_emit_nullifier, 1 },
681 { C::tx_sel_read_phase_length, 1 },
682 { C::tx_read_pi_length_offset,
685 { C::tx_start_phase, 1 },
686 { C::tx_end_phase, 1 },
687 { C::tx_prev_da_gas_used, 1 },
688 { C::tx_prev_l2_gas_used, 100 },
689 { C::tx_next_da_gas_used, 1 },
690 { C::tx_next_l2_gas_used, 100 },
692 { C::tx_next_context_id, 1 },
699 { C::tx_is_padded, 1 },
700 { C::tx_is_tree_insert_phase, 1 },
701 { C::tx_sel_non_revertible_append_note_hash, 1 },
702 { C::tx_sel_can_emit_note_hash, 1 },
705 { C::tx_sel_read_phase_length, 1 },
706 { C::tx_read_pi_length_offset,
709 { C::tx_start_phase, 1 },
710 { C::tx_end_phase, 1 },
711 { C::tx_prev_da_gas_used, 1 },
712 { C::tx_prev_l2_gas_used, 100 },
713 { C::tx_next_da_gas_used, 1 },
714 { C::tx_next_l2_gas_used, 100 },
716 { C::tx_next_context_id, 1 },
723 { C::tx_is_padded, 1 },
724 { C::tx_sel_non_revertible_append_l2_l1_msg, 1 },
725 { C::tx_sel_can_emit_l2_l1_msg, 1 },
728 { C::tx_sel_read_phase_length, 1 },
729 { C::tx_read_pi_length_offset,
733 { C::tx_start_phase, 1 },
734 { C::tx_end_phase, 1 },
735 { C::tx_prev_da_gas_used, 1 },
736 { C::tx_prev_l2_gas_used, 100 },
737 { C::tx_next_da_gas_used, 1 },
738 { C::tx_next_l2_gas_used, 100 },
740 { C::tx_next_context_id, 1 },
748 { C::tx_start_phase, 1 },
749 { C::tx_sel_read_phase_length, 1 },
752 { C::tx_is_public_call_request, 1 },
753 { C::tx_should_process_call_request, 1 },
756 { C::tx_remaining_phase_counter, 2 },
757 { C::tx_remaining_phase_inv,
FF(2).invert() },
758 { C::tx_remaining_phase_minus_one_inv,
FF(1).invert() },
759 { C::tx_sel_can_emit_note_hash, 1 },
760 { C::tx_sel_can_emit_nullifier, 1 },
761 { C::tx_sel_can_write_public_data, 1 },
762 { C::tx_sel_can_emit_unencrypted_log, 1 },
763 { C::tx_sel_can_emit_l2_l1_msg, 1 },
766 { C::tx_msg_sender, first_setup_call_request.msgSender },
767 { C::tx_contract_addr, first_setup_call_request.contractAddress },
768 { C::tx_is_static, first_setup_call_request.isStaticCall },
769 { C::tx_calldata_hash, first_setup_call_request.calldataHash },
770 { C::tx_prev_da_gas_used, 1 },
771 { C::tx_prev_l2_gas_used, 100 },
772 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 1 },
773 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 100 },
774 { C::tx_next_da_gas_used, 2 },
775 { C::tx_next_l2_gas_used, 200 },
776 { C::tx_next_da_gas_used_sent_to_enqueued_call, 2 },
777 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 200 },
779 { C::tx_next_context_id, 1 },
787 { C::tx_remaining_phase_counter, 1 },
788 { C::tx_remaining_phase_inv, 1 },
789 { C::tx_sel_can_emit_note_hash, 1 },
790 { C::tx_sel_can_emit_nullifier, 1 },
791 { C::tx_sel_can_write_public_data, 1 },
792 { C::tx_sel_can_emit_unencrypted_log, 1 },
793 { C::tx_sel_can_emit_l2_l1_msg, 1 },
796 { C::tx_msg_sender, second_setup_call_request.msgSender },
797 { C::tx_contract_addr, second_setup_call_request.contractAddress },
798 { C::tx_is_static, second_setup_call_request.isStaticCall },
799 { C::tx_calldata_hash, second_setup_call_request.calldataHash },
800 { C::tx_end_phase, 1 },
801 { C::tx_prev_da_gas_used, 2 },
802 { C::tx_prev_l2_gas_used, 200 },
803 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 2 },
804 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 200 },
805 { C::tx_next_da_gas_used, 3 },
806 { C::tx_next_l2_gas_used, 300 },
807 { C::tx_next_da_gas_used_sent_to_enqueued_call, 3 },
808 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 300 },
810 { C::tx_next_context_id, 2 },
817 { C::tx_is_padded, 1 },
818 { C::tx_is_tree_insert_phase, 1 },
819 { C::tx_sel_revertible_append_nullifier, 1 },
820 { C::tx_sel_can_emit_nullifier, 1 },
821 { C::tx_is_revertible, 1 },
823 { C::tx_sel_read_phase_length, 1 },
824 { C::tx_read_pi_length_offset,
826 { C::tx_start_phase, 1 },
827 { C::tx_end_phase, 1 },
828 { C::tx_prev_da_gas_used, 3 },
829 { C::tx_prev_l2_gas_used, 300 },
830 { C::tx_next_da_gas_used, 3 },
831 { C::tx_next_l2_gas_used, 300 },
833 { C::tx_next_context_id, 3 },
840 { C::tx_is_padded, 1 },
841 { C::tx_is_tree_insert_phase, 1 },
842 { C::tx_sel_revertible_append_note_hash, 1 },
843 { C::tx_sel_can_emit_note_hash, 1 },
844 { C::tx_is_revertible, 1 },
846 { C::tx_sel_read_phase_length, 1 },
847 { C::tx_read_pi_length_offset,
849 { C::tx_start_phase, 1 },
850 { C::tx_end_phase, 1 },
851 { C::tx_prev_da_gas_used, 3 },
852 { C::tx_prev_l2_gas_used, 300 },
853 { C::tx_next_da_gas_used, 3 },
854 { C::tx_next_l2_gas_used, 300 },
856 { C::tx_next_context_id, 3 },
863 { C::tx_is_padded, 1 },
864 { C::tx_sel_revertible_append_l2_l1_msg, 1 },
865 { C::tx_sel_can_emit_l2_l1_msg, 1 },
866 { C::tx_is_revertible, 1 },
868 { C::tx_sel_read_phase_length, 1 },
869 { C::tx_read_pi_length_offset,
872 { C::tx_start_phase, 1 },
873 { C::tx_end_phase, 1 },
874 { C::tx_prev_da_gas_used, 3 },
875 { C::tx_prev_l2_gas_used, 300 },
876 { C::tx_next_da_gas_used, 3 },
877 { C::tx_next_l2_gas_used, 300 },
879 { C::tx_next_context_id, 3 },
887 { C::tx_start_phase, 1 },
888 { C::tx_sel_read_phase_length, 1 },
890 { C::tx_is_public_call_request, 1 },
891 { C::tx_should_process_call_request, 1 },
893 { C::tx_read_pi_length_offset,
895 { C::tx_remaining_phase_counter, 1 },
896 { C::tx_remaining_phase_inv, 1 },
897 { C::tx_is_revertible, 1 },
898 { C::tx_sel_can_emit_note_hash, 1 },
899 { C::tx_sel_can_emit_nullifier, 1 },
900 { C::tx_sel_can_write_public_data, 1 },
901 { C::tx_sel_can_emit_unencrypted_log, 1 },
902 { C::tx_sel_can_emit_l2_l1_msg, 1 },
905 { C::tx_msg_sender, app_logic_call_request.msgSender },
906 { C::tx_contract_addr, app_logic_call_request.contractAddress },
907 { C::tx_is_static, app_logic_call_request.isStaticCall },
908 { C::tx_calldata_hash, app_logic_call_request.calldataHash },
910 { C::tx_end_phase, 1 },
911 { C::tx_prev_da_gas_used, 3 },
912 { C::tx_prev_l2_gas_used, 300 },
913 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 3 },
914 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 300 },
915 { C::tx_next_da_gas_used, 4 },
916 { C::tx_next_l2_gas_used, 400 },
917 { C::tx_next_da_gas_used_sent_to_enqueued_call, 4 },
918 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 400 },
920 { C::tx_next_context_id, 3 },
927 { C::tx_sel_read_phase_length, 1 },
930 { C::tx_is_padded, 0 },
931 { C::tx_is_public_call_request, 1 },
932 { C::tx_should_process_call_request, 1 },
933 { C::tx_sel_can_emit_note_hash, 1 },
934 { C::tx_sel_can_emit_nullifier, 1 },
935 { C::tx_sel_can_write_public_data, 1 },
936 { C::tx_sel_can_emit_unencrypted_log, 1 },
937 { C::tx_sel_can_emit_l2_l1_msg, 1 },
938 { C::tx_start_phase, 1 },
939 { C::tx_end_phase, 1 },
940 { C::tx_is_teardown_phase, 1 },
941 { C::tx_remaining_phase_counter, 1 },
942 { C::tx_remaining_phase_inv, 1 },
943 { C::tx_is_revertible, 1 },
945 { C::tx_msg_sender, teardown_call_request.msgSender },
946 { C::tx_contract_addr, teardown_call_request.contractAddress },
947 { C::tx_is_static, teardown_call_request.isStaticCall },
948 { C::tx_calldata_hash, teardown_call_request.calldataHash },
949 { C::tx_prev_da_gas_used, 4 },
950 { C::tx_prev_l2_gas_used, 400 },
951 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 0 },
952 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 0 },
953 { C::tx_next_da_gas_used, 4 },
954 { C::tx_next_l2_gas_used, 400 },
955 { C::tx_next_da_gas_used_sent_to_enqueued_call, 13213 },
956 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 456789 },
958 { C::tx_next_context_id, 4 },
965 { C::tx_remaining_phase_counter, 1 },
966 { C::tx_remaining_phase_inv, 1 },
967 { C::tx_is_collect_fee, 1 },
968 { C::tx_sel_can_write_public_data, 1 },
974 { C::tx_start_phase, 1 },
975 { C::tx_end_phase, 1 },
976 { C::tx_prev_da_gas_used, 4 },
977 { C::tx_prev_l2_gas_used, 400 },
978 { C::tx_next_da_gas_used, 4 },
979 { C::tx_next_l2_gas_used, 400 },
980 { C::tx_uint32_max, 0xffffffff },
982 { C::tx_next_context_id, 5 },
989 { C::tx_start_phase, 1 },
990 { C::tx_end_phase, 1 },
991 { C::tx_is_tree_padding, 1 },
992 { C::tx_remaining_phase_counter, 1 },
993 { C::tx_remaining_phase_inv, 1 },
994 { C::tx_sel_can_emit_note_hash, 1 },
995 { C::tx_sel_can_emit_nullifier, 1 },
999 { C::tx_next_context_id, 5 },
1006 { C::tx_start_phase, 1 },
1007 { C::tx_end_phase, 1 },
1008 { C::tx_is_cleanup, 1 },
1009 { C::tx_remaining_phase_counter, 1 },
1010 { C::tx_remaining_phase_inv, 1 },
1012 { C::tx_next_context_id, 5 },
1018 public_inputs_builder.process_public_inputs_aux_precomputed(
trace);
1024 check_relation<tx>(
trace);