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

Swap StakingPower and VotingPower, and modify from StakingPower to VotingWeight #449

Merged
merged 5 commits into from
Jul 29, 2022

Conversation

tnasu
Copy link
Member

@tnasu tnasu commented Jul 27, 2022

Description

Keeping tendermint's interface(abci, rpc, etc.) swap StakingPower and VotingPower.
And modify from StakingPower to VotingWeight

Here is the summary of the usage:

Tendermint Ostracon (Before) Ostracon (After)
Proposer One of ValidatorSet One of ValidatorSet One of ValidatorSet
Select a Proposer by Validator.ProposerPriority Validator.StakingPower Validator.VotingPower
Voters ValidatorSet VoterSet (Part of ValidatorSet) VoterSet (Part of ValidatorSet)
Select VoterSet by - Validator.StakingPower Validator.VotingPower
Voting Validator.VotingPower Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
DuplicateVoteEvidence TotalVotingPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
DuplicateVoteEvidence ValidatorPower Validator.VotingPower Validator.StakingPower Validator.VotingPower
DuplicateVoteEvidence added Power - Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
LightClientAttackEvidence TotalVotingPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
ValidatorSet TotalXxxPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Validator VotingPower Validator.VotingPower Validator.StakingPower Validator.VotingPower
Validator added Power - Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
VoterSet TotalXxxPower - VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Proto Type DuplicateVoteEvidence TotalVotingPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Proto Type DuplicateVoteEvidence Power Validator.VotingPower Validator.StakingPower Validator.VotingPower
Proto Type DuplicateVoteEvidence added Power - Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
Proto Type LightClientAttackEvidence TotalVotingPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Proto Type ValidatorSet TotalXxxPower ValidatorSet.TotalVotingPower VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Proto Type Validator Power Validator.VotingPower Validator.StakingPower Validator.VotingPower
Proto Type Validator added Power - Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
Proto Type SimpleValidator Power Validator.VotingPower Validator.StakingPower Validator.VotingPower
Proto Type VoterSet TotalXxxPower - VoterSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
Proto ABCI Validator Power Validator.VotingPower Validator.StakingPower Validator.VotingPower
Proto ABCI Validator added Power - Validator.VotingPower Validator.StakingPower => Validator.VotingWeight
Proto ABCI ValidatorUpdate Power Validator.VotingPower Validator.StakingPower Validator.VotingPower
Proto ABCI Evidence TotalVotingPower ValidatorSet.TotalVotingPower VoteSet.TotalVotingPower VoterSet.TotalStakingPower => VoterSet.TotalVotingWeight
RPC ValidatorInfo VotingPower RPC ValidatorInfo VotingPower == Validator.VotingPower RPC ValidatorInfo StakingPower == Validator.StakingPower RPC ValidatorInfo VotingPower == Validator.VotingPower
  • Tendermint.Validator.VotingPower ==
    • Ostracon(Before).Validator.StakingPower == Ostracon(After).Validator.VotingPower
  • Tendermint.Validator.VotingPower !=
    • Ostracon(Before).Validator.VotingPower == Ostracon(After).Validator.StakingPower == Caluculated power value
  • Tendermint.Evidence.TotalVotingPower == Tendermint.ValidatorSet.TotalVotingPower !=
    • Ostracon(Before).VoterSet.TotalVotingPower == Ostracon(After).VoterSet.TotalStakingPower == Caluculated power value

Relates:

@codecov
Copy link

codecov bot commented Jul 27, 2022

Codecov Report

Merging #449 (5673e41) into main (81b4fb7) will increase coverage by 0.01%.
The diff coverage is 92.45%.

@@            Coverage Diff             @@
##             main     #449      +/-   ##
==========================================
+ Coverage   65.37%   65.38%   +0.01%     
==========================================
  Files         278      278              
  Lines       37920    37948      +28     
==========================================
+ Hits        24791    24814      +23     
- Misses      11316    11319       +3     
- Partials     1813     1815       +2     
Impacted Files Coverage Δ
light/errors.go 75.00% <ø> (ø)
rpc/core/consensus.go 0.00% <0.00%> (ø)
rpc/core/status.go 0.00% <0.00%> (ø)
rpc/core/types/responses.go 35.71% <ø> (ø)
types/vote_set.go 49.75% <80.00%> (ø)
evidence/verify.go 78.84% <81.81%> (ø)
types/validator.go 82.90% <92.30%> (ø)
types/voter_set.go 85.62% <94.00%> (+1.44%) ⬆️
consensus/state.go 73.44% <100.00%> (+0.11%) ⬆️
light/detector.go 68.29% <100.00%> (ø)
... and 24 more

