From a9f3df7ea81168bafff90d318534df5c6d728fa2 Mon Sep 17 00:00:00 2001 From: Tzahi Date: Wed, 6 Nov 2024 08:25:36 +0200 Subject: [PATCH] test(blockifier): execute_directly wih v3 invoke instead of deprecated (#1770) --- crates/blockifier/src/test_utils/struct_impls.rs | 12 ++++++++---- crates/blockifier/src/transaction/objects.rs | 13 +++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/blockifier/src/test_utils/struct_impls.rs b/crates/blockifier/src/test_utils/struct_impls.rs index 5c5ba7882b..2f37bc4be1 100644 --- a/crates/blockifier/src/test_utils/struct_impls.rs +++ b/crates/blockifier/src/test_utils/struct_impls.rs @@ -33,7 +33,11 @@ use crate::test_utils::{ TEST_ERC20_CONTRACT_ADDRESS2, TEST_SEQUENCER_ADDRESS, }; -use crate::transaction::objects::{DeprecatedTransactionInfo, TransactionInfo}; +use crate::transaction::objects::{ + CurrentTransactionInfo, + DeprecatedTransactionInfo, + TransactionInfo, +}; use crate::versioned_constants::{ GasCosts, OsConstants, @@ -45,11 +49,11 @@ impl CallEntryPoint { /// Executes the call directly, without account context. Limits the number of steps by resource /// bounds. pub fn execute_directly(self, state: &mut dyn State) -> EntryPointExecutionResult { - let limit_steps_by_resources = false; // Do not limit steps by resources as we use default reasources. + // Do not limit steps by resources as we use default resources. + let limit_steps_by_resources = false; self.execute_directly_given_tx_info( state, - // TODO(Yoni, 1/12/2024): change the default to V3. - TransactionInfo::Deprecated(DeprecatedTransactionInfo::default()), + TransactionInfo::Current(CurrentTransactionInfo::create_for_testing()), limit_steps_by_resources, ExecutionMode::Execute, ) diff --git a/crates/blockifier/src/transaction/objects.rs b/crates/blockifier/src/transaction/objects.rs index f3a7ed7cf4..aec7f63f59 100644 --- a/crates/blockifier/src/transaction/objects.rs +++ b/crates/blockifier/src/transaction/objects.rs @@ -118,6 +118,19 @@ impl CurrentTransactionInfo { ValidResourceBounds::AllResources(AllResourceBounds { l1_gas, .. }) => l1_gas, } } + + #[cfg(any(test, feature = "testing"))] + pub fn create_for_testing() -> Self { + Self { + common_fields: CommonAccountFields::default(), + resource_bounds: ValidResourceBounds::create_for_testing_no_fee_enforcement(), + tip: Tip::default(), + nonce_data_availability_mode: DataAvailabilityMode::L2, + fee_data_availability_mode: DataAvailabilityMode::L2, + paymaster_data: PaymasterData::default(), + account_deployment_data: AccountDeploymentData::default(), + } + } } #[derive(Clone, Debug, Default, Eq, PartialEq)]