-
Notifications
You must be signed in to change notification settings - Fork 22
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): separate create and validate logic on gas prices #2243
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e945fbe
to
ec2b2fe
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2243 +/- ##
===========================================
+ Coverage 40.10% 52.71% +12.60%
===========================================
Files 26 228 +202
Lines 1895 25689 +23794
Branches 1895 25689 +23794
===========================================
+ Hits 760 13542 +12782
- Misses 1100 11170 +10070
- Partials 35 977 +942 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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 7 files reviewed, 1 unresolved discussion (waiting on @aner-starkware, @ArniStarkware, and @dorimedini-starkware)
a discussion (no related file):
Why do we need this change? Specifically if new()
is now a private method, what's the difference between safe_new()
and the previous new()
?
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 7 files reviewed, 1 unresolved discussion (waiting on @alonh5, @aner-starkware, and @dorimedini-starkware)
a discussion (no related file):
Previously, alonh5 (Alon Haramati) wrote…
Why do we need this change? Specifically if
new()
is now a private method, what's the difference betweensafe_new()
and the previousnew()
?
The goal is to move new()
into starknet API.
You do have a point - it will be public at that point. Should I change the visibility of new
in this PR?
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 r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @aner-starkware, @ArniStarkware, and @dorimedini-starkware)
a discussion (no related file):
Previously, ArniStarkware (Arnon Hod) wrote…
The goal is to move
new()
into starknet API.
You do have a point - it will be public at that point. Should I change the visibility ofnew
in this PR?
I think the reason there is a new()
function is for that validation. So in that case I would remove the new()
function and the getters completely and make the fields public. WDYT?
crates/blockifier/src/blockifier/block.rs
line 88 at r2 (raw file):
} pub fn safe_new(
Suggestion:
validated_new
ec2b2fe
to
ab1a504
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 7 files reviewed, 2 unresolved discussions (waiting on @alonh5, @aner-starkware, and @dorimedini-starkware)
a discussion (no related file):
Previously, alonh5 (Alon Haramati) wrote…
I think the reason there is a
new()
function is for that validation. So in that case I would remove thenew()
function and the getters completely and make the fields public. WDYT?
Done.
crates/blockifier/src/blockifier/block.rs
line 88 at r2 (raw file):
} pub fn safe_new(
Done.
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 r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @aner-starkware and @dorimedini-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 @aner-starkware, @ArniStarkware, and @dorimedini-starkware)
crates/blockifier/src/blockifier/block.rs
line 108 at r3 (raw file):
FeeType::Eth => &self.eth_gas_prices, } }
You can also remove these now.
Code quote:
pub fn get_l1_gas_price_by_fee_type(&self, fee_type: &FeeType) -> NonzeroGasPrice {
self.get_gas_prices_by_fee_type(fee_type).l1_gas_price
}
pub fn get_l1_data_gas_price_by_fee_type(&self, fee_type: &FeeType) -> NonzeroGasPrice {
self.get_gas_prices_by_fee_type(fee_type).l1_data_gas_price
}
pub fn get_l2_gas_price_by_fee_type(&self, fee_type: &FeeType) -> NonzeroGasPrice {
self.get_gas_prices_by_fee_type(fee_type).l2_gas_price
}
pub fn get_gas_prices_by_fee_type(&self, fee_type: &FeeType) -> &GasPriceVector {
match fee_type {
FeeType::Strk => &self.strk_gas_prices,
FeeType::Eth => &self.eth_gas_prices,
}
}
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 @alonh5, @aner-starkware, and @dorimedini-starkware)
crates/blockifier/src/blockifier/block.rs
line 108 at r3 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
You can also remove these now.
No - I can not. I looked into it.
It is used in many locations, non-trivially.
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 @aner-starkware, @ArniStarkware, and @dorimedini-starkware)
crates/blockifier/src/blockifier/block.rs
line 108 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
No - I can not. I looked into it.
It is used in many locations, non-trivially.
Oh I see. Let's leave them then.
Can you remove the get_
prefix and the _by_fee_type
suffix?
The Rust style guide says you shouldn't use get_
and the _by_fee_type
is also redundant because the fee type argument signifies that.
ab1a504
to
8ed2ee0
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: all files reviewed, 1 unresolved discussion (waiting on @alonh5, @aner-starkware, and @dorimedini-starkware)
crates/blockifier/src/blockifier/block.rs
line 108 at r3 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Oh I see. Let's leave them then.
Can you remove theget_
prefix and the_by_fee_type
suffix?
The Rust style guide says you shouldn't useget_
and the_by_fee_type
is also redundant because the fee type argument signifies that.
Done. Now on the next PR on this stack: #2269.
8ed2ee0
to
0056b67
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: complete! all files reviewed, all discussions resolved (waiting on @aner-starkware and @dorimedini-starkware)
0056b67
to
b761166
Compare
b761166
to
7d6ad29
Compare
No description provided.