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(sync): bifurcation for syncTarget #219

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

cristaloleg
Copy link
Contributor

@cristaloleg cristaloleg commented Sep 24, 2024

Fixes #217

@cristaloleg cristaloleg self-assigned this Sep 24, 2024
sync/sync_head.go Outdated Show resolved Hide resolved
header.go Show resolved Hide resolved
p2p/server_test.go Show resolved Hide resolved
sync/sync_head.go Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
@cristaloleg cristaloleg marked this pull request as ready for review October 14, 2024 11:16
Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

more comments for tests would be helpful - and I think there's some deduplication that can be done throughout the tests if possible ideally but that's just a nice to have.

TODO:

  • some sort of metric reported if verifySkipping fails
  • reject networkHead in case verifySkipping fails (log it aggressively w/ a WARN and report as metric)
  • change name of err message

headertest/dummy_header.go Show resolved Hide resolved
sync/sync_head_test.go Outdated Show resolved Hide resolved
sync/sync_head_test.go Outdated Show resolved Hide resolved
sync/sync_head_test.go Outdated Show resolved Hide resolved
sync/sync_head_test.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

Very nice coverage with tests. 2 remaining comments to address

sync/metrics.go Outdated Show resolved Hide resolved
sync/sync_head_test.go Outdated Show resolved Hide resolved
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Finally, I get to this. Apologies for taking it that long.

The logic is correct, and test coverage is great. I have a few semantical comments on error handling, comments and metrics.

I also had an idea on how to make bifurcation part of a general code path with recursion, but that would require minor refactoring of existing methods. It could make the code a bit cleaner, but the impact of spending more time on this is really low, so lets keep it as it is.

sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/metrics.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

One thing I recalled. Only mocha currently has this case, and we should test the patch there before merging by detecting if bifurcation happened and succeeded.

sync/sync_head.go Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
sync/sync_head.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 63.63636% with 24 lines in your changes missing coverage. Please review.

Project coverage is 64.01%. Comparing base (88c5b8c) to head (7eec051).
Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
sync/metrics.go 5.26% 17 Missing and 1 partial ⚠️
sync/sync_head.go 86.36% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
+ Coverage   62.80%   64.01%   +1.21%     
==========================================
  Files          39       38       -1     
  Lines        3589     3702     +113     
==========================================
+ Hits         2254     2370     +116     
  Misses       1160     1160              
+ Partials      175      172       -3     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement bifurcation for syncTarget estimation / verification
5 participants