diff --git a/crates/blockifier/src/abi/abi_utils_test.rs b/crates/blockifier/src/abi/abi_utils_test.rs index 278237ccce0..0a82ab9759c 100644 --- a/crates/blockifier/src/abi/abi_utils_test.rs +++ b/crates/blockifier/src/abi/abi_utils_test.rs @@ -1,9 +1,9 @@ use starknet_api::core::EntryPointSelector; use starknet_api::felt; +use starknet_api::transaction::constants as tx_constants; use crate::abi::abi_utils::selector_from_name; use crate::abi::constants as abi_constants; -use crate::transaction::constants as tx_constants; #[test] fn test_selector_from_name() { diff --git a/crates/blockifier/src/concurrency/worker_logic_test.rs b/crates/blockifier/src/concurrency/worker_logic_test.rs index 0b02dc21805..541558c7028 100644 --- a/crates/blockifier/src/concurrency/worker_logic_test.rs +++ b/crates/blockifier/src/concurrency/worker_logic_test.rs @@ -4,6 +4,7 @@ use std::sync::Mutex; use rstest::rstest; use starknet_api::core::{ContractAddress, Nonce}; use starknet_api::test_utils::NonceManager; +use starknet_api::transaction::constants::DEPLOY_CONTRACT_FUNCTION_ENTRY_POINT_NAME; use starknet_api::transaction::fields::{ContractAddressSalt, Fee, ValidResourceBounds}; use starknet_api::transaction::TransactionVersion; use starknet_api::{contract_address, declare_tx_args, felt, invoke_tx_args, nonce, storage_key}; @@ -32,7 +33,6 @@ use crate::test_utils::{ TEST_ERC20_CONTRACT_ADDRESS2, }; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants::DEPLOY_CONTRACT_FUNCTION_ENTRY_POINT_NAME; use crate::transaction::objects::HasRelatedFeeType; use crate::transaction::test_utils::{ account_invoke_tx, diff --git a/crates/blockifier/src/execution/stack_trace_test.rs b/crates/blockifier/src/execution/stack_trace_test.rs index b71c6cd3374..07e5e533fa1 100644 --- a/crates/blockifier/src/execution/stack_trace_test.rs +++ b/crates/blockifier/src/execution/stack_trace_test.rs @@ -10,6 +10,14 @@ use starknet_api::core::{ Nonce, }; use starknet_api::executable_transaction::AccountTransaction as Transaction; +use starknet_api::transaction::constants::{ + DEPLOY_CONTRACT_FUNCTION_ENTRY_POINT_NAME, + EXECUTE_ENTRY_POINT_NAME, + FELT_TRUE, + VALIDATE_DECLARE_ENTRY_POINT_NAME, + VALIDATE_DEPLOY_ENTRY_POINT_NAME, + VALIDATE_ENTRY_POINT_NAME, +}; use starknet_api::transaction::fields::{ ContractAddressSalt, Fee, @@ -37,14 +45,6 @@ use crate::execution::syscalls::hint_processor::ENTRYPOINT_FAILED_ERROR; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::{fund_account, test_state}; use crate::test_utils::{create_calldata, CairoVersion, BALANCE}; -use crate::transaction::constants::{ - DEPLOY_CONTRACT_FUNCTION_ENTRY_POINT_NAME, - EXECUTE_ENTRY_POINT_NAME, - FELT_TRUE, - VALIDATE_DECLARE_ENTRY_POINT_NAME, - VALIDATE_DEPLOY_ENTRY_POINT_NAME, - VALIDATE_ENTRY_POINT_NAME, -}; use crate::transaction::test_utils::{ account_invoke_tx, block_context, diff --git a/crates/blockifier/src/fee/receipt_test.rs b/crates/blockifier/src/fee/receipt_test.rs index 95c315918bc..3a412de0847 100644 --- a/crates/blockifier/src/fee/receipt_test.rs +++ b/crates/blockifier/src/fee/receipt_test.rs @@ -1,7 +1,7 @@ use rstest::{fixture, rstest}; use starknet_api::execution_resources::GasVector; use starknet_api::transaction::fields::GasVectorComputationMode; -use starknet_api::transaction::L2ToL1Payload; +use starknet_api::transaction::{constants, L2ToL1Payload}; use starknet_api::{invoke_tx_args, nonce}; use starknet_types_core::felt::Felt; @@ -24,7 +24,6 @@ use crate::state::cached_state::StateChangesCount; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::{create_calldata, create_trivial_calldata, CairoVersion, BALANCE}; -use crate::transaction::constants; use crate::transaction::objects::HasRelatedFeeType; use crate::transaction::test_utils::{ account_invoke_tx, diff --git a/crates/blockifier/src/test_utils/invoke.rs b/crates/blockifier/src/test_utils/invoke.rs index 945f985adc0..51853209b85 100644 --- a/crates/blockifier/src/test_utils/invoke.rs +++ b/crates/blockifier/src/test_utils/invoke.rs @@ -3,11 +3,11 @@ use starknet_api::executable_transaction::{ InvokeTransaction as ExecutableInvokeTransaction, }; use starknet_api::test_utils::invoke::InvokeTxArgs; +use starknet_api::transaction::constants::EXECUTE_ENTRY_POINT_NAME; use starknet_api::transaction::{InvokeTransaction, InvokeTransactionV0, TransactionVersion}; use crate::abi::abi_utils::selector_from_name; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants::EXECUTE_ENTRY_POINT_NAME; pub fn invoke_tx(invoke_args: InvokeTxArgs) -> AccountTransaction { let tx_hash = invoke_args.tx_hash; diff --git a/crates/blockifier/src/test_utils/prices.rs b/crates/blockifier/src/test_utils/prices.rs index 6ef4fee5f07..307595a7ea9 100644 --- a/crates/blockifier/src/test_utils/prices.rs +++ b/crates/blockifier/src/test_utils/prices.rs @@ -4,6 +4,7 @@ use cached::proc_macro::cached; use cairo_vm::vm::runners::cairo_runner::ExecutionResources; use starknet_api::core::ContractAddress; use starknet_api::test_utils::invoke::InvokeTxArgs; +use starknet_api::transaction::constants; use starknet_api::{calldata, felt}; use crate::abi::abi_utils::{get_fee_token_var_address, selector_from_name}; @@ -13,7 +14,6 @@ use crate::execution::entry_point::{CallEntryPoint, EntryPointExecutionContext}; use crate::state::state_api::State; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::BALANCE; -use crate::transaction::constants; use crate::transaction::objects::FeeType; use crate::transaction::test_utils::account_invoke_tx; diff --git a/crates/blockifier/src/test_utils/transfers_generator.rs b/crates/blockifier/src/test_utils/transfers_generator.rs index bfa43974f88..68a1f082bbe 100644 --- a/crates/blockifier/src/test_utils/transfers_generator.rs +++ b/crates/blockifier/src/test_utils/transfers_generator.rs @@ -2,6 +2,7 @@ use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use starknet_api::core::ContractAddress; use starknet_api::test_utils::NonceManager; +use starknet_api::transaction::constants::TRANSFER_ENTRY_POINT_NAME; use starknet_api::transaction::fields::Fee; use starknet_api::transaction::TransactionVersion; use starknet_api::{calldata, felt, invoke_tx_args}; @@ -17,7 +18,6 @@ use crate::test_utils::initial_test_state::test_state; use crate::test_utils::invoke::invoke_tx; use crate::test_utils::{CairoVersion, BALANCE, MAX_FEE}; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants::TRANSFER_ENTRY_POINT_NAME; use crate::transaction::transaction_execution::Transaction; const N_ACCOUNTS: u16 = 10000; diff --git a/crates/blockifier/src/transaction.rs b/crates/blockifier/src/transaction.rs index 4cf550f4c67..6181c79cbae 100644 --- a/crates/blockifier/src/transaction.rs +++ b/crates/blockifier/src/transaction.rs @@ -1,5 +1,4 @@ pub mod account_transaction; -pub mod constants; #[cfg(test)] pub mod error_format_test; pub mod errors; diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index bc2ab3ececf..e35d7e72506 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -23,7 +23,7 @@ use starknet_api::transaction::fields::{ TransactionSignature, ValidResourceBounds, }; -use starknet_api::transaction::{TransactionHash, TransactionVersion}; +use starknet_api::transaction::{constants, TransactionHash, TransactionVersion}; use starknet_types_core::felt::Felt; use crate::abi::abi_utils::selector_from_name; @@ -47,7 +47,6 @@ use crate::fee::receipt::TransactionReceipt; use crate::retdata; use crate::state::cached_state::{StateChanges, TransactionalState}; use crate::state::state_api::{State, StateReader, UpdatableState}; -use crate::transaction::constants; use crate::transaction::errors::{ TransactionExecutionError, TransactionFeeError, diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 31da1c42566..f5bb3be7f3c 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -17,6 +17,7 @@ use starknet_api::hash::StarkHash; use starknet_api::state::StorageKey; use starknet_api::test_utils::invoke::InvokeTxArgs; use starknet_api::test_utils::NonceManager; +use starknet_api::transaction::constants::TRANSFER_ENTRY_POINT_NAME; use starknet_api::transaction::fields::{ AllResourceBounds, Calldata, @@ -82,7 +83,6 @@ use crate::test_utils::{ MAX_FEE, }; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants::TRANSFER_ENTRY_POINT_NAME; use crate::transaction::objects::{FeeType, HasRelatedFeeType, TransactionInfoCreator}; use crate::transaction::test_utils::{ account_invoke_tx, diff --git a/crates/blockifier/src/transaction/test_utils.rs b/crates/blockifier/src/transaction/test_utils.rs index 41d0c334ebd..5722b59311b 100644 --- a/crates/blockifier/src/transaction/test_utils.rs +++ b/crates/blockifier/src/transaction/test_utils.rs @@ -15,7 +15,7 @@ use starknet_api::transaction::fields::{ TransactionSignature, ValidResourceBounds, }; -use starknet_api::transaction::TransactionVersion; +use starknet_api::transaction::{constants, TransactionVersion}; use starknet_api::{calldata, declare_tx_args, deploy_account_tx_args, felt, invoke_tx_args}; use starknet_types_core::felt::Felt; use strum::IntoEnumIterator; @@ -43,7 +43,6 @@ use crate::test_utils::{ MAX_FEE, }; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants; use crate::transaction::objects::{FeeType, TransactionExecutionInfo, TransactionExecutionResult}; use crate::transaction::transaction_types::TransactionType; use crate::transaction::transactions::ExecutableTransaction; diff --git a/crates/blockifier/src/transaction/transactions.rs b/crates/blockifier/src/transaction/transactions.rs index 0e78b1f1c57..c3a852097db 100644 --- a/crates/blockifier/src/transaction/transactions.rs +++ b/crates/blockifier/src/transaction/transactions.rs @@ -15,7 +15,12 @@ use starknet_api::transaction::fields::{ Fee, TransactionSignature, }; -use starknet_api::transaction::{DeclareTransactionV2, DeclareTransactionV3, TransactionVersion}; +use starknet_api::transaction::{ + constants, + DeclareTransactionV2, + DeclareTransactionV3, + TransactionVersion, +}; use crate::abi::abi_utils::selector_from_name; use crate::context::{BlockContext, TransactionContext}; @@ -30,7 +35,6 @@ use crate::execution::execution_utils::execute_deployment; use crate::state::cached_state::TransactionalState; use crate::state::errors::StateError; use crate::state::state_api::{State, UpdatableState}; -use crate::transaction::constants; use crate::transaction::errors::TransactionExecutionError; use crate::transaction::objects::{ CommonAccountFields, diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 4bdf6b51f73..cf41b91c397 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -28,6 +28,7 @@ use starknet_api::transaction::fields::{ ValidResourceBounds, }; use starknet_api::transaction::{ + constants, EventContent, EventData, EventKey, @@ -117,7 +118,6 @@ use crate::test_utils::{ TEST_SEQUENCER_ADDRESS, }; use crate::transaction::account_transaction::AccountTransaction; -use crate::transaction::constants; use crate::transaction::errors::{ TransactionExecutionError, TransactionFeeError, diff --git a/crates/starknet_api/src/transaction.rs b/crates/starknet_api/src/transaction.rs index f343c8b4775..42eeadefad9 100644 --- a/crates/starknet_api/src/transaction.rs +++ b/crates/starknet_api/src/transaction.rs @@ -44,6 +44,7 @@ use crate::StarknetApiError; #[path = "transaction_test.rs"] mod transaction_test; +pub mod constants; pub mod fields; // TODO(Noa, 14/11/2023): Replace QUERY_VERSION_BASE_BIT with a lazy calculation. diff --git a/crates/blockifier/src/transaction/constants.rs b/crates/starknet_api/src/transaction/constants.rs similarity index 100% rename from crates/blockifier/src/transaction/constants.rs rename to crates/starknet_api/src/transaction/constants.rs