diff --git a/crates/blockifier/src/blockifier/transaction_executor.rs b/crates/blockifier/src/blockifier/transaction_executor.rs index f693daf8ff..bec2bd5b8c 100644 --- a/crates/blockifier/src/blockifier/transaction_executor.rs +++ b/crates/blockifier/src/blockifier/transaction_executor.rs @@ -19,7 +19,7 @@ use crate::state::state_api::{StateReader, StateResult}; use crate::transaction::errors::TransactionExecutionError; use crate::transaction::objects::TransactionExecutionInfo; use crate::transaction::transaction_execution::Transaction; -use crate::transaction::transactions::{ExecutableTransaction, ExecutionFlags}; +use crate::transaction::transactions::ExecutableTransaction; #[cfg(test)] #[path = "transaction_executor_test.rs"] @@ -102,9 +102,9 @@ impl TransactionExecutor { ); // Executing a single transaction cannot be done in a concurrent mode. - let execution_flags = ExecutionFlags { concurrency_mode: false }; + let concurrency_mode = false; let tx_execution_result = - tx.execute_raw(&mut transactional_state, &self.block_context, execution_flags); + tx.execute_raw(&mut transactional_state, &self.block_context, concurrency_mode); match tx_execution_result { Ok(tx_execution_info) => { let tx_state_changes_keys = diff --git a/crates/blockifier/src/concurrency/test_utils.rs b/crates/blockifier/src/concurrency/test_utils.rs index a14e96de6f..fa18a9f32f 100644 --- a/crates/blockifier/src/concurrency/test_utils.rs +++ b/crates/blockifier/src/concurrency/test_utils.rs @@ -9,7 +9,7 @@ use crate::state::cached_state::{CachedState, TransactionalState}; use crate::state::state_api::StateReader; use crate::test_utils::dict_state_reader::DictStateReader; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::transactions::{ExecutableTransaction, ExecutionFlags}; +use crate::transaction::transactions::ExecutableTransaction; // Public Consts. @@ -76,9 +76,8 @@ pub fn create_fee_transfer_call_info( ) -> CallInfo { let block_context = BlockContext::create_for_account_testing(); let mut transactional_state = TransactionalState::create_transactional(state); - let execution_flags = ExecutionFlags { concurrency_mode }; let execution_info = - account_tx.execute_raw(&mut transactional_state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut transactional_state, &block_context, concurrency_mode).unwrap(); let execution_info = execution_info.fee_transfer_call_info.unwrap(); transactional_state.abort(); diff --git a/crates/blockifier/src/concurrency/worker_logic.rs b/crates/blockifier/src/concurrency/worker_logic.rs index dee56aa6aa..851a462f31 100644 --- a/crates/blockifier/src/concurrency/worker_logic.rs +++ b/crates/blockifier/src/concurrency/worker_logic.rs @@ -19,7 +19,7 @@ use crate::state::cached_state::{ContractClassMapping, StateMaps, TransactionalS use crate::state::state_api::{StateReader, UpdatableState}; use crate::transaction::objects::{TransactionExecutionInfo, TransactionExecutionResult}; use crate::transaction::transaction_execution::Transaction; -use crate::transaction::transactions::{ExecutableTransaction, ExecutionFlags}; +use crate::transaction::transactions::ExecutableTransaction; #[cfg(test)] #[path = "worker_logic_test.rs"] @@ -125,9 +125,9 @@ impl<'a, S: StateReader> WorkerExecutor<'a, S> { let tx = &self.chunk[tx_index]; let mut transactional_state = TransactionalState::create_transactional(&mut tx_versioned_state); - let execution_flags = ExecutionFlags { concurrency_mode: true }; + let concurrency_mode = true; let execution_result = - tx.execute_raw(&mut transactional_state, self.block_context, execution_flags); + tx.execute_raw(&mut transactional_state, self.block_context, concurrency_mode); // Update the versioned state and store the transaction execution output. let execution_output_inner = match execution_result { diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 651d950822..9e0538e4a7 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -62,7 +62,6 @@ use crate::transaction::transactions::{ enforce_fee, Executable, ExecutableTransaction, - ExecutionFlags as TransactionExecutionFlags, ValidatableTransaction, }; @@ -735,7 +734,7 @@ impl ExecutableTransaction for AccountTransaction { &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, - execution_flags_: TransactionExecutionFlags, + concurrency_mode: bool, ) -> TransactionExecutionResult { let tx_context = Arc::new(block_context.to_tx_context(self)); self.verify_tx_version(tx_context.tx_info.version())?; @@ -777,7 +776,7 @@ impl ExecutableTransaction for AccountTransaction { final_fee, // TODO (AvivG): access execution_flags within func instead of passing them as args. self.execution_flags.charge_fee, - execution_flags_.concurrency_mode, + concurrency_mode, )?; let tx_execution_info = TransactionExecutionInfo { diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 32365b81db..7d444de7d1 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -108,7 +108,7 @@ use crate::transaction::test_utils::{ INVALID, }; use crate::transaction::transaction_types::TransactionType; -use crate::transaction::transactions::{ExecutableTransaction, ExecutionFlags}; +use crate::transaction::transactions::ExecutableTransaction; use crate::utils::u64_from_usize; #[rstest] @@ -1364,9 +1364,9 @@ fn test_count_actual_storage_changes( nonce: nonce_manager.next(account_address), }; let account_tx = account_invoke_tx(invoke_args.clone()); - let execution_flags = ExecutionFlags { concurrency_mode: false }; + let concurrency_mode = false; let execution_info = - account_tx.execute_raw(&mut state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut state, &block_context, concurrency_mode).unwrap(); let fee_1 = execution_info.receipt.fee; let state_changes_1 = state.get_actual_state_changes().unwrap(); @@ -1414,7 +1414,7 @@ fn test_count_actual_storage_changes( ..invoke_args.clone() }); let execution_info = - account_tx.execute_raw(&mut state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut state, &block_context, concurrency_mode).unwrap(); let fee_2 = execution_info.receipt.fee; let state_changes_2 = state.get_actual_state_changes().unwrap(); @@ -1455,7 +1455,7 @@ fn test_count_actual_storage_changes( ..invoke_args }); let execution_info = - account_tx.execute_raw(&mut state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut state, &block_context, concurrency_mode).unwrap(); let fee_transfer = execution_info.receipt.fee; let state_changes_transfer = state.get_actual_state_changes().unwrap(); @@ -1534,9 +1534,9 @@ fn test_concurrency_execute_fee_transfer( // Case 1: The transaction did not read form/ write to the sequenser balance before executing // fee transfer. let mut transactional_state = TransactionalState::create_transactional(state); - let execution_flags = ExecutionFlags { concurrency_mode: true }; + let concurrency_mode = true; let result = - account_tx.execute_raw(&mut transactional_state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut transactional_state, &block_context, concurrency_mode).unwrap(); assert!(!result.is_reverted()); let transactional_cache = transactional_state.cache.borrow(); for storage in [ @@ -1575,7 +1575,7 @@ fn test_concurrency_execute_fee_transfer( }); let execution_result = - account_tx.execute_raw(&mut transactional_state, &block_context, execution_flags); + account_tx.execute_raw(&mut transactional_state, &block_context, concurrency_mode); let result = execution_result.unwrap(); assert!(!result.is_reverted()); // Check that the sequencer balance was not updated. @@ -1629,9 +1629,9 @@ fn test_concurrent_fee_transfer_when_sender_is_sequencer( let fee_token_address = block_context.chain_info.fee_token_address(fee_type); let mut transactional_state = TransactionalState::create_transactional(state); - let execution_flags = ExecutionFlags { concurrency_mode: true }; + let concurrency_mode = true; let result = - account_tx.execute_raw(&mut transactional_state, &block_context, execution_flags).unwrap(); + account_tx.execute_raw(&mut transactional_state, &block_context, concurrency_mode).unwrap(); assert!(!result.is_reverted()); // Check that the sequencer balance was updated (in this case, was not changed). for (seq_key, seq_value) in diff --git a/crates/blockifier/src/transaction/transaction_execution.rs b/crates/blockifier/src/transaction/transaction_execution.rs index d4b78de048..cf244ceeef 100644 --- a/crates/blockifier/src/transaction/transaction_execution.rs +++ b/crates/blockifier/src/transaction/transaction_execution.rs @@ -30,7 +30,7 @@ use crate::transaction::objects::{ TransactionInfo, TransactionInfoCreator, }; -use crate::transaction::transactions::{Executable, ExecutableTransaction, ExecutionFlags}; +use crate::transaction::transactions::{Executable, ExecutableTransaction}; // TODO: Move into transaction.rs, makes more sense to be defined there. #[derive(Clone, Debug, derive_more::From)] @@ -140,7 +140,7 @@ impl ExecutableTransaction for L1HandlerTransaction { &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, - _execution_flags: ExecutionFlags, + _concurrency_mode: bool, ) -> TransactionExecutionResult { let tx_context = Arc::new(block_context.to_tx_context(self)); let limit_steps_by_resources = false; @@ -188,17 +188,16 @@ impl ExecutableTransaction for Transaction { &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, - execution_flags: ExecutionFlags, + concurrency_mode: bool, ) -> TransactionExecutionResult { // TODO(Yoni, 1/8/2024): consider unimplementing the ExecutableTransaction trait for inner // types, since now running Transaction::execute_raw is not identical to // AccountTransaction::execute_raw. - let concurrency_mode = execution_flags.concurrency_mode; let tx_execution_info = match self { Self::Account(account_tx) => { - account_tx.execute_raw(state, block_context, execution_flags)? + account_tx.execute_raw(state, block_context, concurrency_mode)? } - Self::L1Handler(tx) => tx.execute_raw(state, block_context, execution_flags)?, + Self::L1Handler(tx) => tx.execute_raw(state, block_context, concurrency_mode)?, }; // Check if the transaction is too large to fit any block. diff --git a/crates/blockifier/src/transaction/transactions.rs b/crates/blockifier/src/transaction/transactions.rs index 8f30f658ff..b6cb607500 100644 --- a/crates/blockifier/src/transaction/transactions.rs +++ b/crates/blockifier/src/transaction/transactions.rs @@ -66,9 +66,9 @@ pub trait ExecutableTransaction: Sized { ) -> TransactionExecutionResult { log::debug!("Executing Transaction..."); let mut transactional_state = TransactionalState::create_transactional(state); - let execution_flags = ExecutionFlags { concurrency_mode: false }; + let concurrency_mode = false; let execution_result = - self.execute_raw(&mut transactional_state, block_context, execution_flags); + self.execute_raw(&mut transactional_state, block_context, concurrency_mode); match execution_result { Ok(value) => { @@ -92,7 +92,7 @@ pub trait ExecutableTransaction: Sized { &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, - execution_flags: ExecutionFlags, + concurrency_mode: bool, ) -> TransactionExecutionResult; }