From d1d76ca3f1d9faf2279bae32918d9f4489f3f8d4 Mon Sep 17 00:00:00 2001 From: Ciabas Date: Thu, 17 Jul 2025 16:34:19 +0200 Subject: [PATCH 1/4] [hotfix] Add info box to authors section on gov actions explaining the special case of MLabs withdrawal --- .../GovernanceActionDetailsCardData.tsx | 60 ++++++++++++++++++- govtool/frontend/src/i18n/locales/en.json | 6 ++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index b38a2b2d0..b8adba8e1 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -1,5 +1,5 @@ import { useMemo, useState, useEffect } from "react"; -import { Box, Tabs, Tab, styled, Skeleton } from "@mui/material"; +import { Box, Tabs, Tab, styled, Skeleton, Link } from "@mui/material"; import { useLocation } from "react-router-dom"; import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline"; import CancelOutlinedIcon from "@mui/icons-material/CancelOutlined"; @@ -29,9 +29,11 @@ import { validateSignature, } from "@utils"; import { MetadataValidationStatus, ProposalData } from "@models"; +import { Trans } from "react-i18next"; import { errorRed, successGreen } from "@/consts"; import { GovernanceActionType } from "@/types/governanceAction"; import { useAppContext } from "@/context"; +import { theme } from "@/theme"; type TabPanelProps = { children?: React.ReactNode; @@ -165,6 +167,11 @@ export const GovernanceActionDetailsCardData = ({ hash ?? "" }`; + const isItMLabsWithdrawal = + type === GovernanceActionType.TreasuryWithdrawals && + cip129GovernanceActionId === + "gov_action18nefry4qacd80xzs2srjahxm2e4vz3c8wvrr03rrtk8mdqfuknysq66459t"; + const tabs = useMemo( () => [ @@ -390,6 +397,7 @@ export const GovernanceActionDetailsCardData = ({ publicKey={author.publicKey} algorithm={author.witnessAlgorithm} jsonContent={jsonContent} + forceValidStatus={isItMLabsWithdrawal} /> {author.name} ))} + {isItMLabsWithdrawal && authors && authors.length > 0 && } @@ -520,13 +529,16 @@ const AuthorSignatureStatus = ({ publicKey, signature, jsonContent, + forceValidStatus = false, }: { algorithm?: string; publicKey?: string; signature?: string; jsonContent?: Record; + forceValidStatus: boolean; }) => { const { t } = useTranslation(); + const [isSignatureValid, setIsSignatureValid] = useState( null, ); @@ -543,6 +555,9 @@ const AuthorSignatureStatus = ({ const result = await validateSignature(args); if (!cancelled) setIsSignatureValid(result); } + if (forceValidStatus) { + return setIsSignatureValid(true); + } checkSignature(); return () => { cancelled = true; @@ -573,3 +588,46 @@ const AuthorSignatureStatus = ({ ); }; + +const AuthorsVerificationInfoBox = () => { + const { t } = useTranslation(); + const { + palette: { lightBlue, secondaryBlue }, + } = theme; + + return ( + + + + + {t("govActions.safeModeInfoBox.title")} + + + {t("govActions.safeModeInfoBox.line1")} + + + ]} + /> + + + {t("govActions.safeModeInfoBox.link")} + + + + ); +}; diff --git a/govtool/frontend/src/i18n/locales/en.json b/govtool/frontend/src/i18n/locales/en.json index 4ecbc2ea9..4e89f3fb1 100644 --- a/govtool/frontend/src/i18n/locales/en.json +++ b/govtool/frontend/src/i18n/locales/en.json @@ -482,6 +482,12 @@ "additionalInformationAboutYourVote": "Additional information about your vote", "provideNewContextAboutYourVote": "Provide new context about your vote", "rationale": "Rationale", + "safeModeInfoBox": { + "title": "How this Author got verified?", + "line1": "A metadata formatting issue caused only part of the data to be signed, preventing automatic verification — the signature is valid and can be manually confirmed.", + "line2": "<0>Govtool have manually verified the signature confirming this Treasury action is genuinely coming from Intersect and has marked it accordingly to make it explicit to DReps.", + "link": "More details" + }, "seeExternalData": "See external data", "selectDifferentOption": "Select a different option to change your vote", "showVotes": "Show votes", From f115d816a36a6acf01822cc08e9707723a55d9b2 Mon Sep 17 00:00:00 2001 From: Sudip Bhattarai Date: Thu, 17 Jul 2025 21:36:22 +0545 Subject: [PATCH 2/4] Fix CommitteeThreshold query in network-metrics --- govtool/backend/sql/get-network-metrics.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/govtool/backend/sql/get-network-metrics.sql b/govtool/backend/sql/get-network-metrics.sql index 4aa9c8cbb..3d0844d49 100644 --- a/govtool/backend/sql/get-network-metrics.sql +++ b/govtool/backend/sql/get-network-metrics.sql @@ -186,9 +186,9 @@ CommitteeThreshold AS ( SELECT c.* FROM committee c - LEFT JOIN LatestGovAction lga ON c.gov_action_proposal_id = lga.id - WHERE (c.gov_action_proposal_id IS NOT NULL AND lga.id IS NOT NULL) - OR (c.gov_action_proposal_id IS NULL) + where + ( c.gov_action_proposal_id = (Select id from LatestGovAction)) + OR ( c.gov_action_proposal_id IS NULL) ) SELECT UniqueDelegators.count AS unique_delegators, From dae191e6e78ce0c9a179117b4463b48253ea74ad Mon Sep 17 00:00:00 2001 From: Sudip Bhattarai Date: Thu, 17 Jul 2025 23:09:56 +0545 Subject: [PATCH 3/4] Solve get-network-metrics returning 500 on preview --- govtool/backend/sql/get-network-metrics.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/govtool/backend/sql/get-network-metrics.sql b/govtool/backend/sql/get-network-metrics.sql index 3d0844d49..f5f821bc3 100644 --- a/govtool/backend/sql/get-network-metrics.sql +++ b/govtool/backend/sql/get-network-metrics.sql @@ -189,6 +189,7 @@ CommitteeThreshold AS ( where ( c.gov_action_proposal_id = (Select id from LatestGovAction)) OR ( c.gov_action_proposal_id IS NULL) + order by gov_action_proposal_id nulls last ) SELECT UniqueDelegators.count AS unique_delegators, From 4982aaf48778608006ee4b5d117ca94dff64e1cd Mon Sep 17 00:00:00 2001 From: Sudip Bhattarai Date: Fri, 18 Jul 2025 02:43:36 +0545 Subject: [PATCH 4/4] Fix Duplicate row in get-network-metrics query --- govtool/backend/sql/get-network-metrics.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/govtool/backend/sql/get-network-metrics.sql b/govtool/backend/sql/get-network-metrics.sql index f5f821bc3..73ddabc95 100644 --- a/govtool/backend/sql/get-network-metrics.sql +++ b/govtool/backend/sql/get-network-metrics.sql @@ -189,7 +189,7 @@ CommitteeThreshold AS ( where ( c.gov_action_proposal_id = (Select id from LatestGovAction)) OR ( c.gov_action_proposal_id IS NULL) - order by gov_action_proposal_id nulls last + order by gov_action_proposal_id nulls last limit 1 ) SELECT UniqueDelegators.count AS unique_delegators,