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

refactor: add wait_for_marker to p2p_sync:client test_utils #2147

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

noamsp-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

noamsp-starkware commented Nov 18, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@noamsp-starkware noamsp-starkware marked this pull request as ready for review November 18, 2024 15:05
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 18.49%. Comparing base (e3165c4) to head (612c480).
Report is 548 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2147       +/-   ##
===========================================
- Coverage   40.10%   18.49%   -21.61%     
===========================================
  Files          26      106       +80     
  Lines        1895    12638    +10743     
  Branches     1895    12638    +10743     
===========================================
+ Hits          760     2338     +1578     
- Misses       1100     9859     +8759     
- Partials       35      441      +406     

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


🚨 Try these New Features:

Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @noamsp-starkware)


crates/papyrus_p2p_sync/src/client/state_diff_test.rs line 153 at r1 (raw file):

                let txn = storage_reader.begin_ro_txn().unwrap();
                let state_diff = txn.get_state_diff(block_number).unwrap().unwrap();
                let expected_state_diff = match state_diff_chunk {

Unrelated to the PR: I think there's a mistake here in the test and we treat each state diff chunk as a separate state diff. Let's fix that

Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @noamsp-starkware)


crates/papyrus_p2p_sync/src/client/test_utils.rs line 143 at r1 (raw file):

    sleep_duration: Duration,
    timeout: Duration,
) -> Result<(), StorageError> {

We're in a test. If a storage error happened you can panic


crates/papyrus_p2p_sync/src/client/test_utils.rs line 150 at r1 (raw file):

        let txn = storage_reader.begin_ro_txn().unwrap();
        let storage_marker = match marker_kind {

Consider using the marker table directly instead:

let markers_table = self.open_table(&self.tables.markers)?;


crates/papyrus_p2p_sync/src/client/test_utils.rs line 157 at r1 (raw file):

        };

        match storage_marker {

Run the match on cmp(storage_marker, expected_marker)
If you accept my suggestion below, change this into an if instead


crates/papyrus_p2p_sync/src/client/test_utils.rs line 159 at r1 (raw file):

        match storage_marker {
            marker if marker > expected_marker => {
                return Err(StorageError::MarkerMismatch {

IMO this is not an error and equivalent to the == case

@noamsp-starkware noamsp-starkware force-pushed the noam.s/p2p_class_sync_test_0 branch from 62c45eb to f1b4ed5 Compare November 21, 2024 10:45
@noamsp-starkware noamsp-starkware force-pushed the noam.s/p2p_class_sync_test_0 branch from f1b4ed5 to 612c480 Compare November 21, 2024 10:49
Copy link
Contributor Author

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


crates/papyrus_p2p_sync/src/client/test_utils.rs line 143 at r1 (raw file):

Previously, ShahakShama wrote…

We're in a test. If a storage error happened you can panic

Done.


crates/papyrus_p2p_sync/src/client/test_utils.rs line 157 at r1 (raw file):

Previously, ShahakShama wrote…

Run the match on cmp(storage_marker, expected_marker)
If you accept my suggestion below, change this into an if instead

Done.


crates/papyrus_p2p_sync/src/client/test_utils.rs line 159 at r1 (raw file):

Previously, ShahakShama wrote…

IMO this is not an error and equivalent to the == case

Done.

Copy link
Contributor

@ShahakShama ShahakShama 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 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)

@noamsp-starkware noamsp-starkware merged commit 2547bb7 into main Nov 21, 2024
17 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 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.

3 participants