From 347b59e3cd16a47bc90306a069a8bb34df97d1c2 Mon Sep 17 00:00:00 2001 From: Yonatan-Starkware Date: Thu, 28 Nov 2024 18:18:04 +0200 Subject: [PATCH] chore(blockifier): add syscalls_gas_costs struct --- .../resources/versioned_constants_0_13_0.json | 208 +++++++------- .../resources/versioned_constants_0_13_1.json | 208 +++++++------- .../versioned_constants_0_13_1_1.json | 208 +++++++------- .../resources/versioned_constants_0_13_2.json | 213 +++++++------- .../versioned_constants_0_13_2_1.json | 213 +++++++------- .../resources/versioned_constants_0_13_3.json | 213 +++++++------- .../resources/versioned_constants_0_13_4.json | 217 +++++++------- .../deprecated_syscalls/hint_processor.rs | 2 +- .../src/execution/deprecated_syscalls/mod.rs | 4 +- .../blockifier/src/execution/entry_point.rs | 2 +- .../src/execution/entry_point_execution.rs | 12 +- .../execution/native/entry_point_execution.rs | 12 +- .../src/execution/native/syscall_handler.rs | 50 ++-- .../src/execution/syscalls/hint_processor.rs | 49 ++-- .../src/execution/syscalls/syscall_base.rs | 2 +- crates/blockifier/src/test_utils.rs | 1 + .../src/transaction/account_transaction.rs | 2 +- .../transaction/account_transactions_test.rs | 2 +- .../src/transaction/transactions_test.rs | 1 + crates/blockifier/src/versioned_constants.rs | 271 ++++++++++++------ .../src/versioned_constants_test.rs | 6 +- 21 files changed, 1007 insertions(+), 889 deletions(-) diff --git a/crates/blockifier/resources/versioned_constants_0_13_0.json b/crates/blockifier/resources/versioned_constants_0_13_0.json index 01d8cb9e35..b5a7203236 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_0.json +++ b/crates/blockifier/resources/versioned_constants_0_13_0.json @@ -106,106 +106,6 @@ "fee_transfer_gas_cost": 1, "step_gas_cost": 1100 }, - "call_contract_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 510, - "entry_point_initial_budget": 1 - }, - "deploy_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 700, - "entry_point_initial_budget": 1 - }, - "get_block_hash_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_execution_info_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "replace_class_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_read_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_write_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, - "emit_event_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "send_message_to_l1_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "secp256k1_add_gas_cost": { - "step_gas_cost": 406, - "range_check_gas_cost": 29 - }, - "secp256k1_get_point_from_x_gas_cost": { - "step_gas_cost": 391, - "range_check_gas_cost": 30, - "memory_hole_gas_cost": 20 - }, - "secp256k1_get_xy_gas_cost": { - "step_gas_cost": 239, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256k1_mul_gas_cost": { - "step_gas_cost": 76401, - "range_check_gas_cost": 7045 - }, - "secp256k1_new_gas_cost": { - "step_gas_cost": 475, - "range_check_gas_cost": 35, - "memory_hole_gas_cost": 40 - }, - "secp256r1_add_gas_cost": { - "step_gas_cost": 589, - "range_check_gas_cost": 57 - }, - "secp256r1_get_point_from_x_gas_cost": { - "step_gas_cost": 510, - "range_check_gas_cost": 44, - "memory_hole_gas_cost": 20 - }, - "secp256r1_get_xy_gas_cost": { - "step_gas_cost": 241, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256r1_mul_gas_cost": { - "step_gas_cost": 125240, - "range_check_gas_cost": 13961 - }, - "secp256r1_new_gas_cost": { - "step_gas_cost": 594, - "range_check_gas_cost": 49, - "memory_hole_gas_cost": 40 - }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, - "sha256_process_block_gas_cost": { - "step_gas_cost": 0, - "range_check_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "error_block_number_out_of_range": "Block number out of range", "error_out_of_gas": "Out of gas", "error_entry_point_failed": "ENTRYPOINT_FAILED", @@ -216,7 +116,111 @@ "l1_gas": "L1_GAS", "l2_gas": "L2_GAS", "l1_gas_index": 0, - "l2_gas_index": 1 + "l2_gas_index": 1, + "syscall_gas_costs": { + "call_contract": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "deploy": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 700, + "entry_point_initial_budget": 1 + }, + "get_block_hash": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_execution_info": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "library_call": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "replace_class": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_read": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_write": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + }, + "emit_event": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "send_message_to_l1": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "secp256k1_add": { + "step_gas_cost": 406, + "range_check_gas_cost": 29 + }, + "secp256k1_get_point_from_x": { + "step_gas_cost": 391, + "range_check_gas_cost": 30, + "memory_hole_gas_cost": 20 + }, + "secp256k1_get_xy": { + "step_gas_cost": 239, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256k1_mul": { + "step_gas_cost": 76401, + "range_check_gas_cost": 7045 + }, + "secp256k1_new": { + "step_gas_cost": 475, + "range_check_gas_cost": 35, + "memory_hole_gas_cost": 40 + }, + "secp256r1_add": { + "step_gas_cost": 589, + "range_check_gas_cost": 57 + }, + "secp256r1_get_point_from_x": { + "step_gas_cost": 510, + "range_check_gas_cost": 44, + "memory_hole_gas_cost": 20 + }, + "secp256r1_get_xy": { + "step_gas_cost": 241, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256r1_mul": { + "step_gas_cost": 125240, + "range_check_gas_cost": 13961 + }, + "secp256r1_new": { + "step_gas_cost": 594, + "range_check_gas_cost": 49, + "memory_hole_gas_cost": 40 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "sha256_process_block": { + "step_gas_cost": 0, + "range_check_gas_cost": 0, + "syscall_base_gas_cost": 0 + } + } }, "os_resources": { "execute_syscalls": { @@ -616,4 +620,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 1efc124f37..cb05b58cb7 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1.json @@ -106,108 +106,6 @@ "fee_transfer_gas_cost": 1, "step_gas_cost": 1100 }, - "call_contract_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 510, - "entry_point_initial_budget": 1 - }, - "deploy_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 700, - "entry_point_initial_budget": 1 - }, - "get_block_hash_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_execution_info_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "replace_class_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_read_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_write_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, - "emit_event_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "send_message_to_l1_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "secp256k1_add_gas_cost": { - "step_gas_cost": 406, - "range_check_gas_cost": 29 - }, - "secp256k1_get_point_from_x_gas_cost": { - "step_gas_cost": 391, - "range_check_gas_cost": 30, - "memory_hole_gas_cost": 20 - }, - "secp256k1_get_xy_gas_cost": { - "step_gas_cost": 239, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256k1_mul_gas_cost": { - "step_gas_cost": 76501, - "range_check_gas_cost": 7045, - "memory_hole_gas_cost": 2 - }, - "secp256k1_new_gas_cost": { - "step_gas_cost": 475, - "range_check_gas_cost": 35, - "memory_hole_gas_cost": 40 - }, - "secp256r1_add_gas_cost": { - "step_gas_cost": 589, - "range_check_gas_cost": 57 - }, - "secp256r1_get_point_from_x_gas_cost": { - "step_gas_cost": 510, - "range_check_gas_cost": 44, - "memory_hole_gas_cost": 20 - }, - "secp256r1_get_xy_gas_cost": { - "step_gas_cost": 241, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256r1_mul_gas_cost": { - "step_gas_cost": 125340, - "range_check_gas_cost": 13961, - "memory_hole_gas_cost": 2 - }, - "secp256r1_new_gas_cost": { - "step_gas_cost": 594, - "range_check_gas_cost": 49, - "memory_hole_gas_cost": 40 - }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, - "sha256_process_block_gas_cost": { - "step_gas_cost": 0, - "range_check_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "error_block_number_out_of_range": "Block number out of range", "error_out_of_gas": "Out of gas", "error_entry_point_failed": "ENTRYPOINT_FAILED", @@ -222,6 +120,112 @@ "validate_rounding_consts": { "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 + }, + "syscall_gas_costs": { + "call_contract": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "deploy": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 700, + "entry_point_initial_budget": 1 + }, + "get_block_hash": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_execution_info": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "library_call": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "replace_class": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_read": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_write": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + }, + "emit_event": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "send_message_to_l1": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "secp256k1_add": { + "step_gas_cost": 406, + "range_check_gas_cost": 29 + }, + "secp256k1_get_point_from_x": { + "step_gas_cost": 391, + "range_check_gas_cost": 30, + "memory_hole_gas_cost": 20 + }, + "secp256k1_get_xy": { + "step_gas_cost": 239, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256k1_mul": { + "step_gas_cost": 76501, + "range_check_gas_cost": 7045, + "memory_hole_gas_cost": 2 + }, + "secp256k1_new": { + "step_gas_cost": 475, + "range_check_gas_cost": 35, + "memory_hole_gas_cost": 40 + }, + "secp256r1_add": { + "step_gas_cost": 589, + "range_check_gas_cost": 57 + }, + "secp256r1_get_point_from_x": { + "step_gas_cost": 510, + "range_check_gas_cost": 44, + "memory_hole_gas_cost": 20 + }, + "secp256r1_get_xy": { + "step_gas_cost": 241, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256r1_mul": { + "step_gas_cost": 125340, + "range_check_gas_cost": 13961, + "memory_hole_gas_cost": 2 + }, + "secp256r1_new": { + "step_gas_cost": 594, + "range_check_gas_cost": 49, + "memory_hole_gas_cost": 40 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "sha256_process_block": { + "step_gas_cost": 0, + "range_check_gas_cost": 0, + "syscall_base_gas_cost": 0 + } } }, "os_resources": { 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 a871f499e3..4f9f5885cf 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1_1.json @@ -106,108 +106,6 @@ "fee_transfer_gas_cost": 1, "step_gas_cost": 1100 }, - "call_contract_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 510, - "entry_point_initial_budget": 1 - }, - "deploy_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 700, - "entry_point_initial_budget": 1 - }, - "get_block_hash_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_execution_info_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "replace_class_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_read_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "storage_write_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, - "emit_event_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 10 - }, - "send_message_to_l1_gas_cost": { - "syscall_base_gas_cost": 1, - "step_gas_cost": 50 - }, - "secp256k1_add_gas_cost": { - "step_gas_cost": 406, - "range_check_gas_cost": 29 - }, - "secp256k1_get_point_from_x_gas_cost": { - "step_gas_cost": 391, - "range_check_gas_cost": 30, - "memory_hole_gas_cost": 20 - }, - "secp256k1_get_xy_gas_cost": { - "step_gas_cost": 239, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256k1_mul_gas_cost": { - "step_gas_cost": 76501, - "range_check_gas_cost": 7045, - "memory_hole_gas_cost": 2 - }, - "secp256k1_new_gas_cost": { - "step_gas_cost": 475, - "range_check_gas_cost": 35, - "memory_hole_gas_cost": 40 - }, - "secp256r1_add_gas_cost": { - "step_gas_cost": 589, - "range_check_gas_cost": 57 - }, - "secp256r1_get_point_from_x_gas_cost": { - "step_gas_cost": 510, - "range_check_gas_cost": 44, - "memory_hole_gas_cost": 20 - }, - "secp256r1_get_xy_gas_cost": { - "step_gas_cost": 241, - "range_check_gas_cost": 11, - "memory_hole_gas_cost": 40 - }, - "secp256r1_mul_gas_cost": { - "step_gas_cost": 125340, - "range_check_gas_cost": 13961, - "memory_hole_gas_cost": 2 - }, - "secp256r1_new_gas_cost": { - "step_gas_cost": 594, - "range_check_gas_cost": 49, - "memory_hole_gas_cost": 40 - }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, - "sha256_process_block_gas_cost": { - "step_gas_cost": 0, - "range_check_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "error_block_number_out_of_range": "Block number out of range", "error_out_of_gas": "Out of gas", "error_entry_point_failed": "ENTRYPOINT_FAILED", @@ -222,6 +120,112 @@ "validate_rounding_consts": { "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 + }, + "syscall_gas_costs": { + "call_contract": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "deploy": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 700, + "entry_point_initial_budget": 1 + }, + "get_block_hash": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_execution_info": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "library_call": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 510, + "entry_point_initial_budget": 1 + }, + "replace_class": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_read": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "storage_write": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + }, + "emit_event": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 10 + }, + "send_message_to_l1": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 50 + }, + "secp256k1_add": { + "step_gas_cost": 406, + "range_check_gas_cost": 29 + }, + "secp256k1_get_point_from_x": { + "step_gas_cost": 391, + "range_check_gas_cost": 30, + "memory_hole_gas_cost": 20 + }, + "secp256k1_get_xy": { + "step_gas_cost": 239, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256k1_mul": { + "step_gas_cost": 76501, + "range_check_gas_cost": 7045, + "memory_hole_gas_cost": 2 + }, + "secp256k1_new": { + "step_gas_cost": 475, + "range_check_gas_cost": 35, + "memory_hole_gas_cost": 40 + }, + "secp256r1_add": { + "step_gas_cost": 589, + "range_check_gas_cost": 57 + }, + "secp256r1_get_point_from_x": { + "step_gas_cost": 510, + "range_check_gas_cost": 44, + "memory_hole_gas_cost": 20 + }, + "secp256r1_get_xy": { + "step_gas_cost": 241, + "range_check_gas_cost": 11, + "memory_hole_gas_cost": 40 + }, + "secp256r1_mul": { + "step_gas_cost": 125340, + "range_check_gas_cost": 13961, + "memory_hole_gas_cost": 2 + }, + "secp256r1_new": { + "step_gas_cost": 594, + "range_check_gas_cost": 49, + "memory_hole_gas_cost": 40 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "sha256_process_block": { + "step_gas_cost": 0, + "range_check_gas_cost": 0, + "syscall_base_gas_cost": 0 + } } }, "os_resources": { diff --git a/crates/blockifier/resources/versioned_constants_0_13_2.json b/crates/blockifier/resources/versioned_constants_0_13_2.json index 6013ac9aea..571cce2ee0 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2.json @@ -58,22 +58,9 @@ "max_recursion_depth": 50, "segment_arena_cells": false, "os_constants": { - "call_contract_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 510, - "syscall_base_gas_cost": 1 - }, + "block_hash_contract_address": 1, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "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_initial_budget": { "step_gas_cost": 100 }, @@ -91,35 +78,14 @@ "entry_point_initial_budget": 1, "step_gas_cost": 600 }, - "get_block_hash_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_execution_info_gas_cost": { - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 - }, "default_initial_gas_cost": { "step_gas_cost": 100000000 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, "l1_gas": "L1_GAS", "l1_gas_index": 0, "l1_handler_version": 0, "l2_gas": "L2_GAS", "l2_gas_index": 1, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "sha256_process_block_gas_cost": { - "step_gas_cost": 1852, - "range_check_gas_cost": 65, - "bitwise_builtin_gas_cost": 1115, - "syscall_base_gas_cost": 1 - }, "memory_hole_gas_cost": 10, "nop_entry_point_offset": -1, "os_contract_addresses": { @@ -136,76 +102,8 @@ "add_mod_gas_cost": 0, "mul_mod_gas_cost": 0, "ecdsa_gas_cost": 0, - "replace_class_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "secp256k1_add_gas_cost": { - "range_check_gas_cost": 29, - "step_gas_cost": 406 - }, - "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 30, - "step_gas_cost": 391 - }, - "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 239 - }, - "secp256k1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 7045, - "step_gas_cost": 76501 - }, - "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 35, - "step_gas_cost": 475 - }, - "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 589 - }, - "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 44, - "step_gas_cost": 510 - }, - "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 241 - }, - "secp256r1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 13961, - "step_gas_cost": 125340 - }, - "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 49, - "step_gas_cost": 594 - }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, "sierra_array_len_bound": 4294967296, "step_gas_cost": 100, - "storage_read_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "storage_write_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "stored_block_hash_buffer": 10, "syscall_base_gas_cost": { "step_gas_cost": 100 @@ -223,7 +121,114 @@ "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 }, - "validated": "VALID" + "validated": "VALID", + "syscall_gas_costs": { + "call_contract": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "deploy": { + "entry_point_initial_budget": 1, + "step_gas_cost": 700, + "syscall_base_gas_cost": 1 + }, + "emit_event": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "get_block_hash": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_execution_info": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "library_call": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "sha256_process_block": { + "step_gas_cost": 1852, + "range_check_gas_cost": 65, + "bitwise_builtin_gas_cost": 1115, + "syscall_base_gas_cost": 1 + }, + "replace_class": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "secp256k1_add": { + "range_check_gas_cost": 29, + "step_gas_cost": 406 + }, + "secp256k1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 30, + "step_gas_cost": 391 + }, + "secp256k1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 239 + }, + "secp256k1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 7045, + "step_gas_cost": 76501 + }, + "secp256k1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 35, + "step_gas_cost": 475 + }, + "secp256r1_add": { + "range_check_gas_cost": 57, + "step_gas_cost": 589 + }, + "secp256r1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 44, + "step_gas_cost": 510 + }, + "secp256r1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 241 + }, + "secp256r1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 13961, + "step_gas_cost": 125340 + }, + "secp256r1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 49, + "step_gas_cost": 594 + }, + "send_message_to_l1": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_read": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_write": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + } + } }, "os_resources": { "execute_syscalls": { 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 f305600f49..ea79b39e53 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2_1.json @@ -58,22 +58,9 @@ "enable_reverts": false, "segment_arena_cells": false, "os_constants": { - "call_contract_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 510, - "syscall_base_gas_cost": 1 - }, + "block_hash_contract_address": 1, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "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_initial_budget": { "step_gas_cost": 100 }, @@ -91,35 +78,14 @@ "entry_point_initial_budget": 1, "step_gas_cost": 600 }, - "get_block_hash_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_execution_info_gas_cost": { - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 - }, "default_initial_gas_cost": { "step_gas_cost": 100000000 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, "l1_gas": "L1_GAS", "l1_gas_index": 0, "l1_handler_version": 0, "l2_gas": "L2_GAS", "l2_gas_index": 1, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "sha256_process_block_gas_cost": { - "step_gas_cost": 1852, - "range_check_gas_cost": 65, - "bitwise_builtin_gas_cost": 1115, - "syscall_base_gas_cost": 1 - }, "memory_hole_gas_cost": 10, "nop_entry_point_offset": -1, "os_contract_addresses": { @@ -136,76 +102,8 @@ "add_mod_gas_cost": 0, "mul_mod_gas_cost": 0, "ecdsa_gas_cost": 0, - "replace_class_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "secp256k1_add_gas_cost": { - "range_check_gas_cost": 29, - "step_gas_cost": 406 - }, - "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 30, - "step_gas_cost": 391 - }, - "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 239 - }, - "secp256k1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 7045, - "step_gas_cost": 76501 - }, - "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 35, - "step_gas_cost": 475 - }, - "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 589 - }, - "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 44, - "step_gas_cost": 510 - }, - "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 241 - }, - "secp256r1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 13961, - "step_gas_cost": 125340 - }, - "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 49, - "step_gas_cost": 594 - }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, "sierra_array_len_bound": 4294967296, "step_gas_cost": 100, - "storage_read_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "storage_write_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "stored_block_hash_buffer": 10, "syscall_base_gas_cost": { "step_gas_cost": 100 @@ -223,7 +121,114 @@ "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 }, - "validated": "VALID" + "validated": "VALID", + "syscall_gas_costs": { + "call_contract": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "deploy": { + "entry_point_initial_budget": 1, + "step_gas_cost": 700, + "syscall_base_gas_cost": 1 + }, + "emit_event": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "get_block_hash": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_execution_info": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "library_call": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "sha256_process_block": { + "step_gas_cost": 1852, + "range_check_gas_cost": 65, + "bitwise_builtin_gas_cost": 1115, + "syscall_base_gas_cost": 1 + }, + "replace_class": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "secp256k1_add": { + "range_check_gas_cost": 29, + "step_gas_cost": 406 + }, + "secp256k1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 30, + "step_gas_cost": 391 + }, + "secp256k1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 239 + }, + "secp256k1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 7045, + "step_gas_cost": 76501 + }, + "secp256k1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 35, + "step_gas_cost": 475 + }, + "secp256r1_add": { + "range_check_gas_cost": 57, + "step_gas_cost": 589 + }, + "secp256r1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 44, + "step_gas_cost": 510 + }, + "secp256r1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 241 + }, + "secp256r1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 13961, + "step_gas_cost": 125340 + }, + "secp256r1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 49, + "step_gas_cost": 594 + }, + "send_message_to_l1": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_read": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_write": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + } + } }, "os_resources": { "execute_syscalls": { diff --git a/crates/blockifier/resources/versioned_constants_0_13_3.json b/crates/blockifier/resources/versioned_constants_0_13_3.json index f305600f49..ea79b39e53 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_3.json +++ b/crates/blockifier/resources/versioned_constants_0_13_3.json @@ -58,22 +58,9 @@ "enable_reverts": false, "segment_arena_cells": false, "os_constants": { - "call_contract_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 510, - "syscall_base_gas_cost": 1 - }, + "block_hash_contract_address": 1, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "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_initial_budget": { "step_gas_cost": 100 }, @@ -91,35 +78,14 @@ "entry_point_initial_budget": 1, "step_gas_cost": 600 }, - "get_block_hash_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_execution_info_gas_cost": { - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 - }, "default_initial_gas_cost": { "step_gas_cost": 100000000 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, "l1_gas": "L1_GAS", "l1_gas_index": 0, "l1_handler_version": 0, "l2_gas": "L2_GAS", "l2_gas_index": 1, - "library_call_gas_cost": { - "call_contract_gas_cost": 1 - }, - "sha256_process_block_gas_cost": { - "step_gas_cost": 1852, - "range_check_gas_cost": 65, - "bitwise_builtin_gas_cost": 1115, - "syscall_base_gas_cost": 1 - }, "memory_hole_gas_cost": 10, "nop_entry_point_offset": -1, "os_contract_addresses": { @@ -136,76 +102,8 @@ "add_mod_gas_cost": 0, "mul_mod_gas_cost": 0, "ecdsa_gas_cost": 0, - "replace_class_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "secp256k1_add_gas_cost": { - "range_check_gas_cost": 29, - "step_gas_cost": 406 - }, - "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 30, - "step_gas_cost": 391 - }, - "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 239 - }, - "secp256k1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 7045, - "step_gas_cost": 76501 - }, - "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 35, - "step_gas_cost": 475 - }, - "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 589 - }, - "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 44, - "step_gas_cost": 510 - }, - "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 241 - }, - "secp256r1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 13961, - "step_gas_cost": 125340 - }, - "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 49, - "step_gas_cost": 594 - }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, "sierra_array_len_bound": 4294967296, "step_gas_cost": 100, - "storage_read_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "storage_write_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 0, - "syscall_base_gas_cost": 0 - }, "stored_block_hash_buffer": 10, "syscall_base_gas_cost": { "step_gas_cost": 100 @@ -223,7 +121,114 @@ "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 }, - "validated": "VALID" + "validated": "VALID", + "syscall_gas_costs": { + "call_contract": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "deploy": { + "entry_point_initial_budget": 1, + "step_gas_cost": 700, + "syscall_base_gas_cost": 1 + }, + "emit_event": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "get_block_hash": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_execution_info": { + "step_gas_cost": 10, + "syscall_base_gas_cost": 1 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "library_call": { + "entry_point_initial_budget": 1, + "step_gas_cost": 510, + "syscall_base_gas_cost": 1 + }, + "sha256_process_block": { + "step_gas_cost": 1852, + "range_check_gas_cost": 65, + "bitwise_builtin_gas_cost": 1115, + "syscall_base_gas_cost": 1 + }, + "replace_class": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "secp256k1_add": { + "range_check_gas_cost": 29, + "step_gas_cost": 406 + }, + "secp256k1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 30, + "step_gas_cost": 391 + }, + "secp256k1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 239 + }, + "secp256k1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 7045, + "step_gas_cost": 76501 + }, + "secp256k1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 35, + "step_gas_cost": 475 + }, + "secp256r1_add": { + "range_check_gas_cost": 57, + "step_gas_cost": 589 + }, + "secp256r1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 44, + "step_gas_cost": 510 + }, + "secp256r1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 241 + }, + "secp256r1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 13961, + "step_gas_cost": 125340 + }, + "secp256r1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 49, + "step_gas_cost": 594 + }, + "send_message_to_l1": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_read": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "storage_write": { + "step_gas_cost": 50, + "syscall_base_gas_cost": 1 + }, + "get_class_hash_at": { + "step_gas_cost": 0, + "syscall_base_gas_cost": 0 + } + } }, "os_resources": { "execute_syscalls": { diff --git a/crates/blockifier/resources/versioned_constants_0_13_4.json b/crates/blockifier/resources/versioned_constants_0_13_4.json index 09e7574c41..dbb15ca39d 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_4.json +++ b/crates/blockifier/resources/versioned_constants_0_13_4.json @@ -58,23 +58,9 @@ "max_recursion_depth": 50, "segment_arena_cells": false, "os_constants": { - "call_contract_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 860, - "range_check_gas_cost": 15 - }, + "block_hash_contract_address": 1, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 1128, - "range_check_gas_cost": 18, - "pedersen_gas_cost": 7 - }, - "emit_event_gas_cost": { - "step_gas_cost": 100, - "range_check_gas_cost": 1 - }, "entry_point_initial_budget": { "step_gas_cost": 100 }, @@ -88,21 +74,9 @@ "error_entry_point_failed": "ENTRYPOINT_FAILED", "error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND", "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", - "get_block_hash_gas_cost": { - "step_gas_cost": 104, - "range_check_gas_cost": 2 - }, - "get_execution_info_gas_cost": { - "step_gas_cost": 100, - "range_check_gas_cost": 1 - }, "default_initial_gas_cost": { "step_gas_cost": 100000000 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 1 - }, - "keccak_round_cost_gas_cost": 180000, "l1_gas": "L1_GAS", "l1_gas_index": 0, "l1_handler_version": 0, @@ -110,17 +84,6 @@ "l1_data_gas": "L1_DATA", "l1_data_gas_index": 2, "l2_gas_index": 1, - "library_call_gas_cost": { - "entry_point_initial_budget": 1, - "step_gas_cost": 836, - "range_check_gas_cost": 15 - }, - "sha256_process_block_gas_cost": { - "step_gas_cost": 1855, - "range_check_gas_cost": 65, - "bitwise_builtin_gas_cost": 1115, - "syscall_base_gas_cost": 1 - }, "memory_hole_gas_cost": 10, "nop_entry_point_offset": -1, "os_contract_addresses": { @@ -137,76 +100,8 @@ "add_mod_gas_cost": 230, "mul_mod_gas_cost": 604, "ecdsa_gas_cost": 10561, - "replace_class_gas_cost": { - "step_gas_cost": 104, - "range_check_gas_cost": 1 - }, - "secp256k1_add_gas_cost": { - "range_check_gas_cost": 29, - "step_gas_cost": 410 - }, - "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 30, - "step_gas_cost": 395 - }, - "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 207 - }, - "secp256k1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 7045, - "step_gas_cost": 76505 - }, - "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 35, - "step_gas_cost": 461 - }, - "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 593 - }, - "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, - "range_check_gas_cost": 44, - "step_gas_cost": 514 - }, - "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 11, - "step_gas_cost": 209 - }, - "secp256r1_mul_gas_cost": { - "memory_hole_gas_cost": 2, - "range_check_gas_cost": 13961, - "step_gas_cost": 125344 - }, - "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, - "range_check_gas_cost": 49, - "step_gas_cost": 580 - }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 141, - "range_check_gas_cost": 1 - }, "sierra_array_len_bound": 4294967296, "step_gas_cost": 100, - "storage_read_gas_cost": { - "step_gas_cost": 100, - "range_check_gas_cost": 1 - }, - "storage_write_gas_cost": { - "step_gas_cost": 100, - "range_check_gas_cost": 1 - }, - "get_class_hash_at_gas_cost": { - "step_gas_cost": 100, - "range_check_gas_cost": 1 - }, "stored_block_hash_buffer": 10, "syscall_base_gas_cost": { "step_gas_cost": 100 @@ -225,7 +120,115 @@ "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 }, - "validated": "VALID" + "validated": "VALID", + "syscall_gas_costs": { + "call_contract": { + "entry_point_initial_budget": 1, + "step_gas_cost": 860, + "range_check_gas_cost": 15 + }, + "deploy": { + "entry_point_initial_budget": 1, + "step_gas_cost": 1128, + "range_check_gas_cost": 18, + "pedersen_gas_cost": 7 + }, + "emit_event": { + "step_gas_cost": 100, + "range_check_gas_cost": 1 + }, + "get_block_hash": { + "step_gas_cost": 104, + "range_check_gas_cost": 2 + }, + "get_execution_info": { + "step_gas_cost": 100, + "range_check_gas_cost": 1 + }, + "keccak": { + "syscall_base_gas_cost": 1 + }, + "keccak_round_cost": 180000, + "library_call": { + "entry_point_initial_budget": 1, + "step_gas_cost": 836, + "range_check_gas_cost": 15 + }, + "sha256_process_block": { + "step_gas_cost": 1855, + "range_check_gas_cost": 65, + "bitwise_builtin_gas_cost": 1115, + "syscall_base_gas_cost": 1 + }, + "replace_class": { + "step_gas_cost": 104, + "range_check_gas_cost": 1 + }, + "secp256k1_add": { + "range_check_gas_cost": 29, + "step_gas_cost": 410 + }, + "secp256k1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 30, + "step_gas_cost": 395 + }, + "secp256k1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 207 + }, + "secp256k1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 7045, + "step_gas_cost": 76505 + }, + "secp256k1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 35, + "step_gas_cost": 461 + }, + "secp256r1_add": { + "range_check_gas_cost": 57, + "step_gas_cost": 593 + }, + "secp256r1_get_point_from_x": { + "memory_hole_gas_cost": 20, + "range_check_gas_cost": 44, + "step_gas_cost": 514 + }, + "secp256r1_get_xy": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 11, + "step_gas_cost": 209 + }, + "secp256r1_mul": { + "memory_hole_gas_cost": 2, + "range_check_gas_cost": 13961, + "step_gas_cost": 125344 + }, + "secp256r1_new": { + "memory_hole_gas_cost": 40, + "range_check_gas_cost": 49, + "step_gas_cost": 580 + }, + "send_message_to_l1": { + "step_gas_cost": 141, + "range_check_gas_cost": 1 + }, + "storage_read": { + "step_gas_cost": 100, + "range_check_gas_cost": 1 + }, + "storage_write": { + "step_gas_cost": 100, + "range_check_gas_cost": 1 + }, + "get_class_hash_at": { + "step_gas_cost": 100, + "range_check_gas_cost": 1 + } + } }, "os_resources": { "execute_syscalls": { diff --git a/crates/blockifier/src/execution/deprecated_syscalls/hint_processor.rs b/crates/blockifier/src/execution/deprecated_syscalls/hint_processor.rs index 16f24ce504..201bdad740 100644 --- a/crates/blockifier/src/execution/deprecated_syscalls/hint_processor.rs +++ b/crates/blockifier/src/execution/deprecated_syscalls/hint_processor.rs @@ -533,7 +533,7 @@ pub fn execute_library_call( storage_address: syscall_handler.storage_address, caller_address: syscall_handler.caller_address, call_type: CallType::Delegate, - initial_gas: syscall_handler.context.gas_costs().default_initial_gas_cost, + initial_gas: syscall_handler.context.gas_costs().base.default_initial_gas_cost, }; execute_inner_call(entry_point, vm, syscall_handler).map_err(|error| { diff --git a/crates/blockifier/src/execution/deprecated_syscalls/mod.rs b/crates/blockifier/src/execution/deprecated_syscalls/mod.rs index 8a15ad9224..b921789774 100644 --- a/crates/blockifier/src/execution/deprecated_syscalls/mod.rs +++ b/crates/blockifier/src/execution/deprecated_syscalls/mod.rs @@ -219,7 +219,7 @@ pub fn call_contract( storage_address, caller_address: syscall_handler.storage_address, call_type: CallType::Call, - initial_gas: syscall_handler.context.gas_costs().default_initial_gas_cost, + initial_gas: syscall_handler.context.gas_costs().base.default_initial_gas_cost, }; let retdata_segment = execute_inner_call(entry_point, vm, syscall_handler).map_err(|error| { @@ -344,7 +344,7 @@ pub fn deploy( storage_address: deployed_contract_address, caller_address: deployer_address, }; - let mut remaining_gas = syscall_handler.context.gas_costs().default_initial_gas_cost; + let mut remaining_gas = syscall_handler.context.gas_costs().base.default_initial_gas_cost; let call_info = execute_deployment( syscall_handler.state, syscall_handler.context, diff --git a/crates/blockifier/src/execution/entry_point.rs b/crates/blockifier/src/execution/entry_point.rs index c89edd7265..fc6eeb3d5e 100644 --- a/crates/blockifier/src/execution/entry_point.rs +++ b/crates/blockifier/src/execution/entry_point.rs @@ -284,7 +284,7 @@ impl EntryPointExecutionContext { // New transactions with only L1 bounds use the L1 resource bounds directly. // New transactions with L2 bounds use the L2 bounds directly. let l1_gas_per_step = versioned_constants.vm_resource_fee_cost().n_steps; - let l2_gas_per_step = versioned_constants.os_constants.gas_costs.step_gas_cost; + let l2_gas_per_step = versioned_constants.os_constants.gas_costs.base.step_gas_cost; let tx_upper_bound_u64 = match tx_info { // Fee is a larger uint type than GasAmount, so we need to saturate the division. diff --git a/crates/blockifier/src/execution/entry_point_execution.rs b/crates/blockifier/src/execution/entry_point_execution.rs index 89e6182d5c..cdb9c8c7dc 100644 --- a/crates/blockifier/src/execution/entry_point_execution.rs +++ b/crates/blockifier/src/execution/entry_point_execution.rs @@ -196,12 +196,12 @@ fn prepare_program_extra_data( // Create the builtin cost segment, the builtin order should be the same as the price builtin // array in the os in compiled_class.cairo in load_compiled_class_facts. let builtin_price_array = [ - gas_costs.pedersen_gas_cost, - gas_costs.bitwise_builtin_gas_cost, - gas_costs.ecop_gas_cost, - gas_costs.poseidon_gas_cost, - gas_costs.add_mod_gas_cost, - gas_costs.mul_mod_gas_cost, + gas_costs.base.pedersen_gas_cost, + gas_costs.base.bitwise_builtin_gas_cost, + gas_costs.base.ecop_gas_cost, + gas_costs.base.poseidon_gas_cost, + gas_costs.base.add_mod_gas_cost, + gas_costs.base.mul_mod_gas_cost, ]; let data = builtin_price_array diff --git a/crates/blockifier/src/execution/native/entry_point_execution.rs b/crates/blockifier/src/execution/native/entry_point_execution.rs index 719bbc775e..f9ec45d116 100644 --- a/crates/blockifier/src/execution/native/entry_point_execution.rs +++ b/crates/blockifier/src/execution/native/entry_point_execution.rs @@ -31,12 +31,12 @@ pub fn execute_entry_point_call( let builtin_costs = BuiltinCosts { // todo(rodrigo): Unsure of what value `const` means, but 1 is the right value. r#const: 1, - pedersen: gas_costs.pedersen_gas_cost, - bitwise: gas_costs.bitwise_builtin_gas_cost, - ecop: gas_costs.ecop_gas_cost, - poseidon: gas_costs.poseidon_gas_cost, - add_mod: gas_costs.add_mod_gas_cost, - mul_mod: gas_costs.mul_mod_gas_cost, + pedersen: gas_costs.base.pedersen_gas_cost, + bitwise: gas_costs.base.bitwise_builtin_gas_cost, + ecop: gas_costs.base.ecop_gas_cost, + poseidon: gas_costs.base.poseidon_gas_cost, + add_mod: gas_costs.base.add_mod_gas_cost, + mul_mod: gas_costs.base.mul_mod_gas_cost, }; let execution_result = compiled_class.executor.run( diff --git a/crates/blockifier/src/execution/native/syscall_handler.rs b/crates/blockifier/src/execution/native/syscall_handler.rs index 20b8e08e02..5bd0640978 100644 --- a/crates/blockifier/src/execution/native/syscall_handler.rs +++ b/crates/blockifier/src/execution/native/syscall_handler.rs @@ -85,7 +85,7 @@ impl<'state> NativeSyscallHandler<'state> { return Err(vec![]); } // Refund `SYSCALL_BASE_GAS_COST` as it was pre-charged. - let required_gas = syscall_gas_cost - self.gas_costs().syscall_base_gas_cost; + let required_gas = syscall_gas_cost - self.gas_costs().base.syscall_base_gas_cost; if *remaining_gas < required_gas { // Out of gas failure. @@ -214,7 +214,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { block_number: u64, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().get_block_hash_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.get_block_hash)?; match self.base.get_block_hash(block_number) { Ok(value) => Ok(value), @@ -223,7 +223,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { } fn get_execution_info(&mut self, remaining_gas: &mut u64) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().get_execution_info_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.get_execution_info)?; Ok(ExecutionInfo { block_info: self.get_block_info(), @@ -239,7 +239,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { contract_address: Felt, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().get_class_hash_at_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.get_class_hash_at)?; let request = ContractAddress::try_from(contract_address) .map_err(|err| self.handle_error(remaining_gas, err.into()))?; @@ -251,7 +251,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { } fn get_execution_info_v2(&mut self, remaining_gas: &mut u64) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().get_execution_info_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.get_execution_info)?; Ok(ExecutionInfoV2 { block_info: self.get_block_info(), @@ -270,7 +270,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { deploy_from_zero: bool, remaining_gas: &mut u64, ) -> SyscallResult<(Felt, Vec)> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().deploy_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.deploy)?; let (deployed_contract_address, call_info) = self .base @@ -289,7 +289,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { Ok((Felt::from(deployed_contract_address), constructor_retdata)) } fn replace_class(&mut self, class_hash: Felt, remaining_gas: &mut u64) -> SyscallResult<()> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().replace_class_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.replace_class)?; self.base .replace_class(ClassHash(class_hash)) @@ -304,7 +304,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { calldata: &[Felt], remaining_gas: &mut u64, ) -> SyscallResult> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().library_call_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.library_call)?; let class_hash = ClassHash(class_hash); @@ -333,7 +333,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { calldata: &[Felt], remaining_gas: &mut u64, ) -> SyscallResult> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().call_contract_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.call_contract)?; let contract_address = ContractAddress::try_from(address) .map_err(|error| self.handle_error(remaining_gas, error.into()))?; @@ -370,7 +370,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { address: Felt, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().storage_read_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.storage_read)?; if address_domain != 0 { let address_domain = Felt::from(address_domain); @@ -392,7 +392,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { value: Felt, remaining_gas: &mut u64, ) -> SyscallResult<()> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().storage_write_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.storage_write)?; if address_domain != 0 { let address_domain = Felt::from(address_domain); @@ -413,7 +413,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { data: &[Felt], remaining_gas: &mut u64, ) -> SyscallResult<()> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().emit_event_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.emit_event)?; let event = EventContent { keys: keys.iter().copied().map(EventKey).collect(), @@ -430,7 +430,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { payload: &[Felt], remaining_gas: &mut u64, ) -> SyscallResult<()> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().send_message_to_l1_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.send_message_to_l1)?; let to_address = EthAddress::try_from(to_address) .map_err(|err| self.handle_error(remaining_gas, err.into()))?; @@ -440,7 +440,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { } fn keccak(&mut self, input: &[u64], remaining_gas: &mut u64) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().keccak_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.keccak)?; match self.base.keccak(input, remaining_gas) { Ok((state, _n_rounds)) => Ok(U256 { @@ -457,7 +457,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { y: U256, remaining_gas: &mut u64, ) -> SyscallResult> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256k1_new_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256k1_new)?; Secp256Point::new(x, y) .map(|op| op.map(|p| p.into())) @@ -470,7 +470,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { p1: Secp256k1Point, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256k1_add_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256k1_add)?; Ok(Secp256Point::add(p0.into(), p1.into()).into()) } @@ -481,7 +481,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { m: U256, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256k1_mul_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256k1_mul)?; Ok(Secp256Point::mul(p.into(), m).into()) } @@ -494,7 +494,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { ) -> SyscallResult> { self.pre_execute_syscall( remaining_gas, - self.gas_costs().secp256k1_get_point_from_x_gas_cost, + self.gas_costs().syscalls.secp256k1_get_point_from_x, )?; Secp256Point::get_point_from_x(x, y_parity) @@ -507,7 +507,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { p: Secp256k1Point, remaining_gas: &mut u64, ) -> SyscallResult<(U256, U256)> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256k1_get_xy_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256k1_get_xy)?; Ok((p.x, p.y)) } @@ -518,7 +518,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { y: U256, remaining_gas: &mut u64, ) -> SyscallResult> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256r1_new_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256r1_new)?; Secp256Point::new(x, y) .map(|option| option.map(|p| p.into())) @@ -531,7 +531,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { p1: Secp256r1Point, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256r1_add_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256r1_add)?; Ok(Secp256Point::add(p0.into(), p1.into()).into()) } @@ -541,7 +541,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { m: U256, remaining_gas: &mut u64, ) -> SyscallResult { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256r1_mul_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256r1_mul)?; Ok(Secp256Point::mul(p.into(), m).into()) } @@ -554,7 +554,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { ) -> SyscallResult> { self.pre_execute_syscall( remaining_gas, - self.gas_costs().secp256r1_get_point_from_x_gas_cost, + self.gas_costs().syscalls.secp256r1_get_point_from_x, )?; Secp256Point::get_point_from_x(x, y_parity) @@ -567,7 +567,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { p: Secp256r1Point, remaining_gas: &mut u64, ) -> SyscallResult<(U256, U256)> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().secp256r1_get_xy_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.secp256r1_get_xy)?; Ok((p.x, p.y)) } @@ -578,7 +578,7 @@ impl StarknetSyscallHandler for &mut NativeSyscallHandler<'_> { current_block: &[u32; 16], remaining_gas: &mut u64, ) -> SyscallResult<()> { - self.pre_execute_syscall(remaining_gas, self.gas_costs().sha256_process_block_gas_cost)?; + self.pre_execute_syscall(remaining_gas, self.gas_costs().syscalls.sha256_process_block)?; let data_as_bytes = sha2::digest::generic_array::GenericArray::from_exact_iter( current_block.iter().flat_map(|x| x.to_be_bytes()), diff --git a/crates/blockifier/src/execution/syscalls/hint_processor.rs b/crates/blockifier/src/execution/syscalls/hint_processor.rs index 22fd7c6c9a..c7e0972457 100644 --- a/crates/blockifier/src/execution/syscalls/hint_processor.rs +++ b/crates/blockifier/src/execution/syscalls/hint_processor.rs @@ -300,89 +300,89 @@ impl<'a> SyscallHintProcessor<'a> { match selector { SyscallSelector::CallContract => { - self.execute_syscall(vm, call_contract, self.gas_costs().call_contract_gas_cost) + self.execute_syscall(vm, call_contract, self.gas_costs().syscalls.call_contract) } SyscallSelector::Deploy => { - self.execute_syscall(vm, deploy, self.gas_costs().deploy_gas_cost) + self.execute_syscall(vm, deploy, self.gas_costs().syscalls.deploy) } SyscallSelector::EmitEvent => { - self.execute_syscall(vm, emit_event, self.gas_costs().emit_event_gas_cost) + self.execute_syscall(vm, emit_event, self.gas_costs().syscalls.emit_event) } SyscallSelector::GetBlockHash => { - self.execute_syscall(vm, get_block_hash, self.gas_costs().get_block_hash_gas_cost) + self.execute_syscall(vm, get_block_hash, self.gas_costs().syscalls.get_block_hash) } SyscallSelector::GetClassHashAt => self.execute_syscall( vm, get_class_hash_at, - self.gas_costs().get_class_hash_at_gas_cost, + self.gas_costs().syscalls.get_class_hash_at, ), SyscallSelector::GetExecutionInfo => self.execute_syscall( vm, get_execution_info, - self.gas_costs().get_execution_info_gas_cost, + self.gas_costs().syscalls.get_execution_info, ), SyscallSelector::Keccak => { - self.execute_syscall(vm, keccak, self.gas_costs().keccak_gas_cost) + self.execute_syscall(vm, keccak, self.gas_costs().syscalls.keccak) } SyscallSelector::Sha256ProcessBlock => self.execute_syscall( vm, sha_256_process_block, - self.gas_costs().sha256_process_block_gas_cost, + self.gas_costs().syscalls.sha256_process_block, ), SyscallSelector::LibraryCall => { - self.execute_syscall(vm, library_call, self.gas_costs().library_call_gas_cost) + self.execute_syscall(vm, library_call, self.gas_costs().syscalls.library_call) } SyscallSelector::ReplaceClass => { - self.execute_syscall(vm, replace_class, self.gas_costs().replace_class_gas_cost) + self.execute_syscall(vm, replace_class, self.gas_costs().syscalls.replace_class) } SyscallSelector::Secp256k1Add => { - self.execute_syscall(vm, secp256k1_add, self.gas_costs().secp256k1_add_gas_cost) + self.execute_syscall(vm, secp256k1_add, self.gas_costs().syscalls.secp256k1_add) } SyscallSelector::Secp256k1GetPointFromX => self.execute_syscall( vm, secp256k1_get_point_from_x, - self.gas_costs().secp256k1_get_point_from_x_gas_cost, + self.gas_costs().syscalls.secp256k1_get_point_from_x, ), SyscallSelector::Secp256k1GetXy => self.execute_syscall( vm, secp256k1_get_xy, - self.gas_costs().secp256k1_get_xy_gas_cost, + self.gas_costs().syscalls.secp256k1_get_xy, ), SyscallSelector::Secp256k1Mul => { - self.execute_syscall(vm, secp256k1_mul, self.gas_costs().secp256k1_mul_gas_cost) + self.execute_syscall(vm, secp256k1_mul, self.gas_costs().syscalls.secp256k1_mul) } SyscallSelector::Secp256k1New => { - self.execute_syscall(vm, secp256k1_new, self.gas_costs().secp256k1_new_gas_cost) + self.execute_syscall(vm, secp256k1_new, self.gas_costs().syscalls.secp256k1_new) } SyscallSelector::Secp256r1Add => { - self.execute_syscall(vm, secp256r1_add, self.gas_costs().secp256r1_add_gas_cost) + self.execute_syscall(vm, secp256r1_add, self.gas_costs().syscalls.secp256r1_add) } SyscallSelector::Secp256r1GetPointFromX => self.execute_syscall( vm, secp256r1_get_point_from_x, - self.gas_costs().secp256r1_get_point_from_x_gas_cost, + self.gas_costs().syscalls.secp256r1_get_point_from_x, ), SyscallSelector::Secp256r1GetXy => self.execute_syscall( vm, secp256r1_get_xy, - self.gas_costs().secp256r1_get_xy_gas_cost, + self.gas_costs().syscalls.secp256r1_get_xy, ), SyscallSelector::Secp256r1Mul => { - self.execute_syscall(vm, secp256r1_mul, self.gas_costs().secp256r1_mul_gas_cost) + self.execute_syscall(vm, secp256r1_mul, self.gas_costs().syscalls.secp256r1_mul) } SyscallSelector::Secp256r1New => { - self.execute_syscall(vm, secp256r1_new, self.gas_costs().secp256r1_new_gas_cost) + self.execute_syscall(vm, secp256r1_new, self.gas_costs().syscalls.secp256r1_new) } SyscallSelector::SendMessageToL1 => self.execute_syscall( vm, send_message_to_l1, - self.gas_costs().send_message_to_l1_gas_cost, + self.gas_costs().syscalls.send_message_to_l1, ), SyscallSelector::StorageRead => { - self.execute_syscall(vm, storage_read, self.gas_costs().storage_read_gas_cost) + self.execute_syscall(vm, storage_read, self.gas_costs().syscalls.storage_read) } SyscallSelector::StorageWrite => { - self.execute_syscall(vm, storage_write, self.gas_costs().storage_write_gas_cost) + self.execute_syscall(vm, storage_write, self.gas_costs().syscalls.storage_write) } _ => Err(HintError::UnknownHint( format!("Unsupported syscall selector {selector:?}.").into(), @@ -456,7 +456,8 @@ impl<'a> SyscallHintProcessor<'a> { ) -> SyscallResult, { // Refund `SYSCALL_BASE_GAS_COST` as it was pre-charged. - let required_gas = syscall_gas_cost - self.base.context.gas_costs().syscall_base_gas_cost; + let required_gas = + syscall_gas_cost - self.base.context.gas_costs().base.syscall_base_gas_cost; let SyscallRequestWrapper { gas_counter, request } = SyscallRequestWrapper::::read(vm, &mut self.syscall_ptr)?; diff --git a/crates/blockifier/src/execution/syscalls/syscall_base.rs b/crates/blockifier/src/execution/syscalls/syscall_base.rs index f664d2ab47..7e172065f1 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_base.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_base.rs @@ -278,7 +278,7 @@ impl<'state> SyscallHandlerBase<'state> { // TODO(Ori, 1/2/2024): Write an indicative expect message explaining why the conversion // works. let n_rounds_as_u64 = u64::try_from(n_rounds).expect("Failed to convert usize to u64."); - let gas_cost = n_rounds_as_u64 * self.context.gas_costs().keccak_round_cost_gas_cost; + let gas_cost = n_rounds_as_u64 * self.context.gas_costs().syscalls.keccak_round_cost; if gas_cost > *remaining_gas { let out_of_gas_error = Felt::from_hex(OUT_OF_GAS_ERROR) diff --git a/crates/blockifier/src/test_utils.rs b/crates/blockifier/src/test_utils.rs index a2d8164767..07d3f9f383 100644 --- a/crates/blockifier/src/test_utils.rs +++ b/crates/blockifier/src/test_utils.rs @@ -214,6 +214,7 @@ pub fn trivial_external_entry_point_with_address( initial_gas: VersionedConstants::create_for_testing() .os_constants .gas_costs + .base .default_initial_gas_cost, ..Default::default() } diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 18433b8134..f5e02fed6c 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -443,7 +443,7 @@ impl AccountTransaction { // The fee contains the cost of running this transfer, and the token contract is // well known to the sequencer, so there is no need to limit its run. let mut remaining_gas_for_fee_transfer = - block_context.versioned_constants.os_constants.gas_costs.default_initial_gas_cost; + block_context.versioned_constants.os_constants.gas_costs.base.default_initial_gas_cost; let fee_transfer_call = CallEntryPoint { class_hash: None, code_address: None, diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 8267351af6..97cd130b14 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -1092,7 +1092,7 @@ fn test_max_fee_computation_from_tx_bounds(block_context: BlockContext) { }); assert_max_steps_as_expected!( account_tx_l2_bounds, - l2_gas_bound / block_context.versioned_constants.os_constants.gas_costs.step_gas_cost, + l2_gas_bound / block_context.versioned_constants.os_constants.gas_costs.base.step_gas_cost, ); } diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index 6afdfaef88..39ef530f6f 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -287,6 +287,7 @@ fn expected_fee_transfer_call_info( .versioned_constants .os_constants .gas_costs + .base .default_initial_gas_cost, }; let expected_fee_sender_address = *account_address.0.key(); diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index ea22107412..1bf86ff6df 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -245,13 +245,13 @@ impl VersionedConstants { /// Returns the equivalent L1 gas amount of one unit of Sierra gas. /// The conversion is based on the pricing of a single Cairo step. fn sierra_gas_in_l1_gas_amount(&self) -> ResourceCost { - Ratio::new(1, self.os_constants.gas_costs.step_gas_cost) + Ratio::new(1, self.os_constants.gas_costs.base.step_gas_cost) * self.vm_resource_fee_cost().n_steps } /// Returns the default initial gas for VM mode transactions. pub fn default_initial_gas_cost(&self) -> u64 { - self.os_constants.gas_costs.default_initial_gas_cost + self.os_constants.gas_costs.base.default_initial_gas_cost } pub fn vm_resource_fee_cost(&self) -> &VmResourceCosts { @@ -378,10 +378,10 @@ impl VersionedConstants { .sum(); // The minimum total cost is `syscall_base_gas_cost`, which is pre-charged by the compiler. std::cmp::max( - n_steps * gas_costs.step_gas_cost - + n_memory_holes * gas_costs.memory_hole_gas_cost + n_steps * gas_costs.base.step_gas_cost + + n_memory_holes * gas_costs.base.memory_hole_gas_cost + total_builtin_gas_cost, - gas_costs.syscall_base_gas_cost, + gas_costs.base.syscall_base_gas_cost, ) } } @@ -569,9 +569,80 @@ impl<'de> Deserialize<'de> for OsResources { } } -/// Gas cost constants. For more documentation see in core/os/constants.cairo. #[derive(Debug, Default, Deserialize)] -pub struct GasCosts { +pub struct SyscallGasCosts { + pub call_contract: u64, + pub deploy: u64, + pub get_block_hash: u64, + pub get_execution_info: u64, + pub library_call: u64, + pub replace_class: u64, + pub storage_read: u64, + pub storage_write: u64, + pub get_class_hash_at: u64, + pub emit_event: u64, + pub send_message_to_l1: u64, + pub secp256k1_add: u64, + pub secp256k1_get_point_from_x: u64, + pub secp256k1_get_xy: u64, + pub secp256k1_mul: u64, + pub secp256k1_new: u64, + pub secp256r1_add: u64, + pub secp256r1_get_point_from_x: u64, + pub secp256r1_get_xy: u64, + pub secp256r1_mul: u64, + pub secp256r1_new: u64, + pub keccak: u64, + pub keccak_round_cost: u64, + pub sha256_process_block: u64, +} + +impl SyscallGasCosts { + pub fn get_syscall_gas_cost(&self, selector: &SyscallSelector) -> Result { + let gas_cost = match *selector { + SyscallSelector::CallContract => self.call_contract, + SyscallSelector::Deploy => self.deploy, + SyscallSelector::EmitEvent => self.emit_event, + SyscallSelector::GetBlockHash => self.get_block_hash, + SyscallSelector::GetExecutionInfo => self.get_execution_info, + SyscallSelector::GetClassHashAt => self.get_class_hash_at, + SyscallSelector::Keccak => self.keccak, + SyscallSelector::Sha256ProcessBlock => self.sha256_process_block, + SyscallSelector::LibraryCall => self.library_call, + SyscallSelector::ReplaceClass => self.replace_class, + SyscallSelector::Secp256k1Add => self.secp256k1_add, + SyscallSelector::Secp256k1GetPointFromX => self.secp256k1_get_point_from_x, + SyscallSelector::Secp256k1GetXy => self.secp256k1_get_xy, + SyscallSelector::Secp256k1Mul => self.secp256k1_mul, + SyscallSelector::Secp256k1New => self.secp256k1_new, + SyscallSelector::Secp256r1Add => self.secp256r1_add, + SyscallSelector::Secp256r1GetPointFromX => self.secp256r1_get_point_from_x, + SyscallSelector::Secp256r1GetXy => self.secp256r1_get_xy, + SyscallSelector::Secp256r1Mul => self.secp256r1_mul, + SyscallSelector::Secp256r1New => self.secp256r1_new, + SyscallSelector::SendMessageToL1 => self.send_message_to_l1, + SyscallSelector::StorageRead => self.storage_read, + SyscallSelector::StorageWrite => self.storage_write, + SyscallSelector::DelegateCall + | SyscallSelector::DelegateL1Handler + | SyscallSelector::GetBlockNumber + | SyscallSelector::GetBlockTimestamp + | SyscallSelector::GetCallerAddress + | SyscallSelector::GetContractAddress + | SyscallSelector::GetTxInfo + | SyscallSelector::GetSequencerAddress + | SyscallSelector::GetTxSignature + | SyscallSelector::LibraryCallL1Handler => { + return Err(GasCostsError::DeprecatedSyscall { selector: *selector }); + } + }; + + Ok(gas_cost) + } +} + +#[derive(Debug, Default, Deserialize)] +pub struct BaseGasCosts { pub step_gas_cost: u64, pub memory_hole_gas_cost: u64, // Range check has a hard-coded cost higher than its proof percentage to avoid the overhead of @@ -594,46 +665,28 @@ pub struct GasCosts { pub syscall_base_gas_cost: u64, // OS gas costs. pub transaction_gas_cost: u64, - // Syscall gas costs. - pub call_contract_gas_cost: u64, - pub deploy_gas_cost: u64, - pub get_block_hash_gas_cost: u64, - pub get_execution_info_gas_cost: u64, - pub library_call_gas_cost: u64, - pub replace_class_gas_cost: u64, - pub storage_read_gas_cost: u64, - pub storage_write_gas_cost: u64, - pub get_class_hash_at_gas_cost: u64, - pub emit_event_gas_cost: u64, - pub send_message_to_l1_gas_cost: u64, - pub secp256k1_add_gas_cost: u64, - pub secp256k1_get_point_from_x_gas_cost: u64, - pub secp256k1_get_xy_gas_cost: u64, - pub secp256k1_mul_gas_cost: u64, - pub secp256k1_new_gas_cost: u64, - pub secp256r1_add_gas_cost: u64, - pub secp256r1_get_point_from_x_gas_cost: u64, - pub secp256r1_get_xy_gas_cost: u64, - pub secp256r1_mul_gas_cost: u64, - pub secp256r1_new_gas_cost: u64, - pub keccak_gas_cost: u64, - pub keccak_round_cost_gas_cost: u64, - pub sha256_process_block_gas_cost: u64, +} + +/// Gas cost constants. For more documentation see in core/os/constants.cairo. +#[derive(Debug, Default, Deserialize)] +pub struct GasCosts { + pub base: BaseGasCosts, + pub syscalls: SyscallGasCosts, } impl GasCosts { pub fn get_builtin_gas_cost(&self, builtin: &BuiltinName) -> Result { let gas_cost = match *builtin { - BuiltinName::range_check => self.range_check_gas_cost, - BuiltinName::pedersen => self.pedersen_gas_cost, - BuiltinName::bitwise => self.bitwise_builtin_gas_cost, - BuiltinName::ec_op => self.ecop_gas_cost, - BuiltinName::keccak => self.keccak_builtin_gas_cost, - BuiltinName::poseidon => self.poseidon_gas_cost, - BuiltinName::range_check96 => self.range_check_gas_cost, - BuiltinName::add_mod => self.add_mod_gas_cost, - BuiltinName::mul_mod => self.mul_mod_gas_cost, - BuiltinName::ecdsa => self.ecdsa_gas_cost, + BuiltinName::range_check => self.base.range_check_gas_cost, + BuiltinName::pedersen => self.base.pedersen_gas_cost, + BuiltinName::bitwise => self.base.bitwise_builtin_gas_cost, + BuiltinName::ec_op => self.base.ecop_gas_cost, + BuiltinName::keccak => self.base.keccak_builtin_gas_cost, + BuiltinName::poseidon => self.base.poseidon_gas_cost, + BuiltinName::range_check96 => self.base.range_check_gas_cost, + BuiltinName::add_mod => self.base.add_mod_gas_cost, + BuiltinName::mul_mod => self.base.mul_mod_gas_cost, + BuiltinName::ecdsa => self.base.ecdsa_gas_cost, BuiltinName::segment_arena => return Err(GasCostsError::VirtualBuiltin), BuiltinName::output => { return Err(GasCostsError::UnsupportedBuiltinInCairo1 { builtin: *builtin }); @@ -642,48 +695,6 @@ impl GasCosts { Ok(gas_cost) } - - pub fn get_syscall_gas_cost(&self, selector: &SyscallSelector) -> Result { - let gas_cost = match *selector { - SyscallSelector::CallContract => self.call_contract_gas_cost, - SyscallSelector::Deploy => self.deploy_gas_cost, - SyscallSelector::EmitEvent => self.emit_event_gas_cost, - SyscallSelector::GetBlockHash => self.get_block_hash_gas_cost, - SyscallSelector::GetExecutionInfo => self.get_execution_info_gas_cost, - SyscallSelector::GetClassHashAt => self.get_class_hash_at_gas_cost, - SyscallSelector::Keccak => self.keccak_gas_cost, - SyscallSelector::Sha256ProcessBlock => self.sha256_process_block_gas_cost, - SyscallSelector::LibraryCall => self.library_call_gas_cost, - SyscallSelector::ReplaceClass => self.replace_class_gas_cost, - SyscallSelector::Secp256k1Add => self.secp256k1_add_gas_cost, - SyscallSelector::Secp256k1GetPointFromX => self.secp256k1_get_point_from_x_gas_cost, - SyscallSelector::Secp256k1GetXy => self.secp256k1_get_xy_gas_cost, - SyscallSelector::Secp256k1Mul => self.secp256k1_mul_gas_cost, - SyscallSelector::Secp256k1New => self.secp256k1_new_gas_cost, - SyscallSelector::Secp256r1Add => self.secp256r1_add_gas_cost, - SyscallSelector::Secp256r1GetPointFromX => self.secp256r1_get_point_from_x_gas_cost, - SyscallSelector::Secp256r1GetXy => self.secp256r1_get_xy_gas_cost, - SyscallSelector::Secp256r1Mul => self.secp256r1_mul_gas_cost, - SyscallSelector::Secp256r1New => self.secp256r1_new_gas_cost, - SyscallSelector::SendMessageToL1 => self.send_message_to_l1_gas_cost, - SyscallSelector::StorageRead => self.storage_read_gas_cost, - SyscallSelector::StorageWrite => self.storage_write_gas_cost, - SyscallSelector::DelegateCall - | SyscallSelector::DelegateL1Handler - | SyscallSelector::GetBlockNumber - | SyscallSelector::GetBlockTimestamp - | SyscallSelector::GetCallerAddress - | SyscallSelector::GetContractAddress - | SyscallSelector::GetTxInfo - | SyscallSelector::GetSequencerAddress - | SyscallSelector::GetTxSignature - | SyscallSelector::LibraryCallL1Handler => { - return Err(GasCostsError::DeprecatedSyscall { selector: *selector }); - } - }; - - Ok(gas_cost) - } } // Below, serde first deserializes the json into a regular IndexMap wrapped by the newtype @@ -704,7 +715,8 @@ impl OsConstants { // not used by the blockifier but included for transparency. These constanst will be ignored // during the creation of the struct containing the gas costs. - const ADDITIONAL_FIELDS: [&'static str; 28] = [ + const ADDITIONAL_FIELDS: [&'static str; 30] = [ + "block_hash_contract_address", "constructor_entry_point_selector", "default_entry_point_selector", "entry_point_type_constructor", @@ -733,6 +745,7 @@ impl OsConstants { "validate_entry_point_selector", "validate_rounding_consts", "validated", + "syscall_gas_costs", ]; } @@ -740,9 +753,11 @@ impl TryFrom<&OsConstantsRawJson> for GasCosts { type Error = OsConstantsSerdeError; fn try_from(raw_json_data: &OsConstantsRawJson) -> Result { - let gas_costs_value: Value = serde_json::to_value(&raw_json_data.parse_gas_costs()?)?; - let gas_costs: GasCosts = serde_json::from_value(gas_costs_value)?; - Ok(gas_costs) + let base_value: Value = serde_json::to_value(&raw_json_data.parse_base()?)?; + let base: BaseGasCosts = serde_json::from_value(base_value)?; + let syscalls_value: Value = serde_json::to_value(&raw_json_data.parse_syscalls(&base)?)?; + let syscalls: SyscallGasCosts = serde_json::from_value(syscalls_value)?; + Ok(GasCosts { base, syscalls }) } } @@ -797,8 +812,8 @@ struct OsConstantsRawJson { } impl OsConstantsRawJson { - fn parse_gas_costs(&self) -> Result, OsConstantsSerdeError> { - let mut gas_costs = IndexMap::new(); + fn parse_base(&self) -> Result, OsConstantsSerdeError> { + let mut base = IndexMap::new(); let additional_fields: IndexSet<_> = OsConstants::ADDITIONAL_FIELDS.iter().copied().collect(); for (key, value) in &self.raw_json_file_as_dict { @@ -807,14 +822,29 @@ impl OsConstantsRawJson { continue; } - self.recursive_add_to_gas_costs(key, value, &mut gas_costs)?; + self.recursive_add_to_base(key, value, &mut base)?; + } + + Ok(base) + } + + fn parse_syscalls( + &self, + base: &BaseGasCosts, + ) -> Result, OsConstantsSerdeError> { + let mut gas_costs = IndexMap::new(); + let syscalls: IndexMap = serde_json::from_value( + (self.raw_json_file_as_dict.get("syscall_gas_costs").unwrap()).clone(), + )?; + for (key, value) in syscalls { + self.add_to_syscalls(&key, &value, &mut gas_costs, base)?; } Ok(gas_costs) } /// Recursively adds a key to gas costs, calculating its value after processing any nested keys. // Invariant: there is no circular dependency between key definitions. - fn recursive_add_to_gas_costs( + fn recursive_add_to_base( &self, key: &str, value: &Value, @@ -846,7 +876,7 @@ impl OsConstantsRawJson { inner_key: inner_key.clone(), } })?; - self.recursive_add_to_gas_costs(inner_key, inner_value, gas_costs)?; + self.recursive_add_to_base(inner_key, inner_value, gas_costs)?; let inner_key_value = gas_costs.get(inner_key).ok_or_else(|| { OsConstantsSerdeError::KeyNotFound { key: key.to_string(), @@ -873,6 +903,61 @@ impl OsConstantsRawJson { Ok(()) } + + fn add_to_syscalls( + &self, + key: &str, + value: &Value, + syscalls: &mut IndexMap, + base: &BaseGasCosts, + ) -> Result<(), OsConstantsSerdeError> { + let mut cost = 0; + match value { + Value::Object(obj) => { + for (inner_key, factor) in obj { + let inner_value = match inner_key.as_str() { + "step_gas_cost" => base.step_gas_cost, + "memory_hole_gas_cost" => base.memory_hole_gas_cost, + "range_check_gas_cost" => base.range_check_gas_cost, + "keccak_builtin_gas_cost" => base.keccak_builtin_gas_cost, + "pedersen_gas_cost" => base.pedersen_gas_cost, + "bitwise_builtin_gas_cost" => base.bitwise_builtin_gas_cost, + "ecop_gas_cost" => base.ecop_gas_cost, + "poseidon_gas_cost" => base.poseidon_gas_cost, + "add_mod_gas_cost" => base.add_mod_gas_cost, + "mul_mod_gas_cost" => base.mul_mod_gas_cost, + "ecdsa_gas_cost" => base.ecdsa_gas_cost, + "default_initial_gas_cost" => base.default_initial_gas_cost, + "entry_point_initial_budget" => base.entry_point_initial_budget, + "syscall_base_gas_cost" => base.syscall_base_gas_cost, + "transaction_gas_cost" => base.transaction_gas_cost, + _ => { + return Err(OsConstantsSerdeError::KeyNotFound { + key: key.to_string(), + inner_key: inner_key.clone(), + }); + } + }; + let factor = + factor.as_u64().ok_or_else(|| OsConstantsSerdeError::OutOfRangeFactor { + key: key.to_string(), + value: factor.clone(), + })?; + cost += inner_value * factor; + } + syscalls.insert(key.to_string(), cost); + } + Value::Number(n) => { + cost = n.as_u64().ok_or_else(|| OsConstantsSerdeError::OutOfRange { + key: key.to_string(), + value: n.clone(), + })?; + syscalls.insert(key.to_string(), cost); + } + _ => return Err(OsConstantsSerdeError::UnhandledValueType(value.clone())), + } + Ok(()) + } } #[derive(Debug, Error)] diff --git a/crates/blockifier/src/versioned_constants_test.rs b/crates/blockifier/src/versioned_constants_test.rs index f18a9f2e59..4f9b96c16f 100644 --- a/crates/blockifier/src/versioned_constants_test.rs +++ b/crates/blockifier/src/versioned_constants_test.rs @@ -29,11 +29,11 @@ fn test_successful_gas_costs_parsing() { let os_constants: Arc = Arc::new(OsConstants { gas_costs, ..Default::default() }); let versioned_constants = VersionedConstants { os_constants, ..Default::default() }; - assert_eq!(versioned_constants.os_constants.gas_costs.step_gas_cost, 2); - assert_eq!(versioned_constants.os_constants.gas_costs.entry_point_initial_budget, 2 * 3); // step_gas_cost * 3. + assert_eq!(versioned_constants.os_constants.gas_costs.base.step_gas_cost, 2); + assert_eq!(versioned_constants.os_constants.gas_costs.base.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.transaction_gas_cost, 6 * 4 + 2 * 5); + assert_eq!(versioned_constants.os_constants.gas_costs.base.transaction_gas_cost, 6 * 4 + 2 * 5); } /// Assert versioned constants overrides are used when provided.