From bec5223fd3086c01bf28992c1765e67ee4796c2e Mon Sep 17 00:00:00 2001 From: Aviv Greenburg Date: Thu, 28 Nov 2024 17:31:36 +0200 Subject: [PATCH] chore(blockifier): add struct ExecutionFlags to AccountTransaction --- .../blockifier/transaction_executor_test.rs | 3 ++ .../src/concurrency/versioned_state_test.rs | 5 ++- .../src/concurrency/worker_logic_test.rs | 3 +- crates/blockifier/src/test_utils/declare.rs | 10 +++-- .../src/test_utils/deploy_account.rs | 5 ++- crates/blockifier/src/test_utils/invoke.rs | 7 ++-- .../src/test_utils/transfers_generator.rs | 19 ++++++---- .../src/transaction/account_transaction.rs | 19 +++++++--- .../transaction/account_transactions_test.rs | 13 ++++++- .../blockifier/src/transaction/test_utils.rs | 31 ++++++++++------ .../src/transaction/transaction_execution.rs | 24 ++++++++++-- .../src/transaction/transactions_test.rs | 37 +++++++++++++------ .../native_blockifier/src/py_transaction.rs | 8 ++-- crates/starknet_batcher/src/block_builder.rs | 4 +- .../src/stateful_transaction_validator.rs | 7 +++- 15 files changed, 133 insertions(+), 62 deletions(-) diff --git a/crates/blockifier/src/blockifier/transaction_executor_test.rs b/crates/blockifier/src/blockifier/transaction_executor_test.rs index 3089818a87f..1ca67c1dde8 100644 --- a/crates/blockifier/src/blockifier/transaction_executor_test.rs +++ b/crates/blockifier/src/blockifier/transaction_executor_test.rs @@ -29,6 +29,7 @@ use crate::test_utils::{ BALANCE, DEFAULT_STRK_L1_GAS_PRICE, }; +use crate::transaction::account_transaction::ExecutionFlags; use crate::transaction::errors::TransactionExecutionError; use crate::transaction::test_utils::{ account_invoke_tx, @@ -129,6 +130,7 @@ fn test_declare( resource_bounds: l1_resource_bounds(0_u8.into(), DEFAULT_STRK_L1_GAS_PRICE.into()), }, calculate_class_info_for_testing(declared_contract.get_class()), + ExecutionFlags::default(), ) .into(); tx_executor_test_body(state, block_context, tx, expected_bouncer_weights); @@ -150,6 +152,7 @@ fn test_deploy_account( version, }, &mut NonceManager::default(), + ExecutionFlags::default(), ) .into(); let expected_bouncer_weights = BouncerWeights { diff --git a/crates/blockifier/src/concurrency/versioned_state_test.rs b/crates/blockifier/src/concurrency/versioned_state_test.rs index c817263ddc2..5566d7546c3 100644 --- a/crates/blockifier/src/concurrency/versioned_state_test.rs +++ b/crates/blockifier/src/concurrency/versioned_state_test.rs @@ -44,6 +44,7 @@ use crate::test_utils::deploy_account::deploy_account_tx; use crate::test_utils::dict_state_reader::DictStateReader; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::{CairoVersion, BALANCE, DEFAULT_STRK_L1_GAS_PRICE}; +use crate::transaction::account_transaction::ExecutionFlags; use crate::transaction::objects::HasRelatedFeeType; use crate::transaction::test_utils::{default_all_resource_bounds, l1_resource_bounds}; use crate::transaction::transactions::ExecutableTransaction; @@ -234,6 +235,7 @@ fn test_run_parallel_txs(default_all_resource_bounds: ValidResourceBounds) { ), }, &mut NonceManager::default(), + ExecutionFlags::default(), ); let enforce_fee = deploy_account_tx_1.enforce_fee(); @@ -247,7 +249,8 @@ fn test_run_parallel_txs(default_all_resource_bounds: ValidResourceBounds) { constructor_calldata: constructor_calldata.clone(), }; let nonce_manager = &mut NonceManager::default(); - let delpoy_account_tx_2 = deploy_account_tx(deploy_tx_args, nonce_manager); + let delpoy_account_tx_2 = + deploy_account_tx(deploy_tx_args, nonce_manager, ExecutionFlags::default()); let account_address = delpoy_account_tx_2.sender_address(); let tx_context = block_context.to_tx_context(&delpoy_account_tx_2); let fee_type = tx_context.tx_info.fee_type(); diff --git a/crates/blockifier/src/concurrency/worker_logic_test.rs b/crates/blockifier/src/concurrency/worker_logic_test.rs index 057d4bafab5..c27e5b0fdb5 100644 --- a/crates/blockifier/src/concurrency/worker_logic_test.rs +++ b/crates/blockifier/src/concurrency/worker_logic_test.rs @@ -32,7 +32,7 @@ use crate::test_utils::{ BALANCE, TEST_ERC20_CONTRACT_ADDRESS2, }; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use crate::transaction::objects::HasRelatedFeeType; use crate::transaction::test_utils::{ account_invoke_tx, @@ -560,6 +560,7 @@ fn test_deploy_before_declare( nonce: nonce!(0_u8), }, test_class_info.clone(), + ExecutionFlags::default(), ); // Deploy test contract. diff --git a/crates/blockifier/src/test_utils/declare.rs b/crates/blockifier/src/test_utils/declare.rs index 5ac24e5b49c..e34867b6aa2 100644 --- a/crates/blockifier/src/test_utils/declare.rs +++ b/crates/blockifier/src/test_utils/declare.rs @@ -2,10 +2,14 @@ use starknet_api::contract_class::ClassInfo; use starknet_api::executable_transaction::AccountTransaction as ExecutableTransaction; use starknet_api::test_utils::declare::{executable_declare_tx, DeclareTxArgs}; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; -pub fn declare_tx(declare_tx_args: DeclareTxArgs, class_info: ClassInfo) -> AccountTransaction { +pub fn declare_tx( + declare_tx_args: DeclareTxArgs, + class_info: ClassInfo, + execution_flags: ExecutionFlags, +) -> AccountTransaction { let declare_tx = executable_declare_tx(declare_tx_args, class_info); - AccountTransaction { tx: ExecutableTransaction::Declare(declare_tx), only_query: false } + AccountTransaction { tx: ExecutableTransaction::Declare(declare_tx), execution_flags } } diff --git a/crates/blockifier/src/test_utils/deploy_account.rs b/crates/blockifier/src/test_utils/deploy_account.rs index 1e40d4e188e..77cea652827 100644 --- a/crates/blockifier/src/test_utils/deploy_account.rs +++ b/crates/blockifier/src/test_utils/deploy_account.rs @@ -2,16 +2,17 @@ use starknet_api::executable_transaction::AccountTransaction as ExecutableTransa use starknet_api::test_utils::deploy_account::{executable_deploy_account_tx, DeployAccountTxArgs}; use starknet_api::test_utils::NonceManager; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; pub fn deploy_account_tx( deploy_tx_args: DeployAccountTxArgs, nonce_manager: &mut NonceManager, + execution_flags: ExecutionFlags, ) -> AccountTransaction { let deploy_account_tx = executable_deploy_account_tx(deploy_tx_args, nonce_manager); AccountTransaction { tx: ExecutableTransaction::DeployAccount(deploy_account_tx), - only_query: false, + execution_flags, } } diff --git a/crates/blockifier/src/test_utils/invoke.rs b/crates/blockifier/src/test_utils/invoke.rs index b4e4b3a530e..bc462e77411 100644 --- a/crates/blockifier/src/test_utils/invoke.rs +++ b/crates/blockifier/src/test_utils/invoke.rs @@ -1,11 +1,10 @@ use starknet_api::executable_transaction::AccountTransaction as ExecutableTransaction; use starknet_api::test_utils::invoke::{executable_invoke_tx, InvokeTxArgs}; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; -pub fn invoke_tx(invoke_args: InvokeTxArgs) -> AccountTransaction { - let only_query = invoke_args.only_query; +pub fn invoke_tx(invoke_args: InvokeTxArgs, execution_flags: ExecutionFlags) -> AccountTransaction { let invoke_tx = ExecutableTransaction::Invoke(executable_invoke_tx(invoke_args)); - AccountTransaction { tx: invoke_tx, only_query } + AccountTransaction { tx: invoke_tx, execution_flags } } diff --git a/crates/blockifier/src/test_utils/transfers_generator.rs b/crates/blockifier/src/test_utils/transfers_generator.rs index 0915dc82f1b..96cc0a44b16 100644 --- a/crates/blockifier/src/test_utils/transfers_generator.rs +++ b/crates/blockifier/src/test_utils/transfers_generator.rs @@ -17,7 +17,7 @@ use crate::test_utils::dict_state_reader::DictStateReader; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::invoke::invoke_tx; use crate::test_utils::{CairoVersion, BALANCE, MAX_FEE}; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use crate::transaction::transaction_execution::Transaction; const N_ACCOUNTS: u16 = 10000; @@ -180,13 +180,16 @@ impl TransfersGenerator { felt!(0_u8) // Calldata: msb amount. ]; - invoke_tx(invoke_tx_args! { - max_fee: self.config.max_fee, - sender_address, - calldata: execute_calldata, - version: self.config.tx_version, - nonce, - }) + invoke_tx( + invoke_tx_args! { + max_fee: self.config.max_fee, + sender_address, + calldata: execute_calldata, + version: self.config.tx_version, + nonce, + }, + ExecutionFlags::default(), + ) } } diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 2c06fda9638..0c187132c65 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -61,7 +61,7 @@ use crate::transaction::transaction_types::TransactionType; use crate::transaction::transactions::{ Executable, ExecutableTransaction, - ExecutionFlags, + ExecutionFlags as TransactionExecutionFlags, ValidatableTransaction, }; @@ -77,11 +77,18 @@ mod flavors_test; #[path = "post_execution_test.rs"] mod post_execution_test; +#[derive(Clone, Debug, Default, derive_more::From)] +pub struct ExecutionFlags { + pub only_query: bool, + pub charge_fee: bool, + pub skip_validate: bool, +} + /// Represents a paid Starknet transaction. #[derive(Clone, Debug, derive_more::From)] pub struct AccountTransaction { pub tx: Transaction, - pub only_query: bool, + pub execution_flags: ExecutionFlags, } // TODO(AvivG): create additional macro that returns a reference. macro_rules! implement_tx_getter_calls { @@ -708,7 +715,7 @@ impl ExecutableTransaction for AccountTransaction { &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, - execution_flags: ExecutionFlags, + execution_flags: TransactionExecutionFlags, ) -> TransactionExecutionResult { let tx_context = Arc::new(block_context.to_tx_context(self)); self.verify_tx_version(tx_context.tx_info.version())?; @@ -769,9 +776,9 @@ impl ExecutableTransaction for AccountTransaction { impl TransactionInfoCreator for AccountTransaction { fn create_tx_info(&self) -> TransactionInfo { match &self.tx { - Transaction::Declare(tx) => tx.create_tx_info(self.only_query), - Transaction::DeployAccount(tx) => tx.create_tx_info(self.only_query), - Transaction::Invoke(tx) => tx.create_tx_info(self.only_query), + Transaction::Declare(tx) => tx.create_tx_info(self.execution_flags.only_query), + Transaction::DeployAccount(tx) => tx.create_tx_info(self.execution_flags.only_query), + Transaction::Invoke(tx) => tx.create_tx_info(self.execution_flags.only_query), } } } diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index b7eca58eaf5..b768f2a911b 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -83,7 +83,10 @@ use crate::test_utils::{ DEFAULT_STRK_L2_GAS_PRICE, MAX_FEE, }; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{ + AccountTransaction, + ExecutionFlags as AccountExecutionFlags, +}; use crate::transaction::objects::{HasRelatedFeeType, TransactionInfoCreator}; use crate::transaction::test_utils::{ account_invoke_tx, @@ -211,6 +214,7 @@ fn test_fee_enforcement( version, }, &mut NonceManager::default(), + AccountExecutionFlags::default(), ); let enforce_fee = deploy_account_tx.enforce_fee(); @@ -459,6 +463,7 @@ fn test_max_fee_limit_validate( nonce: nonce_manager.next(account_address), }, class_info, + AccountExecutionFlags::default(), ); account_tx.execute(&mut state, &block_context, true, true).unwrap(); @@ -782,7 +787,11 @@ fn test_fail_declare(block_context: BlockContext, max_fee: Fee) { }; let declare_account_tx = AccountTransaction { tx: ApiExecutableTransaction::Declare(executable_declare), - only_query: false, + execution_flags: AccountExecutionFlags { + only_query: false, + charge_fee: false, + skip_validate: false, + }, }; // Fail execution, assert nonce and balance are unchanged. diff --git a/crates/blockifier/src/transaction/test_utils.rs b/crates/blockifier/src/transaction/test_utils.rs index 36757124a48..d44b73c4388 100644 --- a/crates/blockifier/src/transaction/test_utils.rs +++ b/crates/blockifier/src/transaction/test_utils.rs @@ -42,7 +42,7 @@ use crate::test_utils::{ DEFAULT_STRK_L2_GAS_PRICE, MAX_FEE, }; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use crate::transaction::objects::{TransactionExecutionInfo, TransactionExecutionResult}; use crate::transaction::transaction_types::TransactionType; use crate::transaction::transactions::ExecutableTransaction; @@ -113,7 +113,8 @@ pub fn deploy_and_fund_account( deploy_tx_args: DeployAccountTxArgs, ) -> (AccountTransaction, ContractAddress) { // Deploy an account contract. - let deploy_account_tx = deploy_account_tx(deploy_tx_args, nonce_manager); + let deploy_account_tx = + deploy_account_tx(deploy_tx_args, nonce_manager, ExecutionFlags::default()); let account_address = deploy_account_tx.sender_address(); // Update the balance of the about-to-be deployed account contract in the erc20 contract, so it @@ -247,6 +248,7 @@ pub fn create_account_tx_for_validate_test( compiled_class_hash: declared_contract.get_compiled_class_hash(), }, class_info, + ExecutionFlags::default(), ) } TransactionType::DeployAccount => { @@ -267,26 +269,31 @@ pub fn create_account_tx_for_validate_test( constructor_calldata, }, nonce_manager, + ExecutionFlags::default(), ) } TransactionType::InvokeFunction => { let execute_calldata = create_calldata(sender_address, "foo", &[]); - invoke_tx(invoke_tx_args! { - max_fee, - resource_bounds, - signature, - sender_address, - calldata: execute_calldata, - version: tx_version, - nonce: nonce_manager.next(sender_address), - }) + invoke_tx( + invoke_tx_args! { + max_fee, + resource_bounds, + signature, + sender_address, + calldata: execute_calldata, + version: tx_version, + nonce: nonce_manager.next(sender_address), + }, + ExecutionFlags::default(), + ) } _ => panic!("{tx_type:?} is not an account transaction."), } } pub fn account_invoke_tx(invoke_args: InvokeTxArgs) -> AccountTransaction { - invoke_tx(invoke_args) + let only_query = invoke_args.only_query; + invoke_tx(invoke_args, ExecutionFlags { only_query, charge_fee: false, skip_validate: false }) } pub fn run_invoke_tx( diff --git a/crates/blockifier/src/transaction/transaction_execution.rs b/crates/blockifier/src/transaction/transaction_execution.rs index d305e0bdb8b..ac44b5bd76c 100644 --- a/crates/blockifier/src/transaction/transaction_execution.rs +++ b/crates/blockifier/src/transaction/transaction_execution.rs @@ -19,7 +19,10 @@ use crate::execution::entry_point::EntryPointExecutionContext; use crate::fee::receipt::TransactionReceipt; use crate::state::cached_state::TransactionalState; use crate::state::state_api::UpdatableState; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{ + AccountTransaction, + ExecutionFlags as AccountExecutionFlags, +}; use crate::transaction::errors::TransactionFeeError; use crate::transaction::objects::{ TransactionExecutionInfo, @@ -40,7 +43,14 @@ impl From for Transaction { fn from(value: starknet_api::executable_transaction::Transaction) -> Self { match value { starknet_api::executable_transaction::Transaction::Account(tx) => { - Transaction::Account(AccountTransaction { tx, only_query: false }) + Transaction::Account(AccountTransaction { + tx, + execution_flags: AccountExecutionFlags { + only_query: false, + charge_fee: false, + skip_validate: false, + }, + }) } starknet_api::executable_transaction::Transaction::L1Handler(tx) => { Transaction::L1Handler(tx) @@ -119,7 +129,15 @@ impl Transaction { } _ => unimplemented!(), }; - Ok(AccountTransaction { tx: executable_tx, only_query }.into()) + Ok(AccountTransaction { + tx: executable_tx, + execution_flags: AccountExecutionFlags { + only_query, + charge_fee: false, + skip_validate: false, + }, + } + .into()) } } diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 5933e4b0768..728052bc121 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -116,7 +116,7 @@ use crate::test_utils::{ MAX_FEE, TEST_SEQUENCER_ADDRESS, }; -use crate::transaction::account_transaction::AccountTransaction; +use crate::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use crate::transaction::errors::{ TransactionExecutionError, TransactionFeeError, @@ -449,11 +449,14 @@ fn test_invoke_tx( let test_contract_address = test_contract.get_instance_address(0); let account_contract_address = account_contract.get_instance_address(0); let calldata = create_trivial_calldata(test_contract_address); - let invoke_tx = invoke_tx(invoke_tx_args! { - sender_address: account_contract_address, - calldata: Calldata(Arc::clone(&calldata.0)), - resource_bounds, - }); + let invoke_tx = invoke_tx( + invoke_tx_args! { + sender_address: account_contract_address, + calldata: Calldata(Arc::clone(&calldata.0)), + resource_bounds, + }, + ExecutionFlags::default(), + ); // Extract invoke transaction fields for testing, as it is consumed when creating an account // transaction. @@ -973,6 +976,7 @@ fn test_max_fee_exceeds_balance( class_hash: test_contract.get_class_hash() }, &mut NonceManager::default(), + ExecutionFlags::default(), ); assert_resource_bounds_exceed_balance_failure(state, block_context, invalid_tx); @@ -1005,6 +1009,7 @@ fn test_max_fee_exceeds_balance( resource_bounds: $invalid_resource_bounds, }, class_info, + ExecutionFlags::default(), ); assert_resource_bounds_exceed_balance_failure(state, block_context, invalid_tx); }; @@ -1518,6 +1523,7 @@ fn test_declare_tx( nonce: nonce_manager.next(sender_address), }, class_info.clone(), + ExecutionFlags::default(), ); // Check state before transaction application. @@ -1639,6 +1645,7 @@ fn test_declare_tx( nonce: nonce_manager.next(sender_address), }, class_info.clone(), + ExecutionFlags::default(), ); let result = account_tx2.execute(state, block_context, true, true); assert_matches!( @@ -1673,6 +1680,7 @@ fn test_declare_tx_v0(default_l1_resource_bounds: ValidResourceBounds) { nonce: nonce_manager.next(sender_address), }, class_info.clone(), + ExecutionFlags::default(), ); let actual_execution_info = account_tx.execute(state, block_context, false, true).unwrap(); // fee not charged for declare v0. @@ -1700,6 +1708,7 @@ fn test_deploy_account_tx( class_hash: account_class_hash }, &mut nonce_manager, + ExecutionFlags::default(), ); // Extract deploy account transaction fields for testing, as it is consumed when creating an @@ -1857,6 +1866,7 @@ fn test_deploy_account_tx( class_hash: account_class_hash }, &mut nonce_manager, + ExecutionFlags::default(), ); let error = deploy_account.execute(state, block_context, true, true).unwrap_err(); assert_matches!( @@ -1887,6 +1897,7 @@ fn test_fail_deploy_account_undeclared_class_hash( resource_bounds: default_all_resource_bounds, class_hash: undeclared_hash }, &mut nonce_manager, + ExecutionFlags::default(), ); let tx_context = block_context.to_tx_context(&deploy_account); let fee_type = tx_context.tx_info.fee_type(); @@ -2226,12 +2237,14 @@ fn test_only_query_flag( .concat() .into(), ); - let invoke_tx = crate::test_utils::invoke::invoke_tx(invoke_tx_args! { - calldata: execute_calldata, - resource_bounds: default_all_resource_bounds, - sender_address, - only_query, - }); + let invoke_tx = crate::test_utils::invoke::invoke_tx( + invoke_tx_args! { + calldata: execute_calldata, + resource_bounds: default_all_resource_bounds, + sender_address, + }, + ExecutionFlags { only_query, charge_fee: false, skip_validate: false }, + ); let tx_execution_info = invoke_tx.execute(state, block_context, true, true).unwrap(); assert_eq!(tx_execution_info.revert_error, None); diff --git a/crates/native_blockifier/src/py_transaction.rs b/crates/native_blockifier/src/py_transaction.rs index d012c0fa164..6753e2355d0 100644 --- a/crates/native_blockifier/src/py_transaction.rs +++ b/crates/native_blockifier/src/py_transaction.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use blockifier::transaction::account_transaction::AccountTransaction; +use blockifier::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use blockifier::transaction::transaction_execution::Transaction; use blockifier::transaction::transaction_types::TransactionType; use pyo3::exceptions::PyValueError; @@ -140,18 +140,18 @@ pub fn py_tx( .expect("A class info must be passed in a Declare transaction."); AccountTransaction { tx: ExecutableTransaction::Declare(py_declare(tx, non_optional_py_class_info)?), - only_query: false, + execution_flags: ExecutionFlags::default(), } .into() } TransactionType::DeployAccount => AccountTransaction { tx: ExecutableTransaction::DeployAccount(py_deploy_account(tx)?), - only_query: false, + execution_flags: ExecutionFlags::default(), } .into(), TransactionType::InvokeFunction => AccountTransaction { tx: ExecutableTransaction::Invoke(py_invoke_function(tx)?), - only_query: false, + execution_flags: ExecutionFlags::default(), } .into(), TransactionType::L1Handler => py_l1_handler(tx)?.into(), diff --git a/crates/starknet_batcher/src/block_builder.rs b/crates/starknet_batcher/src/block_builder.rs index c503dfae29a..cdd8cd2fd70 100644 --- a/crates/starknet_batcher/src/block_builder.rs +++ b/crates/starknet_batcher/src/block_builder.rs @@ -15,7 +15,7 @@ use blockifier::execution::contract_class::RunnableCompiledClass; use blockifier::state::cached_state::CommitmentStateDiff; use blockifier::state::errors::StateError; use blockifier::state::global_cache::GlobalContractCache; -use blockifier::transaction::account_transaction::AccountTransaction; +use blockifier::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use blockifier::transaction::objects::TransactionExecutionInfo; use blockifier::transaction::transaction_execution::Transaction as BlockifierTransaction; use blockifier::versioned_constants::{VersionedConstants, VersionedConstantsOverrides}; @@ -166,7 +166,7 @@ impl BlockBuilderTrait for BlockBuilder { BlockifierTransaction::Account(AccountTransaction { // TODO(yair): Avoid this clone. tx: account_tx.clone(), - only_query: false, + execution_flags: ExecutionFlags::default(), }) } Transaction::L1Handler(l1_handler_tx) => { diff --git a/crates/starknet_gateway/src/stateful_transaction_validator.rs b/crates/starknet_gateway/src/stateful_transaction_validator.rs index 0674b8cd4bf..6e0549e50dc 100644 --- a/crates/starknet_gateway/src/stateful_transaction_validator.rs +++ b/crates/starknet_gateway/src/stateful_transaction_validator.rs @@ -5,7 +5,7 @@ use blockifier::blockifier::stateful_validator::{ use blockifier::bouncer::BouncerConfig; use blockifier::context::{BlockContext, ChainInfo}; use blockifier::state::cached_state::CachedState; -use blockifier::transaction::account_transaction::AccountTransaction; +use blockifier::transaction::account_transaction::{AccountTransaction, ExecutionFlags}; use blockifier::versioned_constants::VersionedConstants; #[cfg(test)] use mockall::automock; @@ -75,7 +75,10 @@ impl StatefulTransactionValidator { mut validator: V, ) -> StatefulTransactionValidatorResult<()> { let skip_validate = skip_stateful_validations(executable_tx, account_nonce); - let account_tx = AccountTransaction { tx: executable_tx.clone(), only_query: false }; + let account_tx = AccountTransaction { + tx: executable_tx.clone(), + execution_flags: ExecutionFlags::default(), + }; validator .validate(account_tx, skip_validate) .map_err(|err| GatewaySpecError::ValidationFailure { data: err.to_string() })?;