Skip to content

Commit 74d2f3a

Browse files
committed
Bump blockifier to v0.13.5
commit-id:1bd782e3
1 parent 9ac735e commit 74d2f3a

File tree

21 files changed

+282
-124
lines changed

21 files changed

+282
-124
lines changed

Cargo.lock

+38-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ license = "MIT"
2727
license-file = "LICENSE"
2828

2929
[workspace.dependencies]
30-
blockifier = { git = "https://github.com/cptartur/sequencer.git", branch = "main-v0.13.4", default-features = false, features = ["testing"] }
31-
starknet_api = { git = "https://github.com/cptartur/sequencer.git", branch = "main-v0.13.4" }
30+
blockifier = { git = "https://github.com/software-mansion-labs/sequencer.git", branch = "main-v0.13.5-modified-sierra-dep", default-features = false, features = ["testing", "tracing"] }
31+
starknet_api = { git = "https://github.com/software-mansion-labs/sequencer.git", branch = "main-v0.13.5-modified-sierra-dep" }
3232
cairo-lang-casm = { version = "2.11.2", features = ["serde"] }
3333
cairo-lang-runner = "2.11.2"
3434
cairo-lang-sierra-to-casm = "2.11.2"

crates/cheatnet/src/constants.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use starknet_api::contract_class::{ContractClass, SierraVersion};
22
use std::collections::HashMap;
33
use std::sync::Arc;
44

5-
use blockifier::execution::entry_point::{CallEntryPoint, CallType};
5+
use blockifier::execution::entry_point::{CallType, ExecutableCallEntryPoint};
66
use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
77
use conversions::IntoConv;
88
use conversions::string::TryFromHexStr;
@@ -14,6 +14,7 @@ use runtime::starknet::context::ERC20_CONTRACT_ADDRESS;
1414
use runtime::starknet::state::DictStateReader;
1515
use starknet::core::utils::get_selector_from_name;
1616
use starknet_api::contract_class::EntryPointType;
17+
use starknet_api::core::ClassHash;
1718
use starknet_api::{core::ContractAddress, transaction::fields::Calldata};
1819

1920
// Mocked class hashes, those are not checked anywhere
@@ -69,11 +70,11 @@ pub fn build_testing_state() -> DictStateReader {
6970
}
7071

