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

bugFix/rewards-missmatch-computation #1909

Merged
merged 3 commits into from
Jun 10, 2020

Conversation

sasurobert
Copy link
Contributor

Fixed the wrong computation of end of epoch rewards. In case the same validator had multiple nodes in multiple shards the actual reward was calculated with NumTotalSelected divided by the last shardID set for this validator. The last shard ID set was from range over a map.

ValidatorFailure uint32
NumSelectedInSuccessBlocks uint32
AccumulatedFees *big.Int
numSelectedInSuccessBlocks uint32
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tought I deleted all.

@LucianMincu LucianMincu added the type:bug Something isn't working label Jun 10, 2020
@ccorcoveanu ccorcoveanu self-requested a review June 10, 2020 13:22
@@ -121,6 +118,7 @@ func NewEpochStartRewardsCreator(args ArgsNewRewardsCreator) (*rewardsCreator, e

// CreateBlockStarted announces block creation started and cleans inside data
func (rc *rewardsCreator) clean() {
rc.mapRewardsPerBlockPerValidator = make(map[uint32]*big.Int)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you do the same in the constructor so it won't be nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need clean is called every time CreateRewards is called.

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

System tests passed.

@LucianMincu LucianMincu merged commit 9888d5a into release-candidate Jun 10, 2020
@LucianMincu LucianMincu deleted the bugFix/rewards-computation branch June 10, 2020 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants