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 updateValidatorDistInfoFromPool #3046

Merged
merged 3 commits into from
Dec 8, 2018

Conversation

jaekwon
Copy link
Contributor

@jaekwon jaekwon commented Dec 8, 2018

Fixes regression introduced by #2984.
Continuiation of #3033 , which didn't fix the simulation issues.
(candidate) Complete solution for #3019, 9002 halt bug.

From #2984, it isn't sufficient to take the fee pool rewards of a validator. Since we don't track delegator accums (as we do with validator accums), and because onValidatorModified >updateValidatorDistInfoFromPool is also being called upon delegation updates (or at least I believe this is the reason), it is necessary to also withdraw self delegation.

TODO: I don't think self-delegation should be required to be modified here... consider using a delegation hook to do the self-delegation withdraw part instead, e.g. splitting the updateValidatorDistInfoFromPool function into two. It might not result in cleaner code, however. Think hard.

@codecov
Copy link

codecov bot commented Dec 8, 2018

Codecov Report

Merging #3046 into develop will increase coverage by 0.01%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #3046      +/-   ##
===========================================
+ Coverage    52.16%   52.17%   +0.01%     
===========================================
  Files          140      136       -4     
  Lines         9768     9605     -163     
===========================================
- Hits          5095     5011      -84     
+ Misses        4332     4263      -69     
+ Partials       341      331      -10

@jaekwon jaekwon merged commit bc51fa9 into develop Dec 8, 2018
@jaekwon
Copy link
Contributor Author

jaekwon commented Dec 8, 2018

This was merged because I'm reasonably confident that it's at least better than what we have now on develop, and we might as well bump the rc release. Lets continue discussions and reviews here.

if !k.HasValidatorDistInfo(ctx, operatorAddr) {
return types.ErrNoValidatorDistInfo(k.codespace)
}
accAddr := sdk.AccAddress(operatorAddr.Bytes())

// withdraw reward for self-delegation
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, I think this reintroduces the attack we were trying to prevent - #2914

@cwgoes cwgoes deleted the jae/withdrawvalidatorselfdelegation2 branch December 10, 2018 16:07
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