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: split transaction file part one fields dedicated file #1732

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion crates/blockifier/src/blockifier/stateful_validator_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use assert_matches::assert_matches;
use rstest::rstest;
use starknet_api::transaction::{TransactionVersion, ValidResourceBounds};
use starknet_api::transaction::fields::ValidResourceBounds;
use starknet_api::transaction::TransactionVersion;

use crate::blockifier::stateful_validator::StatefulValidator;
use crate::context::BlockContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use assert_matches::assert_matches;
use pretty_assertions::assert_eq;
use rstest::rstest;
use starknet_api::test_utils::NonceManager;
use starknet_api::transaction::{Fee, TransactionVersion};
use starknet_api::transaction::fields::Fee;
use starknet_api::transaction::TransactionVersion;
use starknet_api::{declare_tx_args, deploy_account_tx_args, felt, invoke_tx_args, nonce};
use starknet_types_core::felt::Felt;

Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/bouncer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use assert_matches::assert_matches;
use cairo_vm::types::builtin_name::BuiltinName;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use rstest::rstest;
use starknet_api::transaction::Fee;
use starknet_api::transaction::fields::Fee;
use starknet_api::{class_hash, contract_address, storage_key};

use super::BouncerConfig;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/fee_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;

use num_traits::ToPrimitive;
use starknet_api::core::ContractAddress;
use starknet_api::transaction::Fee;
use starknet_api::transaction::fields::Fee;
use starknet_types_core::felt::Felt;

