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): parametrize test_max_fee_exceeds_balance by resource bounds types #1322

Conversation

dorimedini-starkware
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware commented Oct 11, 2024

This change is Reviewable

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 14 lines in your changes missing coverage. Please review.

Project coverage is 77.35%. Comparing base (e3165c4) to head (21653a6).
Report is 126 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet_api/src/transaction.rs 0.00% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1322       +/-   ##
===========================================
+ Coverage   40.10%   77.35%   +37.24%     
===========================================
  Files          26      100       +74     
  Lines        1895    13457    +11562     
  Branches     1895    13457    +11562     
===========================================
+ Hits          760    10409     +9649     
- Misses       1100     2591     +1491     
- Partials       35      457      +422     

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

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from ae7be2c to 42d8ada Compare October 13, 2024 08:14
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from f989b8b to 518d113 Compare October 13, 2024 08:14
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from 42d8ada to 04ce114 Compare October 13, 2024 08:16
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 518d113 to b3d32a5 Compare October 13, 2024 08:17
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from 04ce114 to 8c269eb Compare October 13, 2024 08:36
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from b3d32a5 to 8b2feeb Compare October 13, 2024 08:36
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from 8c269eb to db2167f Compare October 13, 2024 12:39
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 8b2feeb to 30334dd Compare October 13, 2024 12:39
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from db2167f to cc00710 Compare October 13, 2024 13:04
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 30334dd to c6b5046 Compare October 13, 2024 13:04
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from cc00710 to f5d813d Compare October 14, 2024 08:07
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from c6b5046 to c38639f Compare October 14, 2024 08:07
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from f5d813d to d936ad2 Compare October 14, 2024 09:15
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from c38639f to ae6c0f6 Compare October 14, 2024 09:15
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 0ba46bf to c6d2344 Compare October 30, 2024 12:19
Copy link

Artifacts upload triggered. View details here

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch from 3042759 to 8a0aea2 Compare October 30, 2024 12:23
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from c6d2344 to 89d3c64 Compare October 30, 2024 12:23
Copy link

Artifacts upload triggered. View details here

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types branch 2 times, most recently from 0fbf558 to 69f90e5 Compare October 30, 2024 12:59
@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 89d3c64 to b789d5c Compare October 30, 2024 12:59
Copy link

Artifacts upload triggered. View details here

@dorimedini-starkware dorimedini-starkware changed the base branch from 10-11-test_blockifier_parametrize_test_invoke_tx_by_resource_bounds_types to graphite-base/1322 October 31, 2024 08:29
Copy link

Artifacts upload triggered. View details here

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from b789d5c to 19c997d Compare October 31, 2024 08:49
@dorimedini-starkware dorimedini-starkware changed the base branch from graphite-base/1322 to main October 31, 2024 08:49
Copy link

Artifacts upload triggered. View details here

Copy link
Contributor

@yoavGrs yoavGrs 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: 0 of 1 files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware)


crates/blockifier/src/transaction/transactions_test.rs line 841 at r2 (raw file):

}

fn assert_failure_if_resource_bounds_exceed_balance(

No if

Suggestion:

assert_resource_bounds_exceed_balance_failure

crates/blockifier/src/transaction/transactions_test.rs line 881 at r2 (raw file):

                    TransactionExecutionError::TransactionPreValidationError(
                        TransactionPreValidationError::TransactionFeeError(
                            TransactionFeeError::ResourcesBoundsExceedBalance {

It is better if this error object contains an AllResourceBounds object.
Non blocking.

Code quote:

ResourcesBoundsExceedBalance

crates/blockifier/src/transaction/transactions_test.rs line 955 at r2 (raw file):

        &[(account_contract, 1), (test_contract, 1)],
    );
    let account_contract_address = account_contract.get_instance_address(0);

Suggestion.

Suggestion:

sender_address

crates/blockifier/src/transaction/transactions_test.rs line 956 at r2 (raw file):

    );
    let account_contract_address = account_contract.get_instance_address(0);
    let default_args = invoke_tx_args! {

Suggestion:

default_invoke_args

crates/blockifier/src/transaction/transactions_test.rs line 960 at r2 (raw file):

        calldata: create_trivial_calldata(test_contract.get_instance_address(0)
    )};
    let invalid_max_fee = Fee(BALANCE.0 + 1);

Move under V1 Invoke.

Code quote:

let invalid_max_fee = Fee(BALANCE.0 + 1);

crates/blockifier/src/transaction/transactions_test.rs line 1047 at r2 (raw file):

                base_resource_bounds
            ));
            base_resource_bounds.l1_gas.max_amount.0 -= 10;

