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

feat: allow DataStreamBuilder to retry queries if non fatal err #1711

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

noamsp-starkware
Copy link
Contributor

Create err types BadPeerError,ParseDataError. later on the errors from P2PSyncClientError will be sorted to fatal and non-fatal(BadPeer). this will allow to retry on non fatal errors during parsing of data blocks.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 63.41463% with 15 lines in your changes missing coverage. Please review.

Project coverage is 18.59%. Comparing base (e3165c4) to head (780199e).
Report is 264 commits behind head on main.

Files with missing lines Patch % Lines
...ates/papyrus_p2p_sync/src/client/stream_builder.rs 67.85% 9 Missing ⚠️
crates/papyrus_p2p_sync/src/client/header.rs 20.00% 4 Missing ⚠️
crates/papyrus_p2p_sync/src/client/transaction.rs 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1711       +/-   ##
===========================================
- Coverage   40.10%   18.59%   -21.52%     
===========================================
  Files          26      100       +74     
  Lines        1895    12270    +10375     
  Branches     1895    12270    +10375     
===========================================
+ Hits          760     2281     +1521     
- Misses       1100     9557     +8457     
- Partials       35      432      +397     

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

@noamsp-starkware noamsp-starkware force-pushed the noam.s/light_verifications_inside_sync_1 branch from 57cc457 to 7a23b58 Compare November 5, 2024 11:01
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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware)


crates/papyrus_p2p_sync/src/client/stream_builder.rs line 119 at r1 (raw file):

                        Err(ParseDataError::BadPeer(err)) => {
                            warn!(
                                "Query for {:?} returned with bad peer error: {:?}. retrying query.",

retrying query -> reporting peer and retrying query


crates/papyrus_p2p_sync/src/client/stream_builder.rs line 119 at r1 (raw file):

                        Err(ParseDataError::BadPeer(err)) => {
                            warn!(
                                "Query for {:?} returned with bad peer error: {:?}. retrying query.",

I think it's worth logging the block number. The same is true for the log above this one
"Query for {:?} on {:?} returned ...", Self::TYPE_DESCRIPTION, current_block_number, err)

Create err types BadPeerError,ParseDataError. later on the errors from
P2PSyncClientError will be sorted to fatal and non-fatal(BadPeer). this
will allow to retry on non fatal errors during parsing of data blocks.
moves non-fatal state diff related errors to BadPeerError to allow
retrying the query with a different peer. previously state diff related
tests checked these non-fatal errors as assertions to certain scenarios.
we now just check that these scenarios cause peer reporting.
@noamsp-starkware noamsp-starkware force-pushed the noam.s/light_verifications_inside_sync_1 branch from da56660 to 780199e Compare November 10, 2024 11:25
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, 4 of 4 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)

@noamsp-starkware noamsp-starkware merged commit 7122d01 into main Nov 10, 2024
17 checks passed
@noamsp-starkware noamsp-starkware deleted the noam.s/light_verifications_inside_sync_1 branch November 10, 2024 12:04
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 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