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

add voting power in VoterInfo of abci #102

Merged
merged 3 commits into from
Jul 10, 2020
Merged

add voting power in VoterInfo of abci #102

merged 3 commits into from
Jul 10, 2020

Conversation

zemyblue
Copy link
Member

@zemyblue zemyblue commented Jul 9, 2020

Closes: #35

Description

Add voting power in VoterInfo of abci, and fill it when transfer BeginBlock
The Power of Validator is used as staking value when update the validator information and slash evidence.
So, I didn't use it as VotingPower of validator. I add the Power in the VoterInfo structure to transfer a votingpower though.

But later, we need to change the distribution of cosmos-sdk for referencing right voting power.
https://github.com/cosmos/cosmos-sdk/blob/f8df05f6f15e40dc6c4df6ea4246c594769f5f22/x/distribution/abci.go#L20-L23


For contributor use:

  • Wrote tests
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer

@zemyblue zemyblue changed the title add voting power in VotingInfo of abci add voting power in VoterInfo of abci Jul 9, 2020
@zemyblue zemyblue requested review from egonspace and torao July 9, 2020 06:49
@zemyblue zemyblue self-assigned this Jul 9, 2020
@zemyblue zemyblue added this to the Change reward distribution milestone Jul 9, 2020
Copy link
Contributor

@torao torao left a comment

Choose a reason for hiding this comment

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

This PR only adds Voter.Power to Protocol Buffers, right? (Is the code to use this added Voter.Power going to be fixed later?)

@zemyblue
Copy link
Member Author

zemyblue commented Jul 9, 2020

This PR only adds Voter.Power to Protocol Buffers, right? (Is the code to use this added Voter.Power going to be fixed later?)

No, this PR add VoteInfo.Power not Voter.Power. And VoterInfo of protobuf doesn't have matched any structure in code, it is just object for transfering vote information of previous block.

Voter.Power is set with Validator.VotingPower when generate RequestBeginBlock for calling BeginBlock.
You can see the code used in https://github.com/line/tendermint/pull/102/files#diff-b92652a6804d4a2173c557bab87194ddR351

@@ -314,7 +314,8 @@ message ValidatorUpdate {
// VoteInfo
message VoteInfo {
Validator validator = 1 [(gogoproto.nullable) = false];
bool signed_last_block = 2;
int64 power = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

I've looked at various things, and I think it would be better to put StakingPower(it is Power for now) and VotingPower in the Validator in here(https://github.com/line/tendermint/blob/e007be020311ca4ae8cf4b50170b600492ffb509/types/protobuf.go#L74)

Because VotingPower will also be needed to pass Evidence over, it would be better to put it in the Validator.(https://github.com/line/tendermint/blob/e007be020311ca4ae8cf4b50170b600492ffb509/types/protobuf.go#L173)

Copy link
Member Author

@zemyblue zemyblue Jul 10, 2020

Choose a reason for hiding this comment

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

But the Power of Validator should be used as Staking value, because we can take all the staking value of byzantine via evidence when the byzantine's fraud is found. If we use the voting power as Valdiator.Power, we can't get the byzantine's all staking money, because voting power and staking power is difference

And second reasone is that the Validator.Power is used when update valdiator's staking power.

So I think it's better to remain the Validator.Power as staking power.

Copy link
Contributor

@egonspace egonspace Jul 10, 2020

Choose a reason for hiding this comment

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

I meant to put both StakingPower and VotingPower in the Validator to sync abci.Validator with types.Validator

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's a good point. But as I mentioned above, the abci.Validatoris used three part and there aren't need voting power all part. Voting power is only needed when transfer BeginBlock.
So, I was thinking about what to do. And then I decide to insert voting power to VoterInfo not Validator. Because VoterInfo is only used when transfer voting information in the BeginBlock, so the purpose is equals with voting power. And doesn't used others and doesn't have matched structure.

But as you pointed in offline, the name can make confuse with staking power, hence I'll modify the name more clearly.

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