diff --git a/crates/blockifier/cairo_native b/crates/blockifier/cairo_native index 76e83965d3..c9b0fb767d 160000 --- a/crates/blockifier/cairo_native +++ b/crates/blockifier/cairo_native @@ -1 +1 @@ -Subproject commit 76e83965d3bf1252eb6c68200a3accd5fd1ec004 +Subproject commit c9b0fb767d5952053bfe978782a18a410713866a diff --git a/crates/blockifier/resources/versioned_constants_0_13_0.json b/crates/blockifier/resources/versioned_constants_0_13_0.json index 6f52d6cb43..1871d66fbf 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_0.json +++ b/crates/blockifier/resources/versioned_constants_0_13_0.json @@ -89,28 +89,24 @@ "syscall_base_gas_cost": { "step_gas_cost": 100 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "call_contract_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 10, - "entry_point_gas_cost": 1 + "step_gas_cost": 510, + "entry_point_initial_budget": 1 }, "deploy_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 200, - "entry_point_gas_cost": 1 + "step_gas_cost": 700, + "entry_point_initial_budget": 1 }, "get_block_hash_gas_cost": { "syscall_base_gas_cost": 1, @@ -611,4 +607,4 @@ 1000 ] } -} +} \ No newline at end of file diff --git a/crates/blockifier/resources/versioned_constants_0_13_1.json b/crates/blockifier/resources/versioned_constants_0_13_1.json index 1be6a8686f..884c8fe266 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1.json @@ -89,28 +89,24 @@ "syscall_base_gas_cost": { "step_gas_cost": 100 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "call_contract_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 10, - "entry_point_gas_cost": 1 + "step_gas_cost": 510, + "entry_point_initial_budget": 1 }, "deploy_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 200, - "entry_point_gas_cost": 1 + "step_gas_cost": 700, + "entry_point_initial_budget": 1 }, "get_block_hash_gas_cost": { "syscall_base_gas_cost": 1, diff --git a/crates/blockifier/resources/versioned_constants_0_13_1_1.json b/crates/blockifier/resources/versioned_constants_0_13_1_1.json index 782d3ca130..86e40687ed 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1_1.json @@ -89,28 +89,24 @@ "syscall_base_gas_cost": { "step_gas_cost": 100 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "call_contract_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 10, - "entry_point_gas_cost": 1 + "step_gas_cost": 510, + "entry_point_initial_budget": 1 }, "deploy_gas_cost": { "syscall_base_gas_cost": 1, - "step_gas_cost": 200, - "entry_point_gas_cost": 1 + "step_gas_cost": 700, + "entry_point_initial_budget": 1 }, "get_block_hash_gas_cost": { "syscall_base_gas_cost": 1, diff --git a/crates/blockifier/resources/versioned_constants_0_13_2.json b/crates/blockifier/resources/versioned_constants_0_13_2.json index 86ab5aeb02..3ef484e8cf 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2.json @@ -58,25 +58,21 @@ "os_constants": { "block_hash_contract_address": 1, "call_contract_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 10, + "entry_point_initial_budget": 1, + "step_gas_cost": 510, "syscall_base_gas_cost": 1 }, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, "deploy_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 200, + "entry_point_initial_budget": 1, + "step_gas_cost": 700, "syscall_base_gas_cost": 1 }, "emit_event_gas_cost": { "step_gas_cost": 10, "syscall_base_gas_cost": 1 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "entry_point_initial_budget": { "step_gas_cost": 100 }, @@ -91,8 +87,8 @@ "error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND", "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "get_block_hash_gas_cost": { "step_gas_cost": 50, @@ -207,9 +203,9 @@ "step_gas_cost": 100 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", diff --git a/crates/blockifier/resources/versioned_constants_0_13_2_1.json b/crates/blockifier/resources/versioned_constants_0_13_2_1.json index 0b740a1205..c990dc87a3 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2_1.json @@ -58,25 +58,21 @@ "os_constants": { "block_hash_contract_address": 1, "call_contract_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 10, + "entry_point_initial_budget": 1, + "step_gas_cost": 510, "syscall_base_gas_cost": 1 }, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, "deploy_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 200, + "entry_point_initial_budget": 1, + "step_gas_cost": 700, "syscall_base_gas_cost": 1 }, "emit_event_gas_cost": { "step_gas_cost": 10, "syscall_base_gas_cost": 1 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "entry_point_initial_budget": { "step_gas_cost": 100 }, @@ -91,8 +87,8 @@ "error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND", "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "get_block_hash_gas_cost": { "step_gas_cost": 50, @@ -207,9 +203,9 @@ "step_gas_cost": 100 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", diff --git a/crates/blockifier/resources/versioned_constants_0_13_3.json b/crates/blockifier/resources/versioned_constants_0_13_3.json index 0b740a1205..c990dc87a3 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_3.json +++ b/crates/blockifier/resources/versioned_constants_0_13_3.json @@ -58,25 +58,21 @@ "os_constants": { "block_hash_contract_address": 1, "call_contract_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 10, + "entry_point_initial_budget": 1, + "step_gas_cost": 510, "syscall_base_gas_cost": 1 }, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, "deploy_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 200, + "entry_point_initial_budget": 1, + "step_gas_cost": 700, "syscall_base_gas_cost": 1 }, "emit_event_gas_cost": { "step_gas_cost": 10, "syscall_base_gas_cost": 1 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "entry_point_initial_budget": { "step_gas_cost": 100 }, @@ -91,8 +87,8 @@ "error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND", "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", "fee_transfer_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 100 + "entry_point_initial_budget": 1, + "step_gas_cost": 600 }, "get_block_hash_gas_cost": { "step_gas_cost": 50, @@ -207,9 +203,9 @@ "step_gas_cost": 100 }, "transaction_gas_cost": { - "entry_point_gas_cost": 2, + "entry_point_initial_budget": 2, "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 + "step_gas_cost": 1100 }, "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", diff --git a/crates/blockifier/resources/versioned_constants_0_13_4.json b/crates/blockifier/resources/versioned_constants_0_13_4.json index 3c1703482b..26e1f90c4e 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_4.json +++ b/crates/blockifier/resources/versioned_constants_0_13_4.json @@ -58,14 +58,14 @@ "os_constants": { "block_hash_contract_address": 1, "call_contract_gas_cost": { - "entry_point_gas_cost": 1, + "entry_point_initial_budget": 1, "step_gas_cost": 860, "range_check_gas_cost": 15 }, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, "deploy_gas_cost": { - "entry_point_gas_cost": 1, + "entry_point_initial_budget": 1, "step_gas_cost": 1128, "range_check_gas_cost": 18, "pedersen_gas_cost": 7 @@ -74,10 +74,6 @@ "step_gas_cost": 100, "range_check_gas_cost": 1 }, - "entry_point_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 500 - }, "entry_point_initial_budget": { "step_gas_cost": 100 }, @@ -114,7 +110,7 @@ "l1_data_gas_index": 2, "l2_gas_index": 1, "library_call_gas_cost": { - "entry_point_gas_cost": 1, + "entry_point_initial_budget": 1, "step_gas_cost": 836, "range_check_gas_cost": 15 }, diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/constants.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/constants.rs index daf276fd65..ff3ebd021d 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/constants.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/constants.rs @@ -1,4 +1,4 @@ -pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 170370; +pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 120370; pub const REQUIRED_GAS_STORAGE_READ_WRITE_TEST: u64 = 16990; pub const REQUIRED_GAS_GET_CLASS_HASH_AT_TEST: u64 = 7830; -pub const REQUIRED_GAS_LIBRARY_CALL_TEST: u64 = 167970; +pub const REQUIRED_GAS_LIBRARY_CALL_TEST: u64 = 117970; diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/deploy.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/deploy.rs index 8bf2807852..c358f92910 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/deploy.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/deploy.rs @@ -38,7 +38,7 @@ fn no_constructor(cairo_version: CairoVersion) { let deploy_call = &entry_point_call.execute_directly(&mut state).unwrap(); assert_eq!( deploy_call.execution, - CallExecution { retdata: retdata![], gas_consumed: 205200, ..CallExecution::default() } + CallExecution { retdata: retdata![], gas_consumed: 155200, ..CallExecution::default() } ); let deployed_contract_address = calculate_contract_address( @@ -119,7 +119,7 @@ fn with_constructor(cairo_version: CairoVersion) { let deploy_call = &entry_point_call.execute_directly(&mut state).unwrap(); assert_eq!( deploy_call.execution, - CallExecution { retdata: retdata![], gas_consumed: 214550, ..CallExecution::default() } + CallExecution { retdata: retdata![], gas_consumed: 164550, ..CallExecution::default() } ); let constructor_call = &deploy_call.inner_calls[0]; diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/library_call.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/library_call.rs index 9a3ede71b5..66456da1df 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/library_call.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/library_call.rs @@ -93,7 +93,7 @@ fn test_library_call_assert_fails(cairo_version: CairoVersion) { // 'ENTRYPOINT_FAILED'. felt!("0x454e545259504f494e545f4641494c4544") ]), - gas_consumed: 150980, + gas_consumed: 100980, failed: true, ..Default::default() } @@ -133,7 +133,7 @@ fn test_nested_library_call(cairo_version: CairoVersion) { class_hash: Some(test_class_hash), code_address: None, call_type: CallType::Delegate, - initial_gas: 9998985960, + initial_gas: 9999085960, ..trivial_external_entry_point_new(test_contract) }; let library_entry_point = CallEntryPoint { @@ -148,12 +148,12 @@ fn test_nested_library_call(cairo_version: CairoVersion) { class_hash: Some(test_class_hash), code_address: None, call_type: CallType::Delegate, - initial_gas: 9999136940, + initial_gas: 9999186940, ..trivial_external_entry_point_new(test_contract) }; let storage_entry_point = CallEntryPoint { calldata: calldata![felt!(key), felt!(value)], - initial_gas: 9998834320, + initial_gas: 9998984320, ..nested_storage_entry_point }; @@ -243,7 +243,7 @@ fn test_nested_library_call(cairo_version: CairoVersion) { call: main_entry_point.clone(), execution: CallExecution { retdata: retdata![felt!(value)], - gas_consumed: 475110, + gas_consumed: 325110, ..CallExecution::default() }, charged_resources: main_call_resources, diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 648725249f..90e4dadcf2 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -429,7 +429,7 @@ fn add_kzg_da_resources_to_resources_mapping( }, validate_gas_consumed: 4740, // The gas consumption results from parsing the input // arguments. - execute_gas_consumed: 162080, + execute_gas_consumed: 112080, inner_call_initial_gas: versioned_constants_for_account_testing().default_initial_gas_cost(), }, CairoVersion::Cairo1)] diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index 0ce942652a..0a4fb04cf6 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -584,7 +584,6 @@ pub struct GasCosts { pub entry_point_initial_budget: u64, pub syscall_base_gas_cost: u64, // OS gas costs. - pub entry_point_gas_cost: u64, pub transaction_gas_cost: u64, // Syscall gas costs. pub call_contract_gas_cost: u64, diff --git a/crates/blockifier/src/versioned_constants_test.rs b/crates/blockifier/src/versioned_constants_test.rs index 4f281f71af..4f407de017 100644 --- a/crates/blockifier/src/versioned_constants_test.rs +++ b/crates/blockifier/src/versioned_constants_test.rs @@ -19,7 +19,7 @@ fn test_successful_gas_costs_parsing() { "entry_point_initial_budget": { "step_gas_cost": 3 }, - "entry_point_gas_cost": { + "transaction_gas_cost": { "entry_point_initial_budget": 4, "step_gas_cost": 5 }, @@ -33,7 +33,7 @@ fn test_successful_gas_costs_parsing() { assert_eq!(versioned_constants.os_constants.gas_costs.entry_point_initial_budget, 2 * 3); // step_gas_cost * 3. // entry_point_initial_budget * 4 + step_gas_cost * 5. - assert_eq!(versioned_constants.os_constants.gas_costs.entry_point_gas_cost, 6 * 4 + 2 * 5); + assert_eq!(versioned_constants.os_constants.gas_costs.transaction_gas_cost, 6 * 4 + 2 * 5); } /// Assert versioned constants overrides are used when provided.