blockifier: replace flags in cairo native run config with enum#12717
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
81d6d3a to
1f76a02
Compare
2d428b5 to
ee2d740
Compare
1f76a02 to
922fbba
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 2 comments and resolved 2 discussions.
Reviewable status: 0 of 16 files reviewed, all discussions resolved.
922fbba to
a19e630
Compare
a19e630 to
00531e9
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 1 comment.
Reviewable status: 0 of 17 files reviewed, all discussions resolved.
a discussion (no related file):
Collides with #12696.
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware reviewed 1 file.
Reviewable status: 1 of 17 files reviewed, all discussions resolved.
|
Points of discussion:
Code quote: #[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum RunCairoNativeOptions {
Off,
WaitOnCompilation,
DontWaitOnCompilation,
} |
00531e9 to
40616b3
Compare
avi-starkware
left a comment
There was a problem hiding this comment.
@avi-starkware reviewed 17 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ArniStarkware).
crates/blockifier/src/blockifier/config.rs line 299 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Points of discussion:
- The name of the struct.
- The name of the variants.
- How should the variants serialize?
- Can be
CairoNativeMode - The last variant can be
CompilationWorkerThreadinstead, and I likeWaitOnCompilation. - Use "snake_case" for readability.
crates/blockifier/src/state/native_class_manager.rs line 165 at r5 (raw file):
CompiledClasses::V0(_) => self.class_cache.set(class_hash, compiled_class), CompiledClasses::V1(compiled_class_v1, sierra_contract_class) => { if let CairoNativeRunMode::SynchronousCompilation = self.cairo_native_run_mode() {
Suggestion:
if self.cairo_native_run_mode() == CairoNativeRunMode::SynchronousCompilation {crates/blockifier/src/state/native_class_manager.rs line 186 at r5 (raw file):
); if let CairoNativeRunMode::AsynchronousCompilation = self.cairo_native_run_mode() {
Suggestion:
if self.cairo_native_run_mode() == CairoNativeRunMode::AsynchronousCompilation {40616b3 to
e51a471
Compare
ArniStarkware
left a comment
There was a problem hiding this comment.
@ArniStarkware made 3 comments and resolved 2 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArniStarkware).
crates/blockifier/src/blockifier/config.rs line 299 at r4 (raw file):
Previously, avi-starkware (Avi Cohen) wrote…
- Can be
CairoNativeMode- The last variant can be
CompilationWorkerThreadinstead, and I likeWaitOnCompilation.- Use "snake_case" for readability.
Done, except for 2.a. I don't like CompilationWorkerThread. That is not a "mode"...
crates/blockifier/src/state/native_class_manager.rs line 165 at r5 (raw file):
CompiledClasses::V0(_) => self.class_cache.set(class_hash, compiled_class), CompiledClasses::V1(compiled_class_v1, sierra_contract_class) => { if let CairoNativeRunMode::SynchronousCompilation = self.cairo_native_run_mode() {
Done.
crates/blockifier/src/state/native_class_manager.rs line 186 at r5 (raw file):
); if let CairoNativeRunMode::AsynchronousCompilation = self.cairo_native_run_mode() {
Done.
avi-starkware
left a comment
There was a problem hiding this comment.
@avi-starkware made 1 comment.
Reviewable status: 1 of 17 files reviewed, 1 unresolved discussion (waiting on ArniStarkware).
crates/blockifier/src/blockifier/config.rs line 299 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Done, except for 2.a. I don't like
CompilationWorkerThread. That is not a "mode"...
It is just the terminology used in the native class manager. We call the thread responsible for compilation the "compilation worker".
The execution worker thread running the class either compiles the class itself and then runs it (in mode WaitOnCompilation), or sends a compilation request to the compilation worker thread and runs the casm in the VM instead of waiting.
We could call it DeferCompilation, DelegateCompilation, LazyCompilation, or something like that...
e51a471 to
82616a7
Compare
|
Previously, avi-starkware (Avi Cohen) wrote…
Done. |
avi-starkware
left a comment
There was a problem hiding this comment.
@avi-starkware reviewed 16 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArniStarkware).
avi-starkware
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on ArniStarkware).
avi-starkware
left a comment
There was a problem hiding this comment.
@avi-starkware made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ArniStarkware).

Note
Medium Risk
Touches core contract class compilation/execution configuration and changes defaults/serialization, which can alter native compilation behavior at runtime if configs aren’t migrated correctly.
Overview
Refactors Cairo native execution configuration from two booleans (
run_cairo_native,wait_on_native_compilation) into a singleCairoNativeModeenum (off,wait_on_compilation,lazy_compilation) and wires this throughCairoNativeRunConfig/ContractClassManagerConfig.Updates the class manager startup and compilation flow to branch on the new mode (no worker in
OfforWaitOnCompilation; async worker only inLazyCompilation), adjusts invariants/assertions, and migrates all tests and helper constructors to the new API.Migrates node/deployment JSON configs and the config schema to the new
cairo_native_run_modefield (defaulting tooffin schema;lazy_compilationin provided app configs), and adds a compatibility mapping innative_blockifier’s Python config conversion from the old flags to the new enum.Written by Cursor Bugbot for commit 82616a7. This will update automatically on new commits. Configure here.