-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat(blockifier): add config to support choosing a single contract to compile natively #4523
feat(blockifier): add config to support choosing a single contract to compile natively #4523
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d009bc0
to
8a5861c
Compare
// Should add assert testing class_hash is OK? |
5615d50
to
8daae76
Compare
8daae76
to
5615d50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 5 files reviewed, 2 unresolved discussions
crates/blockifier/src/state/native_class_manager.rs
line 199 at r2 (raw file):
/// `None` enables all, an empty list disables all, and listed contracts are compiled natively. /// TODO(AvivG): implement for list, currently only one contract is supported. fn compile_with_native(&self, class_hash: ClassHash) -> bool {
Considering this change. @noaov1 WDYT?
Suggestion:
compile_natively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 5 files reviewed, 3 unresolved discussions (waiting on @noaov1)
config/sequencer/default_config.json
line 98 at r2 (raw file):
}, "batcher_config.contract_class_manager_config.cairo_native_run_config.contract_to_compile_natively.#is_none": { "description": "Flag for an optional field.",
Should this description be fixed?
Code quote:
description": "Flag for an optional field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 4 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @AvivYossef-starkware and @noaov1)
crates/blockifier/src/state/native_class_manager.rs
line 199 at r2 (raw file):
Previously, avivg-starkware wrote…
Considering this change. @noaov1 WDYT?
Compiling with native or using native is a more indicative name, IMO. It might not be clear what natively represents.
crates/blockifier/src/blockifier/config.rs
line 148 at r2 (raw file):
pub channel_size: usize, pub contract_to_compile_natively: Option<ClassHash>, /* if 'None' compile all contracts * natively. */
Suggestion:
pub contract_to_compile_with_native: Option<ClassHash>, /* if 'None' compile all contracts
* natively. */
crates/blockifier/src/blockifier/config.rs
line 188 at r2 (raw file):
ClassHash::default(), "contract_to_compile_natively", "The contract to compile natively.",
Suggestion:
"The contract to compile using Cario native compilation.",
… compile natively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @AvivYossef-starkware, @meship-starkware, and @noaov1)
crates/blockifier/src/state/native_class_manager.rs
line 199 at r2 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
Compiling with native or using native is a more indicative name, IMO. It might not be clear what natively represents.
changed
crates/blockifier/src/blockifier/config.rs
line 148 at r2 (raw file):
pub channel_size: usize, pub contract_to_compile_natively: Option<ClassHash>, /* if 'None' compile all contracts * natively. */
Done
crates/blockifier/src/blockifier/config.rs
line 188 at r2 (raw file):
ClassHash::default(), "contract_to_compile_natively", "The contract to compile natively.",
Done.
5615d50
to
c9a99a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 5 files reviewed, 5 unresolved discussions (waiting on @meship-starkware and @noaov1)
crates/blockifier/src/blockifier/config.rs
line 147 at r3 (raw file):
pub wait_on_native_compilation: bool, pub channel_size: usize, pub contract_to_compile_with_native: Option<ClassHash>, /* if 'None' compile all contracts
Im not sure I undestand,
if contract_to_compile_with_native=class_hash "0x1"
we compile everything beside "0x1" to Casm and if `contract_to_compile_with_native=None we compile everything to Native?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 5 files reviewed, 7 unresolved discussions (waiting on @avivg-starkware, @meship-starkware, and @noaov1)
crates/native_blockifier/src/py_objects.rs
line 195 at r1 (raw file):
Previously, avivg-starkware wrote…
// Should add assert testing class_hash is OK?
How can you test it?
What do you mean by ok?
crates/blockifier/src/state/native_class_manager.rs
line 120 at r3 (raw file):
CachedClass::V0(_) => self.cache.set(class_hash, compiled_class), CachedClass::V1(compiled_class_v1, sierra_contract_class) => { if !self.compile_with_native(class_hash) {
This means that we won't compile any other contract to native even if wait_on_native_compilation
is set to true
. Is this the desired behavior?
crates/blockifier/src/state/native_class_manager.rs
line 197 at r3 (raw file):
/// Determines if a contract should be compiled natively based on the allowlist. /// `None` enables all, an empty list disables all, and listed contracts are compiled natively.
Right Now we don't have a list,
so adjust the docstring.
config/sequencer/default_config.json
line 101 at r3 (raw file):
"privacy": "TemporaryValue", "value": true },
Try this
"batcher_config.contract_class_manager_config.cairo_native_run_config.contract_to_compile_with_native": {
"description": "The contract to compile using Cario native compilation.",
"privacy": "Public",
"value": null
},
Code quote:
"batcher_config.contract_class_manager_config.cairo_native_run_config.contract_to_compile_with_native": {
"description": "The contract to compile using Cario native compilation.",
"privacy": "Public",
"value": "0x0"
},
"batcher_config.contract_class_manager_config.cairo_native_run_config.contract_to_compile_with_native.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": true
},
No description provided.