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

Adding inclusion_delay and inactivity to ideal_rewards object #7564

Merged
merged 8 commits into from
Oct 4, 2023

Conversation

lucassaldanha
Copy link
Member

@lucassaldanha lucassaldanha commented Oct 2, 2023

PR Description

Added two new fields to the ideal_rewards object accordingly to ethereum/beacon-APIs#340.

Fixed Issue(s)

partially addresses #7554

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@@ -69,7 +69,8 @@ public TotalAttestationReward(long validatorIndex, final RewardAndPenalty reward
this.inactivity =
detailedRewardAndPenalty
.getReward(RewardComponent.INACTIVITY)
.minus(detailedRewardAndPenalty.getPenalty(RewardComponent.INACTIVITY));
.minus(detailedRewardAndPenalty.getPenalty(RewardComponent.INACTIVITY))
.longValue();
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we are using a long value, we should match the previous calculation's formats above.

this.inactivity =
        detailedRewardAndPenalty.getReward(RewardComponent.INACTIVITY).longValue()
            - detailedRewardAndPenalty.getPenalty(RewardComponent.INACTIVITY).longValue();

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, we should probably update the other calculations to have a single .longValue() so we only do the unboxing once. I'll update the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I introduced a bug doing it that way because we would have issues when the penalties for a component is greater than the rewards and we end up with a negative value causing a UInt underflow.

Copy link
Contributor

@courtneyeh courtneyeh left a comment

Choose a reason for hiding this comment

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

LGTM

@lucassaldanha lucassaldanha enabled auto-merge (squash) October 4, 2023 01:37
@lucassaldanha lucassaldanha merged commit 9ef0b17 into Consensys:master Oct 4, 2023
14 checks passed
@lucassaldanha lucassaldanha deleted the teku-7554 branch October 4, 2023 01:56
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