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 10 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 Show resolved Hide resolved
sync/sync_head_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
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

@@ -71,6 +72,16 @@ func newMetrics() (*metrics, error) {
return nil, err
}

failedAgainstSubjHead, err := meter.Int64Counter(
Copy link
Member

Choose a reason for hiding this comment

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

IMO I feel like we'd need more context here to make this metric valuable (e.g. when it failed, what heights, etc)
Bc just the number by itself won't be really helpful to diagnose where / how the problem occurred.

I'm in favour of leaving this metric out for now and adding it back later in a meaningful way. This really rarely happens anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So...adding attributes like height will make it more valuable?

Also, e.g. when it failed what exactly? I assume you're not talking about time when it happened but the place? Probably this should be reflected in metric's name, do you have a better naming for this?

Copy link
Member

Choose a reason for hiding this comment

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

You'd need to know:

height/hash of subjective head when this occurred, + height/hash of failed network head and probably timestamp as well

sync/sync_head_test.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