-
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
refactor: streamline class info object to match contract class #427
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on Graphite |
ad0e6f0
to
2f12b2a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## arni/snapi/contract_class_refacrtor/class_info_new_method #427 +/- ##
============================================================================================
Coverage ? 62.70%
============================================================================================
Files ? 146
Lines ? 17999
Branches ? 17999
============================================================================================
Hits ? 11287
Misses ? 5880
Partials ? 832 ☔ 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 2 of 5 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)
crates/blockifier/src/execution/contract_class.rs
line 49 at r3 (raw file):
/// We wrap the actual class in an Arc to avoid cloning the program when cloning the class. // Note: when deserializing from a SN API class JSON string, the ABI field is ignored // by serde, since it is not required for execution.
What is this referring to?
Code quote:
/// Represents a runnable Starknet contract class (meaning, the program is runnable by the VM).
/// We wrap the actual class in an Arc to avoid cloning the program when cloning the class.
// Note: when deserializing from a SN API class JSON string, the ABI field is ignored
// by serde, since it is not required for execution.
crates/gateway/src/compilation.rs
line 3 at r3 (raw file):
use std::sync::Arc; use blockifier::execution::contract_class::{ClassInfo, ContractClassV1};
Consider using as BlockifierContractClass
Code quote:
ContractClassV1
crates/papyrus_execution/src/lib.rs
line 760 at r3 (raw file):
)?); let class_info = ClassInfo::new(&class_v0, DEPRECATED_CONTRACT_SIERRA_SIZE, abi_length) .map_err(|err| ExecutionError::BadDeclareTransaction {
Is this error still in use?
Code quote:
ExecutionError::BadDeclareTransaction
2f12b2a
to
52a0311
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: 2 of 5 files reviewed, 1 unresolved discussion (waiting on @yair-starkware)
crates/blockifier/src/execution/contract_class.rs
line 49 at r3 (raw file):
Previously, yair-starkware (Yair) wrote…
What is this referring to?
The original intent was to document ContractClass:
https://reviewable.io/reviews/starkware-libs/blockifier/452
Done.
crates/gateway/src/compilation.rs
line 3 at r3 (raw file):
Previously, yair-starkware (Yair) wrote…
Consider using
as BlockifierContractClass
Done.
crates/papyrus_execution/src/lib.rs
line 760 at r3 (raw file):
Previously, yair-starkware (Yair) wrote…
Is this error still in use?
No! 🥳
Removed.
52a0311
to
4edc527
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 2 of 3 files at r4, all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on @ArniStarkware)
crates/blockifier/src/execution/contract_class.rs
line 49 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
The original intent was to document ContractClass:
https://reviewable.io/reviews/starkware-libs/blockifier/452Done.
I don't understand how the comment matches the type (where is the Arc?)
4edc527
to
a24e9fd
Compare
Previously, yair-starkware (Yair) wrote…
You are correct. This issue is now handled in #491. I think these are unrelated issues, and I hope the prep PR will be merged long before this one. |
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 @ArniStarkware)
a24e9fd
to
8c8184d
Compare
f928dab
to
3766781
Compare
Is this cleaner, in your opinion? Suggestion: pub enum ClassInfo {
V0 (ClassInfoV0),
V1 (ClassInfoV1),
}
pub struct ClassInfoV0 {contract_class: ContractClassV0, abi_length: usize};
pub struct ClassInfoV1 {contract_class: ContractClassV1, sierra_program_length: usize, abi_length: usize }; |
8c8184d
to
7b7cc8b
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 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
crates/blockifier/src/execution/contract_class.rs
line 502 at r5 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Is this cleaner, in your opinion?
No
7b7cc8b
to
e19524c
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 5 of 5 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
e19524c
to
ca57611
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 4 of 4 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
ca57611
to
d458a7c
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 3 of 3 files at r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
d458a7c
to
a013fb2
Compare
This is the main innovation of this PR. Code quote: pub enum ClassInfo {
V0 { contract_class: ContractClassV0, abi_length: usize },
V1 { contract_class: ContractClassV1, sierra_program_length: usize, abi_length: usize },
} |
a557ae3
to
9960a4b
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 r11.
Reviewable status: 1 of 5 files reviewed, all discussions resolved (waiting on @yair-starkware)
crates/blockifier/src/execution/contract_class.rs
line 565 at r10 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
This is the main innovation of this PR.
This, and deleting the combersomnew
class method.
Using two separate enums (ContractClass
and ClassInfo
) that mirror each other's structure can be redundant and can make the code harder to maintain, as any changes to ContractClass
would need to be reflected in ClassInfo
32c4b2e
to
112302a
Compare
9960a4b
to
0c792be
Compare
112302a
to
85481c0
Compare
0c792be
to
5120579
Compare
Previously, noaov1 (Noa Oved) wrote…
I split this PR into this one and #1215. PTAL. |
d4d1890
to
955c47e
Compare
955c47e
to
625fcaf
Compare
5120579
to
55a6aae
Compare
Benchmark movements: |
No longer relevant. It becomes harder to streamline now that there are three variants of contract class. |
This change is