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 2.0.4 #2607

Merged
merged 25 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1d10b8e
chore: show total dRep votes for all governance actions on full gover…
kneerose Dec 18, 2024
da05827
chore: remove restrictions and check on all governance actions for dRep
kneerose Dec 18, 2024
da3bc3b
chore: replace viewFirstDRepVoteEnabledGovAction with viewFirstGovAction
kneerose Dec 18, 2024
76d11b2
cleanup: remove unnecessary viewFirstDRepVoteEnabledGovernanceAction
kneerose Dec 18, 2024
186cd20
fix: increase Node.js memory limit to 4GB in storybook dockerfile
kneerose Dec 31, 2024
16338f3
Merge pull request #2594 from IntersectMBO/test
MSzalowski Dec 31, 2024
91a2e3d
feat: enhance dRep metadata handling with image and language support
kneerose Jan 2, 2025
81509e7
Merge pull request #2590 from IntersectMBO/infra/test-chores
mesudip Jan 2, 2025
fe20807
Merge pull request #2596 from IntersectMBO/chore/update-metadata-format
kneerose Jan 2, 2025
82ae303
Merge pull request #2552 from IntersectMBO/bugfix/dRep-vote-dependent…
kneerose Jan 2, 2025
c1563b6
fix(#2583): fix encoding and decoding cip-129 drep_script identifiers
MSzalowski Jan 1, 2025
67a199f
Update govtool/frontend/src/utils/drepSearchPhraseProcessor.ts
MSzalowski Jan 2, 2025
5a97d46
fix: fix failed storybook footer test
MSzalowski Jan 2, 2025
788a20c
Merge pull request #2595 from IntersectMBO/fix/2583-wrong-drep-script…
MSzalowski Jan 3, 2025
0d0336e
chore(#2600): reduce CSL version to 12.1.1
MSzalowski Jan 6, 2025
8fc7608
fix(#2535): fix bad request on ga list
MSzalowski Jan 3, 2025
8d13f33
Merge pull request #2598 from IntersectMBO/fix/failed-storybook-foote…
MSzalowski Jan 7, 2025
fef8b9f
Merge pull request #2599 from IntersectMBO/fix/2535-400-bad-request-e…
MSzalowski Jan 7, 2025
d014164
fix: wrong drep activity conditions
MSzalowski Jan 6, 2025
ee558ec
Merge pull request #2603 from IntersectMBO/fix/wrong-drep-activity-co…
MSzalowski Jan 7, 2025
3fd1c7e
Merge pull request #2601 from IntersectMBO/chore/2600-reduce-csl-vers…
MSzalowski Jan 7, 2025
1101c5e
fix: fetching metadata from ipfs.io gateway
MSzalowski Jan 6, 2025
3d6c597
Merge pull request #2604 from IntersectMBO/fix/ipfs-links-not-working
MSzalowski Jan 7, 2025
fbbc6aa
chore: bump GovTool to v2.0.4
MSzalowski Jan 7, 2025
db747ed
Merge pull request #2606 from IntersectMBO/chore/bump-govtool-to-v2.0.4
MSzalowski Jan 7, 2025
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ changes.

-

## [v2.0.4](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.4) 2025-01-07

### Added

-

### Fixed

- Fix CIP-129 DRep view identifier for script based DReps [Issue 2583](https://github.com/IntersectMBO/govtool/issues/2583)
- Fix fetching metadata from IPFS gateway
- Fix bad request on passing the random sorting to GA list request [Issue 2535](https://github.com/IntersectMBO/govtool/issues/2535)
- Fix wrong drep activity conditions

### Changed

- Reduce CSL version to 12.1.1 [Issue 2600](https://github.com/IntersectMBO/govtool/issues/2600)

### Removed

-

## [v2.0.3](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.3) 2024-12-30

### 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-2.0.3/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-2.0.4/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-2.0.3/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-2.0.4/x/vva-be/build/vva-be/vva-be /usr/local/bin

# Expose the necessary port
EXPOSE 9876
Expand Down
22 changes: 21 additions & 1 deletion govtool/backend/sql/list-dreps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ DRepActivity AS (
ORDER BY
epoch_no DESC
LIMIT 1
),
LatestVotingProcedure AS (
SELECT
vp.*,
ROW_NUMBER() OVER (PARTITION BY drep_voter ORDER BY tx_id DESC) AS rn
FROM
voting_procedure vp
),
LatestVoteEpoch AS (
SELECT
block.epoch_no,
lvp.drep_voter as drep_id
FROM
LatestVotingProcedure lvp
JOIN tx ON tx.id = lvp.tx_id
JOIN block ON block.id = tx.block_id
WHERE
lvp.rn = 1
)
SELECT DISTINCT ON (dh.raw)
encode(dh.raw, 'hex'),
Expand All @@ -26,7 +44,7 @@ SELECT DISTINCT ON (dh.raw)
encode(va.data_hash, 'hex'),
dr_deposit.deposit,
DRepDistr.amount,
(DRepActivity.epoch_no - newestRegister.epoch_no) <= DRepActivity.drep_activity AS active,
(DRepActivity.epoch_no - GREATEST(MAX(COALESCE(block.epoch_no, block_first_register.epoch_no)), lve.epoch_no)) <= DRepActivity.drep_activity AS active,
encode(dr_voting_anchor.tx_hash, 'hex') AS tx_hash,
newestRegister.time AS last_register_time,
COALESCE(latestDeposit.deposit, 0),
Expand Down Expand Up @@ -143,6 +161,7 @@ FROM
) AS dr_first_register ON dr_first_register.drep_hash_id = dh.id AND dr_first_register.rn = 1
LEFT JOIN tx AS tx_first_register ON tx_first_register.id = dr_first_register.tx_id
LEFT JOIN block AS block_first_register ON block_first_register.id = tx_first_register.block_id
LEFT JOIN LatestVoteEpoch lve ON lve.drep_id = dh.id
WHERE
(
COALESCE(?, '') = '' OR
Expand All @@ -163,6 +182,7 @@ GROUP BY
DRepDistr.amount,
DRepActivity.epoch_no,
DRepActivity.drep_activity,
lve.epoch_no,
dr_voting_anchor.tx_hash,
newestRegister.time,
newestRegister.epoch_no,
Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/vva-be.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.6
name: vva-be
version: 2.0.3
version: 2.0.4

-- A short (one-line) description of the package.
-- synopsis:
Expand Down
18 changes: 6 additions & 12 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions govtool/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@govtool/frontend",
"private": true,
"version": "2.0.3",
"version": "2.0.4",
"type": "module",
"scripts": {
"build": "vite build",
Expand All @@ -25,7 +25,7 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@emurgo/cardano-serialization-lib-asmjs": "^13.1.0",
"@emurgo/cardano-serialization-lib-asmjs": "^12.1.1",
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "^0.5.5",
Expand Down Expand Up @@ -112,6 +112,5 @@
"typescript": "^5.0.2",
"nth-check": "^2.0.1",
"postcss": "^8.4.31"
},
"_id": "[email protected]"
}
}
5 changes: 3 additions & 2 deletions govtool/frontend/src/components/organisms/DRepCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const DRepCard = ({
metadataStatus,
image,
drepId,
isScriptBased,
},
isConnected,
isDelegationLoading,
Expand All @@ -59,8 +60,8 @@ export const DRepCard = ({
});

const cip129Identifier = encodeCIP129Identifier({
txID: `22${drepId}`,
bech32Prefix: "drep",
txID: `${isScriptBased ? "23" : "22"}${drepId}`,
bech32Prefix: isScriptBased ? "drep_script" : "drep",
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const DRepDetailsCard = ({
view,
drepId,
votingPower,
isScriptBased,
} = dRepData;

const groupedReferences = references?.reduce<Record<string, Reference[]>>(
Expand Down Expand Up @@ -120,8 +121,8 @@ export const DRepDetailsCard = ({
>
<CopyableText
value={encodeCIP129Identifier({
txID: `22${drepId}`,
bech32Prefix: "drep",
txID: `${isScriptBased ? "23" : "22"}${drepId}`,
bech32Prefix: isScriptBased ? "drep_script" : "drep",
})}
dataTestId="copy-cip-129-drep-id-button"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const StyledTab = styled((props: StyledTabProps) => (
}));

export const DashboardGovernanceActions = () => {
const { debouncedSearchText, ...dataActionsBarProps } = useDataActionsBar();
const { debouncedSearchText, isAdjusting, ...dataActionsBarProps } =
useDataActionsBar();
const { chosenFilters, chosenSorting } = dataActionsBarProps;
const { voter } = useGetVoterInfo();
const { isMobile } = useScreenDimension();
Expand All @@ -81,6 +82,7 @@ export const DashboardGovernanceActions = () => {
filters: queryFilters,
sorting: chosenSorting,
searchPhrase: debouncedSearchText,
enabled: !isAdjusting,
});

const { state } = useLocation();
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/organisms/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const Footer = () => {
}}
>
<Typography fontWeight={500} variant="caption">
{t("footer.copyright")}
{t("footer.copyright", { year: new Date().getFullYear() })}
</Typography>
<Box
sx={{
Expand Down
6 changes: 6 additions & 0 deletions govtool/frontend/src/context/dataActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useLocation } from "react-router-dom";
import { useDebounce } from "@hooks";

interface DataActionsBarContextType {
isAdjusting: boolean;
chosenFilters: string[];
chosenFiltersLength: number;
chosenSorting: string;
Expand All @@ -40,6 +41,7 @@ interface ProviderProps {
}

const DataActionsBarProvider: FC<ProviderProps> = ({ children }) => {
const [isAdjusting, setIsAdjusting] = useState<boolean>(true);
const [searchText, setSearchText] = useState<string>("");
const debouncedSearchText = useDebounce(searchText, 300);
const [filtersOpen, setFiltersOpen] = useState<boolean>(false);
Expand All @@ -62,6 +64,7 @@ const DataActionsBarProvider: FC<ProviderProps> = ({ children }) => {
setSearchText("");
setChosenFilters([]);
setChosenSorting("");
setIsAdjusting(false);
}, []);

const userMovedToDifferentAppArea =
Expand All @@ -74,6 +77,7 @@ const DataActionsBarProvider: FC<ProviderProps> = ({ children }) => {
pathname.includes("governance_actions/category");

useEffect(() => {
setIsAdjusting(true);
if (
(!pathname.includes("drep_directory") &&
userMovedToDifferentAppArea &&
Expand All @@ -90,6 +94,7 @@ const DataActionsBarProvider: FC<ProviderProps> = ({ children }) => {

const contextValue = useMemo(
() => ({
isAdjusting,
chosenFilters,
chosenFiltersLength: chosenFilters.length,
chosenSorting,
Expand All @@ -106,6 +111,7 @@ const DataActionsBarProvider: FC<ProviderProps> = ({ children }) => {
sortOpen,
}),
[
isAdjusting,
chosenFilters,
chosenSorting,
debouncedSearchText,
Expand Down
4 changes: 4 additions & 0 deletions govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const useGetProposalsQuery = ({
filters = [],
searchPhrase,
sorting,
enabled,
}: GetProposalsArguments) => {
const { dRepID, pendingTransaction } = useCardano();
const { voter } = useGetVoterInfo();
Expand Down Expand Up @@ -42,6 +43,9 @@ export const useGetProposalsQuery = ({
pendingTransaction.vote?.transactionHash,
],
fetchProposals,
{
enabled,
},
);

const proposals = Object.values(groupByType(data) ?? []);
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
}
},
"footer": {
"copyright": "© 2024 Intersect MBO",
"copyright": "© {{year}} Intersect MBO",
"privacyPolicy": "Privacy policy",
"termOfService": "Terms of Use"
},
Expand Down
39 changes: 2 additions & 37 deletions govtool/frontend/src/services/requests/getDRepList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { bech32 } from "bech32";
import {
type Infinite,
type DRepStatus,
Expand All @@ -7,11 +6,7 @@ import {
DrepDataDTO,
} from "@models";
import { API } from "../API";
import {
decodeCIP129Identifier,
encodeCIP129Identifier,
mapDtoToDrep,
} from "@/utils";
import { dRepSearchPhraseProcessor, mapDtoToDrep } from "@/utils";

export type GetDRepListArguments = {
filters?: string[];
Expand All @@ -30,37 +25,7 @@ export const getDRepList = async ({
searchPhrase: rawSearchPhrase = "",
status = [],
}: GetDRepListArguments): Promise<Infinite<DRepData>> => {
// DBSync contains wrong representation of DRep view for script based DReps,
// but it's still used by BE
const searchPhraseProcessor = async () => {
try {
if (rawSearchPhrase.startsWith("drep_script")) {
const { words } = bech32.decode(rawSearchPhrase);
return bech32.encode("drep", words);
}
if (rawSearchPhrase.startsWith("drep")) {
const decodedIdentifier = decodeCIP129Identifier(rawSearchPhrase);
if (decodedIdentifier) {
const isCIP129Identifier = decodedIdentifier.txID.startsWith("22");
if (isCIP129Identifier) {
return encodeCIP129Identifier({
txID: decodedIdentifier.txID.slice(2),
bech32Prefix: "drep",
});
}
return encodeCIP129Identifier({
txID: decodedIdentifier.txID,
bech32Prefix: "drep",
});
}
}
return rawSearchPhrase;
} catch (e) {
return rawSearchPhrase;
}
};

const searchPhrase = await searchPhraseProcessor();
const searchPhrase = await dRepSearchPhraseProcessor(rawSearchPhrase);

const response = await API.get<Infinite<DrepDataDTO>>("/drep/list", {
params: {
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/services/requests/getProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type GetProposalsArguments = {
pageSize?: number;
sorting?: string;
searchPhrase?: string;
enabled?: boolean;
};

export const getProposals = async ({
Expand Down
Loading
Loading