use crate::context::{BlockContext, TransactionContext};
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/concurrency/fee_utils_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use num_bigint::BigUint;
use rstest::rstest;
use starknet_api::transaction::{Fee, ValidResourceBounds};
use starknet_api::transaction::fields::{Fee, ValidResourceBounds};
use starknet_api::{felt, invoke_tx_args};
use starknet_types_core::felt::Felt;

Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn test_fill_sequencer_balance_reads(
#[case::overflow(Fee(150_u128), felt!(u128::MAX), felt!(5_u128))]
#[case::overflow_edge_case(Fee(500_u128), felt!(u128::MAX), felt!(u128::MAX-1))]
pub fn test_add_fee_to_sequencer_balance(
#[case] actual_fee: starknet_api::transaction::Fee,
#[case] actual_fee: Fee,
#[case] sequencer_balance_low: Felt,
#[case] sequencer_balance_high: Felt,
) {
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/versioned_state_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use assert_matches::assert_matches;
use rstest::{fixture, rstest};
use starknet_api::core::{calculate_contract_address, ClassHash, ContractAddress};
use starknet_api::test_utils::NonceManager;
use starknet_api::transaction::{ContractAddressSalt, ValidResourceBounds};
use starknet_api::transaction::fields::{ContractAddressSalt, ValidResourceBounds};
use starknet_api::{
calldata,
class_hash,
Expand Down
8 changes: 2 additions & 6 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ use std::sync::Mutex;
use rstest::rstest;
use starknet_api::core::{ContractAddress, Nonce};
use starknet_api::test_utils::NonceManager;
use starknet_api::transaction::{
ContractAddressSalt,
Fee,
TransactionVersion,
ValidResourceBounds,
};
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};
use starknet_types_core::felt::Felt;

Expand Down
6 changes: 5 additions & 1 deletion crates/blockifier/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use serde::{Deserialize, Serialize};
use starknet_api::block::GasPriceVector;
use starknet_api::core::{ChainId, ContractAddress};
use starknet_api::transaction::{AllResourceBounds, GasVectorComputationMode, ValidResourceBounds};
use starknet_api::transaction::fields::{
AllResourceBounds,
GasVectorComputationMode,
ValidResourceBounds,
};

use crate::blockifier::block::BlockInfo;
use crate::bouncer::BouncerConfig;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/execution/contract_address_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rstest::rstest;
use starknet_api::core::{calculate_contract_address, ClassHash, ContractAddress};
use starknet_api::transaction::{Calldata, ContractAddressSalt};
use starknet_api::transaction::fields::{Calldata, ContractAddressSalt};
use starknet_api::{calldata, felt};

use crate::abi::abi_utils::selector_from_name;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/execution/contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use starknet_api::deprecated_contract_class::{
EntryPointV0,
Program as DeprecatedProgram,
};
use starknet_api::transaction::GasVectorComputationMode;
use starknet_api::transaction::fields::GasVectorComputationMode;
use starknet_types_core::felt::Felt;

use crate::abi::constants::{self};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ use pretty_assertions::assert_eq;
use rstest::rstest;
use starknet_api::core::{calculate_contract_address, ChainId};
use starknet_api::state::StorageKey;
use starknet_api::transaction::fields::{Calldata, ContractAddressSalt, Fee};
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
EventContent,
EventData,
EventKey,
Fee,
TransactionHash,
TransactionVersion,
QUERY_VERSION_BASE_BIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use num_bigint::{BigUint, TryFromBigIntError};
use starknet_api::contract_class::EntryPointType;
use starknet_api::core::{ClassHash, ContractAddress, EntryPointSelector};
use starknet_api::state::StorageKey;
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use starknet_api::StarknetApiError;
use starknet_types_core::felt::{Felt, FromStrError};
use thiserror::Error;
Expand Down
10 changes: 2 additions & 8 deletions crates/blockifier/src/execution/deprecated_syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ use starknet_api::core::{
EthAddress,
};
use starknet_api::state::StorageKey;
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
EventContent,
EventData,
EventKey,
L2ToL1Payload,
};
use starknet_api::transaction::fields::{Calldata, ContractAddressSalt};
use starknet_api::transaction::{EventContent, EventData, EventKey, L2ToL1Payload};
use starknet_types_core::felt::Felt;
use strum_macros::EnumIter;

Expand Down
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 @@ -9,13 +9,13 @@ use serde::Serialize;
use starknet_api::contract_class::EntryPointType;
use starknet_api::core::{ClassHash, ContractAddress, EntryPointSelector};
use starknet_api::state::StorageKey;
use starknet_api::transaction::{
use starknet_api::transaction::fields::{
AllResourceBounds,
Calldata,
ResourceBounds,
TransactionVersion,
ValidResourceBounds,
};
use starknet_api::transaction::TransactionVersion;
use starknet_types_core::felt::Felt;

use crate::abi::abi_utils::selector_from_name;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/execution/entry_point_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use num_bigint::BigInt;
use pretty_assertions::assert_eq;
use starknet_api::core::EntryPointSelector;
use starknet_api::execution_utils::format_panic_data;
use starknet_api::transaction::{Calldata, Fee};
use starknet_api::transaction::fields::{Calldata, Fee};
use starknet_api::{calldata, felt, storage_key};

use crate::abi::abi_utils::{get_storage_var_address, selector_from_name};
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/execution/execution_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cairo_vm::vm::vm_core::VirtualMachine;
use num_bigint::BigUint;
use starknet_api::core::ClassHash;
use starknet_api::deprecated_contract_class::Program as DeprecatedProgram;
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use starknet_types_core::felt::Felt;

use super::call_info::CallExecution;
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/execution/stack_trace_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use starknet_api::core::{
EntryPointSelector,
Nonce,
};
use starknet_api::transaction::{
use starknet_api::transaction::fields::{
ContractAddressSalt,
Fee,
TransactionSignature,
TransactionVersion,
ValidResourceBounds,
};
use starknet_api::transaction::TransactionVersion;
use starknet_api::{calldata, felt, invoke_tx_args};
use starknet_types_core::felt::Felt;

Expand Down
7 changes: 6 additions & 1 deletion crates/blockifier/src/execution/syscalls/hint_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ use cairo_vm::vm::vm_core::VirtualMachine;
use starknet_api::contract_class::EntryPointType;
use starknet_api::core::{ClassHash, ContractAddress, EntryPointSelector};
use starknet_api::state::StorageKey;
use starknet_api::transaction::{AllResourceBounds, Calldata, Resource, ValidResourceBounds};
use starknet_api::transaction::fields::{
AllResourceBounds,
Calldata,
Resource,
ValidResourceBounds,
};
use starknet_api::StarknetApiError;
use starknet_types_core::felt::{Felt, FromStrError};
use thiserror::Error;
Expand Down
10 changes: 2 additions & 8 deletions crates/blockifier/src/execution/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ use starknet_api::core::{
EthAddress,
};
use starknet_api::state::StorageKey;
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
EventContent,
EventData,
EventKey,
L2ToL1Payload,
};
use starknet_api::transaction::fields::{Calldata, ContractAddressSalt};
use starknet_api::transaction::{EventContent, EventData, EventKey, L2ToL1Payload};
use starknet_types_core::felt::Felt;

use self::hint_processor::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use pretty_assertions::assert_eq;
use rstest::rstest;
use starknet_api::execution_utils::format_panic_data;
use starknet_api::felt;
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use test_case::test_case;

use super::constants::REQUIRED_GAS_CALL_CONTRACT_TEST;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pretty_assertions::assert_eq;
use starknet_api::core::calculate_contract_address;
use starknet_api::transaction::{Calldata, ContractAddressSalt, Fee};
use starknet_api::transaction::fields::{Calldata, ContractAddressSalt, Fee};
use starknet_api::{calldata, felt};
use test_case::test_case;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use itertools::concat;
use pretty_assertions::assert_eq;
use starknet_api::felt;
use starknet_api::transaction::{Calldata, EventContent, EventData, EventKey};
use starknet_api::transaction::fields::Calldata;
use starknet_api::transaction::{EventContent, EventData, EventKey};
use starknet_types_core::felt::Felt;
use test_case::test_case;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ use starknet_api::block::GasPrice;
use starknet_api::core::ChainId;
use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::execution_resources::GasAmount;
use starknet_api::transaction::{
use starknet_api::transaction::fields::{
AccountDeploymentData,
Calldata,
Fee,
PaymasterData,
Resource,
ResourceBounds,
Tip,
TransactionHash,
TransactionVersion,
ValidResourceBounds,
QUERY_VERSION_BASE_BIT,
};
use starknet_api::transaction::{TransactionHash, TransactionVersion, QUERY_VERSION_BASE_BIT};
use starknet_api::{felt, nonce};
use starknet_types_core::felt::Felt;
use test_case::test_case;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use test_case::test_case;

use crate::abi::abi_utils::selector_from_name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cairo_vm::types::builtin_name::BuiltinName;
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use pretty_assertions::assert_eq;
use starknet_api::execution_utils::format_panic_data;
use starknet_api::transaction::GasVectorComputationMode;
use starknet_api::transaction::fields::GasVectorComputationMode;
use starknet_api::{calldata, felt, storage_key};
use test_case::test_case;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use test_case::test_case;

use crate::abi::abi_utils::selector_from_name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use itertools::concat;
use starknet_api::core::EthAddress;
use starknet_api::felt;
use starknet_api::transaction::{Calldata, L2ToL1Payload};
use starknet_api::transaction::fields::Calldata;
use starknet_api::transaction::L2ToL1Payload;
use test_case::test_case;

use crate::abi::abi_utils::selector_from_name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet_api::transaction::Calldata;
use starknet_api::transaction::fields::Calldata;
use test_case::test_case;

use crate::abi::abi_utils::selector_from_name;
Expand Down
9 changes: 7 additions & 2 deletions crates/blockifier/src/fee/fee_checks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use starknet_api::execution_resources::{GasAmount, GasVector};
use starknet_api::transaction::Resource::{self, L1DataGas, L1Gas, L2Gas};
use starknet_api::transaction::{AllResourceBounds, Fee, ResourceBounds, ValidResourceBounds};
use starknet_api::transaction::fields::Resource::{self, L1DataGas, L1Gas, L2Gas};
use starknet_api::transaction::fields::{
AllResourceBounds,
Fee,
ResourceBounds,
ValidResourceBounds,
};
use starknet_types_core::felt::Felt;
use thiserror::Error;

Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/fee/fee_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rstest::rstest;
use starknet_api::block::{GasPrice, NonzeroGasPrice};
use starknet_api::execution_resources::{GasAmount, GasVector};
use starknet_api::invoke_tx_args;
use starknet_api::transaction::{
use starknet_api::transaction::fields::{
AllResourceBounds,
Fee,
GasVectorComputationMode,
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/fee/fee_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use num_bigint::BigUint;
use starknet_api::core::ContractAddress;
use starknet_api::execution_resources::GasVector;
use starknet_api::state::StorageKey;
use starknet_api::transaction::ValidResourceBounds::{AllResources, L1Gas};
use starknet_api::transaction::{Fee, GasVectorComputationMode, Resource};
use starknet_api::transaction::fields::ValidResourceBounds::{AllResources, L1Gas};
use starknet_api::transaction::fields::{Fee, GasVectorComputationMode, Resource};
use starknet_types_core::felt::Felt;

use crate::abi::abi_utils::get_fee_token_var_address;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/fee/gas_usage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_api::execution_resources::GasVector;
use starknet_api::transaction::GasVectorComputationMode;
use starknet_api::transaction::fields::GasVectorComputationMode;

use super::fee_utils::get_vm_resources_cost;
use crate::abi::constants;
Expand Down
3 changes: 2 additions & 1 deletion crates/blockifier/src/fee/gas_usage_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use rstest::{fixture, rstest};
use starknet_api::block::StarknetVersion;
use starknet_api::execution_resources::{GasAmount, GasVector};
use starknet_api::invoke_tx_args;
use starknet_api::transaction::{EventContent, EventData, EventKey, GasVectorComputationMode};
use starknet_api::transaction::fields::GasVectorComputationMode;
use starknet_api::transaction::{EventContent, EventData, EventKey};
use starknet_types_core::felt::Felt;

use crate::abi::constants;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/fee/receipt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_api::core::ContractAddress;
use starknet_api::execution_resources::GasVector;
use starknet_api::transaction::Fee;
use starknet_api::transaction::fields::Fee;

use crate::context::TransactionContext;
use crate::execution::call_info::ExecutionSummary;
Expand Down
3 changes: 2 additions & 1 deletion crates/blockifier/src/fee/receipt_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rstest::{fixture, rstest};
use starknet_api::execution_resources::GasVector;
use starknet_api::transaction::{GasVectorComputationMode, L2ToL1Payload};
use starknet_api::transaction::fields::GasVectorComputationMode;
use starknet_api::transaction::L2ToL1Payload;
use starknet_api::{invoke_tx_args, nonce};
use starknet_types_core::felt::Felt;

Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/fee/resources.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_api::core::ContractAddress;
use starknet_api::execution_resources::{GasAmount, GasVector};
use starknet_api::transaction::GasVectorComputationMode;
use starknet_api::transaction::fields::GasVectorComputationMode;

use crate::execution::call_info::{EventSummary, ExecutionSummary};
use crate::fee::eth_gas_constants;
Expand Down
Loading
Loading