@@ -158,7 +158,11 @@ static NON_TRIVIAL_RESOURCE_BOUNDS: LazyLock<AllResourceBounds> =
158158 } ,
159159 } ) ;
160160
161- type TxPair = ( ExecutableAccountTx , InternalConsensusTransaction ) ;
161+ struct TxData {
162+ executable : ExecutableAccountTx ,
163+ internal : InternalConsensusTransaction ,
164+ should_revert : bool ,
165+ }
162166
163167/// ID of the current blobs file.
164168fn current_generation ( ) -> usize {
@@ -249,7 +253,7 @@ struct BlobFactory {
249253 blocks : Vec < BlockData > ,
250254
251255 // Transactions for the next block.
252- next_txs : Vec < TxPair > ,
256+ next_txs : Vec < TxData > ,
253257
254258 // Context.
255259 nonce_manager : NonceManager ,
@@ -310,11 +314,18 @@ impl BlobFactory {
310314 . unwrap ( ) ;
311315 let mut transactions_with_receipts = Vec :: new ( ) ;
312316 // Consume the transactions list (next block starts empty).
313- for ( executable, internal) in std:: mem:: take ( & mut self . next_txs ) . into_iter ( ) {
317+ for TxData { executable, internal, should_revert } in
318+ std:: mem:: take ( & mut self . next_txs ) . into_iter ( )
319+ {
314320 let ( execution_info, _state_changes) = executor
315321 . execute ( & BlockifierTx :: new_for_sequencing ( ExecutableTx :: Account ( executable) ) )
316322 . unwrap ( ) ;
317- assert ! ( !execution_info. is_reverted( ) , "Got a reverted tx: {execution_info:?}" ) ;
323+ assert_eq ! (
324+ execution_info. is_reverted( ) ,
325+ should_revert,
326+ "Execution result does not match expected (should_revert={should_revert}): \
327+ {execution_info:?}"
328+ ) ;
318329
319330 transactions_with_receipts
320331 . push ( InternalTransactionWithReceipt { transaction : internal, execution_info } ) ;
@@ -511,7 +522,11 @@ impl BlobFactory {
511522 . returning ( move |_| Ok ( Some ( contract. get_class ( ) ) ) ) ;
512523
513524 // Return the transactions.
514- self . next_txs . push ( ( executable. into ( ) , internal_tx) ) ;
525+ self . next_txs . push ( TxData {
526+ executable : executable. into ( ) ,
527+ internal : internal_tx,
528+ should_revert : false ,
529+ } ) ;
515530 }
516531
517532 fn make_free_deploy_account_tx ( & mut self , account : FeatureContract ) -> ContractAddress {
@@ -563,7 +578,11 @@ impl BlobFactory {
563578 tx : without_hash,
564579 tx_hash,
565580 } ) ;
566- self . next_txs . push ( ( executable. into ( ) , internal) ) ;
581+ self . next_txs . push ( TxData {
582+ executable : executable. into ( ) ,
583+ internal,
584+ should_revert : false ,
585+ } ) ;
567586 contract_address
568587 }
569588
@@ -573,6 +592,7 @@ impl BlobFactory {
573592 function_name : & str ,
574593 calldata : & [ Felt ] ,
575594 with_fee_charge : bool ,
595+ should_revert : bool ,
576596 ) {
577597 let nonce = self . nonce_manager . next ( * OPERATOR_ADDRESS ) ;
578598 let resource_bounds = if with_fee_charge {
@@ -608,7 +628,7 @@ impl BlobFactory {
608628 tx : without_hash,
609629 tx_hash,
610630 } ) ;
611- self . next_txs . push ( ( executable. into ( ) , internal) ) ;
631+ self . next_txs . push ( TxData { executable : executable . into ( ) , internal, should_revert } ) ;
612632 }
613633
614634 fn make_operator_deploy_tx (
@@ -637,6 +657,7 @@ impl BlobFactory {
637657 "deploy_contract" ,
638658 & calldata,
639659 with_fee_charge,
660+ false , // should not revert
640661 ) ;
641662 contract_address
642663 }
@@ -664,15 +685,17 @@ impl BlobFactory {
664685 /// no commitment is computed.
665686 fn make_preconfirmed_block_from_remaining_txs (
666687 block_context : BlockContext ,
667- txs : Vec < TxPair > ,
688+ txs : Vec < TxData > ,
668689 mut state : DictStateReader ,
669690 ) -> CendeWritePreconfirmedBlock {
670691 let block_info = block_context. block_info ( ) . clone ( ) ;
671692 let mut transactions = vec ! [ ] ;
672693 let mut transaction_receipts = vec ! [ ] ;
673694 let mut transaction_state_diffs = vec ! [ ] ;
674695
675- for ( tx_index, ( executable, internal) ) in txs. into_iter ( ) . enumerate ( ) {
696+ for ( tx_index, TxData { executable, internal, should_revert } ) in
697+ txs. into_iter ( ) . enumerate ( )
698+ {
676699 let tx_hash = match & internal {
677700 InternalConsensusTransaction :: RpcTransaction ( tx) => tx. tx_hash ,
678701 InternalConsensusTransaction :: L1Handler ( _) => {
@@ -684,6 +707,12 @@ impl BlobFactory {
684707 let execution_info = BlockifierAccountTx :: new_for_sequencing ( executable)
685708 . execute ( & mut tx_state, & block_context)
686709 . unwrap ( ) ;
710+ assert_eq ! (
711+ execution_info. is_reverted( ) ,
712+ should_revert,
713+ "Execution result does not match expected (should_revert={should_revert}): \
714+ {execution_info:?}"
715+ ) ;
687716
688717 let state_changes = tx_state. to_state_diff ( ) . unwrap ( ) ;
689718
0 commit comments