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.22-rc #2201

Merged
merged 35 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
249a5dc
chore: update test-metrics-api dependencies
kneerose Oct 7, 2024
21da87c
chore: update test-metadata-api dependencies
kneerose Oct 7, 2024
e2ff999
chore: update test-govtool-frontend dependencies
kneerose Oct 7, 2024
46aa788
chore: update requests package version on test-govtool-backend
kneerose Oct 7, 2024
fb994d7
chore: update bouncycastle dependency version on test-load-testing
kneerose Oct 7, 2024
7a3bc90
fix: correct testId for CC committee yes votes
kneerose Oct 16, 2024
c065deb
chore: add workflow to assign project to new issues
Ryun1 Oct 17, 2024
e3595ed
[#1897] fix unwanted horizontal page scroll on Governance Actions page
j-dyczka Oct 17, 2024
abffc20
Merge pull request #2127 from IntersectMBO/fix/test-dependabot-alerts
kneerose Oct 18, 2024
899fa98
Merge pull request #2159 from IntersectMBO/fix/vote-count-issue
kneerose Oct 18, 2024
5372420
Merge pull request #2179 from IntersectMBO/fix/1897-GAs-page-horizont…
jdyczka Oct 18, 2024
537ebbc
[#1965] fix duplicate testIds for reference errors and hints
j-dyczka Oct 17, 2024
d5c42a8
Merge pull request #2180 from IntersectMBO/fix/1965-duplicate-testids…
jdyczka Oct 18, 2024
e2b5f92
[#2171] eliminate duplicate DReps
j-dyczka Oct 17, 2024
27915e9
Merge pull request #2172 from IntersectMBO/fix/2171-duplicated-dreps
jdyczka Oct 18, 2024
daedc37
[#1951] return isScriptBased flag from BE for listDReps and getDRepInfo
j-dyczka Oct 15, 2024
a57e43f
[#1951] handle scripe based DReps on FE
j-dyczka Oct 18, 2024
7f9ff90
chore: add get genesis params on kuber api
kneerose Oct 18, 2024
0406770
test: gov action expiry epoch and date validation
kneerose Oct 18, 2024
6181c4d
fix: ga epoch boundary for preprod
MSzalowski Oct 21, 2024
7ba23cc
[#1951] fix delegation cert hash for script DReps
j-dyczka Oct 21, 2024
5eac3f2
[#1951] add workaround for multiple rows for one drep view in drep_ha…
j-dyczka Oct 21, 2024
2b1feeb
[#1951] remove calculating view on FE
j-dyczka Oct 21, 2024
c627813
Merge pull request #2182 from IntersectMBO/fix/1951-script-based-dreps
jdyczka Oct 21, 2024
d6398d2
Merge pull request #2185 from IntersectMBO/backend-test/epoch-boundary
kneerose Oct 22, 2024
4c550d6
feat: set markdown alignment unset
MSzalowski Oct 21, 2024
a316950
Merge pull request #2188 from IntersectMBO/feat/reset-markdown-alignment
MSzalowski Oct 22, 2024
41a5391
Merge pull request #2186 from IntersectMBO/fix/fix-ga-epoch-boundary-…
MSzalowski Oct 22, 2024
14f95de
chore: bump Cardano node to 10.0.0-pre
Ryun1 Oct 22, 2024
efc4cb8
chore: update cookie dependencies version on test-metrics-api and te…
kneerose Oct 23, 2024
c53b4c0
chore: update @types/node version in govtool-frontend
kneerose Oct 23, 2024
91c2214
Merge pull request #2197 from IntersectMBO/fix/test-dependabot-alerts
kneerose Oct 23, 2024
19dc4b4
fix: use logger import from helper instead of cypress logger
kneerose Oct 23, 2024
571e269
Merge pull request #2200 from IntersectMBO/bugfix/logger-import
kneerose Oct 23, 2024
960e4d9
Merge pull request #2198 from IntersectMBO/develop
MSzalowski Oct 23, 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
30 changes: 30 additions & 0 deletions .github/workflows/add-issue-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Add Issue to Projects

on:
issues:
types: [opened]

jobs:
add-to-projects:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install GitHub CLI
run: sudo apt-get install gh

- name: Authenticate GitHub CLI with default token
run: gh auth login --with-token <<< "$GITHUB_TOKEN"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Add issue to GovTool Project
run: gh project item-add IntersectMBO/30 --content-type Issue --content-id ${{ github.event.issue.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Add issue to Community Backlog Project
run: gh project item-add IntersectMBO/34 --content-type Issue --content-id ${{ github.event.issue.node_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ changes.

### Fixed

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

### Changed

-
- Bump to use Cardano Node `10.0.0-pre`

### Removed

Expand Down
7 changes: 7 additions & 0 deletions govtool/backend/sql/get-current-delegation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ select
else encode(drep_hash.raw,'hex')
end as drep_raw,
drep_hash.view as drep_view,
EXISTS (
SELECT dh.has_script
FROM drep_hash as dh
WHERE drep_hash.raw = dh.raw
AND dh.has_script = true
LIMIT 1
) AS has_script,
encode(tx.hash, 'hex')
from delegation_vote
join tx on tx.id = delegation_vote.tx_id
Expand Down
14 changes: 14 additions & 0 deletions govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ LatestRegistrationEntry AS (
drep_registration.tx_id DESC
LIMIT 1
),
IsScriptHash AS (
SELECT EXISTS(
SELECT
drep_hash.has_script
FROM
drep_hash
CROSS JOIN DRepId
WHERE
drep_hash.raw = DRepId.raw
AND
drep_hash.has_script = true
) AS has_script),
IsRegisteredAsDRep AS (
SELECT
(LatestRegistrationEntry.deposit IS NULL
Expand Down Expand Up @@ -165,6 +177,7 @@ SoleVoterRetire AS (
LIMIT 1
)
SELECT
IsScriptHash.has_script,
IsRegisteredAsDRep.value,
WasRegisteredAsDRep.value,
IsRegisteredAsSoleVoter.value,
Expand Down Expand Up @@ -197,5 +210,6 @@ FROM
CROSS JOIN SoleVoterRegister
CROSS JOIN SoleVoterRetire
CROSS JOIN LatestRegistrationEntry
CROSS JOIN IsScriptHash
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = LatestRegistrationEntry.voting_anchor_id
LEFT JOIN off_chain_vote_drep_data ON off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
17 changes: 13 additions & 4 deletions govtool/backend/sql/list-dreps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DRepActivity AS (
SELECT
encode(dh.raw, 'hex'),
dh.view,
dh.has_script,
va.url,
encode(va.data_hash, 'hex'),
dr_deposit.deposit,
Expand All @@ -30,7 +31,7 @@ SELECT
newestRegister.time AS last_register_time,
COALESCE(latestDeposit.deposit, 0),
non_deregister_voting_anchor.url IS NOT NULL AS has_non_deregister_voting_anchor,
off_chain_vote_fetch_error.fetch_error,
fetch_error.message,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
Expand Down Expand Up @@ -96,8 +97,15 @@ FROM
LEFT JOIN DRepDistr ON DRepDistr.hash_id = dh.id
AND DRepDistr.rn = 1
LEFT JOIN voting_anchor va ON va.id = dr_voting_anchor.voting_anchor_id
LEFT JOIN voting_anchor non_deregister_voting_anchor on non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
LEFT JOIN off_chain_vote_fetch_error ON off_chain_vote_fetch_error.voting_anchor_id = va.id
LEFT JOIN voting_anchor non_deregister_voting_anchor ON non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
LEFT JOIN (
SELECT fetch_error as message, voting_anchor_id
FROM off_chain_vote_fetch_error
WHERE fetch_time = (
SELECT max(fetch_time)
FROM off_chain_vote_fetch_error)
GROUP BY fetch_error, voting_anchor_id
) AS fetch_error ON fetch_error.voting_anchor_id = va.id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = va.id
LEFT JOIN off_chain_vote_drep_data on off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
CROSS JOIN DRepActivity
Expand Down Expand Up @@ -130,6 +138,7 @@ GROUP BY
dh.raw,
second_to_newest_drep_registration.voting_anchor_id,
dh.view,
dh.has_script,
va.url,
va.data_hash,
dr_deposit.deposit,
Expand All @@ -140,7 +149,7 @@ GROUP BY
newestRegister.time,
latestDeposit.deposit,
non_deregister_voting_anchor.url,
off_chain_vote_fetch_error.fetch_error,
fetch_error.message,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ SELECT
end
) as description,
CASE
WHEN meta.network_name::text = 'mainnet' THEN
WHEN meta.network_name::text = 'mainnet' OR meta.network_name::text = 'preprod' THEN
latest_epoch.start_time + (gov_action_proposal.expiration - latest_epoch.no)::bigint * INTERVAL '5 days'
ELSE
latest_epoch.start_time + (gov_action_proposal.expiration - latest_epoch.no)::bigint * INTERVAL '1 day'
Expand Down
7 changes: 5 additions & 2 deletions govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ mapDRepStatus Types.Inactive = Inactive
drepRegistrationToDrep :: Types.DRepRegistration -> DRep
drepRegistrationToDrep Types.DRepRegistration {..} =
DRep
{ dRepDrepId = DRepHash dRepRegistrationDRepHash,
{ dRepIsScriptBased = dRepRegistrationIsScriptBased,
dRepDrepId = DRepHash dRepRegistrationDRepHash,
dRepView = dRepRegistrationView,
dRepUrl = dRepRegistrationUrl,
dRepMetadataHash = dRepRegistrationDataHash,
Expand All @@ -131,6 +132,7 @@ delegationToResponse Types.Delegation {..} =
DelegationResponse
{ delegationResponseDRepHash = HexText <$> delegationDRepHash,
delegationResponseDRepView = delegationDRepView,
delegationResponseIsDRepScriptBased = delegationIsDRepScriptBased,
delegationResponseTxHash = HexText delegationTxHash
}

Expand Down Expand Up @@ -286,7 +288,8 @@ drepInfo (unHexText -> dRepId) = do
CacheEnv {dRepInfoCache} <- asks vvaCache
Types.DRepInfo {..} <- cacheRequest dRepInfoCache dRepId $ DRep.getDRepInfo dRepId
return $ DRepInfoResponse
{ dRepInfoResponseIsRegisteredAsDRep = dRepInfoIsRegisteredAsDRep
{ dRepInfoResponseIsScriptBased = dRepInfoIsScriptBased
, dRepInfoResponseIsRegisteredAsDRep = dRepInfoIsRegisteredAsDRep
, dRepInfoResponseWasRegisteredAsDRep = dRepInfoWasRegisteredAsDRep
, dRepInfoResponseIsRegisteredAsSoleVoter = dRepInfoIsRegisteredAsSoleVoter
, dRepInfoResponseWasRegisteredAsSoleVoter = dRepInfoWasRegisteredAsSoleVoter
Expand Down
13 changes: 8 additions & 5 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ instance ToSchema VoteResponse where

data DRepInfoResponse
= DRepInfoResponse
{ dRepInfoResponseIsRegisteredAsDRep :: Bool
{ dRepInfoResponseIsScriptBased :: Bool
, dRepInfoResponseIsRegisteredAsDRep :: Bool
, dRepInfoResponseWasRegisteredAsDRep :: Bool
, dRepInfoResponseIsRegisteredAsSoleVoter :: Bool
, dRepInfoResponseWasRegisteredAsSoleVoter :: Bool
Expand Down Expand Up @@ -758,7 +759,8 @@ instance ToSchema DRepType where

data DRep
= DRep
{ dRepDrepId :: DRepHash
{ dRepIsScriptBased :: Bool
, dRepDrepId :: DRepHash
, dRepView :: Text
, dRepUrl :: Maybe Text
, dRepMetadataHash :: Maybe Text
Expand Down Expand Up @@ -855,9 +857,10 @@ instance ToSchema ListDRepsResponse where

data DelegationResponse
= DelegationResponse
{ delegationResponseDRepHash :: Maybe HexText
, delegationResponseDRepView :: Text
, delegationResponseTxHash :: HexText
{ delegationResponseDRepHash :: Maybe HexText
, delegationResponseDRepView :: Text
, delegationResponseIsDRepScriptBased :: Bool
, delegationResponseTxHash :: HexText
}
deriveJSON (jsonOptions "delegationResponse") ''DelegationResponse

Expand Down
6 changes: 3 additions & 3 deletions govtool/backend/src/VVA/AdaHolder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ getCurrentDelegation ::
getCurrentDelegation stakeKey = withPool $ \conn -> do
result <- liftIO $ SQL.query conn getCurrentDelegationSql (SQL.Only stakeKey)
case result of
[] -> return Nothing
[(mDRepHash, dRepView, txHash)] -> return $ Just $ Delegation mDRepHash dRepView txHash
_ -> error ("multiple delegations for stake key: " <> unpack stakeKey)
[] -> return Nothing
[(mDRepHash, dRepView, isDRepScriptBased, txHash)] -> return $ Just $ Delegation mDRepHash dRepView isDRepScriptBased txHash
_ -> error ("multiple delegations for stake key: " <> unpack stakeKey)

getVotingPowerSql :: SQL.Query
getVotingPowerSql = sqlFrom $(embedFile "sql/get-stake-key-voting-power.sql")
Expand Down
11 changes: 7 additions & 4 deletions govtool/backend/src/VVA/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ listDReps = withPool $ \conn -> do
results <- liftIO $ SQL.query_ conn listDRepsSql
timeZone <- liftIO getCurrentTimeZone
return
[ DRepRegistration drepHash drepView url dataHash (floor @Scientific deposit) votingPower status drepType txHash (localTimeToUTC timeZone date) metadataError paymentAddress givenName objectives motivations qualifications imageUrl imageHash
[ DRepRegistration drepHash drepView isScriptBased url dataHash (floor @Scientific deposit) votingPower status drepType txHash (localTimeToUTC timeZone date) metadataError paymentAddress givenName objectives motivations qualifications imageUrl imageHash
| ( drepHash
, drepView
, isScriptBased
, url
, dataHash
, deposit
Expand Down Expand Up @@ -132,7 +133,8 @@ getDRepInfo
getDRepInfo drepId = withPool $ \conn -> do
result <- liftIO $ SQL.query conn getDRepInfoSql (SQL.Only drepId)
case result of
[ ( isRegisteredAsDRep
[ ( isScriptBased
, isRegisteredAsDRep
, wasRegisteredAsDRep
, isRegisteredAsSoleVoter
, wasRegisteredAsSoleVoter
Expand All @@ -153,7 +155,8 @@ getDRepInfo drepId = withPool $ \conn -> do
, imageHash
)] ->
return $ DRepInfo
{ dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
{ dRepInfoIsScriptBased = isScriptBased
, dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
, dRepInfoWasRegisteredAsDRep = fromMaybe False wasRegisteredAsDRep
, dRepInfoIsRegisteredAsSoleVoter = fromMaybe False isRegisteredAsSoleVoter
, dRepInfoWasRegisteredAsSoleVoter = fromMaybe False wasRegisteredAsSoleVoter
Expand All @@ -173,4 +176,4 @@ getDRepInfo drepId = withPool $ \conn -> do
, dRepInfoImageUrl = imageUrl
, dRepInfoImageHash = imageHash
}
[] -> return $ DRepInfo False False False False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
[] -> return $ DRepInfo False False False False False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
11 changes: 7 additions & 4 deletions govtool/backend/src/VVA/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ data Vote

data DRepInfo
= DRepInfo
{ dRepInfoIsRegisteredAsDRep :: Bool
{ dRepInfoIsScriptBased :: Bool
, dRepInfoIsRegisteredAsDRep :: Bool
, dRepInfoWasRegisteredAsDRep :: Bool
, dRepInfoIsRegisteredAsSoleVoter :: Bool
, dRepInfoWasRegisteredAsSoleVoter :: Bool
Expand Down Expand Up @@ -101,6 +102,7 @@ data DRepRegistration
= DRepRegistration
{ dRepRegistrationDRepHash :: Text
, dRepRegistrationView :: Text
, dRepRegistrationIsScriptBased :: Bool
, dRepRegistrationUrl :: Maybe Text
, dRepRegistrationDataHash :: Maybe Text
, dRepRegistrationDeposit :: Integer
Expand Down Expand Up @@ -215,7 +217,8 @@ data NetworkMetrics

data Delegation
= Delegation
{ delegationDRepHash :: Maybe Text
, delegationDRepView :: Text
, delegationTxHash :: Text
{ delegationDRepHash :: Maybe Text
, delegationDRepView :: Text
, delegationIsDRepScriptBased :: Bool
, delegationTxHash :: Text
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { Typography } from "@mui/material";
import { FormErrorMessageProps } from "./types";

export const FormErrorMessage = ({
dataTestId,
errorMessage,
errorStyles,
}: FormErrorMessageProps) =>
errorMessage && (
<Typography
color="red"
data-testid={`${errorMessage.replace(/\s+/g, "-").toLowerCase()}-error`}
data-testid={
dataTestId ?? `${errorMessage.replace(/\s+/g, "-").toLowerCase()}-error`
}
fontSize={12}
fontWeight={400}
sx={{ mt: 0.25 }}
Expand Down
5 changes: 4 additions & 1 deletion govtool/frontend/src/components/atoms/FormHelpfulText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import { Typography } from "@mui/material";
import { FormHelpfulTextProps } from "./types";

export const FormHelpfulText = ({
dataTestId,
helpfulText,
helpfulTextStyle,
sx,
}: FormHelpfulTextProps) =>
helpfulText && (
<Typography
color="#9792B5"
data-testid={`${helpfulText.replace(/\s+/g, "-").toLowerCase()}-error`}
data-testid={
dataTestId ?? `${helpfulText.replace(/\s+/g, "-").toLowerCase()}-error`
}
fontSize={12}
fontWeight={400}
sx={{ mt: 0.5, ...sx }}
Expand Down
2 changes: 2 additions & 0 deletions govtool/frontend/src/components/atoms/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ export type CheckboxProps = Omit<MUICheckboxProps, "onChange" | "value"> & {
};

export type FormErrorMessageProps = {
dataTestId?: string;
errorMessage?: string;
errorStyles?: MUITypographyProps;
};

export type FormHelpfulTextProps = {
dataTestId?: string;
helpfulText?: string;
helpfulTextStyle?: MUITypographyProps;
sx?: SxProps;
Expand Down
6 changes: 6 additions & 0 deletions govtool/frontend/src/components/molecules/DRepDataForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ const ReferencesSection = ({
name={`${fieldName}.${index}.label`}
helpfulText={t("forms.dRepData.referenceDescriptionHelpfulText")}
dataTestId={`${type}-reference-description-${index + 1}-input`}
errorDataTestId={`${type}-reference-description-${index + 1}-error`}
helpfulTextDataTestId={`${type}-reference-description-${
index + 1
}-hint`}
rules={Rules.LINK_DESCRIPTION}
/>
<ControlledField.Input
Expand All @@ -252,6 +256,8 @@ const ReferencesSection = ({
layoutStyles={{ mb: 3 }}
name={`${fieldName}.${index}.uri`}
dataTestId={`${type}-reference-url-${index + 1}-input`}
errorDataTestId={`${type}-reference-url-${index + 1}-error`}
helpfulTextDataTestId={`${type}-reference-url-${index + 1}-hint`}
rules={Rules.LINK_URL}
/>
</Fragment>
Expand Down
Loading
Loading