Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump blockifier to v0.13.5 #3130

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ license = "MIT"
license-file = "LICENSE"

[workspace.dependencies]
blockifier = { git = "https://github.com/cptartur/sequencer.git", branch = "main-v0.13.4", default-features = false, features = ["testing"] }
starknet_api = { git = "https://github.com/cptartur/sequencer.git", branch = "main-v0.13.4" }
blockifier = { git = "https://github.com/software-mansion-labs/sequencer.git", branch = "main-v0.13.5-modified-sierra-dep", default-features = false, features = ["testing", "tracing"] }
starknet_api = { git = "https://github.com/software-mansion-labs/sequencer.git", branch = "main-v0.13.5-modified-sierra-dep" }
cairo-lang-casm = { version = "2.11.2", features = ["serde"] }
cairo-lang-runner = "2.11.2"
cairo-lang-sierra-to-casm = "2.11.2"
Expand Down
9 changes: 5 additions & 4 deletions crates/cheatnet/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use starknet_api::contract_class::{ContractClass, SierraVersion};
use std::collections::HashMap;
use std::sync::Arc;

use blockifier::execution::entry_point::{CallEntryPoint, CallType};
use blockifier::execution::entry_point::{CallType, ExecutableCallEntryPoint};
use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use conversions::IntoConv;
use conversions::string::TryFromHexStr;
Expand All @@ -14,6 +14,7 @@ use runtime::starknet::context::ERC20_CONTRACT_ADDRESS;
use runtime::starknet::state::DictStateReader;
use starknet::core::utils::get_selector_from_name;
use starknet_api::contract_class::EntryPointType;
use starknet_api::core::ClassHash;
use starknet_api::{core::ContractAddress, transaction::fields::Calldata};

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

#[must_use]
pub fn build_test_entry_point() -> CallEntryPoint {
pub fn build_test_entry_point() -> ExecutableCallEntryPoint {
let test_selector = get_selector_from_name(TEST_ENTRY_POINT_SELECTOR).unwrap();
let entry_point_selector = test_selector.into_();
CallEntryPoint {
class_hash: None,
ExecutableCallEntryPoint {
class_hash: ClassHash(TryFromHexStr::try_from_hex_str(TEST_CONTRACT_CLASS_HASH).unwrap()),
code_address: Some(TryFromHexStr::try_from_hex_str(TEST_ADDRESS).unwrap()),
entry_point_type: EntryPointType::External,
entry_point_selector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::runtime_extensions::call_to_blockifier_runtime_extension::execution::
use crate::runtime_extensions::cheatable_starknet_runtime_extension::CheatableStarknetRuntimeExtension;
use crate::runtime_extensions::common::get_relocated_vm_trace;
use blockifier::execution::contract_class::CompiledClassV1;
use blockifier::execution::entry_point::ExecutableCallEntryPoint;
use blockifier::execution::entry_point_execution::{
VmExecutionContext, finalize_execution, prepare_call_arguments,
};
Expand All @@ -19,10 +20,8 @@ use blockifier::execution::syscalls::hint_processor::SyscallHintProcessor;
use blockifier::versioned_constants::GasCosts;
use blockifier::{
execution::{
contract_class::EntryPointV1,
entry_point::{CallEntryPoint, EntryPointExecutionContext},
errors::EntryPointExecutionError,
execution_utils::Args,
contract_class::EntryPointV1, entry_point::EntryPointExecutionContext,
errors::EntryPointExecutionError, execution_utils::Args,
},
state::state_api::State,
};
Expand Down Expand Up @@ -80,12 +79,12 @@ fn prepare_program_extra_data(
// TODO(#2957) remove copied code
// Copied from https://github.com/starkware-libs/sequencer/blob/0e1e92e0b90790e4bec20721c069c312d6a60a13/crates/blockifier/src/execution/entry_point_execution.rs#L98
fn initialize_execution_context<'a>(
call: CallEntryPoint,
call: ExecutableCallEntryPoint,
compiled_class: &'a CompiledClassV1,
state: &'a mut dyn State,
context: &'a mut EntryPointExecutionContext,
) -> Result<VmExecutionContext<'a>, PreExecutionError> {
let entry_point = compiled_class.get_entry_point(&call)?;
let entry_point = compiled_class.get_entry_point(&call.type_and_selector())?;

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

// blockifier/src/execution/cairo1_execution.rs:48 (execute_entry_point_call)
pub fn execute_entry_point_call_cairo1(
call: CallEntryPoint,
call: ExecutableCallEntryPoint,
compiled_class_v1: &CompiledClassV1,
state: &mut dyn State,
cheatnet_state: &mut CheatnetState, // Added parameter
Expand Down Expand Up @@ -181,10 +180,10 @@ pub fn execute_entry_point_call_cairo1(
.on_error_get_last_pc(&mut runner)?;

let trace = get_relocated_vm_trace(&mut runner);
let syscall_counter = cheatable_runtime
let syscall_usage_map = cheatable_runtime
.extended_runtime
.hint_handler
.syscall_counter
.syscalls_usage
.clone();

let call_info = finalize_execution(
Expand All @@ -206,7 +205,7 @@ pub fn execute_entry_point_call_cairo1(
});
}

Ok((call_info, syscall_counter, trace))
Ok((call_info, syscall_usage_map, trace))
// endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ pub fn deploy_syscall(
cheatnet_state: &mut CheatnetState,
remaining_gas: &mut u64,
) -> SyscallResult<DeployResponse> {
// Increment the Deploy syscall's linear cost counter by the number of elements in the
// constructor calldata
syscall_handler.increment_linear_factor_by(
&SyscallSelector::Deploy,
request.constructor_calldata.0.len(),
);

// region: Modified blockifier code
let deployer_address = syscall_handler.storage_address();
// endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use blockifier::execution::contract_class::CompiledClassV0;
use blockifier::execution::deprecated_entry_point_execution::{
VmExecutionContext, finalize_execution, initialize_execution_context, prepare_call_arguments,
};
use blockifier::execution::entry_point::{CallEntryPoint, EntryPointExecutionContext};
use blockifier::execution::entry_point::{EntryPointExecutionContext, ExecutableCallEntryPoint};
use blockifier::execution::errors::EntryPointExecutionError;
use blockifier::execution::execution_utils::Args;
use blockifier::state::state_api::State;
Expand All @@ -19,7 +19,7 @@ use cairo_vm::vm::runners::cairo_runner::{CairoArg, CairoRunner};

// blockifier/src/execution/deprecated_execution.rs:36 (execute_entry_point_call)
pub fn execute_entry_point_call_cairo0(
call: CallEntryPoint,
call: ExecutableCallEntryPoint,
compiled_class_v0: CompiledClassV0,
state: &mut dyn State,
cheatnet_state: &mut CheatnetState,
Expand Down Expand Up @@ -58,10 +58,10 @@ pub fn execute_entry_point_call_cairo0(
)
.on_error_get_last_pc(&mut runner)?;

let syscall_counter = cheatable_syscall_handler
let syscall_usage = cheatable_syscall_handler
.extended_runtime
.hint_handler
.syscall_counter
.syscalls_usage
.clone();

let execution_result = finalize_execution(
Expand All @@ -72,7 +72,7 @@ pub fn execute_entry_point_call_cairo0(
n_total_args,
)?;

Ok((execution_result, syscall_counter, None))
Ok((execution_result, syscall_usage, None))
// endregion
}

Expand Down
Loading
Loading