Skip to content

Commit

Permalink
chore(blockifier): update expected gas in syscall tests for native
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-pino committed Nov 14, 2024
1 parent c854a27 commit 55b4849
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn test_call_contract_that_panics() {
test_case(
FeatureContract::TestContract(CairoVersion::Native),
FeatureContract::TestContract(CairoVersion::Native),
189010;
190370;
"Call Contract between two contracts using Native"
)
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::test_utils::{calldata_for_deploy_test, trivial_external_entry_point_n
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 205200;"VM")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 215310;"Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 215200;"Native")
)]
fn no_constructor(deployer_contract: FeatureContract, expected_gas: u64) {
// TODO(Yoni): share the init code of the tests in this file.
Expand Down Expand Up @@ -99,7 +99,7 @@ fn no_constructor_nonempty_calldata(deployer_contract: FeatureContract) {
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1),214550, 4610;"VM")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native),233890, 13840;"Native")
test_case(FeatureContract::TestContract(CairoVersion::Native),234550, 14610;"Native")
)]
fn with_constructor(
deployer_contract: FeatureContract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const N_EMITTED_EVENTS: [Felt; 1] = [Felt::from_hex_unchecked("0x1")];

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 57430; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 57330; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 47330; "VM")]
fn positive_flow(test_contract: FeatureContract, expected_gas: u64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE}
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 254910; "VM")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 263740; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 264910; "Native")
)]
fn test_keccak(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::versioned_constants::VersionedConstants;

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 186610; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 187970; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), REQUIRED_GAS_LIBRARY_CALL_TEST; "VM")]
fn test_library_call(test_contract: FeatureContract, expected_gas: u64) {
Expand Down Expand Up @@ -103,7 +103,7 @@ fn test_library_call_assert_fails(test_contract: FeatureContract) {

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 512510; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 515110; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 475110; "VM")]
fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
Expand Down Expand Up @@ -157,7 +157,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
class_hash: Some(test_class_hash),
code_address: None,
call_type: CallType::Delegate,
initial_gas: if_native(&test_contract)(9999258160, 9998985960),
initial_gas: if_native(&test_contract)(9999257700, 9998985960),
..trivial_external_entry_point_new(test_contract)
};
let library_entry_point = CallEntryPoint {
Expand All @@ -172,19 +172,19 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
class_hash: Some(test_class_hash),
code_address: None,
call_type: CallType::Delegate,
initial_gas: if_native(&test_contract)(9999418850, 9999136940),
initial_gas: if_native(&test_contract)(9999418680, 9999136940),
..trivial_external_entry_point_new(test_contract)
};
let storage_entry_point = CallEntryPoint {
calldata: calldata![felt!(key), felt!(value)],
initial_gas: if_native(&test_contract)(9999097590, 9998834320),
initial_gas: if_native(&test_contract)(9999096060, 9998834320),
..nested_storage_entry_point
};

let first_storage_entry_point_resources = if_native(&test_contract)(
ChargedResources {
vm_resources: ExecutionResources::default(),
gas_for_fee: GasAmount(25920),
gas_for_fee: GasAmount(26990),
},
ChargedResources::from_execution_resources(ExecutionResources {
n_steps: 244,
Expand All @@ -195,7 +195,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
let storage_entry_point_resources = if_native(&test_contract)(
ChargedResources {
vm_resources: ExecutionResources::default(),
gas_for_fee: GasAmount(25920),
gas_for_fee: GasAmount(26990),
},
first_storage_entry_point_resources.clone(),
);
Expand All @@ -210,7 +210,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
call: nested_storage_entry_point,
execution: CallExecution {
retdata: retdata![felt!(value + 1)],
gas_consumed: if_native(&test_contract)(25920, REQUIRED_GAS_STORAGE_READ_WRITE_TEST),
gas_consumed: if_native(&test_contract)(26990, REQUIRED_GAS_STORAGE_READ_WRITE_TEST),
..CallExecution::default()
},
charged_resources: first_storage_entry_point_resources,
Expand All @@ -223,7 +223,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
let library_call_resources = if_native(&test_contract)(
ChargedResources {
vm_resources: ExecutionResources::default(),
gas_for_fee: GasAmount(186610),
gas_for_fee: GasAmount(187970),
},
ChargedResources::from_execution_resources(
&get_syscall_resources(SyscallSelector::LibraryCall)
Expand All @@ -239,7 +239,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
call: library_entry_point,
execution: CallExecution {
retdata: retdata![felt!(value + 1)],
gas_consumed: if_native(&test_contract)(186610, REQUIRED_GAS_LIBRARY_CALL_TEST),
gas_consumed: if_native(&test_contract)(187970, REQUIRED_GAS_LIBRARY_CALL_TEST),
..CallExecution::default()
},
charged_resources: library_call_resources,
Expand All @@ -252,7 +252,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
call: storage_entry_point,
execution: CallExecution {
retdata: retdata![felt!(value)],
gas_consumed: if_native(&test_contract)(25920, REQUIRED_GAS_STORAGE_READ_WRITE_TEST),
gas_consumed: if_native(&test_contract)(26990, REQUIRED_GAS_STORAGE_READ_WRITE_TEST),
..CallExecution::default()
},
charged_resources: storage_entry_point_resources,
Expand All @@ -265,7 +265,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
let main_call_resources = if_native(&test_contract)(
ChargedResources {
vm_resources: ExecutionResources::default(),
gas_for_fee: GasAmount(512510),
gas_for_fee: GasAmount(515110),
},
ChargedResources::from_execution_resources(
&(&get_syscall_resources(SyscallSelector::LibraryCall) * 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE}

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 30680; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 30960; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 20960; "VM")]
fn test_send_message_to_l1(test_contract: FeatureContract, expected_gas: u64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE}

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 890255; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 891425; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 881425; "VM")]
fn test_sha256(test_contract: FeatureContract, gas_consumed: u64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE}

#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 25920; "Native")
test_case(FeatureContract::TestContract(CairoVersion::Native), 26990; "Native")
)]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), REQUIRED_GAS_STORAGE_READ_WRITE_TEST; "VM")]
fn test_storage_read_write(test_contract: FeatureContract, expected_gas: u64) {
Expand Down

0 comments on commit 55b4849

Please sign in to comment.