Skip to content

Commit 257440d

Browse files
authored
Merge pull request #2201 from IntersectMBO/test
GovTool v1.0.22-rc
2 parents c6358e9 + 960e4d9 commit 257440d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1077
-980
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Add Issue to Projects
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
add-to-projects:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Install GitHub CLI
15+
run: sudo apt-get install gh
16+
17+
- name: Authenticate GitHub CLI with default token
18+
run: gh auth login --with-token <<< "$GITHUB_TOKEN"
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Add issue to GovTool Project
23+
run: gh project item-add IntersectMBO/30 --content-type Issue --content-id ${{ github.event.issue.node_id }}
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Add issue to Community Backlog Project
28+
run: gh project item-add IntersectMBO/34 --content-type Issue --content-id ${{ github.event.issue.node_id }}
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ changes.
1616

1717
### Fixed
1818

19-
-
19+
- Fix unwanted horizontal page scroll on Governance Actions page [Issue 1897](https://github.com/IntersectMBO/govtool/issues/1897)
20+
- Fix duplicate testIds for reference errors and hints in DRep metadata form [Issue 1965](https://github.com/IntersectMBO/govtool/issues/1965)
21+
- Eliminate duplicate DReps in the DRep Directory [Issue 2171](https://github.com/IntersectMBO/govtool/issues/2171)
22+
- Handle script based DReps [Issue 1951](https://github.com/IntersectMBO/govtool/issues/1951)
2023

2124
### Changed
2225

23-
-
26+
- Bump to use Cardano Node `10.0.0-pre`
2427

2528
### Removed
2629

govtool/backend/sql/get-current-delegation.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ select
44
else encode(drep_hash.raw,'hex')
55
end as drep_raw,
66
drep_hash.view as drep_view,
7+
EXISTS (
8+
SELECT dh.has_script
9+
FROM drep_hash as dh
10+
WHERE drep_hash.raw = dh.raw
11+
AND dh.has_script = true
12+
LIMIT 1
13+
) AS has_script,
714
encode(tx.hash, 'hex')
815
from delegation_vote
916
join tx on tx.id = delegation_vote.tx_id

govtool/backend/sql/get-drep-info.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ LatestRegistrationEntry AS (
3434
drep_registration.tx_id DESC
3535
LIMIT 1
3636
),
37+
IsScriptHash AS (
38+
SELECT EXISTS(
39+
SELECT
40+
drep_hash.has_script
41+
FROM
42+
drep_hash
43+
CROSS JOIN DRepId
44+
WHERE
45+
drep_hash.raw = DRepId.raw
46+
AND
47+
drep_hash.has_script = true
48+
) AS has_script),
3749
IsRegisteredAsDRep AS (
3850
SELECT
3951
(LatestRegistrationEntry.deposit IS NULL
@@ -165,6 +177,7 @@ SoleVoterRetire AS (
165177
LIMIT 1
166178
)
167179
SELECT
180+
IsScriptHash.has_script,
168181
IsRegisteredAsDRep.value,
169182
WasRegisteredAsDRep.value,
170183
IsRegisteredAsSoleVoter.value,
@@ -197,5 +210,6 @@ FROM
197210
CROSS JOIN SoleVoterRegister
198211
CROSS JOIN SoleVoterRetire
199212
CROSS JOIN LatestRegistrationEntry
213+
CROSS JOIN IsScriptHash
200214
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = LatestRegistrationEntry.voting_anchor_id
201215
LEFT JOIN off_chain_vote_drep_data ON off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id

govtool/backend/sql/list-dreps.sql

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DRepActivity AS (
2121
SELECT
2222
encode(dh.raw, 'hex'),
2323
dh.view,
24+
dh.has_script,
2425
va.url,
2526
encode(va.data_hash, 'hex'),
2627
dr_deposit.deposit,
@@ -30,7 +31,7 @@ SELECT
3031
newestRegister.time AS last_register_time,
3132
COALESCE(latestDeposit.deposit, 0),
3233
non_deregister_voting_anchor.url IS NOT NULL AS has_non_deregister_voting_anchor,
33-
off_chain_vote_fetch_error.fetch_error,
34+
fetch_error.message,
3435
off_chain_vote_drep_data.payment_address,
3536
off_chain_vote_drep_data.given_name,
3637
off_chain_vote_drep_data.objectives,
@@ -96,8 +97,15 @@ FROM
9697
LEFT JOIN DRepDistr ON DRepDistr.hash_id = dh.id
9798
AND DRepDistr.rn = 1
9899
LEFT JOIN voting_anchor va ON va.id = dr_voting_anchor.voting_anchor_id
99-
LEFT JOIN voting_anchor non_deregister_voting_anchor on non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
100-
LEFT JOIN off_chain_vote_fetch_error ON off_chain_vote_fetch_error.voting_anchor_id = va.id
100+
LEFT JOIN voting_anchor non_deregister_voting_anchor ON non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
101+
LEFT JOIN (
102+
SELECT fetch_error as message, voting_anchor_id
103+
FROM off_chain_vote_fetch_error
104+
WHERE fetch_time = (
105+
SELECT max(fetch_time)
106+
FROM off_chain_vote_fetch_error)
107+
GROUP BY fetch_error, voting_anchor_id
108+
) AS fetch_error ON fetch_error.voting_anchor_id = va.id
101109
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = va.id
102110
LEFT JOIN off_chain_vote_drep_data on off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
103111
CROSS JOIN DRepActivity
@@ -130,6 +138,7 @@ GROUP BY
130138
dh.raw,
131139
second_to_newest_drep_registration.voting_anchor_id,
132140
dh.view,
141+
dh.has_script,
133142
va.url,
134143
va.data_hash,
135144
dr_deposit.deposit,
@@ -140,7 +149,7 @@ GROUP BY
140149
newestRegister.time,
141150
latestDeposit.deposit,
142151
non_deregister_voting_anchor.url,
143-
off_chain_vote_fetch_error.fetch_error,
152+
fetch_error.message,
144153
off_chain_vote_drep_data.payment_address,
145154
off_chain_vote_drep_data.given_name,
146155
off_chain_vote_drep_data.objectives,

govtool/backend/sql/list-proposals.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SELECT
5454
end
5555
) as description,
5656
CASE
57-
WHEN meta.network_name::text = 'mainnet' THEN
57+
WHEN meta.network_name::text = 'mainnet' OR meta.network_name::text = 'preprod' THEN
5858
latest_epoch.start_time + (gov_action_proposal.expiration - latest_epoch.no)::bigint * INTERVAL '5 days'
5959
ELSE
6060
latest_epoch.start_time + (gov_action_proposal.expiration - latest_epoch.no)::bigint * INTERVAL '1 day'

govtool/backend/src/VVA/API.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ mapDRepStatus Types.Inactive = Inactive
106106
drepRegistrationToDrep :: Types.DRepRegistration -> DRep
107107
drepRegistrationToDrep Types.DRepRegistration {..} =
108108
DRep
109-
{ dRepDrepId = DRepHash dRepRegistrationDRepHash,
109+
{ dRepIsScriptBased = dRepRegistrationIsScriptBased,
110+
dRepDrepId = DRepHash dRepRegistrationDRepHash,
110111
dRepView = dRepRegistrationView,
111112
dRepUrl = dRepRegistrationUrl,
112113
dRepMetadataHash = dRepRegistrationDataHash,
@@ -131,6 +132,7 @@ delegationToResponse Types.Delegation {..} =
131132
DelegationResponse
132133
{ delegationResponseDRepHash = HexText <$> delegationDRepHash,
133134
delegationResponseDRepView = delegationDRepView,
135+
delegationResponseIsDRepScriptBased = delegationIsDRepScriptBased,
134136
delegationResponseTxHash = HexText delegationTxHash
135137
}
136138

@@ -286,7 +288,8 @@ drepInfo (unHexText -> dRepId) = do
286288
CacheEnv {dRepInfoCache} <- asks vvaCache
287289
Types.DRepInfo {..} <- cacheRequest dRepInfoCache dRepId $ DRep.getDRepInfo dRepId
288290
return $ DRepInfoResponse
289-
{ dRepInfoResponseIsRegisteredAsDRep = dRepInfoIsRegisteredAsDRep
291+
{ dRepInfoResponseIsScriptBased = dRepInfoIsScriptBased
292+
, dRepInfoResponseIsRegisteredAsDRep = dRepInfoIsRegisteredAsDRep
290293
, dRepInfoResponseWasRegisteredAsDRep = dRepInfoWasRegisteredAsDRep
291294
, dRepInfoResponseIsRegisteredAsSoleVoter = dRepInfoIsRegisteredAsSoleVoter
292295
, dRepInfoResponseWasRegisteredAsSoleVoter = dRepInfoWasRegisteredAsSoleVoter

govtool/backend/src/VVA/API/Types.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ instance ToSchema VoteResponse where
561561

562562
data DRepInfoResponse
563563
= DRepInfoResponse
564-
{ dRepInfoResponseIsRegisteredAsDRep :: Bool
564+
{ dRepInfoResponseIsScriptBased :: Bool
565+
, dRepInfoResponseIsRegisteredAsDRep :: Bool
565566
, dRepInfoResponseWasRegisteredAsDRep :: Bool
566567
, dRepInfoResponseIsRegisteredAsSoleVoter :: Bool
567568
, dRepInfoResponseWasRegisteredAsSoleVoter :: Bool
@@ -758,7 +759,8 @@ instance ToSchema DRepType where
758759

759760
data DRep
760761
= DRep
761-
{ dRepDrepId :: DRepHash
762+
{ dRepIsScriptBased :: Bool
763+
, dRepDrepId :: DRepHash
762764
, dRepView :: Text
763765
, dRepUrl :: Maybe Text
764766
, dRepMetadataHash :: Maybe Text
@@ -855,9 +857,10 @@ instance ToSchema ListDRepsResponse where
855857

856858
data DelegationResponse
857859
= DelegationResponse
858-
{ delegationResponseDRepHash :: Maybe HexText
859-
, delegationResponseDRepView :: Text
860-
, delegationResponseTxHash :: HexText
860+
{ delegationResponseDRepHash :: Maybe HexText
861+
, delegationResponseDRepView :: Text
862+
, delegationResponseIsDRepScriptBased :: Bool
863+
, delegationResponseTxHash :: HexText
861864
}
862865
deriveJSON (jsonOptions "delegationResponse") ''DelegationResponse
863866

govtool/backend/src/VVA/AdaHolder.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ getCurrentDelegation ::
4242
getCurrentDelegation stakeKey = withPool $ \conn -> do
4343
result <- liftIO $ SQL.query conn getCurrentDelegationSql (SQL.Only stakeKey)
4444
case result of
45-
[] -> return Nothing
46-
[(mDRepHash, dRepView, txHash)] -> return $ Just $ Delegation mDRepHash dRepView txHash
47-
_ -> error ("multiple delegations for stake key: " <> unpack stakeKey)
45+
[] -> return Nothing
46+
[(mDRepHash, dRepView, isDRepScriptBased, txHash)] -> return $ Just $ Delegation mDRepHash dRepView isDRepScriptBased txHash
47+
_ -> error ("multiple delegations for stake key: " <> unpack stakeKey)
4848

4949
getVotingPowerSql :: SQL.Query
5050
getVotingPowerSql = sqlFrom $(embedFile "sql/get-stake-key-voting-power.sql")

govtool/backend/src/VVA/DRep.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ listDReps = withPool $ \conn -> do
6161
results <- liftIO $ SQL.query_ conn listDRepsSql
6262
timeZone <- liftIO getCurrentTimeZone
6363
return
64-
[ DRepRegistration drepHash drepView url dataHash (floor @Scientific deposit) votingPower status drepType txHash (localTimeToUTC timeZone date) metadataError paymentAddress givenName objectives motivations qualifications imageUrl imageHash
64+
[ DRepRegistration drepHash drepView isScriptBased url dataHash (floor @Scientific deposit) votingPower status drepType txHash (localTimeToUTC timeZone date) metadataError paymentAddress givenName objectives motivations qualifications imageUrl imageHash
6565
| ( drepHash
6666
, drepView
67+
, isScriptBased
6768
, url
6869
, dataHash
6970
, deposit
@@ -132,7 +133,8 @@ getDRepInfo
132133
getDRepInfo drepId = withPool $ \conn -> do
133134
result <- liftIO $ SQL.query conn getDRepInfoSql (SQL.Only drepId)
134135
case result of
135-
[ ( isRegisteredAsDRep
136+
[ ( isScriptBased
137+
, isRegisteredAsDRep
136138
, wasRegisteredAsDRep
137139
, isRegisteredAsSoleVoter
138140
, wasRegisteredAsSoleVoter
@@ -153,7 +155,8 @@ getDRepInfo drepId = withPool $ \conn -> do
153155
, imageHash
154156
)] ->
155157
return $ DRepInfo
156-
{ dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
158+
{ dRepInfoIsScriptBased = isScriptBased
159+
, dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
157160
, dRepInfoWasRegisteredAsDRep = fromMaybe False wasRegisteredAsDRep
158161
, dRepInfoIsRegisteredAsSoleVoter = fromMaybe False isRegisteredAsSoleVoter
159162
, dRepInfoWasRegisteredAsSoleVoter = fromMaybe False wasRegisteredAsSoleVoter
@@ -173,4 +176,4 @@ getDRepInfo drepId = withPool $ \conn -> do
173176
, dRepInfoImageUrl = imageUrl
174177
, dRepInfoImageHash = imageHash
175178
}
176-
[] -> return $ DRepInfo False False False False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
179+
[] -> return $ DRepInfo False False False False False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing

0 commit comments

Comments
 (0)