Skip to content

Commit 8357c7e

Browse files
avi-starkwareclaude
andcommitted
blockifier: address review feedback on native compilation path
- Drop unused `NativeCompiledClassV1::new_from_emu`; it had no in-tree callers, and the sierra-emu construction path will be re-added when the benchmarking/replay tool that needs it lands. - Revert `process_compilation_request`'s `.map(...)` shape to a direct `match`, moving `casm` into `NativeCompiledClassV1::new(_with_program)` in the `Ok` arm at zero cost instead of cloning it. - Bump pinned cairo-native rev to pick up `cargo fmt` fix on starkware-libs/cairo_native#1613. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f2fe35e commit 8357c7e

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ 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;
97
use cairo_native::executor::{AotContractExecutor, ContractExecutor};
108
use starknet_api::contract_class::compiled_class_hash::HashableCompiledClass;
119
use starknet_api::core::EntryPointSelector;
@@ -39,16 +37,6 @@ impl NativeCompiledClassV1 {
3937
Self(Arc::new(contract))
4038
}
4139

42-
/// Initialize a compiled class backed by the sierra-emu interpreter instead of the AOT
43-
/// executor. Used by benchmarking / replay tooling that wants to execute through the emu
44-
/// VM while reusing the rest of the blockifier pipeline.
45-
#[cfg(feature = "sierra-emu")]
46-
pub fn new_from_emu(info: EmuContractInfo, casm: CompiledClassV1) -> NativeCompiledClassV1 {
47-
let contract = NativeCompiledClassV1Inner::new(info.into(), casm);
48-
49-
Self(Arc::new(contract))
50-
}
51-
5240
/// Like [`Self::new`], but also stores the Sierra `Program` (via the cairo-native
5341
/// [`AotWithProgram`] pairing) so [`cairo_native::ContractExecutor::run_with_profile`]
5442
/// can resolve libfunc samples. Only callable when the `with-libfunc-profiling`

crates/blockifier/src/state/native_class_manager.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,21 +286,21 @@ fn process_compilation_request(
286286

287287
let start = Instant::now();
288288
#[cfg(feature = "with-libfunc-profiling")]
289-
let compilation_result = compiler
290-
.compile_with_program(sierra_for_compilation)
291-
.map(|info| NativeCompiledClassV1::new_with_program(info, casm.clone()));
289+
let compilation_result = compiler.compile_with_program(sierra_for_compilation);
292290
#[cfg(not(feature = "with-libfunc-profiling"))]
293-
let compilation_result = compiler
294-
.compile(sierra_for_compilation)
295-
.map(|executor| NativeCompiledClassV1::new(executor, casm.clone()));
291+
let compilation_result = compiler.compile(sierra_for_compilation);
296292
let duration = start.elapsed();
297293
log::info!(
298294
"Compiling to native contract with class hash: {:#066x}. Duration: {:.3} seconds",
299295
class_hash.0,
300296
duration.as_secs_f32()
301297
);
302298
match compilation_result {
303-
Ok(native_compiled_class) => {
299+
Ok(compiled) => {
300+
#[cfg(feature = "with-libfunc-profiling")]
301+
let native_compiled_class = NativeCompiledClassV1::new_with_program(compiled, casm);
302+
#[cfg(not(feature = "with-libfunc-profiling"))]
303+
let native_compiled_class = NativeCompiledClassV1::new(compiled, casm);
304304
class_cache.set(
305305
class_hash,
306306
CompiledClasses::V1Native(CachedCairoNative::Compiled(native_compiled_class)),

0 commit comments

Comments
 (0)