Skip to content

Commit

Permalink
chore(blockifier): replace entry_point_gas_cost with initial_budget
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonatan-Starkware committed Nov 24, 2024
1 parent d7b5bc8 commit 49bcd57
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 96 deletions.
22 changes: 9 additions & 13 deletions crates/blockifier/resources/versioned_constants_0_13_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,24 @@
"syscall_base_gas_cost": {
"step_gas_cost": 100
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"call_contract_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_gas_cost": 1
"step_gas_cost": 510,
"entry_point_initial_budget": 1
},
"deploy_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_gas_cost": 1
"step_gas_cost": 700,
"entry_point_initial_budget": 1
},
"get_block_hash_gas_cost": {
"syscall_base_gas_cost": 1,
Expand Down Expand Up @@ -599,4 +595,4 @@
1000
]
}
}
}
20 changes: 8 additions & 12 deletions crates/blockifier/resources/versioned_constants_0_13_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,24 @@
"syscall_base_gas_cost": {
"step_gas_cost": 100
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"call_contract_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_gas_cost": 1
"step_gas_cost": 510,
"entry_point_initial_budget": 1
},
"deploy_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_gas_cost": 1
"step_gas_cost": 700,
"entry_point_initial_budget": 1
},
"get_block_hash_gas_cost": {
"syscall_base_gas_cost": 1,
Expand Down
20 changes: 8 additions & 12 deletions crates/blockifier/resources/versioned_constants_0_13_1_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,24 @@
"syscall_base_gas_cost": {
"step_gas_cost": 100
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"call_contract_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_gas_cost": 1
"step_gas_cost": 510,
"entry_point_initial_budget": 1
},
"deploy_gas_cost": {
"syscall_base_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_gas_cost": 1
"step_gas_cost": 700,
"entry_point_initial_budget": 1
},
"get_block_hash_gas_cost": {
"syscall_base_gas_cost": 1,
Expand Down
22 changes: 9 additions & 13 deletions crates/blockifier/resources/versioned_constants_0_13_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,21 @@
"os_constants": {
"block_hash_contract_address": 1,
"call_contract_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_initial_budget": 1,
"step_gas_cost": 510,
"syscall_base_gas_cost": 1
},
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": 0,
"deploy_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_initial_budget": 1,
"step_gas_cost": 700,
"syscall_base_gas_cost": 1
},
"emit_event_gas_cost": {
"step_gas_cost": 10,
"syscall_base_gas_cost": 1
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"entry_point_initial_budget": {
"step_gas_cost": 100
},
Expand All @@ -79,8 +75,8 @@
"error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND",
"execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad",
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"get_block_hash_gas_cost": {
"step_gas_cost": 50,
Expand Down Expand Up @@ -195,9 +191,9 @@
"step_gas_cost": 100
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e",
"validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3",
Expand Down Expand Up @@ -641,4 +637,4 @@
10000
]
}
}
}
22 changes: 9 additions & 13 deletions crates/blockifier/resources/versioned_constants_0_13_2_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,21 @@
"os_constants": {
"block_hash_contract_address": 1,
"call_contract_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_initial_budget": 1,
"step_gas_cost": 510,
"syscall_base_gas_cost": 1
},
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": 0,
"deploy_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_initial_budget": 1,
"step_gas_cost": 700,
"syscall_base_gas_cost": 1
},
"emit_event_gas_cost": {
"step_gas_cost": 10,
"syscall_base_gas_cost": 1
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"entry_point_initial_budget": {
"step_gas_cost": 100
},
Expand All @@ -79,8 +75,8 @@
"error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND",
"execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad",
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"get_block_hash_gas_cost": {
"step_gas_cost": 50,
Expand Down Expand Up @@ -195,9 +191,9 @@
"step_gas_cost": 100
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e",
"validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3",
Expand Down Expand Up @@ -641,4 +637,4 @@
10000
]
}
}
}
22 changes: 9 additions & 13 deletions crates/blockifier/resources/versioned_constants_0_13_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,21 @@
"os_constants": {
"block_hash_contract_address": 1,
"call_contract_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 10,
"entry_point_initial_budget": 1,
"step_gas_cost": 510,
"syscall_base_gas_cost": 1
},
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": 0,
"deploy_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 200,
"entry_point_initial_budget": 1,
"step_gas_cost": 700,
"syscall_base_gas_cost": 1
},
"emit_event_gas_cost": {
"step_gas_cost": 10,
"syscall_base_gas_cost": 1
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"entry_point_initial_budget": {
"step_gas_cost": 100
},
Expand All @@ -79,8 +75,8 @@
"error_entry_point_not_found": "ENTRYPOINT_NOT_FOUND",
"execute_entry_point_selector": "0x15d40a3d6ca2ac30f4031e42be28da9b056fef9bb7357ac5e85627ee876e5ad",
"fee_transfer_gas_cost": {
"entry_point_gas_cost": 1,
"step_gas_cost": 100
"entry_point_initial_budget": 1,
"step_gas_cost": 600
},
"get_block_hash_gas_cost": {
"step_gas_cost": 50,
Expand Down Expand Up @@ -195,9 +191,9 @@
"step_gas_cost": 100
},
"transaction_gas_cost": {
"entry_point_gas_cost": 2,
"entry_point_initial_budget": 2,
"fee_transfer_gas_cost": 1,
"step_gas_cost": 100
"step_gas_cost": 1100
},
"transfer_entry_point_selector": "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e",
"validate_declare_entry_point_selector": "0x289da278a8dc833409cabfdad1581e8e7d40e42dcaed693fa4008dcdb4963b3",
Expand Down Expand Up @@ -641,4 +637,4 @@
10000
]
}
}
}
10 changes: 3 additions & 7 deletions crates/blockifier/resources/versioned_constants_0_13_4.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
"os_constants": {
"block_hash_contract_address": 1,
"call_contract_gas_cost": {
"entry_point_gas_cost": 1,
"entry_point_initial_budget": 1,
"step_gas_cost": 860,
"range_check_gas_cost": 15
},
"constructor_entry_point_selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"default_entry_point_selector": 0,
"deploy_gas_cost": {
"entry_point_gas_cost": 1,
"entry_point_initial_budget": 1,
"step_gas_cost": 1128,
"range_check_gas_cost": 18,
"pedersen_gas_cost": 7
Expand All @@ -62,10 +62,6 @@
"step_gas_cost": 100,
"range_check_gas_cost": 1
},
"entry_point_gas_cost": {
"entry_point_initial_budget": 1,
"step_gas_cost": 500
},
"entry_point_initial_budget": {
"step_gas_cost": 100
},
Expand Down Expand Up @@ -102,7 +98,7 @@
"l1_data_gas_index": 2,
"l2_gas_index": 1,
"library_call_gas_cost": {
"entry_point_gas_cost": 1,
"entry_point_initial_budget": 1,
"step_gas_cost": 836,
"range_check_gas_cost": 15
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 170370;
pub const REQUIRED_GAS_CALL_CONTRACT_TEST: u64 = 120370;
pub const REQUIRED_GAS_STORAGE_READ_WRITE_TEST: u64 = 16990;
pub const REQUIRED_GAS_GET_CLASS_HASH_AT_TEST: u64 = 7830;
pub const REQUIRED_GAS_LIBRARY_CALL_TEST: u64 = 167970;
pub const REQUIRED_GAS_LIBRARY_CALL_TEST: u64 = 117970;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn no_constructor(cairo_version: CairoVersion) {
let deploy_call = &entry_point_call.execute_directly(&mut state).unwrap();
assert_eq!(
deploy_call.execution,
CallExecution { retdata: retdata![], gas_consumed: 205200, ..CallExecution::default() }
CallExecution { retdata: retdata![], gas_consumed: 155200, ..CallExecution::default() }
);

let deployed_contract_address = calculate_contract_address(
Expand Down Expand Up @@ -119,7 +119,7 @@ fn with_constructor(cairo_version: CairoVersion) {
let deploy_call = &entry_point_call.execute_directly(&mut state).unwrap();
assert_eq!(
deploy_call.execution,
CallExecution { retdata: retdata![], gas_consumed: 214550, ..CallExecution::default() }
CallExecution { retdata: retdata![], gas_consumed: 164550, ..CallExecution::default() }
);

let constructor_call = &deploy_call.inner_calls[0];
Expand Down
Loading

0 comments on commit 49bcd57

Please sign in to comment.