IntersectMBO / govtool

🔩 GovTool and utilities monorepo.
https://gov.tools
Apache License 2.0
14 stars 9 forks source link

🐛 Constitutional Committee Votes not counted #1838

Closed Ryun1 closed 3 months ago

Ryun1 commented 3 months ago

Area

Voting Pillar

Domain

dev-sanchogov.tools

Which wallet were you using?

No response

Context

Steps to reproduce

Go to; https://dev-sanchonet.govtool.byron.network/governance_actions/9b00035645799eabacd86aae4de01d3f95e6e128d0dce2b230f5e2971c6aa0b0#0

Actual behavior

Expected behavior

GovTool shows the correct constitutional committee vote tallies

Ryun1 commented 3 months ago

Unfortunately I cannot test SPO votes, as there is not any SPO votes on SanchoNet atm

MSzalowski commented 3 months ago

For the provided proposal there are indeed votes from constitutional committee:

select * from voting_procedure where gov_action_proposal_id=244;
 id  | tx_id | index | gov_action_proposal_id |       voter_role        | drep_voter | pool_voter |  vote   | voting_anchor_id | committee_voter | invalid 
-----+-------+-------+------------------------+-------------------------+------------+------------+---------+------------------+-----------------+---------
 500 | 22367 |     0 |                    244 | DRep                    |          3 |            | Yes     |                  |                 |        
 510 | 22926 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |             1776 |             108 |        
 511 | 22948 |     0 |                    244 | DRep                    |         11 |            | Yes     |                  |                 |        
 512 | 22978 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |                  |              69 |        
 513 | 22991 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |                6 |               9 |        
 514 | 22992 |     0 |                    244 | DRep                    |         12 |            | Yes     |                  |                 |        
 515 | 22994 |     0 |                    244 | DRep                    |         15 |            | Yes     |                  |                 |        
 521 | 23237 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |             2050 |             137 |        
 525 | 23376 |     0 |                    244 | DRep                    |        168 |            | Yes     |                  |                 |        
 526 | 23377 |     0 |                    244 | DRep                    |         17 |            | Yes     |                  |                 |        
 528 | 23499 |     0 |                    244 | ConstitutionalCommittee |            |            | No      |                  |              69 |        
 529 | 23534 |     0 |                    244 | ConstitutionalCommittee |            |            | No      |                  |              69 |        
 530 | 23535 |     0 |                    244 | ConstitutionalCommittee |            |            | Abstain |                  |              69 |        
 531 | 23536 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |                  |              69 |        
 532 | 23552 |     0 |                    244 | ConstitutionalCommittee |            |            | Yes     |                  |             140 |      

But the amount in drep_distr table for such votes is missing:

WITH LatestDrepDistr AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY hash_id ORDER BY epoch_no DESC) as rn FROM drep_distr
)
SELECT committee_voter, amount FROM gov_action_proposal LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id LEFT JOIN LatestDrepDistr ldd_cc ON ldd_cc.hash_id = voting_procedure.committee_voter AND ldd_cc.rn=1 WHERE gov_action_proposal.id=244;
 committee_voter | amount 
-----------------+--------
                 |       
             108 |       
                 |       
              69 |       
               9 |       
                 |       
                 |       
             137 |       
                 |       
                 |       
              69 |       
              69 |       
              69 |       
              69 |       
             140 |       
(15 rows)