diff --git a/crates/blockifier/src/concurrency/fee_utils.rs b/crates/blockifier/src/concurrency/fee_utils.rs index e40f492319..f31d134708 100644 --- a/crates/blockifier/src/concurrency/fee_utils.rs +++ b/crates/blockifier/src/concurrency/fee_utils.rs @@ -56,11 +56,9 @@ pub fn complete_fee_transfer_flow( sequencer_balance, ); } else { - assert_eq!( - tx_execution_info.receipt.fee, - Fee(0), - "Transaction with no fee transfer info must have zero fee." - ) + // Assumes we set the charge fee flag to the transaction enforce fee value. + let charge_fee = tx_context.tx_info.enforce_fee(); + assert!(!charge_fee, "Transaction with no fee transfer info must not enforce a fee charge.") } } diff --git a/crates/blockifier/src/fee/receipt.rs b/crates/blockifier/src/fee/receipt.rs index 28e630b73f..5720417d50 100644 --- a/crates/blockifier/src/fee/receipt.rs +++ b/crates/blockifier/src/fee/receipt.rs @@ -93,13 +93,13 @@ impl TransactionReceipt { tx_context.block_context.block_info.use_kzg_da, &tx_context.get_gas_vector_computation_mode(), ); - - // L1 handler transactions are not charged an L2 fee but it is compared to the L1 fee. - let fee = if tx_context.tx_info.enforce_fee() || tx_type == TransactionType::L1Handler { - tx_context.tx_info.get_fee_by_gas_vector(&tx_context.block_context.block_info, gas) - } else { + // Backward-compatibility. + let fee = if tx_type == TransactionType::Declare && tx_context.tx_info.is_v0() { Fee(0) + } else { + tx_context.tx_info.get_fee_by_gas_vector(&tx_context.block_context.block_info, gas) }; + let da_gas = tx_resources .starknet_resources .state diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 8d377e80c7..a2bf6240cc 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -72,6 +72,7 @@ use crate::transaction::constants::TRANSFER_ENTRY_POINT_NAME; use crate::transaction::objects::{FeeType, HasRelatedFeeType, TransactionInfoCreator}; use crate::transaction::test_utils::{ account_invoke_tx, + all_resource_bounds, block_context, calculate_class_info_for_testing, create_account_tx_for_validate_test_nonce_0, @@ -557,6 +558,7 @@ fn test_recursion_depth_exceeded( fn test_revert_invoke( block_context: BlockContext, max_fee: Fee, + all_resource_bounds: ValidResourceBounds, #[case] transaction_version: TransactionVersion, #[case] fee_type: FeeType, ) { @@ -575,6 +577,7 @@ fn test_revert_invoke( &block_context, invoke_tx_args! { max_fee, + resource_bounds: all_resource_bounds, sender_address: account_address, calldata: create_calldata( test_contract_address, diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 1e16dffe9a..0650f87b4d 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -1371,7 +1371,6 @@ fn test_declare_tx( None, ExecutionSummary::default(), ); - let account_tx = declare_tx( declare_tx_args! { max_fee: MAX_FEE, @@ -1409,12 +1408,17 @@ fn test_declare_tx( // Build expected fee transfer call info. let expected_actual_fee = actual_execution_info.receipt.fee; - let expected_fee_transfer_call_info = expected_fee_transfer_call_info( - tx_context, - sender_address, - expected_actual_fee, - FeatureContract::ERC20(CairoVersion::Cairo0).get_class_hash(), - ); + // V0 transactions do not handle fee. + let expected_fee_transfer_call_info = if tx_version == TransactionVersion::ZERO { + None + } else { + expected_fee_transfer_call_info( + tx_context, + sender_address, + expected_actual_fee, + FeatureContract::ERC20(CairoVersion::Cairo0).get_class_hash(), + ) + }; let da_gas = starknet_resources.state.to_gas_vector(use_kzg_da); let expected_cairo_resources = get_expected_cairo_resources(