-
Notifications
You must be signed in to change notification settings - Fork 15
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): check max price of l1_data_gas and l2_gas #710
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #710 +/- ##
==========================================
+ Coverage 74.18% 75.23% +1.04%
==========================================
Files 359 87 -272
Lines 36240 11157 -25083
Branches 36240 11157 -25083
==========================================
- Hits 26886 8394 -18492
+ Misses 7220 2352 -4868
+ Partials 2134 411 -1723
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
958996d
to
b9ee9bc
Compare
Benchmark movements: |
b9ee9bc
to
b864fc2
Compare
Benchmark movements: |
b864fc2
to
bab93cc
Compare
bab93cc
to
e571b60
Compare
Benchmark movements: |
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 6 files reviewed, 6 unresolved discussions (waiting on @aner-starkware, @dorimedini-starkware, and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 234 at r1 (raw file):
tx_context: &TransactionContext, ) -> TransactionPreValidationResult<()> { // TODO(Aner): seprate to cases based on context.resource_bounds type
Looks like you can remove the todo, right?
Code quote:
// TODO(Aner): seprate to cases based on context.resource_bounds type
crates/blockifier/src/transaction/account_transaction.rs
line 260 at r1 (raw file):
// TODO(Ori, 1/2/2024): Write an indicative expect message // explaining why the convertion // works.
why did this change?
Code quote:
// TODO(Ori, 1/2/2024): Write an indicative expect message
// explaining why the convertion
// works.
crates/blockifier/src/transaction/account_transaction.rs
line 292 at r1 (raw file):
})?; } // TODO(Aner): add checks for minimal_l1_data_gas and minimal_l2_gas
Suggestion:
// TODO(Aner): Add checks for minimal l1_data_gas and minimal l2_gas.
crates/blockifier/src/transaction/account_transaction.rs
line 296 at r1 (raw file):
let GasPricesForFeeType { l1_gas_price, l1_data_gas_price, l2_gas_price } = block_info.gas_prices.get_gas_prices_by_fee_type(fee_type); // TODO!(Aner): add tests for l1_data_gas_price and l2_gas_price
Suggestion:
// TODO(Aner): Add tests for l1_data_gas_price and l2_gas_price.
crates/blockifier/src/transaction/account_transaction.rs
line 300 at r1 (raw file):
(L1Gas, l1_gas.max_price_per_unit, l1_gas_price.into()), (L1DataGas, l1_data_gas.max_price_per_unit, l1_data_gas_price.into()), (L2Gas, l2_gas.max_price_per_unit, l2_gas_price.into()),
The order of the iteration matters if there is more than one resource that is too expensive, @dorimedini-starkware WDYT?
Code quote:
for (gas_type, max_gas_price, actual_gas_price) in [
(L1Gas, l1_gas.max_price_per_unit, l1_gas_price.into()),
(L1DataGas, l1_data_gas.max_price_per_unit, l1_data_gas_price.into()),
(L2Gas, l2_gas.max_price_per_unit, l2_gas_price.into()),
crates/blockifier/src/transaction/transactions_test.rs
line 986 at r1 (raw file):
); // TODO(Aner): add test for low Max L1 data gas price and L2 gas price
Suggestion:
// TODO(Aner): Add test for low max L1 data gas price and L2 gas price.
d89a9a0
to
2274e3a
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 6 files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 234 at r1 (raw file):
Previously, nimrod-starkware wrote…
Looks like you can remove the todo, right?
Done.
crates/blockifier/src/transaction/account_transaction.rs
line 260 at r1 (raw file):
Previously, nimrod-starkware wrote…
why did this change?
The quoted comment didn't change (though it had a typo, so I fixed it now), but the error type changed to accommodate the different resources.
crates/blockifier/src/transaction/account_transaction.rs
line 292 at r1 (raw file):
})?; } // TODO(Aner): add checks for minimal_l1_data_gas and minimal_l2_gas
Done.
crates/blockifier/src/transaction/account_transaction.rs
line 296 at r1 (raw file):
let GasPricesForFeeType { l1_gas_price, l1_data_gas_price, l2_gas_price } = block_info.gas_prices.get_gas_prices_by_fee_type(fee_type); // TODO!(Aner): add tests for l1_data_gas_price and l2_gas_price
Done. The !
symbolizes that it needs to be done in the following PR.
crates/blockifier/src/transaction/transactions_test.rs
line 986 at r1 (raw file):
); // TODO(Aner): add test for low Max L1 data gas price and L2 gas price
Done.
2274e3a
to
1e25962
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 5 files at r2, 1 of 4 files at r3, all commit messages.
Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on @aner-starkware, @dorimedini-starkware, and @TzahiTaub)
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 6 files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 300 at r1 (raw file):
Previously, nimrod-starkware wrote…
The order of the iteration matters if there is more than one resource that is too expensive, @dorimedini-starkware WDYT?
I think we should do better: the error we return should indicate exactly which gas price(s) are too low.
You should be collecting all problematic (gas_type, max_price, actual_price) tuples and outputting all of them in the error.
The MaxGasPriceTooLow
error should be updated to include a collection of such triples.
That way, the order won't matter, and the users will get the most information
Previously, dorimedini-starkware wrote…
@AvivYossef-starkware I'm guessing this will affect your PRs as well. |
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 6 files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 300 at r1 (raw file):
Previously, aner-starkware wrote…
@AvivYossef-starkware I'm guessing this will affect your PRs as well.
I changed the error in my PR to include it
eff81e9
to
4c57e9e
Compare
e3ad3a6
to
78f2b58
Compare
4c57e9e
to
78e7053
Compare
78f2b58
to
a71ffd9
Compare
a71ffd9
to
37c5646
Compare
0082793
to
e6feb76
Compare
37c5646
to
1968b80
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 62 files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 300 at r1 (raw file):
Previously, AvivYossef-starkware wrote…
I changed the error in my PR to include it
Added a TODO
f745dd0
to
641d5ce
Compare
1968b80
to
641d5ce
Compare
Benchmark movements: |
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 4 files at r17, all commit messages.
Reviewable status: 3 of 62 files reviewed, 5 unresolved discussions (waiting on @aner-starkware and @nimrod-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 239 at r17 (raw file):
&tx_context.get_gas_vector_computation_mode(), )?;
Remove the blank line IMO, as the first let just creates a temp var for the second let.
crates/blockifier/src/transaction/account_transaction.rs
line 247 at r17 (raw file):
let fee_type = &tx_info.fee_type(); match tx_info { TransactionInfo::Current(context) => {
Remove this and its counterpart and you'll earn one less indentation.
Suggestion:
TransactionInfo::Current(context) =>
crates/blockifier/src/transaction/account_transaction.rs
line 249 at r17 (raw file):
TransactionInfo::Current(context) => { match &context.resource_bounds { starknet_api::transaction::ValidResourceBounds::L1Gas(ResourceBounds {
Remove and add ValidResourceBounds
to the imports.
crates/blockifier/src/transaction/account_transaction.rs
line 277 at r17 (raw file):
} } starknet_api::transaction::ValidResourceBounds::AllResources(
As above
928a883
to
c833d06
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 62 files reviewed, 5 unresolved discussions (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 239 at r17 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
Remove the blank line IMO, as the first let just creates a temp var for the second let.
OK, but this part will change anyway in a future PR.
crates/blockifier/src/transaction/account_transaction.rs
line 247 at r17 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
Remove this and its counterpart and you'll earn one less indentation.
Done.
crates/blockifier/src/transaction/account_transaction.rs
line 249 at r17 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
Remove and add
ValidResourceBounds
to the imports.
Done.
crates/blockifier/src/transaction/account_transaction.rs
line 277 at r17 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
As above
Done.
Benchmark movements: |
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 5 files at r2, 1 of 4 files at r3, 56 of 60 files at r16, 1 of 1 files at r18, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @aner-starkware and @nimrod-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 293 at r18 (raw file):
.expect("Failed to convert u128 to u64.")), })?; }
IMO - add some inner function (defined in this function) for this and call it here and above to avoid code duplication.
Code quote:
let max_l1_gas_amount_as_u128: u128 = l1_gas.max_amount.into();
if max_l1_gas_amount_as_u128 < minimal_l1_gas_amount {
return Err(TransactionFeeError::MaxGasAmountTooLow {
resource: L1Gas,
max_gas_amount: l1_gas.max_amount,
// TODO(Ori, 1/2/2024): Write an indicative expect message
// explaining why the conversion
// works.
minimal_gas_amount: (minimal_l1_gas_amount
.try_into()
.expect("Failed to convert u128 to u64.")),
})?;
}
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 @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/transaction/account_transaction.rs
line 293 at r18 (raw file):
Previously, TzahiTaub (Tzahi) wrote…
IMO - add some inner function (defined in this function) for this and call it here and above to avoid code duplication.
I think this part changes, and also this refactoring appears in several places. I'll add a TODO for refactoring in the following 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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware)
c833d06
to
de0aad3
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.
Dismissed @nimrod-starkware from a discussion.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
This change is