-
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): add cairo-native feature #1558
Conversation
Artifacts upload triggered. View details here |
4e37a46
to
2185b8f
Compare
Artifacts upload triggered. View details here |
2185b8f
to
993a986
Compare
Artifacts upload triggered. View details here |
993a986
to
8c3accf
Compare
Artifacts upload triggered. View details here |
61e77de
to
868db33
Compare
Artifacts upload triggered. View details here |
868db33
to
baedc08
Compare
Artifacts upload triggered. View details here |
baedc08
to
489eddb
Compare
Artifacts upload triggered. View details here |
489eddb
to
b3b1f7f
Compare
Artifacts upload triggered. View details here |
b3b1f7f
to
328d73c
Compare
Artifacts upload triggered. View details here |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1558 +/- ##
===========================================
+ Coverage 40.10% 68.96% +28.86%
===========================================
Files 26 100 +74
Lines 1895 13380 +11485
Branches 1895 13380 +11485
===========================================
+ Hits 760 9228 +8468
- Misses 1100 3751 +2651
- Partials 35 401 +366 ☔ View full report in Codecov by Sentry. |
328d73c
to
640f100
Compare
Artifacts upload triggered. View details here |
640f100
to
44dc3f2
Compare
Artifacts upload triggered. View details here |
44dc3f2
to
bed1aca
Compare
Artifacts upload triggered. View details here |
bed1aca
to
a8c7f39
Compare
Artifacts upload triggered. View details here |
a8c7f39
to
0c61caa
Compare
Artifacts upload triggered. View details here |
9266e4e
to
7c9710f
Compare
Artifacts upload triggered. View details here |
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 15 files at r1, all commit messages.
Reviewable status: 7 of 15 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @noaov1)
-- commits
line 2 at r1:
This is weird... Did you amend an existing commit instead of creating a new one?
Code quote:
7c9710f: feat(ci): small QoL improvements to publish_crates.py (#1542)
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 8 of 15 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)
crates/blockifier/src/execution/syscalls/mod.rs
line 532 at r1 (raw file):
} #[cfg(feature = "cairo_native")] ContractClass::V1Native(_) => {
This method introduces code duplication in many places.
Is there a way to avoid it?
Non-blocking
Code quote:
#[cfg(feature = "cairo_native")]
ContractClass::V1Native(_) => {
7c9710f
to
85091d4
Compare
Artifacts upload triggered. View details here |
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: 14 of 15 files reviewed, 2 unresolved discussions (waiting on @avi-starkware and @dorimedini-starkware)
Previously, avi-starkware wrote…
This is weird... Did you amend an existing commit instead of creating a new one?
Indeed weird. Nice catch!
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 r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @avi-starkware and @noaov1)
a discussion (no related file):
there are two options as I see it
- what you did here
- duplicate all code that has a variation into separate modules - one for native and one without. for example:
// Module gated behind #[cfg(feature = "cairo_native")]
pub enum ContractClass {
V0(ContractClassV0),
V1(ContractClassV1),
V1Native(NativeContractClassV1),
}
...
// Module gated behind #[cfg(not(feature = "cairo_native"))]
pub enum ContractClass {
V0(ContractClassV0),
V1(ContractClassV1),
}
which one is better?
.github/workflows/blockifier_ci.yml
line 54 at r2 (raw file):
- run: cargo build -p blockifier --features transaction_serde - run: cargo test -p blockifier --features transaction_serde # native-blckifier is not activated by any workspace crate; test the build.
Suggestion:
# cairo-native is not activated by any workspace crate; test the build.
crates/blockifier/src/transaction/account_transaction.rs
line 972 at r2 (raw file):
} false
does this work?
Suggestion:
match contract_class {
ContractClass::V0(_) => false,
ContractClass::V1(_) => true,
#[cfg(feature = "cairo_native")]
ContractClass::V1Native(_) => true,
}
Previously, dorimedini-starkware wrote…
Solution 2 adds much more code duplication. This means any change to this module will have to be made twice. |
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 @dorimedini-starkware and @noaov1)
crates/blockifier/src/transaction/account_transaction.rs
line 972 at r2 (raw file):
Previously, dorimedini-starkware wrote…
does this work?
It should work. The same pattern is used in test_utils.rs
in this PR (and in many other places...)
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 all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)
85091d4
to
8635ac7
Compare
Artifacts upload triggered. View details here |
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: 12 of 15 files reviewed, 3 unresolved discussions (waiting on @avi-starkware and @dorimedini-starkware)
a discussion (no related file):
Previously, avi-starkware wrote…
Solution 2 adds much more code duplication. This means any change to this module will have to be made twice.
I tend to agree with Avi.
crates/blockifier/src/execution/syscalls/mod.rs
line 532 at r1 (raw file):
Previously, avi-starkware wrote…
This method introduces code duplication in many places.
Is there a way to avoid it?
Non-blocking
Good question. Changed. WDYT?
crates/blockifier/src/transaction/account_transaction.rs
line 972 at r2 (raw file):
Previously, avi-starkware wrote…
It should work. The same pattern is used in
test_utils.rs
in this PR (and in many other places...)
Like. Done.
8635ac7
to
113fd37
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: 12 of 15 files reviewed, 3 unresolved discussions (waiting on @avi-starkware and @dorimedini-starkware)
.github/workflows/blockifier_ci.yml
line 54 at r2 (raw file):
- run: cargo build -p blockifier --features transaction_serde - run: cargo test -p blockifier --features transaction_serde # native-blckifier is not activated by any workspace crate; test the build.
Opps. Done
Artifacts upload triggered. View details here |
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: 11 of 15 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)
crates/blockifier/src/execution/syscalls/mod.rs
line 532 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Good question. Changed. WDYT?
Why not just:
if !is_cairo1(&class) {
return Err(....)
}
The function is_cairo1
covers all the cases. If it is false, it has to be Cairo 0.
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 r2, 3 of 3 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware and @noaov1)
crates/blockifier/src/transaction/transactions.rs
line 156 at r4 (raw file):
let declare_version = declare_tx.version(); // Verify contract class version. if matches!(class_info.contract_class(), ContractClass::V0(_)) {
As I suggested above
Suggestion:
if !is_cairo1(class_info.contract_class()) {
113fd37
to
d198eb6
Compare
Artifacts upload triggered. View details here |
d198eb6
to
6c4010e
Compare
Artifacts upload triggered. View details here |
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 2 of 2 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
No description provided.