diff --git a/crates/blockifier/resources/versioned_constants.json b/crates/blockifier/resources/versioned_constants.json index 9789f0fb80..ec98120a3b 100644 --- a/crates/blockifier/resources/versioned_constants.json +++ b/crates/blockifier/resources/versioned_constants.json @@ -102,6 +102,10 @@ "range_check_gas_cost": 70, "pedersen_gas_cost": 4130, "bitwise_builtin_gas_cost": 594, + "ecop_gas_cost": 256, + "poseidon_gas_cost": 500, + "add_mod_gas_cost": 234, + "mul_mod_gas_cost": 616, "replace_class_gas_cost": { "step_gas_cost": 100, "range_check_gas_cost": 1 diff --git a/crates/blockifier/resources/versioned_constants_13_0.json b/crates/blockifier/resources/versioned_constants_13_0.json index 103ea7fca0..4cfe84c042 100644 --- a/crates/blockifier/resources/versioned_constants_13_0.json +++ b/crates/blockifier/resources/versioned_constants_13_0.json @@ -24,6 +24,12 @@ "stored_block_hash_buffer": 10, "step_gas_cost": 100, "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, + "bitwise_builtin_gas_cost": 0, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, "memory_hole_gas_cost": 10, "initial_gas_cost": { "step_gas_cost": 100000000 diff --git a/crates/blockifier/resources/versioned_constants_13_1.json b/crates/blockifier/resources/versioned_constants_13_1.json index 279612a501..b92d0bb0a9 100644 --- a/crates/blockifier/resources/versioned_constants_13_1.json +++ b/crates/blockifier/resources/versioned_constants_13_1.json @@ -43,6 +43,12 @@ "stored_block_hash_buffer": 10, "step_gas_cost": 100, "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, + "bitwise_builtin_gas_cost": 0, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, "memory_hole_gas_cost": 10, "initial_gas_cost": { "step_gas_cost": 100000000 diff --git a/crates/blockifier/resources/versioned_constants_13_1_1.json b/crates/blockifier/resources/versioned_constants_13_1_1.json index a80475fa16..7264f5810b 100644 --- a/crates/blockifier/resources/versioned_constants_13_1_1.json +++ b/crates/blockifier/resources/versioned_constants_13_1_1.json @@ -43,6 +43,12 @@ "stored_block_hash_buffer": 10, "step_gas_cost": 100, "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, + "bitwise_builtin_gas_cost": 0, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, "memory_hole_gas_cost": 10, "initial_gas_cost": { "step_gas_cost": 100000000 diff --git a/crates/blockifier/resources/versioned_constants_13_2.json b/crates/blockifier/resources/versioned_constants_13_2.json index a0dd34a749..96bd9d3e45 100644 --- a/crates/blockifier/resources/versioned_constants_13_2.json +++ b/crates/blockifier/resources/versioned_constants_13_2.json @@ -95,7 +95,12 @@ "memory_hole_gas_cost": 10, "nop_entry_point_offset": -1, "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, "bitwise_builtin_gas_cost": 594, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, "replace_class_gas_cost": { "step_gas_cost": 50, "syscall_base_gas_cost": 1 diff --git a/crates/blockifier/src/execution/entry_point_execution.rs b/crates/blockifier/src/execution/entry_point_execution.rs index 3ebae0ad8e..da6a1ebab3 100644 --- a/crates/blockifier/src/execution/entry_point_execution.rs +++ b/crates/blockifier/src/execution/entry_point_execution.rs @@ -31,6 +31,7 @@ use crate::execution::execution_utils::{ }; use crate::execution::syscalls::hint_processor::SyscallHintProcessor; use crate::state::state_api::State; +use crate::versioned_constants::GasCosts; // TODO(spapini): Try to refactor this file into a StarknetRunner struct. @@ -165,8 +166,12 @@ pub fn initialize_execution_context<'a>( runner.initialize_function_runner_cairo_1(&entry_point.builtins)?; let mut read_only_segments = ReadOnlySegments::default(); - let program_extra_data_length = - prepare_program_extra_data(&mut runner, contract_class, &mut read_only_segments)?; + let program_extra_data_length = prepare_program_extra_data( + &mut runner, + contract_class, + &mut read_only_segments, + &context.versioned_constants().os_constants.gas_costs, + )?; // Instantiate syscall handler. let initial_syscall_ptr = runner.vm.add_memory_segment(); @@ -193,14 +198,23 @@ fn prepare_program_extra_data( runner: &mut CairoRunner, contract_class: &ContractClassV1, read_only_segments: &mut ReadOnlySegments, + gas_costs: &GasCosts, ) -> Result { - // Create the builtin cost segment, with dummy values. - let mut data = vec![]; - - // TODO(spapini): Put real costs here. - for _i in 0..20 { - data.push(MaybeRelocatable::from(0)); - } + // Create the builtin cost segment, the builtins order is set by offset_in_builtin_costs in + // cairo lang sierra in the cairo repo . + 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, + ]; + + let data = builtin_price_array + .iter() + .map(|&x| MaybeRelocatable::from(Felt::from(x))) + .collect::>(); let builtin_cost_segment_start = read_only_segments.allocate(&mut runner.vm, &data)?; // Put a pointer to the builtin cost segment at the end of the program (after the diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/secp.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/secp.rs index 716fa534a2..60b93c0b9c 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/secp.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/secp.rs @@ -9,7 +9,7 @@ use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, BALANCE}; -#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17022270; "VM")] +#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 17041278; "VM")] fn test_secp256k1(test_contract: FeatureContract, expected_gas: u64) { let chain_info = &ChainInfo::create_for_testing(); let mut state = test_state(chain_info, BALANCE, &[(test_contract, 1)]); diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index 8183338d78..e51098ee31 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -459,10 +459,17 @@ impl<'de> Deserialize<'de> for OsResources { #[derive(Debug, Default, Deserialize)] pub struct GasCosts { 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 // retrieving its price from the table. pub range_check_gas_cost: u64, - pub memory_hole_gas_cost: u64, + // Priced builtins. + pub pedersen_gas_cost: u64, + pub bitwise_builtin_gas_cost: u64, + pub ecop_gas_cost: u64, + pub poseidon_gas_cost: u64, + pub add_mod_gas_cost: u64, + pub mul_mod_gas_cost: u64, // An estimation of the initial gas for a transaction to run with. This solution is // temporary and this value will be deduced from the transaction's fields. pub initial_gas_cost: u64, diff --git a/crates/papyrus_execution/resources/versioned_constants_13_0.json b/crates/papyrus_execution/resources/versioned_constants_13_0.json index da35da1279..4cfe84c042 100644 --- a/crates/papyrus_execution/resources/versioned_constants_13_0.json +++ b/crates/papyrus_execution/resources/versioned_constants_13_0.json @@ -5,159 +5,161 @@ }, "invoke_tx_max_n_steps": 3000000, "max_recursion_depth": 50, + "segment_arena_cells": true, "os_constants": { - "block_hash_contract_address": 1, - "call_contract_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 - }, + "nop_entry_point_offset": -1, + "entry_point_type_external": 0, + "entry_point_type_l1_handler": 1, + "entry_point_type_constructor": 2, + "l1_handler_version": 0, + "sierra_array_len_bound": 4294967296, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", + "validate_entry_point_selector": "0x162da33a4585851fe8d3af3c2a9c60b557814e221e0d4f30ff0b2189d9c7775", + "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", + "validate_deploy_entry_point_selector": "0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895", + "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 200, - "syscall_base_gas_cost": 1 + "block_hash_contract_address": 1, + "stored_block_hash_buffer": 10, + "step_gas_cost": 100, + "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, + "bitwise_builtin_gas_cost": 0, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, + "memory_hole_gas_cost": 10, + "initial_gas_cost": { + "step_gas_cost": 100000000 }, - "emit_event_gas_cost": { - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 + "entry_point_initial_budget": { + "step_gas_cost": 100 + }, + "syscall_base_gas_cost": { + "step_gas_cost": 100 }, "entry_point_gas_cost": { "entry_point_initial_budget": 1, "step_gas_cost": 500 }, - "entry_point_initial_budget": { - "step_gas_cost": 100 - }, - "entry_point_type_constructor": 2, - "entry_point_type_external": 0, - "entry_point_type_l1_handler": 1, - "error_block_number_out_of_range": "Block number out of range", - "error_invalid_argument": "Invalid argument", - "error_invalid_input_len": "Invalid input length", - "error_out_of_gas": "Out of gas", - "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", "fee_transfer_gas_cost": { "entry_point_gas_cost": 1, "step_gas_cost": 100 }, - "get_block_hash_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 + "transaction_gas_cost": { + "entry_point_gas_cost": 2, + "fee_transfer_gas_cost": 1, + "step_gas_cost": 100 }, - "get_execution_info_gas_cost": { + "call_contract_gas_cost": { + "syscall_base_gas_cost": 1, "step_gas_cost": 10, - "syscall_base_gas_cost": 1 + "entry_point_gas_cost": 1 }, - "initial_gas_cost": { - "step_gas_cost": 100000000 + "deploy_gas_cost": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 200, + "entry_point_gas_cost": 1 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 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 }, - "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 }, - "memory_hole_gas_cost": 10, - "nop_entry_point_offset": -1, - "range_check_gas_cost": 70, "replace_class_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 + "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 + }, + "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": { - "range_check_gas_cost": 29, - "step_gas_cost": 406 + "step_gas_cost": 406, + "range_check_gas_cost": 29 }, "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, + "step_gas_cost": 391, "range_check_gas_cost": 30, - "step_gas_cost": 391 + "memory_hole_gas_cost": 20 }, "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 239, "range_check_gas_cost": 11, - "step_gas_cost": 239 + "memory_hole_gas_cost": 40 }, "secp256k1_mul_gas_cost": { - "range_check_gas_cost": 7045, - "step_gas_cost": 76401 + "step_gas_cost": 76401, + "range_check_gas_cost": 7045 }, "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 475, "range_check_gas_cost": 35, - "step_gas_cost": 475 + "memory_hole_gas_cost": 40 }, "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 589 + "step_gas_cost": 589, + "range_check_gas_cost": 57 }, "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, + "step_gas_cost": 510, "range_check_gas_cost": 44, - "step_gas_cost": 510 + "memory_hole_gas_cost": 20 }, "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 241, "range_check_gas_cost": 11, - "step_gas_cost": 241 + "memory_hole_gas_cost": 40 }, "secp256r1_mul_gas_cost": { - "range_check_gas_cost": 13961, - "step_gas_cost": 125240 + "step_gas_cost": 125240, + "range_check_gas_cost": 13961 }, "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 594, "range_check_gas_cost": 49, - "step_gas_cost": 594 + "memory_hole_gas_cost": 40 }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 50, + "keccak_gas_cost": { "syscall_base_gas_cost": 1 }, + "keccak_round_cost_gas_cost": 180000, "sha256_process_block_gas_cost": { - "range_check_gas_cost": 0, "step_gas_cost": 0, + "range_check_gas_cost": 0, "syscall_base_gas_cost": 0 }, - "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 - }, - "stored_block_hash_buffer": 10, - "syscall_base_gas_cost": { - "step_gas_cost": 100 - }, - "transaction_gas_cost": { - "entry_point_gas_cost": 2, - "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 - }, - "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", - "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", - "validate_deploy_entry_point_selector": "0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895", - "validate_entry_point_selector": "0x162da33a4585851fe8d3af3c2a9c60b557814e221e0d4f30ff0b2189d9c7775", - "validated": "VALID" + "error_block_number_out_of_range": "Block number out of range", + "error_out_of_gas": "Out of gas", + "error_invalid_input_len": "Invalid input length", + "error_invalid_argument": "Invalid argument", + "validated": "VALID", + "l1_gas": "L1_GAS", + "l2_gas": "L2_GAS", + "l1_gas_index": 0, + "l2_gas_index": 1 }, "os_resources": { - "compute_os_kzg_commitment_info": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, "execute_syscalls": { "CallContract": { "builtin_instance_counter": { @@ -361,12 +363,7 @@ }, "execute_txs_inner": { "Declare": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 15, @@ -374,14 +371,14 @@ }, "n_memory_holes": 0, "n_steps": 2711 - } - }, - "resources": { + }, "calldata_factor": { + "n_steps": 0, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 15, @@ -389,16 +386,16 @@ }, "n_memory_holes": 0, "n_steps": 2711 + }, + "calldata_factor": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } } }, "DeployAccount": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 23, @@ -406,14 +403,14 @@ }, "n_memory_holes": 0, "n_steps": 3628 - } - }, - "resources": { + }, "calldata_factor": { + "n_steps": 0, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 23, @@ -421,16 +418,16 @@ }, "n_memory_holes": 0, "n_steps": 3628 + }, + "calldata_factor": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } } }, "InvokeFunction": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 16, @@ -438,14 +435,14 @@ }, "n_memory_holes": 0, "n_steps": 3382 - } - }, - "resources": { + }, "calldata_factor": { + "n_steps": 0, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 16, @@ -453,16 +450,16 @@ }, "n_memory_holes": 0, "n_steps": 3382 + }, + "calldata_factor": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } } }, "L1Handler": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 11, @@ -470,14 +467,14 @@ }, "n_memory_holes": 0, "n_steps": 1069 - } - }, - "resources": { + }, "calldata_factor": { + "n_steps": 0, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { "builtin_instance_counter": { "pedersen_builtin": 11, @@ -485,13 +482,27 @@ }, "n_memory_holes": 0, "n_steps": 1069 + }, + "calldata_factor": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } } } + }, + "compute_os_kzg_commitment_info": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } }, "validate_max_n_steps": 1000000, "vm_resource_fee_cost": { + "add_mod_builtin": [ + 0, + 1 + ], "bitwise_builtin": [ 32, 100 @@ -508,6 +519,10 @@ 1024, 100 ], + "mul_mod_builtin": [ + 0, + 1 + ], "n_steps": [ 5, 1000 @@ -527,6 +542,10 @@ "range_check_builtin": [ 8, 100 + ], + "range_check96_builtin": [ + 0, + 1 ] } } diff --git a/crates/papyrus_execution/resources/versioned_constants_13_1.json b/crates/papyrus_execution/resources/versioned_constants_13_1.json index cad391a781..b92d0bb0a9 100644 --- a/crates/papyrus_execution/resources/versioned_constants_13_1.json +++ b/crates/papyrus_execution/resources/versioned_constants_13_1.json @@ -1,10 +1,19 @@ { + "tx_event_limits": { + "max_data_length": 300, + "max_keys_length": 50, + "max_n_emitted_events": 1000 + }, "gateway": { "max_calldata_length": 4000, "max_contract_bytecode_size": 81920 }, "invoke_tx_max_n_steps": 4000000, "l2_resource_gas_costs": { + "gas_per_data_felt": [ + 128, + 1000 + ], "event_key_factor": [ 2, 1 @@ -12,370 +21,368 @@ "gas_per_code_byte": [ 875, 1000 - ], - "gas_per_data_felt": [ - 128, - 1000 ] }, "max_recursion_depth": 50, + "segment_arena_cells": true, "os_constants": { - "block_hash_contract_address": 1, - "call_contract_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 - }, + "nop_entry_point_offset": -1, + "entry_point_type_external": 0, + "entry_point_type_l1_handler": 1, + "entry_point_type_constructor": 2, + "l1_handler_version": 0, + "sierra_array_len_bound": 4294967296, "constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194", + "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", + "validate_entry_point_selector": "0x162da33a4585851fe8d3af3c2a9c60b557814e221e0d4f30ff0b2189d9c7775", + "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", + "validate_deploy_entry_point_selector": "0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895", + "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", "default_entry_point_selector": 0, - "deploy_gas_cost": { - "entry_point_gas_cost": 1, - "step_gas_cost": 200, - "syscall_base_gas_cost": 1 + "block_hash_contract_address": 1, + "stored_block_hash_buffer": 10, + "step_gas_cost": 100, + "range_check_gas_cost": 70, + "pedersen_gas_cost": 0, + "bitwise_builtin_gas_cost": 0, + "ecop_gas_cost": 0, + "poseidon_gas_cost": 0, + "add_mod_gas_cost": 0, + "mul_mod_gas_cost": 0, + "memory_hole_gas_cost": 10, + "initial_gas_cost": { + "step_gas_cost": 100000000 }, - "emit_event_gas_cost": { - "step_gas_cost": 10, - "syscall_base_gas_cost": 1 + "entry_point_initial_budget": { + "step_gas_cost": 100 + }, + "syscall_base_gas_cost": { + "step_gas_cost": 100 }, "entry_point_gas_cost": { "entry_point_initial_budget": 1, "step_gas_cost": 500 }, - "entry_point_initial_budget": { - "step_gas_cost": 100 - }, - "entry_point_type_constructor": 2, - "entry_point_type_external": 0, - "entry_point_type_l1_handler": 1, - "error_block_number_out_of_range": "Block number out of range", - "error_invalid_argument": "Invalid argument", - "error_invalid_input_len": "Invalid input length", - "error_out_of_gas": "Out of gas", - "execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad", "fee_transfer_gas_cost": { "entry_point_gas_cost": 1, "step_gas_cost": 100 }, - "get_block_hash_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 + "transaction_gas_cost": { + "entry_point_gas_cost": 2, + "fee_transfer_gas_cost": 1, + "step_gas_cost": 100 }, - "get_execution_info_gas_cost": { + "call_contract_gas_cost": { + "syscall_base_gas_cost": 1, "step_gas_cost": 10, - "syscall_base_gas_cost": 1 + "entry_point_gas_cost": 1 }, - "initial_gas_cost": { - "step_gas_cost": 100000000 + "deploy_gas_cost": { + "syscall_base_gas_cost": 1, + "step_gas_cost": 200, + "entry_point_gas_cost": 1 }, - "keccak_gas_cost": { - "syscall_base_gas_cost": 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 }, - "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 }, - "memory_hole_gas_cost": 10, - "nop_entry_point_offset": -1, - "range_check_gas_cost": 70, "replace_class_gas_cost": { - "step_gas_cost": 50, - "syscall_base_gas_cost": 1 + "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 + }, + "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": { - "range_check_gas_cost": 29, - "step_gas_cost": 406 + "step_gas_cost": 406, + "range_check_gas_cost": 29 }, "secp256k1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, + "step_gas_cost": 391, "range_check_gas_cost": 30, - "step_gas_cost": 391 + "memory_hole_gas_cost": 20 }, "secp256k1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 239, "range_check_gas_cost": 11, - "step_gas_cost": 239 + "memory_hole_gas_cost": 40 }, "secp256k1_mul_gas_cost": { - "memory_hole_gas_cost": 2, + "step_gas_cost": 76501, "range_check_gas_cost": 7045, - "step_gas_cost": 76501 + "memory_hole_gas_cost": 2 }, "secp256k1_new_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 475, "range_check_gas_cost": 35, - "step_gas_cost": 475 + "memory_hole_gas_cost": 40 }, "secp256r1_add_gas_cost": { - "range_check_gas_cost": 57, - "step_gas_cost": 589 + "step_gas_cost": 589, + "range_check_gas_cost": 57 }, "secp256r1_get_point_from_x_gas_cost": { - "memory_hole_gas_cost": 20, + "step_gas_cost": 510, "range_check_gas_cost": 44, - "step_gas_cost": 510 + "memory_hole_gas_cost": 20 }, "secp256r1_get_xy_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 241, "range_check_gas_cost": 11, - "step_gas_cost": 241 + "memory_hole_gas_cost": 40 }, "secp256r1_mul_gas_cost": { - "memory_hole_gas_cost": 2, + "step_gas_cost": 125340, "range_check_gas_cost": 13961, - "step_gas_cost": 125340 + "memory_hole_gas_cost": 2 }, "secp256r1_new_gas_cost": { - "memory_hole_gas_cost": 40, + "step_gas_cost": 594, "range_check_gas_cost": 49, - "step_gas_cost": 594 + "memory_hole_gas_cost": 40 }, - "send_message_to_l1_gas_cost": { - "step_gas_cost": 50, + "keccak_gas_cost": { "syscall_base_gas_cost": 1 }, + "keccak_round_cost_gas_cost": 180000, "sha256_process_block_gas_cost": { - "range_check_gas_cost": 0, "step_gas_cost": 0, + "range_check_gas_cost": 0, "syscall_base_gas_cost": 0 }, - "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 - }, - "stored_block_hash_buffer": 10, - "syscall_base_gas_cost": { - "step_gas_cost": 100 - }, - "transaction_gas_cost": { - "entry_point_gas_cost": 2, - "fee_transfer_gas_cost": 1, - "step_gas_cost": 100 - }, - "transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e", - "validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3", - "validate_deploy_entry_point_selector": "0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895", - "validate_entry_point_selector": "0x162da33a4585851fe8d3af3c2a9c60b557814e221e0d4f30ff0b2189d9c7775", + "error_block_number_out_of_range": "Block number out of range", + "error_out_of_gas": "Out of gas", + "error_invalid_input_len": "Invalid input length", + "error_invalid_argument": "Invalid argument", + "validated": "VALID", + "l1_gas": "L1_GAS", + "l2_gas": "L2_GAS", + "l1_gas_index": 0, + "l2_gas_index": 1, "validate_rounding_consts": { "validate_block_number_rounding": 100, "validate_timestamp_rounding": 3600 - }, - "validated": "VALID" + } }, "os_resources": { - "compute_os_kzg_commitment_info": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, "execute_syscalls": { "CallContract": { + "n_steps": 760, "builtin_instance_counter": { "range_check_builtin": 20 }, - "n_memory_holes": 0, - "n_steps": 760 + "n_memory_holes": 0 }, "DelegateCall": { + "n_steps": 713, "builtin_instance_counter": { "range_check_builtin": 19 }, - "n_memory_holes": 0, - "n_steps": 713 + "n_memory_holes": 0 }, "DelegateL1Handler": { + "n_steps": 692, "builtin_instance_counter": { "range_check_builtin": 15 }, - "n_memory_holes": 0, - "n_steps": 692 + "n_memory_holes": 0 }, "Deploy": { + "n_steps": 1012, "builtin_instance_counter": { "pedersen_builtin": 7, "range_check_builtin": 19 }, - "n_memory_holes": 0, - "n_steps": 1012 + "n_memory_holes": 0 }, "EmitEvent": { + "n_steps": 61, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 61 + "n_memory_holes": 0 }, "GetBlockHash": { + "n_steps": 104, "builtin_instance_counter": { "range_check_builtin": 2 }, - "n_memory_holes": 0, - "n_steps": 104 + "n_memory_holes": 0 }, "GetBlockNumber": { + "n_steps": 40, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 40 + "n_memory_holes": 0 }, "GetBlockTimestamp": { + "n_steps": 38, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 38 + "n_memory_holes": 0 }, "GetCallerAddress": { + "n_steps": 64, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 64 + "n_memory_holes": 0 }, "GetContractAddress": { + "n_steps": 64, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 64 + "n_memory_holes": 0 }, "GetExecutionInfo": { + "n_steps": 64, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 64 + "n_memory_holes": 0 }, "GetSequencerAddress": { + "n_steps": 34, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 34 + "n_memory_holes": 0 }, "GetTxInfo": { + "n_steps": 64, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 64 + "n_memory_holes": 0 }, "GetTxSignature": { + "n_steps": 44, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 44 + "n_memory_holes": 0 }, "Keccak": { + "n_steps": 381, "builtin_instance_counter": { "bitwise_builtin": 6, "keccak_builtin": 1, "range_check_builtin": 56 }, - "n_memory_holes": 0, - "n_steps": 381 + "n_memory_holes": 0 }, "LibraryCall": { + "n_steps": 751, "builtin_instance_counter": { "range_check_builtin": 20 }, - "n_memory_holes": 0, - "n_steps": 751 + "n_memory_holes": 0 }, "LibraryCallL1Handler": { + "n_steps": 659, "builtin_instance_counter": { "range_check_builtin": 15 }, - "n_memory_holes": 0, - "n_steps": 659 + "n_memory_holes": 0 }, "ReplaceClass": { + "n_steps": 98, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 98 + "n_memory_holes": 0 }, "Secp256k1Add": { + "n_steps": 408, "builtin_instance_counter": { "range_check_builtin": 29 }, - "n_memory_holes": 0, - "n_steps": 408 + "n_memory_holes": 0 }, "Secp256k1GetPointFromX": { + "n_steps": 393, "builtin_instance_counter": { "range_check_builtin": 30 }, - "n_memory_holes": 0, - "n_steps": 393 + "n_memory_holes": 0 }, "Secp256k1GetXy": { + "n_steps": 205, "builtin_instance_counter": { "range_check_builtin": 11 }, - "n_memory_holes": 0, - "n_steps": 205 + "n_memory_holes": 0 }, "Secp256k1Mul": { + "n_steps": 76503, "builtin_instance_counter": { "range_check_builtin": 7045 }, - "n_memory_holes": 0, - "n_steps": 76503 + "n_memory_holes": 0 }, "Secp256k1New": { + "n_steps": 459, "builtin_instance_counter": { "range_check_builtin": 35 }, - "n_memory_holes": 0, - "n_steps": 459 + "n_memory_holes": 0 }, "Secp256r1Add": { + "n_steps": 591, "builtin_instance_counter": { "range_check_builtin": 57 }, - "n_memory_holes": 0, - "n_steps": 591 + "n_memory_holes": 0 }, "Secp256r1GetPointFromX": { + "n_steps": 512, "builtin_instance_counter": { "range_check_builtin": 44 }, - "n_memory_holes": 0, - "n_steps": 512 + "n_memory_holes": 0 }, "Secp256r1GetXy": { + "n_steps": 207, "builtin_instance_counter": { "range_check_builtin": 11 }, - "n_memory_holes": 0, - "n_steps": 207 + "n_memory_holes": 0 }, "Secp256r1Mul": { + "n_steps": 125342, "builtin_instance_counter": { "range_check_builtin": 13961 }, - "n_memory_holes": 0, - "n_steps": 125342 + "n_memory_holes": 0 }, "Secp256r1New": { + "n_steps": 578, "builtin_instance_counter": { "range_check_builtin": 49 }, - "n_memory_holes": 0, - "n_steps": 578 + "n_memory_holes": 0 }, "SendMessageToL1": { + "n_steps": 139, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 139 + "n_memory_holes": 0 }, "Sha256ProcessBlock": { "builtin_instance_counter": {}, @@ -383,170 +390,174 @@ "n_steps": 0 }, "StorageRead": { + "n_steps": 87, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 87 + "n_memory_holes": 0 }, "StorageWrite": { + "n_steps": 89, "builtin_instance_counter": { "range_check_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 89 + "n_memory_holes": 0 } }, "execute_txs_inner": { "Declare": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "resources": { "constant": { + "n_steps": 2839, "builtin_instance_counter": { "pedersen_builtin": 16, "range_check_builtin": 63 }, - "n_memory_holes": 0, - "n_steps": 2839 - } - }, - "resources": { + "n_memory_holes": 0 + }, "calldata_factor": { + "n_steps": 0, "builtin_instance_counter": {}, - "n_memory_holes": 0, - "n_steps": 0 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { + "n_steps": 2839, "builtin_instance_counter": { "pedersen_builtin": 16, "range_check_builtin": 63 }, - "n_memory_holes": 0, - "n_steps": 2839 + "n_memory_holes": 0 + }, + "calldata_factor": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } } }, "DeployAccount": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": { - "pedersen_builtin": 2 - }, - "n_memory_holes": 0, - "n_steps": 21 - }, + "resources": { "constant": { + "n_steps": 3792, "builtin_instance_counter": { "pedersen_builtin": 23, "range_check_builtin": 83 }, - "n_memory_holes": 0, - "n_steps": 3792 - } - }, - "resources": { + "n_memory_holes": 0 + }, "calldata_factor": { + "n_steps": 21, "builtin_instance_counter": { "pedersen_builtin": 2 }, - "n_memory_holes": 0, - "n_steps": 21 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { + "n_steps": 3792, "builtin_instance_counter": { "pedersen_builtin": 23, "range_check_builtin": 83 }, - "n_memory_holes": 0, - "n_steps": 3792 + "n_memory_holes": 0 + }, + "calldata_factor": { + "n_steps": 21, + "builtin_instance_counter": { + "pedersen_builtin": 2 + }, + "n_memory_holes": 0 } } }, "InvokeFunction": { - "deprecated_resources": { - "calldata_factor": { - "builtin_instance_counter": { - "pedersen_builtin": 1 - }, - "n_memory_holes": 0, - "n_steps": 8 - }, + "resources": { "constant": { + "n_steps": 3546, "builtin_instance_counter": { "pedersen_builtin": 14, "range_check_builtin": 80 }, - "n_memory_holes": 0, - "n_steps": 3546 - } - }, - "resources": { + "n_memory_holes": 0 + }, "calldata_factor": { + "n_steps": 8, "builtin_instance_counter": { "pedersen_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 8 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { + "n_steps": 3546, "builtin_instance_counter": { "pedersen_builtin": 14, "range_check_builtin": 80 }, - "n_memory_holes": 0, - "n_steps": 3546 - } - } - }, - "L1Handler": { - "deprecated_resources": { + "n_memory_holes": 0 + }, "calldata_factor": { + "n_steps": 8, "builtin_instance_counter": { "pedersen_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 13 - }, + "n_memory_holes": 0 + } + } + }, + "L1Handler": { + "resources": { "constant": { + "n_steps": 1146, "builtin_instance_counter": { "pedersen_builtin": 11, "range_check_builtin": 17 }, - "n_memory_holes": 0, - "n_steps": 1146 - } - }, - "resources": { + "n_memory_holes": 0 + }, "calldata_factor": { + "n_steps": 13, "builtin_instance_counter": { "pedersen_builtin": 1 }, - "n_memory_holes": 0, - "n_steps": 13 - }, + "n_memory_holes": 0 + } + }, + "deprecated_resources": { "constant": { + "n_steps": 1146, "builtin_instance_counter": { "pedersen_builtin": 11, "range_check_builtin": 17 }, - "n_memory_holes": 0, - "n_steps": 1146 + "n_memory_holes": 0 + }, + "calldata_factor": { + "n_steps": 13, + "builtin_instance_counter": { + "pedersen_builtin": 1 + }, + "n_memory_holes": 0 } } } + }, + "compute_os_kzg_commitment_info": { + "n_steps": 0, + "builtin_instance_counter": {}, + "n_memory_holes": 0 } }, - "tx_event_limits": { - "max_data_length": 300, - "max_keys_length": 50, - "max_n_emitted_events": 1000 - }, "validate_max_n_steps": 1000000, "vm_resource_fee_cost": { + "add_mod_builtin": [ + 0, + 1 + ], "bitwise_builtin": [ 16, 100 @@ -563,6 +574,10 @@ 512, 100 ], + "mul_mod_builtin": [ + 0, + 1 + ], "n_steps": [ 25, 10000 @@ -582,6 +597,10 @@ "range_check_builtin": [ 4, 100 + ], + "range_check96_builtin": [ + 0, + 1 ] } }