Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GovTool - v1.0.28 #2421

Merged
merged 40 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4441d19
chore: add mock temp wallet on gitignore
kneerose Nov 19, 2024
bc67776
chore: format vote ada for governance action
kneerose Nov 19, 2024
c99bc8c
Merge pull request #2390 from IntersectMBO/bugfix/vote-ada-format
kneerose Nov 19, 2024
9bb7527
fix(#2379): fix listing voted-on governance actions
MSzalowski Nov 19, 2024
3248903
chore(#2169): bump CSL to v13.1.0
MSzalowski Nov 20, 2024
0db6732
chore: update csl patch file
MSzalowski Nov 20, 2024
70f4609
Merge pull request #2392 from IntersectMBO/fix/2379--goverance-action…
MSzalowski Nov 20, 2024
97c3aaa
Merge pull request #2393 from IntersectMBO/feat/2169--bump-govtool-fe…
MSzalowski Nov 20, 2024
9b95d4c
fix(#2263): remove markdown from slider card
MSzalowski Nov 20, 2024
4ff3e14
Merge pull request #2394 from IntersectMBO/fix/2263--abstract-format-…
MSzalowski Nov 20, 2024
e27ab29
fix(#2372): fix ada quantities format
MSzalowski Nov 20, 2024
1663f56
Merge pull request #2396 from IntersectMBO/fix/2372--ada-quantities-f…
MSzalowski Nov 20, 2024
0c2f2aa
feat(#2391): display supporing links in columns
MSzalowski Nov 20, 2024
ce48b09
Merge pull request #2397 from IntersectMBO/feat/2391--unwanted-trunca…
MSzalowski Nov 20, 2024
852443c
fix(#2332): fix inconsistend display of pending delegation DRep card
MSzalowski Nov 20, 2024
20ebc9c
Merge pull request #2399 from IntersectMBO/fix/2332--inconsistent-dis…
MSzalowski Nov 21, 2024
81f8378
chore: assert dRep ID card display before view button click
kneerose Nov 22, 2024
ebaebc7
test: add ability to search dReps by name
kneerose Nov 22, 2024
af1ca81
Merge pull request #2401 from IntersectMBO/tests/dRep-search-by-name
kneerose Nov 22, 2024
36fd9bb
fix: fix ada holder voting power calculation
MSzalowski Nov 22, 2024
b108010
feat: extend IPFS url regex
MSzalowski Nov 22, 2024
6b17bc9
chore: add epoch params and fullgovernance DRep vote action type
kneerose Nov 24, 2024
84834b8
chore: add feature flag for vote totals display
kneerose Nov 24, 2024
7349e72
test: update Vote visibility of govAction for registered dRep.
kneerose Nov 24, 2024
45235e9
chore: remove minimum ada format
kneerose Nov 25, 2024
3f1fabf
test: update vote visibility of govAction for disconnect state
kneerose Nov 25, 2024
03f5c37
feat(#2010): add more DRep metrics to network metrics endpoint
MSzalowski Nov 25, 2024
789f586
Merge pull request #2413 from IntersectMBO/feat/2010--add-more-useful…
MSzalowski Nov 26, 2024
d5b0733
Merge pull request #2406 from IntersectMBO/fix/fix-ada-holder-voting-…
MSzalowski Nov 26, 2024
96e7472
Merge pull request #2409 from IntersectMBO/tests/governance-totalVote…
MSzalowski Nov 26, 2024
3417a4f
Merge pull request #2405 from IntersectMBO/feat/support-ipfs-in-govto…
MSzalowski Nov 26, 2024
3fe7bde
fix: fix wrong status of past DRep information
MSzalowski Nov 22, 2024
4c35a51
Merge pull request #2404 from IntersectMBO/fix/fix-wrong-condition-on…
MSzalowski Nov 26, 2024
cba8d19
chore(#2292): change link to support page
MSzalowski Nov 20, 2024
ef8bd0e
Merge pull request #2395 from IntersectMBO/fix/2292-usersnap-the-help…
MSzalowski Nov 26, 2024
9fa9946
chore: bump pdf-ui to v0.5.0
MSzalowski Nov 26, 2024
34f90fd
chore: bump GovTool to v1.0.28
MSzalowski Nov 26, 2024
0ce7cbd
Merge pull request #2418 from IntersectMBO/chore/bump-govtool-to-v1.0.28
MSzalowski Nov 26, 2024
978fafd
Merge pull request #2415 from IntersectMBO/chore/bump-pdf-ui-to-v-0.5.0
MSzalowski Nov 26, 2024
a3f6c73
Merge pull request #2420 from IntersectMBO/develop
MSzalowski Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@ changes.

-

## [v1.0.28](https://github.com/IntersectMBO/govtool/releases/tag/v1.0.28) 2024-11-26

### Added

- Add more useful metrics to the backend GET /network/metrics endpoint [Issue 2010](https://github.com/IntersectMBO/govtool/issues/2010)

### Fixed

- Fix ada holder voting power calculation
- Fix wrong statuses on past DRep info
- Fix listing voted-on governance actions [Issue 2379](https://github.com/IntersectMBO/govtool/issues/2379)
- Fix wronly displayed markdown on slider card [Issue 2263](https://github.com/IntersectMBO/govtool/issues/2316)
- fix ada quantities format to avoid thousands when the total is 0 [Issue 2372](https://github.com/IntersectMBO/govtool/issues/2382)
- fix inconsistent display of delegated DRep card during delegation [Issue 2332](https://github.com/IntersectMBO/govtool/issues/2332)

### Changed

- Bump CSL version to 13.1.0 [Issue 2169](https://github.com/IntersectMBO/govtool/issues/2169)
- Display supporting links below labels than in same row [Issue 2391](https://github.com/IntersectMBO/govtool/issues/2391)
- change link to support page [Issue 2292](https://github.com/IntersectMBO/govtool/issues/2292)
- Bump @intersect.mbo/pdf-ui to v0.5.0

### Removed

-

## [v1.0.27](https://github.com/IntersectMBO/govtool/releases/tag/v1.0.27) 2024-11-19

### Added
Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
WORKDIR /src
COPY . .
RUN cabal build
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.27/x/vva-be/build/vva-be/vva-be /usr/local/bin
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.28/x/vva-be/build/vva-be/vva-be /usr/local/bin
2 changes: 1 addition & 1 deletion govtool/backend/Dockerfile.qovery
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
WORKDIR /src
COPY . .
RUN cabal build
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.27/x/vva-be/build/vva-be/vva-be /usr/local/bin
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.28/x/vva-be/build/vva-be/vva-be /usr/local/bin

# Expose the necessary port
EXPOSE 9876
Expand Down
2 changes: 2 additions & 0 deletions govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ WasRegisteredAsDRep AS (
CROSS JOIN DRepId
WHERE
drep_hash.raw = DRepId.raw
AND drep_registration.deposit >= 0
AND drep_registration.voting_anchor_id IS NOT NULL)) AS value
),
WasRegisteredAsSoleVoter AS (
Expand All @@ -100,6 +101,7 @@ WasRegisteredAsSoleVoter AS (
CROSS JOIN DRepId
WHERE
drep_hash.raw = DRepId.raw
AND drep_registration.deposit >= 0
AND drep_registration.voting_anchor_id IS NULL)) AS value
),
CurrentMetadata AS (
Expand Down
156 changes: 144 additions & 12 deletions govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
WITH current_epoch AS (
WITH DRepActivity AS (
SELECT
drep_activity AS drep_activity,
epoch_no AS epoch_no
FROM
epoch_param
WHERE
epoch_no IS NOT NULL
ORDER BY
epoch_no DESC
LIMIT 1
),
active_drep_boundary_epoch AS (
SELECT
epoch_no - drep_activity AS epoch_no
FROM
DRepActivity
),
RankedDRep AS (
SELECT
dh.raw AS drep_hash_raw,
b.epoch_no,
dr.deposit,
dr.voting_anchor_id,
ROW_NUMBER() OVER (PARTITION BY dh.raw ORDER BY dr.tx_id DESC) AS rank
FROM
drep_hash dh
JOIN
drep_registration dr ON dh.id = dr.drep_hash_id
JOIN
tx t ON dr.tx_id = t.id
JOIN
block b ON t.block_id = b.id
WHERE
dr.deposit >= 0
GROUP BY
dh.raw,
b.epoch_no,
dr.voting_anchor_id,
dr.deposit,
dr.tx_id
),
current_epoch AS (
SELECT
Max(NO) AS no
FROM
Expand Down Expand Up @@ -36,11 +78,74 @@ total_drep_votes AS (
WHERE
voter_role = 'DRep'
),
total_stake_controlled_by_dreps AS (
SELECT
SUM(dd.amount)::bigint AS total
FROM
drep_distr dd
),
total_registered_direct_voters AS (
SELECT
COUNT(DISTINCT dh.raw) AS unique_direct_voters
FROM
drep_registration dr
JOIN
drep_hash dh
ON
dr.drep_hash_id = dh.id
LEFT JOIN
voting_anchor va
ON
dr.voting_anchor_id = va.id
WHERE
dr.deposit > 0
AND va.url IS NULL
),
total_registered_dreps AS (
SELECT
count(DISTINCT dh.raw) AS unique_registrations
FROM
drep_registration dr
JOIN
drep_hash dh
ON
dr.drep_hash_id = dh.id
WHERE
dr.deposit > 0
),
total_active_dreps AS (
SELECT
count(*) AS count
count(DISTINCT drep_hash_raw) AS unique_active_drep_registrations
FROM
RankedDRep
WHERE
epoch_no >= (SELECT epoch_no FROM active_drep_boundary_epoch)
AND rank = 1
),
total_inactive_dreps AS (
SELECT
total_registered_dreps.unique_registrations - total_active_dreps.unique_active_drep_registrations AS total_inactive_dreps
FROM
drep_hash
total_registered_dreps
CROSS JOIN
total_active_dreps
),
total_active_cip119_compliant_dreps AS (
SELECT
count(DISTINCT drep_hash_raw) AS unique_active_cip119_compliant_drep_registrations
FROM
RankedDRep
JOIN
voting_anchor va on va.id = RankedDRep.voting_anchor_id
JOIN off_chain_vote_data ocvd on ocvd.voting_anchor_id = va.id
JOIN off_chain_vote_drep_data ocvdd on ocvdd.off_chain_vote_data_id = ocvd.id
WHERE
-- given_name is the only compulsory field in CIP-119
ocvdd.given_name IS NOT NULL
AND
epoch_no >= (SELECT epoch_no FROM active_drep_boundary_epoch)
AND
rank = 1
),
always_abstain_voting_power AS (
SELECT
Expand All @@ -63,15 +168,20 @@ always_no_confidence_voting_power AS (
drep_hash.view = 'drep_always_no_confidence' ORDER BY epoch_no DESC LIMIT 1), 0) AS amount
)
SELECT
current_epoch.no,
current_epoch.no as epoch_no,
current_block.block_no,
unique_delegators.count,
total_delegations.count,
total_gov_action_proposals.count,
total_drep_votes.count,
total_registered_dreps.count,
always_abstain_voting_power.amount,
always_no_confidence_voting_power.amount,
unique_delegators.count as unique_delegators,
total_delegations.count as total_delegations,
total_gov_action_proposals.count as total_gov_action_proposals,
total_drep_votes.count as total_drep_votes,
total_registered_dreps.unique_registrations as total_registered_dreps,
total_stake_controlled_by_dreps.total as total_stake_controlled_by_dreps,
total_active_dreps.unique_active_drep_registrations as total_active_dreps,
total_inactive_dreps.total_inactive_dreps as total_inactive_dreps,
total_active_cip119_compliant_dreps.unique_active_cip119_compliant_drep_registrations as total_active_cip119_compliant_dreps,
total_registered_direct_voters.unique_direct_voters as total_registered_direct_voters,
always_abstain_voting_power.amount as always_abstain_voting_power,
always_no_confidence_voting_power.amount as always_no_confidence_voting_power,
network_name
FROM
current_epoch
Expand All @@ -81,6 +191,28 @@ FROM
CROSS JOIN total_gov_action_proposals
CROSS JOIN total_drep_votes
CROSS JOIN total_registered_dreps
CROSS JOIN total_stake_controlled_by_dreps
CROSS JOIN total_active_dreps
CROSS JOIN total_inactive_dreps
CROSS JOIN total_active_cip119_compliant_dreps
CROSS JOIN total_registered_direct_voters
CROSS JOIN always_abstain_voting_power
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN meta;
CROSS JOIN meta
GROUP BY
current_epoch.no,
current_block.block_no,
unique_delegators.count,
total_delegations.count,
total_gov_action_proposals.count,
total_drep_votes.count,
total_registered_dreps.unique_registrations,
total_stake_controlled_by_dreps.total,
total_active_dreps.unique_active_drep_registrations,
total_inactive_dreps.total_inactive_dreps,
total_active_cip119_compliant_dreps.unique_active_cip119_compliant_drep_registrations,
total_registered_direct_voters.unique_direct_voters,
always_abstain_voting_power.amount,
always_no_confidence_voting_power.amount,
network_name;

9 changes: 2 additions & 7 deletions govtool/backend/sql/get-stake-key-voting-power.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
SELECT COALESCE(SUM(utxo_view.value::numeric), 0) + COALESCE(reward_sum.total_reward, 0) AS total_value,
SELECT COALESCE(SUM(utxo_view.value::numeric), 0),
encode(stake_address.hash_raw, 'hex')
FROM stake_address
JOIN utxo_view ON utxo_view.stake_address_id = stake_address.id
LEFT JOIN (
SELECT addr_id, SUM(reward_rest.amount) AS total_reward
FROM reward_rest
GROUP BY addr_id
) AS reward_sum ON reward_sum.addr_id = stake_address.id
WHERE stake_address.hash_raw = decode(?, 'hex')
GROUP BY stake_address.hash_raw, reward_sum.total_reward;
GROUP BY stake_address.hash_raw;
5 changes: 5 additions & 0 deletions govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ getNetworkMetrics = do
, getNetworkMetricsResponseTotalGovernanceActions = networkMetricsTotalGovernanceActions
, getNetworkMetricsResponseTotalDRepVotes = networkMetricsTotalDRepVotes
, getNetworkMetricsResponseTotalRegisteredDReps = networkMetricsTotalRegisteredDReps
, getNetworkMetricsResponseTotalStakeControlledByDReps = networkMetricsTotalStakeControlledByDReps
, getNetworkMetricsResponseTotalActiveDReps = networkMetricsTotalActiveDReps
, getNetworkMetricsResponseTotalInactiveDReps = networkMetricsTotalInactiveDReps
, getNetworkMetricsResponseTotalActiveCIP119CompliantDReps = networkMetricsTotalActiveCIP119CompliantDReps
, getNetworkMetricsResponseTotalRegisteredDirectVoters = networkMetricsTotalRegisteredDirectVoters
, getNetworkMetricsResponseAlwaysAbstainVotingPower = networkMetricsAlwaysAbstainVotingPower
, getNetworkMetricsResponseAlwaysNoConfidenceVotingPower = networkMetricsAlwaysNoConfidenceVotingPower
, getNetworkMetricsResponseNetworkName = networkMetricsNetworkName
Expand Down
32 changes: 21 additions & 11 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -878,17 +878,22 @@ instance ToSchema DelegationResponse where

data GetNetworkMetricsResponse
= GetNetworkMetricsResponse
{ getNetworkMetricsResponseCurrentTime :: UTCTime
, getNetworkMetricsResponseCurrentEpoch :: Integer
, getNetworkMetricsResponseCurrentBlock :: Integer
, getNetworkMetricsResponseUniqueDelegators :: Integer
, getNetworkMetricsResponseTotalDelegations :: Integer
, getNetworkMetricsResponseTotalGovernanceActions :: Integer
, getNetworkMetricsResponseTotalDRepVotes :: Integer
, getNetworkMetricsResponseTotalRegisteredDReps :: Integer
, getNetworkMetricsResponseAlwaysAbstainVotingPower :: Integer
, getNetworkMetricsResponseAlwaysNoConfidenceVotingPower :: Integer
, getNetworkMetricsResponseNetworkName :: Text
{ getNetworkMetricsResponseCurrentTime :: UTCTime
, getNetworkMetricsResponseCurrentEpoch :: Integer
, getNetworkMetricsResponseCurrentBlock :: Integer
, getNetworkMetricsResponseUniqueDelegators :: Integer
, getNetworkMetricsResponseTotalDelegations :: Integer
, getNetworkMetricsResponseTotalGovernanceActions :: Integer
, getNetworkMetricsResponseTotalDRepVotes :: Integer
, getNetworkMetricsResponseTotalRegisteredDReps :: Integer
, getNetworkMetricsResponseTotalStakeControlledByDReps :: Integer
, getNetworkMetricsResponseTotalActiveDReps :: Integer
, getNetworkMetricsResponseTotalInactiveDReps :: Integer
, getNetworkMetricsResponseTotalActiveCIP119CompliantDReps :: Integer
, getNetworkMetricsResponseTotalRegisteredDirectVoters :: Integer
, getNetworkMetricsResponseAlwaysAbstainVotingPower :: Integer
, getNetworkMetricsResponseAlwaysNoConfidenceVotingPower :: Integer
, getNetworkMetricsResponseNetworkName :: Text
}

deriveJSON (jsonOptions "getNetworkMetricsResponse") ''GetNetworkMetricsResponse
Expand All @@ -903,6 +908,11 @@ exampleGetNetworkMetricsResponse =
<> "\"totalGovernanceActions\": 0,"
<> "\"totalDRepVotes\": 0,"
<> "\"totalRegisteredDReps\": 0,"
<> "\"totalStakeControlledByDReps\": 0,"
<> "\"totalActiveDReps\": 0,"
<> "\"totalInactiveDReps\": 0,"
<> "\"totalActiveCIP119CompliantDReps\": 0,"
<> "\"totalRegisteredDirectVoters\": 0,"
<> "\"alwaysAbstainVotingPower\": 0,"
<> "\"alwaysNoConfidenceVotingPower\": 0,"
<> "\"networkName\": \"Mainnet\"}"
Expand Down
20 changes: 13 additions & 7 deletions govtool/backend/src/VVA/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,21 @@ getVotes drepId selectedProposals = withPool $ \conn -> do
let proposalsToSelect = if null selectedProposals
then [ govActionId | (_, govActionId, _, _, _, _, _, _, _) <- results]
else selectedProposals
proposals <- if null proposalsToSelect
then return []
else Proposal.getProposals (Just proposalsToSelect)

allProposals <- mapM (Proposal.getProposals . Just . (:[])) proposalsToSelect

let proposals = concat allProposals

let proposalMap = M.fromList $ map (\x -> (proposalId x, x)) proposals

timeZone <- liftIO getCurrentTimeZone
let votes = [ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
, govActionId' `elem` proposalsToSelect
]

let votes =
[ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
, govActionId' `elem` proposalsToSelect
]

return (votes, proposals)

getDRepInfoSql :: SQL.Query
Expand Down
10 changes: 10 additions & 0 deletions govtool/backend/src/VVA/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ networkMetrics = withPool $ \conn -> do
, total_gov_action_proposals
, total_drep_votes
, total_registered_dreps
, total_stake_controlled_by_dreps
, total_active_dreps
, total_inactive_dreps
, total_active_cip119_compliant_dreps
, total_registered_direct_voters
, always_abstain_voting_power
, always_no_confidence_voting_power
, network_name
Expand All @@ -54,6 +59,11 @@ networkMetrics = withPool $ \conn -> do
total_gov_action_proposals
total_drep_votes
total_registered_dreps
total_stake_controlled_by_dreps
total_active_dreps
total_inactive_dreps
total_active_cip119_compliant_dreps
total_registered_direct_voters
always_abstain_voting_power
always_no_confidence_voting_power
network_name
Expand Down
Loading
Loading