-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(blockifier_reexecution): compile sierra to versioned runnable class #2679
base: aviv/get_versioned_class_to_feature_contract
Are you sure you want to change the base?
Conversation
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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @amosStarkware and @AvivYossef-starkware)
crates/blockifier_reexecution/src/state_reader/test_state_reader.rs
line 138 at r1 (raw file):
StarknetContractClass::Sierra(sierra) => { let (casm, _) = sierra_to_versioned_contract_class_v1(sierra).unwrap(); let runnable_contract_class: RunnableCompiledClass = casm.try_into().unwrap();
personally prefer to avoid let x: X = y.into()
when you can do let x = X::from(y)
non-blocking
Suggestion:
let runnable_contract_class = RunnableCompiledClass::try_from(casm).unwrap();
crates/blockifier_reexecution/src/state_reader/compile.rs
line 79 at r1 (raw file):
pub fn sierra_to_versioned_contract_class_v1( sierra: FlattenedSierraClass, ) -> StateResult<(ContractClass, SierraVersion)> {
doesn't this tuple type have a name you can use?
Code quote:
(ContractClass, SierraVersion)
crates/blockifier_reexecution/src/state_reader/compile.rs
line 100 at r1 (raw file):
.collect::<Vec<u64>>() .try_into() .expect("Expected exactly 3 elements.");
this version-from-sierra logic is duplicated, no? is this avoidable? I realize the type of the sierra contract isn't the same but is there something you can reuse?
non-blocking
Code quote:
let [major, minor, patch] = sierra
.sierra_program
.clone()
.into_iter()
.take(3)
.map(|big_uint_as_hex| u64::try_from(big_uint_as_hex.value).unwrap())
.collect::<Vec<u64>>()
.try_into()
.expect("Expected exactly 3 elements.");
crates/blockifier_reexecution/src/state_reader/offline_state_reader.rs
line 163 at r1 (raw file):
match self.get_contract_class(&class_hash)? { StarknetContractClass::Sierra(sierra) => { let (casm, _) = sierra_to_versioned_contract_class_v1(sierra).unwrap();
why is this line needed...? where is casm
used?
Code quote:
let (casm, _) = sierra_to_versioned_contract_class_v1(sierra).unwrap();
83b7b5a
to
ab56dd1
Compare
484c4f6
to
13950e4
Compare
No description provided.