diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce80483c..ce6a54583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,12 @@ changes. - hotfix for ada handle and payment address validation order [Issue 3155](https://github.com/IntersectMBO/govtool/issues/3155) - fix proposal list performance by pre-filtering active proposals [Issue 3190](https://github.com/IntersectMBO/govtool/issues/3190) +- Fix wrong prefix of script based dreps in CIP-129 standard [Issue 3203](https://github.com/IntersectMBO/govtool/issues/3203) ### Changed - Exclude network total stake and info from network metrics [Issue 3189](https://github.com/IntersectMBO/govtool/issues/3189) +- Change restriction level for re-voting on governance actions [Issue 3191](https://github.com/IntersectMBO/govtool/issues/3191) ### Removed diff --git a/govtool/backend/sql/get-votes.sql b/govtool/backend/sql/get-votes.sql index 31aaba85f..132a8fe66 100644 --- a/govtool/backend/sql/get-votes.sql +++ b/govtool/backend/sql/get-votes.sql @@ -1,16 +1,21 @@ -select DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter) voting_procedure.gov_action_proposal_id, concat(encode(gov_action_tx.hash,'hex'),'#',gov_action_proposal.index), encode(drep_hash.raw, 'hex'), voting_procedure.vote::text, voting_anchor.url, encode(voting_anchor.data_hash, 'hex'), block.epoch_no as epoch_no, block.time as time, encode(vote_tx.hash, 'hex') as vote_tx_hash -from voting_procedure -join gov_action_proposal -on gov_action_proposal.id = voting_procedure.gov_action_proposal_id -join drep_hash -on drep_hash.id = voting_procedure.drep_voter -left join voting_anchor -on voting_anchor.id = voting_procedure.voting_anchor_id -join tx as gov_action_tx -on gov_action_tx.id = gov_action_proposal.tx_id -join tx as vote_tx -on vote_tx.id = voting_procedure.tx_id -join block -on block.id = vote_tx.block_id -where drep_hash.raw = decode(?, 'hex') -order by voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter, voting_procedure.id desc +SELECT DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter) + voting_procedure.gov_action_proposal_id, + CONCAT(encode(gov_action_tx.hash,'hex'),'#',gov_action_proposal.index), + encode(drep_hash.raw, 'hex'), + LOWER(voting_procedure.vote::text), + voting_anchor.url, + encode(voting_anchor.data_hash, 'hex'), + block.epoch_no AS epoch_no, + block.time AS time, + encode(vote_tx.hash, 'hex') AS vote_tx_hash +FROM voting_procedure +JOIN gov_action_proposal +ON gov_action_proposal.id = voting_procedure.gov_action_proposal_id +JOIN drep_hash +ON drep_hash.id = voting_procedure.drep_voter +LEFT JOIN voting_anchor ON voting_anchor.id = voting_procedure.voting_anchor_id +JOIN tx AS gov_action_tx ON gov_action_tx.id = gov_action_proposal.tx_id +JOIN tx AS vote_tx ON vote_tx.id = voting_procedure.tx_id +JOIN block ON block.id = vote_tx.block_id +WHERE drep_hash.raw = decode(?, 'hex') +ORDER BY voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter, voting_procedure.id DESC diff --git a/govtool/frontend/src/components/molecules/VoteActionForm.tsx b/govtool/frontend/src/components/molecules/VoteActionForm.tsx index 93f433a6c..ca72961a5 100644 --- a/govtool/frontend/src/components/molecules/VoteActionForm.tsx +++ b/govtool/frontend/src/components/molecules/VoteActionForm.tsx @@ -45,7 +45,6 @@ export const VoteActionForm = ({ const { areFormErrors, confirmVote, - isDirty, isVoteLoading, registerInput, setValue, @@ -350,7 +349,11 @@ export const VoteActionForm = ({ data-testid="vote-button" variant="contained" disabled={ - !vote || previousVote?.vote === vote || (areFormErrors && isDirty) + !vote || + areFormErrors || + (previousVote?.vote === vote && + (previousVote.metadataHash === voteContextHash || + !voteContextHash)) } isLoading={isVoteLoading} onClick={confirmVote} diff --git a/govtool/frontend/src/components/organisms/DRepCard.tsx b/govtool/frontend/src/components/organisms/DRepCard.tsx index c3c4c6a23..bd74a5b11 100644 --- a/govtool/frontend/src/components/organisms/DRepCard.tsx +++ b/govtool/frontend/src/components/organisms/DRepCard.tsx @@ -62,7 +62,7 @@ export const DRepCard = ({ const cip129Identifier = encodeCIP129Identifier({ txID: `${isScriptBased ? "23" : "22"}${drepId}`, - bech32Prefix: isScriptBased ? "drep_script" : "drep", + bech32Prefix: "drep", }); const base64Image = getBase64ImageDetails(image ?? ""); diff --git a/govtool/frontend/src/components/organisms/DRepDetailsCard.tsx b/govtool/frontend/src/components/organisms/DRepDetailsCard.tsx index 98a830623..0a0798d60 100644 --- a/govtool/frontend/src/components/organisms/DRepDetailsCard.tsx +++ b/govtool/frontend/src/components/organisms/DRepDetailsCard.tsx @@ -117,7 +117,7 @@ export const DRepDetailsCard = ({ diff --git a/govtool/frontend/src/components/organisms/VoteContext/VoteContextText.tsx b/govtool/frontend/src/components/organisms/VoteContext/VoteContextText.tsx index 066e9a5ad..3f40d7622 100644 --- a/govtool/frontend/src/components/organisms/VoteContext/VoteContextText.tsx +++ b/govtool/frontend/src/components/organisms/VoteContext/VoteContextText.tsx @@ -22,7 +22,6 @@ export const VoteContextText = ({ const isContinueDisabled = !watch("voteContextText"); const fieldProps = { - key: "voteContextText", layoutStyles: { mb: 3 }, name: "voteContextText", placeholder: t("govActions.provideContext"), @@ -70,6 +69,7 @@ export const VoteContextText = ({ import("@intersect.mbo/pdf-ui/cjs"), @@ -14,6 +15,7 @@ export const ProposalDiscussionPillar = () => { const { pagePadding } = useScreenDimension(); const { validateMetadata } = useValidateMutation(); const { walletApi, ...context } = useCardano(); + const { voter } = useGetVoterInfo(); const { createGovernanceActionJsonLD, createHash } = useGovernanceActions(); return ( @@ -55,6 +57,7 @@ export const ProposalDiscussionPillar = () => { ...walletApi, createGovernanceActionJsonLD, createHash, + voter, }} pathname={window.location.pathname} validateMetadata={ diff --git a/govtool/frontend/src/services/requests/getVoteContextTextFromFile.ts b/govtool/frontend/src/services/requests/getVoteContextTextFromFile.ts index 407e08e11..0690e03b7 100644 --- a/govtool/frontend/src/services/requests/getVoteContextTextFromFile.ts +++ b/govtool/frontend/src/services/requests/getVoteContextTextFromFile.ts @@ -7,8 +7,5 @@ export const getVoteContextTextFromFile = async (url: string | undefined) => { const response = await axios.get(url); - const voteContextText = - response.data.body["CIP108:voteContextText"]["@value"]; - - return voteContextText; + return response.data.body?.body?.comment ?? ""; };