Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(blockifier): execute_directly with v3 invoke instead of deprecated #1770

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading