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 15 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
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
4 participants