Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
PearsonWhite committed Nov 6, 2024
1 parent 9381a45 commit 275a9d7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 171870;
pub const REQUIRED_GAS_STORAGE_READ_WRITE_TEST: u64 = 16989;
pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 170370;
pub const REQUIRED_GAS_STORAGE_READ_WRITE_TEST: u64 = 16990;
pub const REQUIRED_GAS_LIBRARY_CALL_TEST: u64 = 167970;
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn no_constructor_nonempty_calldata(deployer_contract: FeatureContract) {
));
}

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1),216750, 5210;"VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1),214550, 4610;"VM")]
fn with_constructor(
deployer_contract: FeatureContract,
expected_gas: u64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE};

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 255110; "VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 254910; "VM")]
fn test_keccak(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn test_library_call(test_contract: FeatureContract, expected_gas: u64) {
test_contract.get_class_hash().0, // Class hash.
inner_entry_point_selector.0, // Function selector.
felt!(2_u8), // Calldata length.
felt!(1234_u16), // Calldata: address.
felt!(1219_u16), // Calldata: address.
felt!(91_u8) // Calldata: value.
];

Expand Down Expand Up @@ -85,7 +85,7 @@ fn test_library_call_assert_fails(test_contract: FeatureContract) {
);
}

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 478110; "VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 475110; "VM")]
fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]);
Expand Down Expand Up @@ -116,7 +116,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: 9999597720,
initial_gas: 9999600120,
..trivial_external_entry_point_new(test_contract)
};
let library_entry_point = CallEntryPoint {
Expand All @@ -131,17 +131,17 @@ 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: 9999749900,
initial_gas: 9999751100,
..trivial_external_entry_point_new(test_contract)
};
let storage_entry_point = CallEntryPoint {
calldata: calldata![felt!(key), felt!(value)],
initial_gas: 9999445780,
initial_gas: 9999448480,
..nested_storage_entry_point
};

let storage_entry_point_resources = ExecutionResources {
n_steps: 247,
n_steps: 244,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([(BuiltinName::range_check, 7)]),
};
Expand Down Expand Up @@ -169,7 +169,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {

let library_call_resources = &get_syscall_resources(SyscallSelector::LibraryCall)
+ &ExecutionResources {
n_steps: 392,
n_steps: 377,
n_memory_holes: 0,
builtin_instance_counter: HashMap::from([(BuiltinName::range_check, 15)]),
};
Expand Down Expand Up @@ -205,7 +205,7 @@ fn test_nested_library_call(test_contract: FeatureContract, expected_gas: u64) {

let main_call_resources = &(&get_syscall_resources(SyscallSelector::LibraryCall) * 3)
+ &ExecutionResources {
n_steps: 757,
n_steps: 727,
n_memory_holes: 2,
builtin_instance_counter: HashMap::from([(BuiltinName::range_check, 27)]),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE};

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17036546; "VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17034156; "VM")]
fn test_secp256k1(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE};

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 22160; "VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 20960; "VM")]
fn test_send_message_to_l1(test_contract: FeatureContract, expected_gas: u64) {
let chain_info = &ChainInfo::create_for_testing();
let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]);
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/transaction/transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ fn expected_validate_call_info(
};
let n_steps = match (entry_point_selector_name, cairo_version) {
(constants::VALIDATE_DEPLOY_ENTRY_POINT_NAME, CairoVersion::Cairo0) => 13_usize,
(constants::VALIDATE_DEPLOY_ENTRY_POINT_NAME, CairoVersion::Cairo1) => 40_usize,
(constants::VALIDATE_DEPLOY_ENTRY_POINT_NAME, CairoVersion::Cairo1) => 32_usize,
(constants::VALIDATE_DECLARE_ENTRY_POINT_NAME, CairoVersion::Cairo0) => 12_usize,
(constants::VALIDATE_DECLARE_ENTRY_POINT_NAME, CairoVersion::Cairo1) => 28_usize,
(constants::VALIDATE_ENTRY_POINT_NAME, CairoVersion::Cairo0) => 21_usize,
Expand Down Expand Up @@ -2273,7 +2273,7 @@ fn test_l1_handler(#[values(false, true)] use_kzg_da: bool) {
l1_data_gas: 128_u32.into(),
l2_gas: 0_u32.into(),
},
false => GasVector::from_l1_gas(19138_u32.into()),
false => GasVector::from_l1_gas(19131_u32.into()),
};

let expected_da_gas = match use_kzg_da {
Expand All @@ -2289,13 +2289,13 @@ fn test_l1_handler(#[values(false, true)] use_kzg_da: bool) {

let mut expected_execution_resources = ExecutionResources {
builtin_instance_counter: HashMap::from([
(BuiltinName::pedersen, 11 + payload_size),
(
BuiltinName::range_check,
get_tx_resources(TransactionType::L1Handler).builtin_instance_counter
[&BuiltinName::range_check]
+ 6,
),
(BuiltinName::pedersen, 11 + payload_size),
]),
n_steps: get_tx_resources(TransactionType::L1Handler).n_steps + 164,
n_memory_holes: 0,
Expand Down

0 comments on commit 275a9d7

Please sign in to comment.