Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Fix voting power calculation error#64

Open
WeiJun0827 wants to merge 2 commits intotendermint:stargatefrom
likecoin:feature/fix-voting-power
Open

Fix voting power calculation error#64
WeiJun0827 wants to merge 2 commits intotendermint:stargatefrom
likecoin:feature/fix-voting-power

Conversation

@WeiJun0827
Copy link

@WeiJun0827 WeiJun0827 commented Aug 16, 2021

Background

There is only one validator in a testnet, the voting power of this validator is expected to be 100% but got 8.21%.

Cause

The original voting power calculation uses supply(total supply) gotten from the getStakingSupply function as the denominator and token of each validator as the numerator. But should use delegator_shares of active validator as the denominator and its sum as the numerator.

Revision

  • Use the amount of delegator_shares of each active validator divides its sum to calculate the voting power.
  • Delete unused function getStakingSupply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant