From 63b9d2d5a045d7738b1e05653cc0d922cd2de179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Delabrouille?= Date: Tue, 20 Aug 2024 02:14:43 +0200 Subject: [PATCH] better names --- crates/blockifier/src/execution/entry_point.rs | 4 ++-- crates/blockifier/src/test_utils/struct_impls.rs | 10 ++++++---- .../blockifier/src/transaction/account_transaction.rs | 10 +++++----- .../src/transaction/account_transactions_test.rs | 4 ++-- .../src/transaction/transaction_execution.rs | 2 +- crates/papyrus_execution/src/lib.rs | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/crates/blockifier/src/execution/entry_point.rs b/crates/blockifier/src/execution/entry_point.rs index 3bebf7948e..8629d7baed 100644 --- a/crates/blockifier/src/execution/entry_point.rs +++ b/crates/blockifier/src/execution/entry_point.rs @@ -147,14 +147,14 @@ impl EntryPointExecutionContext { }) } - pub fn new_validate( + pub fn new_validation( tx_context: Arc, limit_steps_by_resources: bool, ) -> TransactionExecutionResult { Self::new(tx_context, ExecutionMode::Validate, limit_steps_by_resources) } - pub fn new_execute( + pub fn new_execution( tx_context: Arc, limit_steps_by_resources: bool, ) -> TransactionExecutionResult { diff --git a/crates/blockifier/src/test_utils/struct_impls.rs b/crates/blockifier/src/test_utils/struct_impls.rs index 55615c4b74..6891e74cee 100644 --- a/crates/blockifier/src/test_utils/struct_impls.rs +++ b/crates/blockifier/src/test_utils/struct_impls.rs @@ -69,9 +69,11 @@ impl CallEntryPoint { ) -> EntryPointExecutionResult { let tx_context = TransactionContext { block_context: BlockContext::create_for_testing(), tx_info }; - let mut context = - EntryPointExecutionContext::new_execute(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) } @@ -96,7 +98,7 @@ impl CallEntryPoint { ) -> EntryPointExecutionResult { 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, ) diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index c36dfa557a..463ca687e5 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -373,7 +373,7 @@ impl AccountTransaction { initial_gas: block_context.versioned_constants.os_constants.gas_costs.initial_gas_cost, }; - let mut context = EntryPointExecutionContext::new_execute(tx_context, true)?; + let mut context = EntryPointExecutionContext::new_execution(tx_context, true)?; Ok(fee_transfer_call .execute(state, &mut ExecutionResources::default(), &mut context) @@ -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( @@ -455,7 +455,7 @@ impl AccountTransaction { )?; } else { let mut execution_context = - EntryPointExecutionContext::new_execute(tx_context.clone(), charge_fee)?; + EntryPointExecutionContext::new_execution(tx_context.clone(), charge_fee)?; validate_call_info = self.handle_validate_tx( state, &mut resources, @@ -499,7 +499,7 @@ impl AccountTransaction { ) -> TransactionExecutionResult { let mut resources = ExecutionResources::default(); let mut execution_context = - EntryPointExecutionContext::new_execute(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, @@ -768,7 +768,7 @@ impl ValidatableTransaction for AccountTransaction { limit_steps_by_resources: bool, ) -> TransactionExecutionResult> { 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); diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 59b20f404d..633f44a918 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -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_execute(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; @@ -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_execute(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; diff --git a/crates/blockifier/src/transaction/transaction_execution.rs b/crates/blockifier/src/transaction/transaction_execution.rs index b147169a4e..490ad1e646 100644 --- a/crates/blockifier/src/transaction/transaction_execution.rs +++ b/crates/blockifier/src/transaction/transaction_execution.rs @@ -118,7 +118,7 @@ impl ExecutableTransaction for L1HandlerTransaction { let tx_context = Arc::new(block_context.to_tx_context(self)); let mut execution_resources = ExecutionResources::default(); - let mut context = EntryPointExecutionContext::new_execute(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)?; diff --git a/crates/papyrus_execution/src/lib.rs b/crates/papyrus_execution/src/lib.rs index 3e0d81bfd5..155f2a3ce5 100644 --- a/crates/papyrus_execution/src/lib.rs +++ b/crates/papyrus_execution/src/lib.rs @@ -261,7 +261,7 @@ pub fn execute_call( override_kzg_da_to_false, )?; - let mut context = EntryPointExecutionContext::new_execute( + let mut context = EntryPointExecutionContext::new_execution( // TODO(yair): fix when supporting v3 transactions Arc::new(TransactionContext { block_context,