@tnasu
Copy link
Member Author

tnasu commented Jul 27, 2022

I'd like to change the name of Validator.StakingPower since it's a bad name.

@tnasu
Copy link
Member Author

tnasu commented Jul 28, 2022

I'd like to change the name of Validator.StakingPower since it's a bad name.

I decide to use VotingWeight instead of StakingPower

@tnasu tnasu changed the title Swap StakingPower and VotingPower Swap StakingPower and VotingPower, and modify from StakingPower to VotingWeight Jul 28, 2022
@tnasu tnasu force-pushed the main-swap branch 2 times, most recently from 678f194 to d57e0f5 Compare July 28, 2022 08:32
@tnasu tnasu marked this pull request as ready for review July 28, 2022 08:53
@tnasu tnasu requested review from Kynea0b and torao as code owners July 28, 2022 08:53
@tnasu tnasu requested a review from zemyblue July 28, 2022 08:53
@zemyblue
Copy link
Member

  • VotingPower: Voting power based on deposited tokens of validator.
  • VotingWeight: Randomly allocated voting power when elected by VoterSet.

@tnasu, Is it right?

@tnasu
Copy link
Member Author

tnasu commented Jul 28, 2022

@zemyblue Right.

Randomly allocated voting power when elected by VoterSet.

To explain it a little more carefully, the randomly selected Validator is the VoterSet from ValidatorSet, and when it is selected, the VotingWeight is calculated at the selection by using the VotingPower that the Validator has and the winning-point as a coefficient.

torao
torao previously approved these changes Jul 28, 2022
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.

LGTM

@torao torao added the C: enhancement Classification: New feature or its request, or improvement in maintainability of code label Jul 28, 2022
zemyblue added a commit to zemyblue/finschia-sdk that referenced this pull request Jul 28, 2022
…otingPower` and `StakingPower` with `VotingWeight`.

Finschia/ostracon#449

Signed-off-by: zemyblue <zemyblue@gmail.com>
zemyblue
zemyblue previously approved these changes Jul 28, 2022
torao
torao previously approved these changes Jul 29, 2022
Kynea0b
Kynea0b previously approved these changes Jul 29, 2022
types/voter_set_test.go Outdated Show resolved Hide resolved
types/voter_set_test.go Outdated Show resolved Hide resolved
types/voter_set_test.go Outdated Show resolved Hide resolved
@tnasu tnasu dismissed stale reviews from Kynea0b, torao, and zemyblue via 749fce7 July 29, 2022 03:16
@tnasu tnasu merged commit 2231684 into Finschia:main Jul 29, 2022
zemyblue added a commit to Finschia/finschia-sdk that referenced this pull request Jul 29, 2022
…ngPower` and `VotingPower` with `VotingWeight`. (#614)

* feat: apply the ostracon's change that replace `StakingPower` with `VotingPower` and `StakingPower` with `VotingWeight`.
Finschia/ostracon#449

Signed-off-by: zemyblue <zemyblue@gmail.com>

* docs: update swagger.yaml and statik.go

Signed-off-by: zemyblue <zemyblue@gmail.com>

* docs: update changelog

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update latest changes of ostracon.

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update latest changes of ostracon.

Signed-off-by: zemyblue <zemyblue@gmail.com>

* Update third_party/proto/ostracon/types/evidence.proto

Co-authored-by: Sujong Lee <leesj9476lsj@gmail.com>

Co-authored-by: Sujong Lee <leesj9476lsj@gmail.com>
dudong2 added a commit to dudong2/lbm-sdk that referenced this pull request Aug 1, 2022
…ngPower` and `VotingPower` with `VotingWeight`. (Finschia#614)

* feat: apply the ostracon's change that replace `StakingPower` with `VotingPower` and `StakingPower` with `VotingWeight`.
Finschia/ostracon#449

Signed-off-by: zemyblue <zemyblue@gmail.com>

* docs: update swagger.yaml and statik.go

Signed-off-by: zemyblue <zemyblue@gmail.com>

* docs: update changelog

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update latest changes of ostracon.

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update latest changes of ostracon.

Signed-off-by: zemyblue <zemyblue@gmail.com>

* Update third_party/proto/ostracon/types/evidence.proto

Co-authored-by: Sujong Lee <leesj9476lsj@gmail.com>

Co-authored-by: Sujong Lee <leesj9476lsj@gmail.com>
@tnasu tnasu deleted the main-swap branch August 3, 2022 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: enhancement Classification: New feature or its request, or improvement in maintainability of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants