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

Fix inaccurate validator balance metrics #6134

Merged
merged 8 commits into from Jun 5, 2020

Conversation

0xKiwi
Copy link
Contributor

@0xKiwi 0xKiwi commented Jun 4, 2020

What type of PR is this?
Bug fix

What does this PR do? Why is it needed?
This PR solves the issue of validator metrics being inaccurate, previously the validator client was assuming the response from the beacon node was in the same order requested, but it is actually sorted by validator index. This changes the validator client to use the public key response to set the order received.

Fixes #5305 and fixes #5600

@0xKiwi 0xKiwi requested a review from a team as a code owner June 4, 2020 20:40
@0xKiwi 0xKiwi added the Ready For Review A pull request ready for code review label Jun 4, 2020
}
continue
}
prevEpoch := (slot / params.BeaconConfig().SlotsPerEpoch) - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

How about slot 0? I believe we have a helper func called helpers.PrevEpoch that checks for underflow

Copy link
Contributor Author

@0xKiwi 0xKiwi Jun 4, 2020

Choose a reason for hiding this comment

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

This code doesn't run in epoch 0, but I'll use the helper func.
Ah, but PrevEpoch only takes state.

Copy link
Contributor

Choose a reason for hiding this comment

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

lets make a small helper then in this file that checks for underflow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment to detail

Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

A lot of changes in validator metrics. Note to self to cross check to ensure this doesn't break validator grafana dashboard

@terencechain
Copy link
Member

A lot of changes in validator metrics. Note to self to cross check to ensure this doesn't break validator grafana dashboard

Testing now. Give me 30 mins

terencechain
terencechain previously approved these changes Jun 4, 2020
Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

Tested. Looks good to me other than Raul's feedback

@rauljordan
Copy link
Contributor

Just for the sake of defensive programming, always good to check for underflow @0xKiwi

@prylabs-bulldozer prylabs-bulldozer bot merged commit 92f23df into master Jun 5, 2020
@delete-merged-branch delete-merged-branch bot deleted the fix-balance-metrics branch June 5, 2020 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
3 participants