Skip to content

fix: missed rewards for attestations #281

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

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

AlexanderLukin
Copy link
Contributor

The current calculation algorithm of missed rewards for attestations is working incorrectly for validators with a max effective balance greater than 32. As a result of this calculation, the value of the missed attestation reward for such validators might be negative. The attempt to store a negative value of missed attestation reward to the DB causes failures that lead to a complete inability to update the "validators_summary" table and loss of data about all validators in the epoch where this calculation error happened.

The calculation of missed attestation rewards for 0x02 validators is temporarily disabled until we understand better how to calculate missed attestation rewards for all types of validators.

The current calculation algorithm of missed rewards for attestations is
working incorrectly for validators with a max effective balance greater
than 32. As a result of this calculation, the value of the missed
attestation reward for such validators might be negative. The attempt to
store a negative value of missed attestation reward to the DB causes
failures that lead to a complete inability to update the
"validators_summary" table and loss of data about all validators in the
epoch where this calculation error happened.

The calculation of missed attestation rewards for 0x02 validators is
temporarily disabled until we understand better how to calculate missed
attestation rewards for all types of validators.
@vgorkavenko
Copy link
Contributor

vgorkavenko commented Mar 28, 2025

This should help to fix the issue

const perfectAttestationRewards =
      Math.trunc(perfect.source * epochMeta.state.base_reward * increments * sourceParticipation) +
      Math.trunc(perfect.target * epochMeta.state.base_reward * increments * targetParticipation) +
      Math.trunc(perfect.head * epochMeta.state.base_reward * increments * headParticipation);

@AlexanderLukin AlexanderLukin merged commit 6731f99 into develop Mar 28, 2025
5 checks passed
@AlexanderLukin AlexanderLukin deleted the fix/missed-attestation-rewards-calculation branch March 28, 2025 09:08
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.

3 participants