Skip to content

Commit 9ecf786

Browse files
chore(blockifier): delete redundant test (#6167)
* chore(blockifier): update test_syscall_gas_cost_calculation * chore(blockifier): delete redundant test
1 parent 869ca4f commit 9ecf786

3 files changed

Lines changed: 1 addition & 60 deletions

File tree

crates/blockifier/src/test_utils.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,6 @@ pub fn create_deploy_entry_point(
361361
}
362362
}
363363

364-
pub fn update_json_value(base: &mut serde_json::Value, update: serde_json::Value) {
365-
match (base, update) {
366-
(serde_json::Value::Object(base_map), serde_json::Value::Object(update_map)) => {
367-
base_map.extend(update_map);
368-
}
369-
_ => panic!("Both base and update should be of type serde_json::Value::Object."),
370-
}
371-
}
372-
373364
pub fn gas_vector_from_vm_usage(
374365
vm_usage_in_l1_gas: GasAmount,
375366
computation_mode: &GasVectorComputationMode,

crates/blockifier/src/test_utils/struct_impls.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
1010
use cairo_lang_starknet_classes::contract_class::ContractClass as SierraContractClass;
1111
#[cfg(feature = "cairo_native")]
1212
use cairo_native::executor::AotContractExecutor;
13-
use serde_json::Value;
1413
use starknet_api::block::BlockInfo;
1514
use starknet_api::contract_address;
1615
#[cfg(feature = "cairo_native")]
@@ -25,12 +24,7 @@ use starknet_api::test_utils::{
2524
};
2625

2726
use crate::blockifier::config::{CairoNativeRunConfig, ContractClassManagerConfig};
28-
use crate::blockifier_versioned_constants::{
29-
GasCosts,
30-
OsConstants,
31-
VersionedConstants,
32-
VERSIONED_CONSTANTS_LATEST_JSON,
33-
};
27+
use crate::blockifier_versioned_constants::VersionedConstants;
3428
use crate::bouncer::{BouncerConfig, BouncerWeights};
3529
use crate::context::{BlockContext, ChainInfo, FeeTokenAddresses, TransactionContext};
3630
use crate::execution::call_info::{CallExecution, CallInfo, Retdata};
@@ -47,7 +41,6 @@ use crate::execution::entry_point::{
4741
use crate::execution::native::contract_class::NativeCompiledClassV1;
4842
use crate::state::contract_class_manager::ContractClassManager;
4943
use crate::state::state_api::State;
50-
use crate::test_utils::update_json_value;
5144
use crate::transaction::objects::{
5245
CurrentTransactionInfo,
5346
DeprecatedTransactionInfo,
@@ -143,21 +136,6 @@ impl VersionedConstants {
143136
}
144137
}
145138

146-
impl GasCosts {
147-
pub fn create_for_testing_from_subset(subset_of_os_constants: &str) -> Self {
148-
let subset_of_os_constants: Value = serde_json::from_str(subset_of_os_constants).unwrap();
149-
let mut os_constants: Value =
150-
serde_json::from_str::<Value>(VERSIONED_CONSTANTS_LATEST_JSON.as_str())
151-
.unwrap()
152-
.get("os_constants")
153-
.unwrap()
154-
.clone();
155-
update_json_value(&mut os_constants, subset_of_os_constants);
156-
let os_constants: OsConstants = serde_json::from_value(os_constants).unwrap();
157-
os_constants.gas_costs
158-
}
159-
}
160-
161139
impl ChainInfo {
162140
pub fn create_for_testing() -> Self {
163141
Self {

crates/blockifier/src/versioned_constants_test.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,6 @@ fn all_jsons_in_dir() -> Paths {
1616
glob(format!("{}/resources/*.json", compile_time_cargo_manifest_dir!()).as_str()).unwrap()
1717
}
1818

19-
#[test]
20-
fn test_successful_gas_costs_parsing() {
21-
let json_data = r#"
22-
{
23-
"step_gas_cost": 2,
24-
"entry_point_initial_budget": {
25-
"step_gas_cost": 3
26-
},
27-
"syscall_base_gas_cost": {
28-
"entry_point_initial_budget": 4,
29-
"step_gas_cost": 5
30-
},
31-
"error_out_of_gas": "An additional field in GasCosts::ADDITIONAL_ALLOWED_NAMES, ignored."
32-
}"#;
33-
let gas_costs = GasCosts::create_for_testing_from_subset(json_data);
34-
let os_constants: Arc<OsConstants> = Arc::new(OsConstants { gas_costs, ..Default::default() });
35-
let versioned_constants = VersionedConstants { os_constants, ..Default::default() };
36-
37-
assert_eq!(versioned_constants.os_constants.gas_costs.base.step_gas_cost, 2);
38-
assert_eq!(versioned_constants.os_constants.gas_costs.base.entry_point_initial_budget, 2 * 3); // step_gas_cost * 3.
39-
40-
// entry_point_initial_budget * 4 + step_gas_cost * 5.
41-
assert_eq!(
42-
versioned_constants.os_constants.gas_costs.base.syscall_base_gas_cost,
43-
6 * 4 + 2 * 5
44-
);
45-
}
46-
4719
/// Assert versioned constants overrides are used when provided.
4820
#[test]
4921
fn test_versioned_constants_overrides() {

0 commit comments

Comments
 (0)