Code duplication.
Move te logic into a macro

Suggestion:

            macro_rules! resource_overdraft {
                ($max_amount:expr) => {
                    $max_amount.0 += 10;
                    v3_txs_invalid_bounds_invoke_case!(ValidResourceBounds::AllResources(
                        base_resource_bounds
                    ));
                    v3_txs_invalid_bounds_declare_case!(ValidResourceBounds::AllResources(
                        base_resource_bounds
                    ));
                    $max_amount.0 -= 10;
                };
            }

            resource_overdraft!(base_resource_bounds.l1_gas.max_amount);

Copy link
Collaborator Author

@dorimedini-starkware dorimedini-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: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @yoavGrs)


crates/blockifier/src/transaction/transactions_test.rs line 841 at r2 (raw file):

Previously, yoavGrs wrote…

No if

Done.


crates/blockifier/src/transaction/transactions_test.rs line 956 at r2 (raw file):

    );
    let account_contract_address = account_contract.get_instance_address(0);
    let default_args = invoke_tx_args! {

Done.


crates/blockifier/src/transaction/transactions_test.rs line 960 at r2 (raw file):

Previously, yoavGrs wrote…

Move under V1 Invoke.

Done.


crates/blockifier/src/transaction/transactions_test.rs line 1047 at r2 (raw file):

Previously, yoavGrs wrote…

Code duplication.
Move te logic into a macro

Done.

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from 19c997d to b444899 Compare October 31, 2024 11:00
Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator Author

@dorimedini-starkware dorimedini-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: 0 of 4 files reviewed, 5 unresolved discussions (waiting on @yoavGrs)

a discussion (no related file):
py side pr (change in error formatting, need to check nothing breaks)


@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from b444899 to e3543e2 Compare October 31, 2024 11:13
Copy link

Artifacts upload triggered. View details here

Copy link
Contributor

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

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

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


crates/blockifier/src/transaction/transactions_test.rs line 904 at r5 (raw file):

                        && l1_data_max_amount == l1_data_gas
                        && l1_data_max_price == l1_data_gas_price
                );

Compare AllResourceBounds objects

Suggestion:

            ValidResourceBounds::AllResources(resources) => {
                assert_matches!(
                    tx_error,
                    TransactionExecutionError::TransactionPreValidationError(
                        TransactionPreValidationError::TransactionFeeError(
                            TransactionFeeError::ResourcesBoundsExceedBalance {
                                bounds: resource_bounds,
                                ..
                            }
                        )
                    )
                    if resources == resource_bounds
                );

@dorimedini-starkware dorimedini-starkware force-pushed the 10-11-test_blockifier_parametrize_test_max_fee_exceeds_balance_by_resource_bounds_types branch from e3543e2 to 21653a6 Compare October 31, 2024 13:32
Copy link
Collaborator Author

@dorimedini-starkware dorimedini-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: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @yoavGrs)


crates/blockifier/src/transaction/transactions_test.rs line 904 at r5 (raw file):

Previously, yoavGrs wrote…

Compare AllResourceBounds objects

yes!! much better

Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator Author

@dorimedini-starkware dorimedini-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: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @yoavGrs)

a discussion (no related file):

Previously, dorimedini-starkware wrote…

py side pr (change in error formatting, need to check nothing breaks)

passes


Copy link
Contributor

@yoavGrs yoavGrs 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 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dorimedini-starkware)

@dorimedini-starkware dorimedini-starkware merged commit 891a68c into main Oct 31, 2024
15 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants