Skip to content

Commit f0077f2

Browse files
avi-starkwareclaude
andcommitted
blockifier: re-add new_from_emu for out-of-tree benchmarking branch
`new_from_emu` was deleted in 88b68af after Cursor flagged it as unused. Restore it (with a doc comment naming the planned consumer) so the benchmarking / replay tooling — which will live as a feature branch and is not expected to merge here — can reach it without patching this file. No `#[expect(dead_code)]` needed: `dead_code` doesn't fire on `pub fn` in a library crate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8357c7e commit f0077f2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

crates/blockifier/src/execution/native/contract_class.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use std::sync::Arc;
44

55
#[cfg(feature = "with-libfunc-profiling")]
66
use cairo_native::executor::AotWithProgram;
7+
#[cfg(feature = "sierra-emu")]
8+
use cairo_native::executor::EmuContractInfo;
79
use cairo_native::executor::{AotContractExecutor, ContractExecutor};
810
use starknet_api::contract_class::compiled_class_hash::HashableCompiledClass;
911
use starknet_api::core::EntryPointSelector;
@@ -37,6 +39,17 @@ impl NativeCompiledClassV1 {
3739
Self(Arc::new(contract))
3840
}
3941

42+
/// Initialize a compiled class backed by the sierra-emu interpreter instead of the AOT
43+
/// executor. Intended for the out-of-tree benchmarking / replay feature branch — those
44+
/// tools are not expected to merge into this repo and will consume this constructor
45+
/// from a fork. `pub` so a fork can reach it without patching this file.
46+
#[cfg(feature = "sierra-emu")]
47+
pub fn new_from_emu(info: EmuContractInfo, casm: CompiledClassV1) -> NativeCompiledClassV1 {
48+
let contract = NativeCompiledClassV1Inner::new(info.into(), casm);
49+
50+
Self(Arc::new(contract))
51+
}
52+
4053
/// Like [`Self::new`], but also stores the Sierra `Program` (via the cairo-native
4154
/// [`AotWithProgram`] pairing) so [`cairo_native::ContractExecutor::run_with_profile`]
4255
/// can resolve libfunc samples. Only callable when the `with-libfunc-profiling`

0 commit comments

Comments
 (0)