terra-money / station

🛰️ Station wallet

Home Page:https://station.money

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indicate whether the proposal is passing is calculated wrong

StrathCole opened this issue · comments

In commit f99cf17 there was the new "passing…" (the word, not the line) indicator introduced.

This seems to always calculate "Abstain" votes in favor of "Yes" votes, which does not reflect what the chain is doing.

The code responsible for this is in src/pages/gov/ProposalVotes.tsx
Bildschirmfoto von 2022-11-25 22-13-11

Lines

const consentRatio = list.slice(0, 2).map(({ ratio }) => ratio.byVoted)
const isPassing = !isBelowQuorum && BigNumber.sum(...consentRatio).gte(0.5)

simply seem to take the first two voting entries and adds them for the passing ratio, while abstain should count either not at all (which is what the chain itself does) or towards the third entry (no) if those votes are greater than "yes" votes (to display the indicator correctly).

In addition it seems that no with veto votes are not counted for the quorum threshold on the indicator.

commented

@StrathCole - just submitted a PR that attempts to address this discrepancy and aligns the passing/not passing indicator with chain calculations documented at https://docs.terra.money/develop/module-specifications/spec-governance/#tallying. This includes honoring the veto_threshold. Awaiting TFL review...

commented

It also proposes moving abstain votes to the final position of the progress bar to give the passing threshold flag meaning. This is how it looks on my dev instance (prop 10940):

image

Thank you that looks much better.