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

chore: rename EntryPointExecutionContext::new_invoke to new_execute #220

Closed
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
4 changes: 2 additions & 2 deletions crates/blockifier/src/execution/entry_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ impl EntryPointExecutionContext {
})
}

pub fn new_validate(
pub fn new_validation(
tx_context: Arc<TransactionContext>,
limit_steps_by_resources: bool,
) -> TransactionExecutionResult<Self> {
Self::new(tx_context, ExecutionMode::Validate, limit_steps_by_resources)
}

pub fn new_invoke(
pub fn new_execution(
tx_context: Arc<TransactionContext>,
limit_steps_by_resources: bool,
) -> TransactionExecutionResult<Self> {
Expand Down
10 changes: 6 additions & 4 deletions crates/blockifier/src/test_utils/struct_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ impl CallEntryPoint {
) -> EntryPointExecutionResult<CallInfo> {
let tx_context =
TransactionContext { block_context: BlockContext::create_for_testing(), tx_info };
let mut context =
EntryPointExecutionContext::new_invoke(Arc::new(tx_context), limit_steps_by_resources)
.unwrap();
let mut context = EntryPointExecutionContext::new_execution(
Arc::new(tx_context),
limit_steps_by_resources,
)
.unwrap();
self.execute(state, &mut ExecutionResources::default(), &mut context)
}

Expand All @@ -96,7 +98,7 @@ impl CallEntryPoint {
) -> EntryPointExecutionResult<CallInfo> {
let tx_context =
TransactionContext { block_context: BlockContext::create_for_testing(), tx_info };
let mut context = EntryPointExecutionContext::new_validate(
let mut context = EntryPointExecutionContext::new_validation(
Arc::new(tx_context),
limit_steps_by_resources,
)
Expand Down
10 changes: 5 additions & 5 deletions crates/blockifier/src/transaction/account_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl AccountTransaction {
initial_gas: block_context.versioned_constants.os_constants.gas_costs.initial_gas_cost,
};

let mut context = EntryPointExecutionContext::new_invoke(tx_context, true)?;
let mut context = EntryPointExecutionContext::new_execution(tx_context, true)?;

Ok(fee_transfer_call
.execute(state, &mut ExecutionResources::default(), &mut context)
Expand Down Expand Up @@ -442,7 +442,7 @@ impl AccountTransaction {
// Also, the execution context required form the `DeployAccount` execute phase is
// validation context.
let mut execution_context =
EntryPointExecutionContext::new_validate(tx_context.clone(), charge_fee)?;
EntryPointExecutionContext::new_validation(tx_context.clone(), charge_fee)?;
execute_call_info =
self.run_execute(state, &mut resources, &mut execution_context, remaining_gas)?;
validate_call_info = self.handle_validate_tx(
Expand All @@ -455,7 +455,7 @@ impl AccountTransaction {
)?;
} else {
let mut execution_context =
EntryPointExecutionContext::new_invoke(tx_context.clone(), charge_fee)?;
EntryPointExecutionContext::new_execution(tx_context.clone(), charge_fee)?;
validate_call_info = self.handle_validate_tx(
state,
&mut resources,
Expand Down Expand Up @@ -499,7 +499,7 @@ impl AccountTransaction {
) -> TransactionExecutionResult<ValidateExecuteCallInfo> {
let mut resources = ExecutionResources::default();
let mut execution_context =
EntryPointExecutionContext::new_invoke(tx_context.clone(), charge_fee)?;
EntryPointExecutionContext::new_execution(tx_context.clone(), charge_fee)?;
// Run the validation, and if execution later fails, only keep the validation diff.
let validate_call_info = self.handle_validate_tx(
state,
Expand Down Expand Up @@ -768,7 +768,7 @@ impl ValidatableTransaction for AccountTransaction {
limit_steps_by_resources: bool,
) -> TransactionExecutionResult<Option<CallInfo>> {
let mut context =
EntryPointExecutionContext::new_validate(tx_context, limit_steps_by_resources)?;
EntryPointExecutionContext::new_validation(tx_context, limit_steps_by_resources)?;
let tx_info = &context.tx_context.tx_info;
if tx_info.is_v0() {
return Ok(None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ fn test_max_fee_to_max_steps_conversion(
nonce: nonce_manager.next(account_address),
});
let tx_context1 = Arc::new(block_context.to_tx_context(&account_tx1));
let execution_context1 = EntryPointExecutionContext::new_invoke(tx_context1, true).unwrap();
let execution_context1 = EntryPointExecutionContext::new_execution(tx_context1, true).unwrap();
let max_steps_limit1 = execution_context1.vm_run_resources.get_n_steps();
let tx_execution_info1 = account_tx1.execute(&mut state, &block_context, true, true).unwrap();
let n_steps1 = tx_execution_info1.receipt.resources.vm_resources.n_steps;
Expand All @@ -950,7 +950,7 @@ fn test_max_fee_to_max_steps_conversion(
nonce: nonce_manager.next(account_address),
});
let tx_context2 = Arc::new(block_context.to_tx_context(&account_tx2));
let execution_context2 = EntryPointExecutionContext::new_invoke(tx_context2, true).unwrap();
let execution_context2 = EntryPointExecutionContext::new_execution(tx_context2, true).unwrap();
let max_steps_limit2 = execution_context2.vm_run_resources.get_n_steps();
let tx_execution_info2 = account_tx2.execute(&mut state, &block_context, true, true).unwrap();
let n_steps2 = tx_execution_info2.receipt.resources.vm_resources.n_steps;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/transaction/transaction_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<U: UpdatableState> ExecutableTransaction<U> for L1HandlerTransaction {
let tx_context = Arc::new(block_context.to_tx_context(self));

let mut execution_resources = ExecutionResources::default();
let mut context = EntryPointExecutionContext::new_invoke(tx_context.clone(), true)?;
let mut context = EntryPointExecutionContext::new_execution(tx_context.clone(), true)?;
let mut remaining_gas = block_context.versioned_constants.tx_initial_gas();
let execute_call_info =
self.run_execute(state, &mut execution_resources, &mut context, &mut remaining_gas)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/papyrus_execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub fn execute_call(
override_kzg_da_to_false,
)?;

let mut context = EntryPointExecutionContext::new_invoke(
let mut context = EntryPointExecutionContext::new_execution(
// TODO(yair): fix when supporting v3 transactions
Arc::new(TransactionContext {
block_context,
Expand Down