Skip to content

Commit

Permalink
fix(#2125): fix counting governance action expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Oct 10, 2024
1 parent 11bb2f7 commit 3a5d163
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ changes.

### Fixed

- Fix counting epoch boundaries for Governance Actions [Issue 2125](https://github.com/IntersectMBO/govtool/issues/2125)
- Fix displaying the SPO Votes [Issue 2085](https://github.com/IntersectMBO/govtool/issues/2085)

### Changed
Expand Down
15 changes: 13 additions & 2 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ SELECT
null
end
) as description,
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no),
CASE
WHEN meta.network_name::text = 'mainnet' THEN
epoch_utils.last_epoch_end_time +
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
INTERVAL '5 days'
ELSE
epoch_utils.last_epoch_end_time +
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
INTERVAL '1 day'
END AS expiry_date,
gov_action_proposal.expiration,
creator_block.time,
creator_block.epoch_no,
Expand Down Expand Up @@ -95,6 +104,7 @@ FROM
CROSS JOIN EpochUtils AS epoch_utils
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN always_abstain_voting_power
CROSS JOIN meta
JOIN tx AS creator_tx ON creator_tx.id = gov_action_proposal.tx_id
JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
Expand Down Expand Up @@ -161,4 +171,5 @@ GROUP BY
always_no_confidence_voting_power.amount,
always_abstain_voting_power.amount,
prev_gov_action.index,
prev_gov_action_tx.hash)
prev_gov_action_tx.hash,
meta.network_name)

0 comments on commit 3a5d163

Please sign in to comment.