Skip to content

Commit

Permalink
test(blockifier): execute_directly wih v3 invoke instead of deprecated (
Browse files Browse the repository at this point in the history
  • Loading branch information
TzahiTaub authored Nov 6, 2024
1 parent 48bfb45 commit a9f3df7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/blockifier/src/test_utils/struct_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<CallInfo> {
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,
)
Expand Down
13 changes: 13 additions & 0 deletions crates/blockifier/src/transaction/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit a9f3df7

Please sign in to comment.