-
Notifications
You must be signed in to change notification settings - Fork 26
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): add runnable cairo version to the cairo version enum #2503
chore(blockifier): add runnable cairo version to the cairo version enum #2503
Conversation
7538e8c
to
7b28f4a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2503 +/- ##
==========================================
+ Coverage 40.10% 49.83% +9.73%
==========================================
Files 26 291 +265
Lines 1895 33458 +31563
Branches 1895 33458 +31563
==========================================
+ Hits 760 16675 +15915
- Misses 1100 15652 +14552
- Partials 35 1131 +1096 ☔ View full report in Codecov by Sentry. |
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 33 of 33 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @meship-starkware)
crates/blockifier/src/test_utils/contracts.rs
line 131 at r1 (raw file):
Self::SierraExecutionInfoV1Contract => { CairoVersion::Cairo1(RunnableCairoVersion::Native) }
this will change in the next PR to return the inner runnable cairo1 version?
or will this contract stay "only native"?
Code quote:
Self::SierraExecutionInfoV1Contract => {
CairoVersion::Cairo1(RunnableCairoVersion::Native)
}
crates/blockifier/src/test_utils/contracts.rs
line 310 at r1 (raw file):
pub fn get_sierra_path(&self) -> String { assert_ne!(self.cairo_version(), CairoVersion::Cairo0); assert_ne!(self, &Self::ERC20(CairoVersion::Cairo1(RunnableCairoVersion::Casm)));
what if the ERC20 is native? this can be constructed, compiler won't protect us
Code quote:
assert_ne!(self, &Self::ERC20(CairoVersion::Cairo1(RunnableCairoVersion::Casm)));
crates/blockifier/src/test_utils.rs
line 63 at r1 (raw file):
#[derive(Clone, Hash, PartialEq, Eq, Copy, Debug)] pub enum RunnableCairoVersion {
please add the 1
for clarity.
I would also drop the Version
- it's not a difference in versions, actually, just the execution framework
Suggestion:
RunnableCairo1
crates/blockifier/src/test_utils.rs
line 106 at r1 (raw file):
} } }
is this deleted in PR 2464? because it should be...
if native feature is active, calling this function should always panic imo, Cairo0.other_version()
is not well defined if native exists
Code quote:
pub fn other(&self) -> Self {
match self {
Self::Cairo0 => CairoVersion::Cairo1(RunnableCairoVersion::Casm),
CairoVersion::Cairo1(RunnableCairoVersion::Casm) => Self::Cairo0,
#[cfg(feature = "cairo_native")]
CairoVersion::Cairo1(RunnableCairoVersion::Native) => {
panic!("There is no other version for native")
}
}
}
crates/blockifier/src/test_utils.rs
line 136 at r1 (raw file):
Self::CairoVersion(CairoVersion::Cairo1(RunnableCairoVersion::Native)) => { TrackedResource::SierraGas }
less boilerplate :)
Suggestion:
Self::CairoVersion(CairoVersion::Cairo1(_)) => TrackedResource::SierraGas,
crates/blockifier/src/test_utils.rs
line 370 at r1 (raw file):
) } }
this macro should behave the same for all cairo1 contracts regardless of running framework, right?
Suggestion:
CairoVersion::Cairo1(_) => {
if let $crate::transaction::errors::TransactionExecutionError::ValidateTransactionError {
error, ..
} = $error {
assert_eq!(
error.to_string(),
"Execution failed. Failure reason: 0x496e76616c6964207363656e6172696f \
('Invalid scenario')."
)
}
}
7b28f4a
to
1cd3784
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.
Reviewed 11 of 11 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @meship-starkware)
1cd3784
to
50f6e95
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 33 files reviewed, 5 unresolved discussions (waiting on @dorimedini-starkware)
crates/blockifier/src/test_utils.rs
line 63 at r1 (raw file):
Previously, dorimedini-starkware wrote…
please add the
1
for clarity.
I would also drop theVersion
- it's not a difference in versions, actually, just the execution framework
Done.
crates/blockifier/src/test_utils.rs
line 106 at r1 (raw file):
Previously, dorimedini-starkware wrote…
is this deleted in PR 2464? because it should be...
if native feature is active, calling this function should always panic imo,Cairo0.other_version()
is not well defined if native exists
It is deleted in the next PR
crates/blockifier/src/test_utils.rs
line 136 at r1 (raw file):
Previously, dorimedini-starkware wrote…
less boilerplate :)
Done.
crates/blockifier/src/test_utils.rs
line 370 at r1 (raw file):
Previously, dorimedini-starkware wrote…
this macro should behave the same for all cairo1 contracts regardless of running framework, right?
Done.
crates/blockifier/src/test_utils/contracts.rs
line 131 at r1 (raw file):
Previously, dorimedini-starkware wrote…
this will change in the next PR to return the inner runnable cairo1 version?
or will this contract stay "only native"?
I am changing it in the next PR
crates/blockifier/src/test_utils/contracts.rs
line 310 at r1 (raw file):
Previously, dorimedini-starkware wrote…
what if the ERC20 is native? this can be constructed, compiler won't protect us
Will fix it, but for now ERC20 cannot be native will be fixed in the near future,
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 33 of 33 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @meship-starkware)
50f6e95
to
f8fbee1
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.
Reviewed 7 of 7 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)
f8fbee1
to
cd34971
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)
cd34971
to
53605f5
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.
Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)
No description provided.