7172
#[must_use]
72-
pub fn build_test_entry_point() -> CallEntryPoint {
73+
pub fn build_test_entry_point() -> ExecutableCallEntryPoint {
7374
let test_selector = get_selector_from_name(TEST_ENTRY_POINT_SELECTOR).unwrap();
7475
let entry_point_selector = test_selector.into_();
75-
CallEntryPoint {
76-
class_hash: None,
76+
ExecutableCallEntryPoint {
77+
class_hash: ClassHash(TryFromHexStr::try_from_hex_str(TEST_CONTRACT_CLASS_HASH).unwrap()),
7778
code_address: Some(TryFromHexStr::try_from_hex_str(TEST_ADDRESS).unwrap()),
7879
entry_point_type: EntryPointType::External,
7980
entry_point_selector,

crates/cheatnet/src/runtime_extensions/call_to_blockifier_runtime_extension/execution/cairo1_execution.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::runtime_extensions::call_to_blockifier_runtime_extension::execution::
55
use crate::runtime_extensions::cheatable_starknet_runtime_extension::CheatableStarknetRuntimeExtension;
66
use crate::runtime_extensions::common::get_relocated_vm_trace;
77
use blockifier::execution::contract_class::CompiledClassV1;
8+
use blockifier::execution::entry_point::ExecutableCallEntryPoint;
89
use blockifier::execution::entry_point_execution::{
910
VmExecutionContext, finalize_execution, prepare_call_arguments,
1011
};
@@ -19,10 +20,8 @@ use blockifier::execution::syscalls::hint_processor::SyscallHintProcessor;
1920
use blockifier::versioned_constants::GasCosts;
2021
use blockifier::{
2122
execution::{
22-
contract_class::EntryPointV1,
23-
entry_point::{CallEntryPoint, EntryPointExecutionContext},
24-
errors::EntryPointExecutionError,
25-
execution_utils::Args,
23+
contract_class::EntryPointV1, entry_point::EntryPointExecutionContext,
24+
errors::EntryPointExecutionError, execution_utils::Args,
2625
},
2726
state::state_api::State,
2827
};
@@ -80,12 +79,12 @@ fn prepare_program_extra_data(
8079
// TODO(#2957) remove copied code
8180
// Copied from https://github.com/starkware-libs/sequencer/blob/0e1e92e0b90790e4bec20721c069c312d6a60a13/crates/blockifier/src/execution/entry_point_execution.rs#L98
8281
fn initialize_execution_context<'a>(
83-
call: CallEntryPoint,
82+
call: ExecutableCallEntryPoint,
8483
compiled_class: &'a CompiledClassV1,
8584
state: &'a mut dyn State,
8685
context: &'a mut EntryPointExecutionContext,
8786
) -> Result<VmExecutionContext<'a>, PreExecutionError> {
88-
let entry_point = compiled_class.get_entry_point(&call)?;
87+
let entry_point = compiled_class.get_entry_point(&call.type_and_selector())?;
8988

9089
// Instantiate Cairo runner.
9190
let proof_mode = false;
@@ -130,7 +129,7 @@ fn initialize_execution_context<'a>(
130129

131130
// blockifier/src/execution/cairo1_execution.rs:48 (execute_entry_point_call)
132131
pub fn execute_entry_point_call_cairo1(
133-
call: CallEntryPoint,
132+
call: ExecutableCallEntryPoint,
134133
compiled_class_v1: &CompiledClassV1,
135134
state: &mut dyn State,
136135
cheatnet_state: &mut CheatnetState, // Added parameter
@@ -181,10 +180,10 @@ pub fn execute_entry_point_call_cairo1(
181180
.on_error_get_last_pc(&mut runner)?;
182181

183182
let trace = get_relocated_vm_trace(&mut runner);
184-
let syscall_counter = cheatable_runtime
183+
let syscall_usage_map = cheatable_runtime
185184
.extended_runtime
186185
.hint_handler
187-
.syscall_counter
186+
.syscalls_usage
188187
.clone();
189188

190189
let call_info = finalize_execution(
@@ -206,7 +205,7 @@ pub fn execute_entry_point_call_cairo1(
206205
});
207206
}
208207

209-
Ok((call_info, syscall_counter, trace))
208+
Ok((call_info, syscall_usage_map, trace))
210209
// endregion
211210
}
212211

crates/cheatnet/src/runtime_extensions/call_to_blockifier_runtime_extension/execution/cheated_syscalls.rs

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ pub fn deploy_syscall(
6464
cheatnet_state: &mut CheatnetState,
6565
remaining_gas: &mut u64,
6666
) -> SyscallResult<DeployResponse> {
67+
// Increment the Deploy syscall's linear cost counter by the number of elements in the
68+
// constructor calldata
69+
syscall_handler.increment_linear_factor_by(
70+
&SyscallSelector::Deploy,
71+
request.constructor_calldata.0.len(),
72+
);
73+
6774
// region: Modified blockifier code
6875
let deployer_address = syscall_handler.storage_address();
6976
// endregion

crates/cheatnet/src/runtime_extensions/call_to_blockifier_runtime_extension/execution/deprecated/cairo0_execution.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use blockifier::execution::contract_class::CompiledClassV0;
1010
use blockifier::execution::deprecated_entry_point_execution::{
1111
VmExecutionContext, finalize_execution, initialize_execution_context, prepare_call_arguments,
1212
};
13-
use blockifier::execution::entry_point::{CallEntryPoint, EntryPointExecutionContext};
13+
use blockifier::execution::entry_point::{EntryPointExecutionContext, ExecutableCallEntryPoint};
1414
use blockifier::execution::errors::EntryPointExecutionError;
1515
use blockifier::execution::execution_utils::Args;
1616
use blockifier::state::state_api::State;
@@ -19,7 +19,7 @@ use cairo_vm::vm::runners::cairo_runner::{CairoArg, CairoRunner};
1919

2020
// blockifier/src/execution/deprecated_execution.rs:36 (execute_entry_point_call)
2121
pub fn execute_entry_point_call_cairo0(
22-
call: CallEntryPoint,
22+
call: ExecutableCallEntryPoint,
2323
compiled_class_v0: CompiledClassV0,
2424
state: &mut dyn State,
2525
cheatnet_state: &mut CheatnetState,
@@ -58,10 +58,10 @@ pub fn execute_entry_point_call_cairo0(
5858
)
5959
.on_error_get_last_pc(&mut runner)?;
6060

61-
let syscall_counter = cheatable_syscall_handler
61+
let syscall_usage = cheatable_syscall_handler
6262
.extended_runtime
6363
.hint_handler
64-
.syscall_counter
64+
.syscalls_usage
6565
.clone();
6666

6767
let execution_result = finalize_execution(
@@ -72,7 +72,7 @@ pub fn execute_entry_point_call_cairo0(
7272
n_total_args,
7373
)?;
7474

75-
Ok((execution_result, syscall_counter, None))
75+
Ok((execution_result, syscall_usage, None))
7676
// endregion
7777
}
7878

0 commit comments

Comments
 (0)