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

x/gov: slash nonvoting validators error. #2158

Closed
3 of 4 tasks
MrXJC opened this issue Aug 27, 2018 · 4 comments
Closed
3 of 4 tasks

x/gov: slash nonvoting validators error. #2158

MrXJC opened this issue Aug 27, 2018 · 4 comments

Comments

@MrXJC
Copy link
Contributor

MrXJC commented Aug 27, 2018

Summary of Bug

There is a big error in gov. It will lead to the consensus failure, because every node maybe have entirely different nonVotingVals which is from the map currValidators. Then, slash validators in different order and make the Apphash different.

for _, valAddr := range nonVotingVals {
	val := keeper.ds.GetValidatorSet().Validator(ctx, valAddr)
	keeper.ds.GetValidatorSet().Slash(....)
}

Steps to Reproduce

Just submit a proposal and all of the validators don't vote.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@ValarDragon
Copy link
Contributor

ValarDragon commented Aug 27, 2018

While I agree that non-deterministic ordering of slashes is sub-optimal, I think the slashing logic should be independent of the order in which slashes were applied. (I also agree with fixing this) Unless IAVL root hash depends on insertion order, in which case then this is a problem.

However this shouldn't be a consensus failure. I would like it if we could actually use this (or something similar) in a test somewhere to ensure that the order of slashes isn't important.

/cc @sunnya97 @cwgoes

@cwgoes
Copy link
Contributor

cwgoes commented Aug 27, 2018

Unless IAVL root hash depends on insertion order, in which case then this is a problem.

It does but we resort the keys at the end of the block when the cache is flushed. We should still avoid any sort of non-deterministic Golang map iteration.

@alexanderbez
Copy link
Contributor

alexanderbez commented Aug 27, 2018

++

Sounds like this is a nice-to-have, but not an immediate need. Feel free to submit a PR @MrXJC where iteration happens by sorted map keys 👍

Edit: Ahhh, nvm, I see you opened #2159 -- thank you!

@ValarDragon
Copy link
Contributor

closing, thanks for the PR!

Made #2288 as a follow-up for making a test case for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants