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

[Metrics] Fix block height metric #2193

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Conversation

dailinsubjam
Copy link
Contributor

This PR:

Fix the block height metrics by assigning the most recent leaf (rather than its old ancestor).

@dailinsubjam dailinsubjam self-assigned this Dec 11, 2023
@dailinsubjam dailinsubjam added bug Something isn't working sprint6 labels Dec 11, 2023
.last_synced_block_height
.set(usize::try_from(leaf.get_height()).unwrap_or(0));

if !is_ancestor {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just update this metric below where we send the decide event? I.e. add this in the if block starting on line 677 (if new_dcide_reached)

Copy link
Contributor Author

@dailinsubjam dailinsubjam Dec 11, 2023

Choose a reason for hiding this comment

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

Actually I think this makes more sense. But what I don't understand is that, if I update metrics at line 677 the synced block height will be 2 views higher than updating at line 613, why they are different?

Copy link
Contributor Author

@dailinsubjam dailinsubjam Dec 11, 2023

Choose a reason for hiding this comment

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

Oh, my understanding is that leafA we called on 677 is the current newest pending leaf, we made a decide on this view which equals leafA.view(), but the decided one is leafB on view - 2 (in most cases) due to the consensus protocol. Therefore we'd better still do the update on line 613. Is this understanding correct?

Copy link
Member

@shenkeyao shenkeyao left a comment

Choose a reason for hiding this comment

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

Seconding the opinion that we could just check the view number.

Copy link
Contributor

@nyospe nyospe left a comment

Choose a reason for hiding this comment

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

LGTM

@dailinsubjam dailinsubjam merged commit ddb8d6f into main Dec 11, 2023
9 checks passed
@dailinsubjam dailinsubjam deleted the sishan/fix_metrics_block_height branch December 11, 2023 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sprint6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants