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

Report depth and distance on reorgs #11315

Merged
merged 5 commits into from
Aug 25, 2022
Merged

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Aug 25, 2022

This PR changes the signature of CommonAncestorRoot to return also the Slot of the common ancestor and uses this to report useful metrics on chain reorgs.

@potuz potuz marked this pull request as ready for review August 25, 2022 18:33
@potuz potuz requested a review from a team as a code owner August 25, 2022 18:33
@@ -111,8 +112,9 @@ func (s *Service) saveHead(ctx context.Context, newHeadRoot [32]byte, headBlock
"oldSlot": fmt.Sprintf("%d", headSlot),
"oldRoot": fmt.Sprintf("%#x", oldHeadRoot),
"commonAncestorRoot": fmt.Sprintf("%#x", commonRoot),
"distance": headSlot + newHeadSlot - 2*forkSlot,
Copy link
Member

Choose a reason for hiding this comment

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

do we need to subtract 1?
Shouldn't the reorg distance for the below be 2?

99 - 100
    \- 101

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say that's 3, but I'm happy to subtract any constant, since it won't make the metric change in any meaning.

Copy link
Member

Choose a reason for hiding this comment

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

I dont mind it, you can choose

@prylabs-bulldozer prylabs-bulldozer bot merged commit 52271cf into develop Aug 25, 2022
@delete-merged-branch delete-merged-branch bot deleted the report_reorg_depth branch August 25, 2022 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants