-
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
feat(blockifier): add OS constants to VC #2281
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.
python side PR
Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @dorimedini-starkware)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2281 +/- ##
===========================================
+ Coverage 40.10% 63.16% +23.06%
===========================================
Files 26 143 +117
Lines 1895 18387 +16492
Branches 1895 18387 +16492
===========================================
+ Hits 760 11615 +10855
- Misses 1100 5973 +4873
- Partials 35 799 +764 ☔ 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 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nimrod-starkware and @Yoni-Starkware)
crates/blockifier/src/versioned_constants.rs
line 651 at r1 (raw file):
impl OsConstants { // List of additinal os constants, beside the gas cost and validate rounding constants, that are // not used by the blockifier but included for transparency. These constanst will be ignored
won't you be using these constants? we don't verify deployed addresses are not reserved?
Code quote:
not used by the blockifier
crates/blockifier/resources/versioned_constants_0_13_4.json
line 0 at r1 (raw file):
don't these changes also need to appear on the older VCs...?
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, 2 unresolved discussions (waiting on @dorimedini-starkware and @nimrod-starkware)
crates/blockifier/src/versioned_constants.rs
line 651 at r1 (raw file):
Previously, dorimedini-starkware wrote…
won't you be using these constants? we don't verify deployed addresses are not reserved?
No need to check it in the blockifier
46909f2
to
1583dfb
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 15 of 15 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @nimrod-starkware)
crates/blockifier/src/versioned_constants.rs
line 709 at r2 (raw file):
} } #[derive(Debug, Deserialize)]
Suggestion:
}
#[derive(Debug, Deserialize)]
crates/blockifier/src/versioned_constants.rs
line 713 at r2 (raw file):
pub block_hash: u8, pub alias: u8, pub reserved: u8,
change types from u8 to ContractAddress, as these are contract addresses... if you want to enforce these are less than 256 via typing, define struct OsContractAddress(u8)
and impl From<OsContractAddress> for ContractAddress
, but that seems overkill to me
Code quote:
pub block_hash: u8,
pub alias: u8,
pub reserved: u8,
crates/blockifier/src/versioned_constants.rs
line 719 at r2 (raw file):
fn default() -> Self { Self { block_hash: 1, alias: 2, reserved: 3 } }
I don't like how these magic numbers appear here and in the VC jsons; how about like this?
(latest_constants
returns a &'static VersionedConstants
so there should very small overhead to loading the entire object)
Suggestion:
fn default() -> Self {
VersionedConstants::latest_constants().os_contract_addresses
}
1583dfb
to
51cf7ed
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 12 of 12 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nimrod-starkware)
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, 3 unresolved discussions (waiting on @dorimedini-starkware)
crates/blockifier/resources/versioned_constants_0_13_4.json
line at r1 (raw file):
Previously, dorimedini-starkware wrote…
don't these changes also need to appear on the older VCs...?
Done
crates/blockifier/src/versioned_constants.rs
line 713 at r2 (raw file):
Previously, dorimedini-starkware wrote…
change types from u8 to ContractAddress, as these are contract addresses... if you want to enforce these are less than 256 via typing, define
struct OsContractAddress(u8)
andimpl From<OsContractAddress> for ContractAddress
, but that seems overkill to me
I did another trick, changing to
pub struct OsContractAddresses {
block_hash_contract_address: ContractAddress,
alias_contract_address: ContractAddress,
reserved_contract_address: ContractAddress,
}
Doesn't work because of how ContractAddress
deserializes.
I changed the fields to be private and added methods return it as a ContractAddress
crates/blockifier/src/versioned_constants.rs
line 719 at r2 (raw file):
Previously, dorimedini-starkware wrote…
I don't like how these magic numbers appear here and in the VC jsons; how about like this?
(latest_constants
returns a&'static VersionedConstants
so there should very small overhead to loading the entire object)
Done.
crates/blockifier/src/versioned_constants.rs
line 709 at r2 (raw file):
} } #[derive(Debug, Deserialize)]
Done.
e08d156
to
5b5e79e
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 12 of 12 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)
crates/blockifier/src/versioned_constants.rs
line 713 at r2 (raw file):
Previously, nimrod-starkware wrote…
I did another trick, changing to
pub struct OsContractAddresses { block_hash_contract_address: ContractAddress, alias_contract_address: ContractAddress, reserved_contract_address: ContractAddress, }
Doesn't work because of how
ContractAddress
deserializes.I changed the fields to be private and added methods return it as a
ContractAddress
did you try #[serde(deserialize_with = "???")]
? it may be a cleaner solution
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, 1 unresolved discussion (waiting on @dorimedini-starkware)
crates/blockifier/src/versioned_constants.rs
line 713 at r2 (raw file):
Previously, dorimedini-starkware wrote…
did you try
#[serde(deserialize_with = "???")]
? it may be a cleaner solution
It's possible with an intermediate struct that deserializes easily.
However, implementing a Default
for that becomes more difficult if we want to use VersionedConstants::latest()
as the fields there of ContractAddress
type.
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: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
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, 1 unresolved discussion (waiting on @nimrod-starkware)
a discussion (no related file):
waiting for py side PR to pass
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, 1 unresolved discussion (waiting on @nimrod-starkware)
5b5e79e
to
1340637
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: 3 of 15 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)
a discussion (no related file):
Previously, dorimedini-starkware wrote…
waiting for py side PR to pass
passed
1340637
to
7e8e01f
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 10 of 12 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
7e8e01f
to
c0b15b3
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 all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
c0b15b3
to
bbc0656
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 r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
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, 1 unresolved discussion (waiting on @nimrod-starkware)
crates/blockifier/src/versioned_constants.rs
line 792 at r7 (raw file):
#[serde(default)] validate_rounding_consts: ValidateRoundingConsts, #[serde(default)]
Why default?
Code quote:
#[serde(default)]
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, 1 unresolved discussion (waiting on @Yoni-Starkware)
crates/blockifier/src/versioned_constants.rs
line 792 at r7 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Why default?
There were some tests for the logic of deserialization of OsConstantsRawJson
that didn't explicitly add the struct to the json.
Removed it now.
bbc0656
to
a354d8b
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 r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yoni-Starkware)
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 2 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
a354d8b
to
9d0bc72
Compare
No description provided.