Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

test(concurrency): test commit tx where the sequencer address is als… #1935

Merged

Conversation

meship-starkware
Copy link
Contributor

@meship-starkware meship-starkware commented May 30, 2024

…o the sender address


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.35%. Comparing base (cefb2a2) to head (cff9e85).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1935   +/-   ##
=======================================
  Coverage   78.35%   78.35%           
=======================================
  Files          62       62           
  Lines        8861     8861           
  Branches     8861     8861           
=======================================
  Hits         6943     6943           
  Misses       1479     1479           
  Partials      439      439           

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

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch 2 times, most recently from 9a97998 to 875ae7b Compare May 30, 2024 08:04
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from a68e989 to 6cd229d Compare May 30, 2024 08:21
@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 875ae7b to 7c984b1 Compare May 30, 2024 08:24
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch 2 times, most recently from 8a61d63 to fef3860 Compare May 30, 2024 08:30
@meship-starkware meship-starkware changed the title test(councurrency): test commit tx where the sequencer address is als… test(concurrency): test commit tx where the sequencer address is als… May 30, 2024
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from fef3860 to bca59bf Compare May 30, 2024 11:56
@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 7c984b1 to 3d2698f Compare May 30, 2024 11:57
@avi-starkware
Copy link
Collaborator

crates/blockifier/src/concurrency/worker_logic_test.rs line 144 at r1 (raw file):

}

fn check_sequencer_sender_fee_transfer<S: StateReader>(

Make the name more similar to validate_fee_transfer to make it clear that it does the same thing only that the sender is the sequencer.

Suggestion:

fn validate_fee_transfer_when_sender_is_sequencer<S: StateReader>(

@avi-starkware
Copy link
Collaborator

crates/blockifier/src/concurrency/worker_logic_test.rs line 186 at r1 (raw file):

#[test]
fn test_commit_tx_when_the_sqeuncer_is_the_sender() {

Add a docstring explaining why we need to check this case specifically. (The thing with skipping the last part of the commit in this case.)

Suggestion:

fn test_commit_tx_when_sender_is_sequencer() {

Copy link
Collaborator

@avi-starkware avi-starkware 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 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware and @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch 2 times, most recently from 2b89fea to 02cec2c Compare May 30, 2024 14:05
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from bca59bf to 091e86e Compare June 2, 2024 06:43
Copy link
Collaborator

@avi-starkware avi-starkware 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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware and @noaov1)

@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 091e86e to 467b883 Compare June 2, 2024 10:15
Copy link
Contributor Author

@meship-starkware meship-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 2 files reviewed, 2 unresolved discussions (waiting on @avi-starkware and @noaov1)


crates/blockifier/src/concurrency/worker_logic_test.rs line 144 at r1 (raw file):

Previously, avi-starkware wrote…

Make the name more similar to validate_fee_transfer to make it clear that it does the same thing only that the sender is the sequencer.

Done.


crates/blockifier/src/concurrency/worker_logic_test.rs line 186 at r1 (raw file):

Previously, avi-starkware wrote…

Add a docstring explaining why we need to check this case specifically. (The thing with skipping the last part of the commit in this case.)

Done.

@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 467b883 to 6e17a7e Compare June 2, 2024 10:20
Copy link
Collaborator

@avi-starkware avi-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 02cec2c to 47432a4 Compare June 4, 2024 06:03
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch 2 times, most recently from 56ea039 to e22c71a Compare June 4, 2024 06:08
@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch 2 times, most recently from f3aeb76 to 73d88b2 Compare June 4, 2024 11:18
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from e22c71a to 4e735af Compare June 4, 2024 11:19
@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 73d88b2 to 7e88771 Compare June 5, 2024 13:01
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 4e735af to 4d2c58a Compare June 5, 2024 13:02
@avi-starkware
Copy link
Collaborator

crates/blockifier/src/concurrency/worker_logic_test.rs line 130 at r6 (raw file):

        .unwrap();

    // Commit tx and check that the commit did not affected the result and state.

Suggestion:

    // Commit tx and check that the commit made no changes in the execution result or the state.

Copy link
Collaborator

@avi-starkware avi-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 2 files reviewed, 3 unresolved discussions (waiting on @meship-starkware and @noaov1)


crates/blockifier/src/concurrency/worker_logic_test.rs line 100 at r6 (raw file):

        account_address,
        nonce_manager.next(account_address),
    ))];

If there is only one transaction, there is no need to put it in an array

Code quote:

    let txs = [Transaction::AccountTransaction(trivial_calldata_invoke_tx(
        account_address,
        nonce_manager.next(account_address),
    ))];

crates/blockifier/src/concurrency/worker_logic_test.rs line 103 at r6 (raw file):

    let cached_state =
        test_state(&block_context.chain_info, BALANCE, &[(account, txs.len().try_into().unwrap())]);

Suggestion:

    let cached_state =
        test_state(&block_context.chain_info, BALANCE, &[(account, 1)]);

@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 4d2c58a to c4ac56d Compare June 6, 2024 09:33
Copy link
Contributor Author

