From 2ab99183f6b2e96699e3e3506aaf9f424283ea48 Mon Sep 17 00:00:00 2001 From: Yoni <78365039+Yoni-Starkware@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:49:22 +0300 Subject: [PATCH] refactor(blockifier): rename actual_cost to receipt (#896) --- crates/blockifier/src/blockifier/stateful_validator.rs | 2 +- crates/blockifier/src/fee.rs | 2 +- crates/blockifier/src/fee/fee_checks.rs | 2 +- crates/blockifier/src/fee/fee_test.rs | 2 +- crates/blockifier/src/fee/{actual_cost.rs => receipt.rs} | 2 +- .../blockifier/src/fee/{actual_cost_test.rs => receipt_test.rs} | 0 crates/blockifier/src/transaction/account_transaction.rs | 2 +- crates/blockifier/src/transaction/objects.rs | 2 +- crates/blockifier/src/transaction/transaction_execution.rs | 2 +- crates/blockifier/src/transaction/transactions_test.rs | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) rename crates/blockifier/src/fee/{actual_cost.rs => receipt.rs} (99%) rename crates/blockifier/src/fee/{actual_cost_test.rs => receipt_test.rs} (100%) diff --git a/crates/blockifier/src/blockifier/stateful_validator.rs b/crates/blockifier/src/blockifier/stateful_validator.rs index 3c6a8606dd..dd515fb591 100644 --- a/crates/blockifier/src/blockifier/stateful_validator.rs +++ b/crates/blockifier/src/blockifier/stateful_validator.rs @@ -12,8 +12,8 @@ use crate::blockifier::transaction_executor::{ }; use crate::context::{BlockContext, TransactionContext}; use crate::execution::call_info::CallInfo; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::fee_checks::PostValidationReport; +use crate::fee::receipt::TransactionReceipt; use crate::state::cached_state::CachedState; use crate::state::errors::StateError; use crate::state::state_api::StateReader; diff --git a/crates/blockifier/src/fee.rs b/crates/blockifier/src/fee.rs index 1180cfe170..cc74b9a646 100644 --- a/crates/blockifier/src/fee.rs +++ b/crates/blockifier/src/fee.rs @@ -1,5 +1,5 @@ -pub mod actual_cost; pub mod eth_gas_constants; pub mod fee_checks; pub mod fee_utils; pub mod gas_usage; +pub mod receipt; diff --git a/crates/blockifier/src/fee/fee_checks.rs b/crates/blockifier/src/fee/fee_checks.rs index 4ed70acd45..f999ca4d0a 100644 --- a/crates/blockifier/src/fee/fee_checks.rs +++ b/crates/blockifier/src/fee/fee_checks.rs @@ -4,8 +4,8 @@ use starknet_types_core::felt::Felt; use thiserror::Error; use crate::context::TransactionContext; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::fee_utils::{get_balance_and_if_covers_fee, get_fee_by_gas_vector}; +use crate::fee::receipt::TransactionReceipt; use crate::state::state_api::StateReader; use crate::transaction::errors::TransactionExecutionError; use crate::transaction::objects::{ diff --git a/crates/blockifier/src/fee/fee_test.rs b/crates/blockifier/src/fee/fee_test.rs index 990b51293b..a02225cfbd 100644 --- a/crates/blockifier/src/fee/fee_test.rs +++ b/crates/blockifier/src/fee/fee_test.rs @@ -10,9 +10,9 @@ use starknet_api::transaction::{Fee, Resource, ValidResourceBounds}; use crate::abi::constants::N_STEPS_RESOURCE; use crate::blockifier::block::GasPrices; use crate::context::BlockContext; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::fee_checks::{FeeCheckError, FeeCheckReportFields, PostExecutionReport}; use crate::fee::fee_utils::get_vm_resources_cost; +use crate::fee::receipt::TransactionReceipt; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::{ diff --git a/crates/blockifier/src/fee/actual_cost.rs b/crates/blockifier/src/fee/receipt.rs similarity index 99% rename from crates/blockifier/src/fee/actual_cost.rs rename to crates/blockifier/src/fee/receipt.rs index c91f3dac4c..3297a9dae9 100644 --- a/crates/blockifier/src/fee/actual_cost.rs +++ b/crates/blockifier/src/fee/receipt.rs @@ -22,7 +22,7 @@ use crate::transaction::transaction_types::TransactionType; use crate::utils::usize_from_u128; #[cfg(test)] -#[path = "actual_cost_test.rs"] +#[path = "receipt_test.rs"] pub mod test; /// Parameters required to compute actual cost of a transaction. diff --git a/crates/blockifier/src/fee/actual_cost_test.rs b/crates/blockifier/src/fee/receipt_test.rs similarity index 100% rename from crates/blockifier/src/fee/actual_cost_test.rs rename to crates/blockifier/src/fee/receipt_test.rs diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 8520132378..e53a5d84a9 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -19,7 +19,6 @@ use crate::context::{BlockContext, TransactionContext}; use crate::execution::call_info::{CallInfo, Retdata}; use crate::execution::contract_class::ContractClass; use crate::execution::entry_point::{CallEntryPoint, CallType, EntryPointExecutionContext}; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::fee_checks::{FeeCheckReportFields, PostExecutionReport}; use crate::fee::fee_utils::{ get_fee_by_gas_vector, @@ -27,6 +26,7 @@ use crate::fee::fee_utils::{ verify_can_pay_committed_bounds, }; use crate::fee::gas_usage::estimate_minimal_gas_vector; +use crate::fee::receipt::TransactionReceipt; use crate::retdata; use crate::state::cached_state::{StateChanges, TransactionalState}; use crate::state::state_api::{State, StateReader, UpdatableState}; diff --git a/crates/blockifier/src/transaction/objects.rs b/crates/blockifier/src/transaction/objects.rs index cc918d37ee..938d801ced 100644 --- a/crates/blockifier/src/transaction/objects.rs +++ b/crates/blockifier/src/transaction/objects.rs @@ -25,7 +25,6 @@ use crate::abi::constants as abi_constants; use crate::blockifier::block::BlockInfo; use crate::context::TransactionContext; use crate::execution::call_info::{CallInfo, ExecutionSummary, MessageL1CostInfo, OrderedEvent}; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::eth_gas_constants; use crate::fee::fee_utils::{get_fee_by_gas_vector, get_vm_resources_cost}; use crate::fee::gas_usage::{ @@ -34,6 +33,7 @@ use crate::fee::gas_usage::{ get_log_message_to_l1_emissions_cost, get_onchain_data_segment_length, }; +use crate::fee::receipt::TransactionReceipt; use crate::state::cached_state::StateChangesCount; use crate::transaction::constants; use crate::transaction::errors::{ diff --git a/crates/blockifier/src/transaction/transaction_execution.rs b/crates/blockifier/src/transaction/transaction_execution.rs index 1c62f51752..48a120b2f2 100644 --- a/crates/blockifier/src/transaction/transaction_execution.rs +++ b/crates/blockifier/src/transaction/transaction_execution.rs @@ -8,7 +8,7 @@ use crate::bouncer::verify_tx_weights_in_bounds; use crate::context::BlockContext; use crate::execution::contract_class::ClassInfo; use crate::execution::entry_point::EntryPointExecutionContext; -use crate::fee::actual_cost::TransactionReceipt; +use crate::fee::receipt::TransactionReceipt; use crate::state::cached_state::TransactionalState; use crate::state::state_api::UpdatableState; use crate::transaction::account_transaction::AccountTransaction; diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 99471b475d..f348039070 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -58,13 +58,13 @@ use crate::execution::entry_point::{CallEntryPoint, CallType}; use crate::execution::errors::{ConstructorEntryPointExecutionError, EntryPointExecutionError}; use crate::execution::syscalls::hint_processor::EmitEventError; use crate::execution::syscalls::SyscallSelector; -use crate::fee::actual_cost::TransactionReceipt; use crate::fee::fee_utils::balance_to_big_uint; use crate::fee::gas_usage::{ estimate_minimal_gas_vector, get_da_gas_cost, get_onchain_data_segment_length, }; +use crate::fee::receipt::TransactionReceipt; use crate::state::cached_state::{CachedState, StateChangesCount, TransactionalState}; use crate::state::errors::StateError; use crate::state::state_api::{State, StateReader};