IntersectMBO / IntersectMBO/govtool

🐛 Bug: Double-counting of Always No Confidence stake inflates active DRep total

Open
#4,032 1 comment 0 reactions 1 assignee Claimed by @bosko-m View on GitHub
🐛 Bug 🗳️ Voting Pillar
Dominant language
HTML
Stars
21
Forks
29
Avg merge
2d 22h
Merged PRs (30d)
7

Description

### Area

Voting Pillar

### Domain

gov.tools

### Which wallet were you using?

_No response_

### Context

The SQL query used to calculate `total_stake_controlled_by_active_dreps` is **double-counting** the voting power of the special DRep `drep_always_no_confidence` (ANC).

`TotalStakeControlledByActiveDReps` already includes ANC stake via a sum from `drep_distr` for all DReps. In the final `SELECT`, the ANC voting power is added again from the `AlwaysNoConfidenceVotingPower` CTE, inflating the total by ≈ ₳177.2M.

This lowers the ratification base (~₳5.042B instead of ~₳5.24B), causing percentage calculations (e.g., Yes % in GovTool) to appear higher than they should be.

### Steps to reproduce

1. Run the current SQL query for governance action totals.
2. Compare `total_stake_controlled_by_active_dreps` to:
- Sum of all active DRep stake excluding `drep_always_abstain`.
- Expected total from on-chain data via independent tools.
3. Observe that the final total includes `always_no_confidence_voting_power` twice.

### Actual behavior

1. The ANC voting power is already included in `TotalStakeControlledByActiveDReps` (from `drep_distr`).
2. The ANC voting power is added again in the final `SELECT` of get-network-total-stake.sql query

### Expected behavior

1. The ANC voting power shouldnt be added again in the final `SELECT` of get-network-total-stake.sql

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.