@meship-starkware meship-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 2 files reviewed, 3 unresolved discussions (waiting on @avi-starkware and @noaov1)


crates/blockifier/src/concurrency/worker_logic_test.rs line 100 at r6 (raw file):

Previously, avi-starkware wrote…

If there is only one transaction, there is no need to put it in an array

The worker executer expects a transaction array


crates/blockifier/src/concurrency/worker_logic_test.rs line 103 at r6 (raw file):

    let cached_state =
        test_state(&block_context.chain_info, BALANCE, &[(account, txs.len().try_into().unwrap())]);

Done.


crates/blockifier/src/concurrency/worker_logic_test.rs line 130 at r6 (raw file):

        .unwrap();

    // Commit tx and check that the commit did not affected the result and state.

Done.

Copy link
Collaborator

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

@avi-starkware
Copy link
Collaborator

crates/blockifier/src/concurrency/worker_logic_test.rs line 136 at r7 (raw file):

        commit_result.as_ref().unwrap().fee_transfer_call_info.as_ref().unwrap();
    assert_eq!(read_values_before_commit, fee_transfer_call_info.storage_read_values);
    drop(execution_task_outputs);

No need to drop it right?

Code quote:

    drop(execution_task_outputs);

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 7e88771 to 019ac96 Compare June 6, 2024 13:47
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch 2 times, most recently from 506c30b to 073e112 Compare June 6, 2024 14:43
Copy link
Collaborator

@avi-starkware avi-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 019ac96 to af4ddb3 Compare June 9, 2024 06:08
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 073e112 to d9ba33f Compare June 9, 2024 06:13
avi-starkware
avi-starkware previously approved these changes Jun 9, 2024
Copy link
Collaborator

@avi-starkware avi-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch 2 times, most recently from 3e12a58 to 7ede3d2 Compare June 9, 2024 11:34
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from d9ba33f to 912ea8c Compare June 9, 2024 11:36
Copy link
Collaborator

@noaov1 noaov1 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 2 files at r1, 1 of 1 files at r10, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @meship-starkware)


crates/blockifier/src/concurrency/worker_logic_test.rs line 91 at r10 (raw file):

    let mut block_info = block_context.block_info.clone();
    block_info.sequencer_address = account_address;
    block_context.block_info = block_info;

Suggestion:

    block_context.block_info.sequencer_address = account_address;

crates/blockifier/src/concurrency/worker_logic_test.rs line 99 at r10 (raw file):

        test_contract_address,
        nonce_manager.next(account_address),
    ))];

Is the nonce manager needed?

Suggestion:

    let tx = Transaction::AccountTransaction(trivial_calldata_invoke_tx(
        account_address,
        test_contract_address,
        nonce_manager.next(account_address),
    ));

crates/blockifier/src/concurrency/worker_logic_test.rs line 104 at r10 (raw file):

    let cached_state =
        test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);

Suggestion:

    let state =
        test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);

crates/blockifier/src/concurrency/worker_logic_test.rs line 125 at r10 (raw file):

    let sequencer_balance_high_before = tx_versioned_state
        .get_storage_at(
            executor.block_context.chain_info.fee_token_address(&FeeType::Strk),

Please define a variable and extract the fee type from the transaction context

Code quote:

 executor.block_context.chain_info.fee_token_address(&FeeType::Strk)

@meship-starkware meship-starkware force-pushed the meship/add_utilitis_for_commit_tx_test branch from 7ede3d2 to 192388a Compare June 10, 2024 06:14
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 912ea8c to e71b7aa Compare June 10, 2024 07:09
Base automatically changed from meship/add_utilitis_for_commit_tx_test to main June 10, 2024 08:00
@meship-starkware meship-starkware dismissed avi-starkware’s stale review June 10, 2024 08:00

The base branch was changed.

@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from e71b7aa to 2a21877 Compare June 10, 2024 08:16
@meship-starkware meship-starkware force-pushed the meship/test_commit_tx_with_sequencer_as_the_account branch from 2a21877 to cff9e85 Compare June 10, 2024 08:46
Copy link
Contributor Author

@meship-starkware meship-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 2 files reviewed, 3 unresolved discussions (waiting on @noaov1)


crates/blockifier/src/concurrency/worker_logic_test.rs line 99 at r10 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Is the nonce manager needed?

The executor expects a list of txes, so if I give it only one tx, it won't work.
The nonce manager is not needed.


crates/blockifier/src/concurrency/worker_logic_test.rs line 104 at r10 (raw file):

    let cached_state =
        test_state(&block_context.chain_info, BALANCE, &[(account, 1), (test_contract, 1)]);

Done.


crates/blockifier/src/concurrency/worker_logic_test.rs line 125 at r10 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Please define a variable and extract the fee type from the transaction context

Done.

Copy link
Collaborator

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

@meship-starkware meship-starkware merged commit df75897 into main Jun 16, 2024
9 checks passed
@meship-starkware meship-starkware deleted the meship/test_commit_tx_with_sequencer_as_the_account branch June 16, 2024 05:22
gswirski pushed a commit to reilabs/blockifier that referenced this pull request Jun 26, 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.

4 participants