Skip to content
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

test(blockifier): max fee exceeds balance errors on new resource bounds #764

Open
wants to merge 1 commit into
base: aner/pre_validation_covers_sum_of_products_1
Choose a base branch
from

Conversation

aner-starkware
Copy link
Contributor

@aner-starkware aner-starkware commented Sep 13, 2024

This change is Reviewable

@aner-starkware aner-starkware self-assigned this Sep 13, 2024
Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.49%. Comparing base (a7c0b87) to head (a0bf6e5).

Additional details and impacted files
@@                               Coverage Diff                                @@
##           aner/pre_validation_covers_sum_of_products_1     #764      +/-   ##
================================================================================
+ Coverage                                         70.33%   70.49%   +0.16%     
================================================================================
  Files                                                87       87              
  Lines                                             11180    11180              
  Branches                                          11180    11180              
================================================================================
+ Hits                                               7863     7881      +18     
+ Misses                                             2929     2911      -18     
  Partials                                            388      388              
Flag Coverage Δ
70.49% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from cecac6d to 70f25c7 Compare September 15, 2024 08:43
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 552fd35 to 49bc1aa Compare September 15, 2024 08:44
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 70f25c7 to 0f89641 Compare September 15, 2024 13:01
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 49bc1aa to c7f3e01 Compare September 15, 2024 13:41
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 0f89641 to 808d19d Compare September 16, 2024 12:14
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from c7f3e01 to e4d8c18 Compare September 16, 2024 13:11
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 808d19d to ee3cae4 Compare September 18, 2024 08:51
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from e4d8c18 to 28319f4 Compare September 18, 2024 08:52
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from ee3cae4 to b7f9fde Compare September 18, 2024 10:05
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 28319f4 to 22e9193 Compare September 18, 2024 10:12
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from b7f9fde to e3bf0de Compare September 18, 2024 10:20
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 22e9193 to 2a11389 Compare September 18, 2024 10:40
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from e3bf0de to 44776d4 Compare September 18, 2024 14:26
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 2a11389 to 3740a56 Compare September 18, 2024 14:27
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 44776d4 to f5e0e89 Compare September 23, 2024 12:17
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 3740a56 to 52bee9c Compare September 23, 2024 12:17
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from f5e0e89 to d31516e Compare September 23, 2024 14:03
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 52bee9c to c8533f6 Compare September 23, 2024 14:04
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from d31516e to 9095f45 Compare September 24, 2024 13:48
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from c8533f6 to 343c018 Compare September 24, 2024 13:50
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch 3 times, most recently from d8fa853 to 54bc2bc Compare September 25, 2024 15:53
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 343c018 to 8d5d0b1 Compare September 25, 2024 15:53
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 54bc2bc to df26a10 Compare September 25, 2024 16:04
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 8d5d0b1 to fbc05f3 Compare September 25, 2024 16:04
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from df26a10 to 85446a2 Compare September 26, 2024 09:47
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from fbc05f3 to 8dbaa4f Compare September 26, 2024 09:48
Copy link
Contributor

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r2, 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @aner-starkware, @dorimedini-starkware, and @nimrod-starkware)


crates/blockifier/src/transaction/transactions_test.rs line 912 at r4 (raw file):

    let invalid_max_fee = Fee(BALANCE + 1);
    // TODO(Ori, 1/2/2024): Write an indicative expect message explaining why the conversion works.
    let balance_over_l1_gas_price: u64 =

Clearer?

Suggestion:

maximal_l1_amount

crates/blockifier/src/transaction/transactions_test.rs line 961 at r4 (raw file):

    // TODO!(Aner): remove magic numbers, use function to calculate minimal amounts.
    let min_l1_amount = 1652;
    let min_l2_amount = 445500;

Do you know why these are needed here but weren't needed for the l1 cases above?

Code quote:

    let min_l1_amount = 1652;
    let min_l2_amount = 445500;

crates/blockifier/src/transaction/transactions_test.rs line 968 at r4 (raw file):

    // In the following cases, the balance is not enough to cover the gas price of the transaction.
    // Minimal amounts are used to avoid failing the test due to min gas usage not covered.
    for (l1_max_amount, l2_max_amount, l1_data_max_amount) in [

Why not modify the previous l1_gas txs tests for the all resources case as well? Loop between L1Resources once and AllResources and have less code (hopefully) and all scenarios for both types.


crates/blockifier/src/transaction/transactions_test.rs line 969 at r4 (raw file):

    // Minimal amounts are used to avoid failing the test due to min gas usage not covered.
    for (l1_max_amount, l2_max_amount, l1_data_max_amount) in [
        (min_l1_amount + balance_over_l1_gas_price + 1, min_l2_amount, 0),

Isn't this the tight bound we need?

Suggestion:

max(min_l1_amount, balance_over_l1_gas_price + 1)

@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 85446a2 to 1141f2a Compare September 26, 2024 13:16
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 8dbaa4f to 374488b Compare September 26, 2024 13:16
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_1 branch from 1141f2a to a7c0b87 Compare September 27, 2024 08:04
@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from 374488b to ec0748e Compare September 27, 2024 08:04
Copy link
Contributor Author

@aner-starkware aner-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware, @nimrod-starkware, and @TzahiTaub)


crates/blockifier/src/transaction/transactions_test.rs line 912 at r4 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Clearer?

Done.


crates/blockifier/src/transaction/transactions_test.rs line 961 at r4 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Do you know why these are needed here but weren't needed for the l1 cases above?

Yes, because here I want to test each individual resource, so the other resources, if they are 0 for example, might fail a previous check and we won't get the correct error.


crates/blockifier/src/transaction/transactions_test.rs line 968 at r4 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Why not modify the previous l1_gas txs tests for the all resources case as well? Loop between L1Resources once and AllResources and have less code (hopefully) and all scenarios for both types.

I didn't understand your suggestion.


crates/blockifier/src/transaction/transactions_test.rs line 969 at r4 (raw file):

Previously, TzahiTaub (Tzahi) wrote…

Isn't this the tight bound we need?

Yes, but in any case, it was a temporary patch because of the bug. Now, it can be done without the max (though max is more correct, but is significantly longer and seems to not be needed).

@aner-starkware aner-starkware force-pushed the aner/pre_validation_covers_sum_of_products_2 branch from ec0748e to a0bf6e5 Compare September 27, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants