diff --git a/crates/central_systest_blobs/src/cende_blob_regression_test.rs b/crates/central_systest_blobs/src/cende_blob_regression_test.rs index 97afa803fd5..6c705e746d8 100644 --- a/crates/central_systest_blobs/src/cende_blob_regression_test.rs +++ b/crates/central_systest_blobs/src/cende_blob_regression_test.rs @@ -158,7 +158,11 @@ static NON_TRIVIAL_RESOURCE_BOUNDS: LazyLock = }, }); -type TxPair = (ExecutableAccountTx, InternalConsensusTransaction); +struct TxData { + executable: ExecutableAccountTx, + internal: InternalConsensusTransaction, + should_revert: bool, +} /// ID of the current blobs file. fn current_generation() -> usize { @@ -249,7 +253,7 @@ struct BlobFactory { blocks: Vec, // Transactions for the next block. - next_txs: Vec, + next_txs: Vec, // Context. nonce_manager: NonceManager, @@ -310,11 +314,18 @@ impl BlobFactory { .unwrap(); let mut transactions_with_receipts = Vec::new(); // Consume the transactions list (next block starts empty). - for (executable, internal) in std::mem::take(&mut self.next_txs).into_iter() { + for TxData { executable, internal, should_revert } in + std::mem::take(&mut self.next_txs).into_iter() + { let (execution_info, _state_changes) = executor .execute(&BlockifierTx::new_for_sequencing(ExecutableTx::Account(executable))) .unwrap(); - assert!(!execution_info.is_reverted(), "Got a reverted tx: {execution_info:?}"); + assert_eq!( + execution_info.is_reverted(), + should_revert, + "Execution result does not match expected (should_revert={should_revert}): \ + {execution_info:?}" + ); transactions_with_receipts .push(InternalTransactionWithReceipt { transaction: internal, execution_info }); @@ -511,7 +522,11 @@ impl BlobFactory { .returning(move |_| Ok(Some(contract.get_class()))); // Return the transactions. - self.next_txs.push((executable.into(), internal_tx)); + self.next_txs.push(TxData { + executable: executable.into(), + internal: internal_tx, + should_revert: false, + }); } fn make_free_deploy_account_tx(&mut self, account: FeatureContract) -> ContractAddress { @@ -563,7 +578,11 @@ impl BlobFactory { tx: without_hash, tx_hash, }); - self.next_txs.push((executable.into(), internal)); + self.next_txs.push(TxData { + executable: executable.into(), + internal, + should_revert: false, + }); contract_address } @@ -573,6 +592,7 @@ impl BlobFactory { function_name: &str, calldata: &[Felt], with_fee_charge: bool, + should_revert: bool, ) { let nonce = self.nonce_manager.next(*OPERATOR_ADDRESS); let resource_bounds = if with_fee_charge { @@ -608,7 +628,7 @@ impl BlobFactory { tx: without_hash, tx_hash, }); - self.next_txs.push((executable.into(), internal)); + self.next_txs.push(TxData { executable: executable.into(), internal, should_revert }); } fn make_operator_deploy_tx( @@ -637,6 +657,7 @@ impl BlobFactory { "deploy_contract", &calldata, with_fee_charge, + false, // should not revert ); contract_address } @@ -664,7 +685,7 @@ impl BlobFactory { /// no commitment is computed. fn make_preconfirmed_block_from_remaining_txs( block_context: BlockContext, - txs: Vec, + txs: Vec, mut state: DictStateReader, ) -> CendeWritePreconfirmedBlock { let block_info = block_context.block_info().clone(); @@ -672,7 +693,9 @@ impl BlobFactory { let mut transaction_receipts = vec![]; let mut transaction_state_diffs = vec![]; - for (tx_index, (executable, internal)) in txs.into_iter().enumerate() { + for (tx_index, TxData { executable, internal, should_revert }) in + txs.into_iter().enumerate() + { let tx_hash = match &internal { InternalConsensusTransaction::RpcTransaction(tx) => tx.tx_hash, InternalConsensusTransaction::L1Handler(_) => { @@ -684,6 +707,12 @@ impl BlobFactory { let execution_info = BlockifierAccountTx::new_for_sequencing(executable) .execute(&mut tx_state, &block_context) .unwrap(); + assert_eq!( + execution_info.is_reverted(), + should_revert, + "Execution result does not match expected (should_revert={should_revert}): \ + {execution_info:?}" + ); let state_changes = tx_state.to_state_diff().unwrap();