diff --git a/crates/blockifier/src/test_utils/struct_impls.rs b/crates/blockifier/src/test_utils/struct_impls.rs index e16b4b9de9..61d67bb317 100644 --- a/crates/blockifier/src/test_utils/struct_impls.rs +++ b/crates/blockifier/src/test_utils/struct_impls.rs @@ -10,19 +10,12 @@ use cairo_lang_starknet_classes::contract_class::ContractClass as SierraContract #[cfg(feature = "cairo_native")] use cairo_native::executor::AotContractExecutor; use serde_json::Value; -use starknet_api::block::{BlockInfo, BlockNumber, BlockTimestamp, NonzeroGasPrice}; +use starknet_api::block::{BlockInfo, BlockNumber, BlockTimestamp}; use starknet_api::contract_address; use starknet_api::core::{ChainId, ClassHash}; use starknet_api::deprecated_contract_class::ContractClass as DeprecatedContractClass; -use starknet_api::test_utils::{DEFAULT_ETH_L1_DATA_GAS_PRICE, DEFAULT_ETH_L1_GAS_PRICE}; +use starknet_api::test_utils::DEFAULT_GAS_PRICES; -use super::{ - update_json_value, - TEST_ERC20_CONTRACT_ADDRESS, - TEST_ERC20_CONTRACT_ADDRESS2, - TEST_SEQUENCER_ADDRESS, -}; -use crate::blockifier::block::validated_gas_prices; use crate::bouncer::{BouncerConfig, BouncerWeights, BuiltinCount}; use crate::context::{BlockContext, ChainInfo, FeeTokenAddresses, TransactionContext}; use crate::execution::call_info::{CallExecution, CallInfo, Retdata}; @@ -39,10 +32,12 @@ use crate::execution::native::contract_class::NativeCompiledClassV1; use crate::state::state_api::State; use crate::test_utils::{ get_raw_contract_class, + update_json_value, CURRENT_BLOCK_NUMBER, CURRENT_BLOCK_TIMESTAMP, - DEFAULT_STRK_L1_DATA_GAS_PRICE, - DEFAULT_STRK_L1_GAS_PRICE, + TEST_ERC20_CONTRACT_ADDRESS, + TEST_ERC20_CONTRACT_ADDRESS2, + TEST_SEQUENCER_ADDRESS, }; use crate::transaction::objects::{ CurrentTransactionInfo, @@ -156,22 +151,7 @@ impl BlockInfoExt for BlockInfo { block_number: BlockNumber(CURRENT_BLOCK_NUMBER), block_timestamp: BlockTimestamp(CURRENT_BLOCK_TIMESTAMP), sequencer_address: contract_address!(TEST_SEQUENCER_ADDRESS), - gas_prices: validated_gas_prices( - DEFAULT_ETH_L1_GAS_PRICE, - DEFAULT_STRK_L1_GAS_PRICE, - DEFAULT_ETH_L1_DATA_GAS_PRICE, - DEFAULT_STRK_L1_DATA_GAS_PRICE, - NonzeroGasPrice::new( - VersionedConstants::latest_constants() - .convert_l1_to_l2_gas_price_round_up(DEFAULT_ETH_L1_GAS_PRICE.into()), - ) - .unwrap(), - NonzeroGasPrice::new( - VersionedConstants::latest_constants() - .convert_l1_to_l2_gas_price_round_up(DEFAULT_STRK_L1_GAS_PRICE.into()), - ) - .unwrap(), - ), + gas_prices: DEFAULT_GAS_PRICES, use_kzg_da: false, } } diff --git a/crates/starknet_api/src/test_utils.rs b/crates/starknet_api/src/test_utils.rs index 1841cb0e12..265069d6ef 100644 --- a/crates/starknet_api/src/test_utils.rs +++ b/crates/starknet_api/src/test_utils.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use serde_json::to_string_pretty; use starknet_types_core::felt::Felt; -use crate::block::{BlockNumber, GasPrice, NonzeroGasPrice}; +use crate::block::{BlockNumber, GasPrice, GasPriceVector, GasPrices, NonzeroGasPrice}; use crate::core::{ChainId, ContractAddress, Nonce}; use crate::execution_resources::GasAmount; use crate::rpc_transaction::RpcTransaction; @@ -132,8 +132,23 @@ pub const DEFAULT_ETH_L1_DATA_GAS_PRICE: NonzeroGasPrice = NonzeroGasPrice::new_unchecked(GasPrice(u128::pow(10, 6))); // Given in units of Wei. pub const DEFAULT_STRK_L1_DATA_GAS_PRICE: NonzeroGasPrice = NonzeroGasPrice::new_unchecked(GasPrice(u128::pow(10, 9))); // Given in units of Fri. +pub const DEFAULT_ETH_L2_GAS_PRICE: NonzeroGasPrice = + NonzeroGasPrice::new_unchecked(GasPrice(u128::pow(10, 6))); pub const DEFAULT_STRK_L2_GAS_PRICE: NonzeroGasPrice = NonzeroGasPrice::new_unchecked(GasPrice(u128::pow(10, 9))); +pub const DEFAULT_GAS_PRICES: GasPrices = GasPrices { + eth_gas_prices: GasPriceVector { + l1_gas_price: DEFAULT_ETH_L1_GAS_PRICE, + l2_gas_price: DEFAULT_ETH_L2_GAS_PRICE, + l1_data_gas_price: DEFAULT_ETH_L1_DATA_GAS_PRICE, + }, + strk_gas_prices: GasPriceVector { + l1_gas_price: DEFAULT_STRK_L1_GAS_PRICE, + l2_gas_price: DEFAULT_STRK_L2_GAS_PRICE, + l1_data_gas_price: DEFAULT_STRK_L1_DATA_GAS_PRICE, + }, +}; + // Deprecated transactions: pub const MAX_FEE: Fee = DEFAULT_L1_GAS_AMOUNT.nonzero_saturating_mul(DEFAULT_ETH_L1_GAS_PRICE);