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 - v2.0.11-patch4 #2962

Merged
merged 19 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
94fdb4a
fix: update intercept logic for usersnap and bucket
kneerose Feb 11, 2025
d7a16a8
chore: remove sensitive AWS credentials from user snap test
kneerose Feb 11, 2025
deb388b
Merge pull request #2947 from IntersectMBO/fix/user-snap-issue
kneerose Feb 11, 2025
beb6448
feat(#2258): add support for submitting all governance action types
MSzalowski Feb 5, 2025
b2a8233
feat(#2258): add support for submitting new governance actions inside…
MSzalowski Feb 7, 2025
1019178
fix: ts error on outcomes pillar
MSzalowski Feb 11, 2025
88813eb
Merge pull request #2912 from IntersectMBO/feat/2258-propose-new-cons…
MSzalowski Feb 11, 2025
495648b
chore: bump @intersect.mbo/pdf-ui to v0.6.0
MSzalowski Feb 10, 2025
d2c32d4
Merge pull request #2942 from IntersectMBO/chore/bump-pdf-ui-to-v-0.6.0
MSzalowski Feb 11, 2025
bd816f0
Merge pull request #2952 from IntersectMBO/staging
MSzalowski Feb 11, 2025
aa7e279
Merge pull request #2953 from IntersectMBO/test
MSzalowski Feb 11, 2025
3eeae3b
Enable VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED flag on test/qa stack
mesudip Feb 11, 2025
a142afd
Merge pull request #2954 from IntersectMBO/develop
MSzalowski Feb 11, 2025
1e4c45e
Merge pull request #2955 from IntersectMBO/fix/pillar-flag
mesudip Feb 11, 2025
5fc1371
Merge pull request #2958 from IntersectMBO/staging
MSzalowski Feb 11, 2025
3d86187
Merge pull request #2959 from IntersectMBO/develop
MSzalowski Feb 11, 2025
6098aa8
fix(#2948): committee members calculation
MSzalowski Feb 11, 2025
93ca8ff
Merge pull request #2960 from IntersectMBO/fix/2948-default-vote-valu…
MSzalowski Feb 11, 2025
bbed5d9
Merge pull request #2961 from IntersectMBO/develop
MSzalowski Feb 12, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ changes.

- Add metadata url and hash to drep details [Issue 2911](https://github.com/IntersectMBO/govtool/issues/2911)
- Add CC votes percentages, not voted and Ratification threshold
- Add support for submitting all 7 governance action types [Issue 2258](https://github.com/IntersectMBO/govtool/issues/2258)

### Fixed

- Fix calculating votes counting for governance actions
- Fix crashing backend on unhandled missing proposal from vote [Issue 2920](https://github.com/IntersectMBO/govtool/issues/2920)
- Remove abstain votes (not auto abstain) from total DRep stake
- Fix counting committee members [Issue 2948](https://github.com/IntersectMBO/govtool/issues/2948)

### Changed

- Change threshold visual representation in governance action votes
- Resize governance action details columns
- Update @intersect.mbo/pdf-ui to v0.6.0

### Removed

Expand Down
113 changes: 85 additions & 28 deletions docs/GOVERNANCE_ACTION_SUBMISSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ interface GovernanceAction {
references: [{ label: string; uri: string }];
}

interface InfoProps {
hash: string;
type VotingAnchor = {
url: string;
hash: string;
}

interface TreasuryProps {
amount: string;
hash: string;
type InfoProps = VotingAnchor;

type TreasuryProps {
withdrawals: { receivingAddress: string; amount: string }[];
}
} & VotingAnchor;

type ProtocolParamsUpdate = {
adaPerUtxo: string;
Expand Down Expand Up @@ -77,14 +77,44 @@ type ProtocolParamsUpdate = {
treasuryGrowthRate: UnitInterval;
};

interface ProtocolParameterChangeProps {
type ProtocolParameterChangeProps {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
url: string;
hash: string;

protocolParamsUpdate: Partial<ProtocolParamsUpdate>;
}
} & VotingAnchor;

type HardForkInitiationProps = {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
major: number;
minor: number;
} & VotingAnchor;

type NewConstitutionProps = {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
constitutionUrl: string;
constitutionHash: string;
scriptHash: string;
} & VotingAnchor;

type UpdateCommitteeProps = {
prevGovernanceActionHash?: string;
prevGovernanceActionIndex?: number;
quorumThreshold: QuorumThreshold;
newCommittee?: CommitteeToAdd[];
removeCommittee?: string[];
} & VotingAnchor;

type CommitteeToAdd = {
expiryEpoch: number;
committee: string;
};

type QuorumThreshold = {
numerator: number;
denominator: number;
};

const createGovernanceActionJsonLD: (
governanceAction: GovernanceAction
Expand All @@ -100,6 +130,22 @@ const buildTreasuryGovernanceAction: (
treasuryProps: TreasuryProps
) => Promise<VotingProposalBuilder | undefined>;

const buildProtocolParameterChangeGovernanceAction: (
protocolParameterChangeProps: ProtocolParameterChangeProps
) => Promise<VotingProposalBuilder | undefined>;

const buildHardForkInitiationGovernanceAction: (
hardForkInitiationProps: HardForkInitiationProps
) => Promise<VotingProposalBuilder | undefined>;

const buildNewConstitutionGovernanceAction: (
newConstitutionProps: NewConstitutionProps
) => Promise<VotingProposalBuilder | undefined>;

const buildUpdateCommitteeGovernanceAction: (
updateCommitteeProps: UpdateCommitteeProps
) => Promise<VotingProposalBuilder | undefined>;

const buildSignSubmitConwayCertTx: (params: {
govActionBuilder: VotingProposalBuilder;
type: "createGovAction";
Expand Down Expand Up @@ -165,44 +211,37 @@ const {
buildNewInfoGovernanceAction,
buildProtocolParameterChangeGovernanceAction,
buildHardForkInitiationGovernanceAction,
buildTreasuryGovernanceAction,
buildNewConstitutionGovernanceAction,
buildUpdateCommitteeGovernanceAction,
buildNoConfidenceGovernanceAction,
} = useCardano();

// Info Governance Action
const govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
let govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });

// sign and submit the transaction
await buildSignSubmitConwayCertTx({
govActionBuilder,
type: "createGovAction",
});
// And for the other type of governance actions:

// Treasury Governance Action
const { buildTreasuryGovernanceAction } = useCardano();
govActionBuilder = await buildNoConfidenceGovernanceAction({ hash, url });

// hash of the generated Governance Action metadata, url of the metadata, amount of the transaction, receiving address is the stake key address
const govActionBuilder = await buildTreasuryGovernanceAction({
govActionBuilder = await buildTreasuryGovernanceAction({
hash,
url,
withdrawals: [{ amount, receivingAddress }],
});

// Protocol Parameter Change Governance Action
const { buildProtocolParameterChangeGovernanceAction } = useCardano();

// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the updated protocol parameters
const govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
url,
hash,
protocolParamsUpdate,
});

// Hard Fork Initiation Governance Action
const { buildHardForkInitiationGovernanceAction } = useCardano();

// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the major and minor numbers of the hard fork initiation
const govActionBuilder = await buildHardForkInitiationGovernanceAction({
govActionBuilder = await buildHardForkInitiationGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
url,
Expand All @@ -211,6 +250,24 @@ const govActionBuilder = await buildHardForkInitiationGovernanceAction({
minor,
});

// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the constitution script hash
govActionBuilder = await buildNewConstitutionGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
constitutionUrl,
constitutionHash,
scriptHash,
});

// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the quorum threshold and the new committee members
govActionBuilder = await buildUpdateCommitteeGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
quorumThreshold,
newCommittee,
removeCommittee,
});

// sign and submit the transaction
await buildSignSubmitConwayCertTx({
govActionBuilder,
Expand Down
27 changes: 22 additions & 5 deletions govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ DRepDistr AS (
CurrentEpoch AS (
SELECT MAX(no) AS no FROM epoch
),
CommitteeMembers AS (
SELECT DISTINCT ON (cm.committee_hash_id)
cr.id,
block.time,
encode(cold_key_hash.raw, 'hex') cold_key,
encode(hot_key_hash.raw, 'hex') hot_key
FROM committee_registration cr
JOIN tx ON tx.id = cr.tx_id
JOIN block ON block.id = tx.block_id
JOIN committee_hash cold_key_hash ON cr.cold_key_id = cold_key_hash.id
JOIN committee_hash hot_key_hash ON cr.hot_key_id = hot_key_hash.id
JOIN committee_member cm ON cm.committee_hash_id = cold_key_hash.id OR cm.committee_hash_id = hot_key_hash.id
LEFT JOIN committee_de_registration cdr ON cdr.cold_key_id = cold_key_hash.id
CROSS JOIN CurrentEpoch
WHERE
cdr.id IS NULL AND cm.expiration_epoch > CurrentEpoch.no
),
NoOfCommitteeMembers AS (
SELECT COUNT(*) total FROM CommitteeMembers
),
ActiveDRepBoundaryEpoch AS (
SELECT epoch_no - drep_activity AS epoch_no FROM DRepActivity
),
Expand Down Expand Up @@ -187,9 +207,6 @@ AlwaysNoConfidenceVotingPower AS (
TotalDRepDistr AS (
SELECT SUM(COALESCE(amount, 0))::bigint total_drep_distr FROM drep_distr where epoch_no = (SELECT no from CurrentEpoch)
),
CommitteeMembersCount AS (
SELECT COUNT(*) AS no_of_committee_members FROM committee_member
),
LatestGovAction AS (
SELECT gap.id, gap.enacted_epoch
FROM gov_action_proposal gap
Expand Down Expand Up @@ -223,7 +240,7 @@ SELECT
AlwaysAbstainVotingPower.amount AS always_abstain_voting_power,
AlwaysNoConfidenceVotingPower.amount AS always_no_confidence_voting_power,
meta.network_name,
CommitteeMembersCount.no_of_committee_members,
NoOfCommitteeMembers.total no_of_committee_members,
CommitteeThreshold.quorum_numerator,
CommitteeThreshold.quorum_denominator
FROM CurrentEpoch
Expand All @@ -242,6 +259,6 @@ CROSS JOIN TotalActiveCIP119CompliantDReps
CROSS JOIN TotalRegisteredDirectVoters
CROSS JOIN AlwaysAbstainVotingPower
CROSS JOIN AlwaysNoConfidenceVotingPower
CROSS JOIN CommitteeMembersCount
CROSS JOIN NoOfCommitteeMembers
CROSS JOIN CommitteeThreshold
CROSS JOIN meta;
10 changes: 5 additions & 5 deletions govtool/frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "1.0.0",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "^0.5.11",
"@intersect.mbo/pdf-ui": "^0.6.0",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const CreateGovernanceActionForm = ({
type! as
| GovernanceActionType.InfoAction
| GovernanceActionType.TreasuryWithdrawals
| GovernanceActionType.NewCommittee
| GovernanceActionType.NewConstitution
| GovernanceActionType.NoConfidence
],
).some(
(field) => !watch(field as unknown as Parameters<typeof watch>[0]),
Expand All @@ -67,6 +70,9 @@ export const CreateGovernanceActionForm = ({
type! as
| GovernanceActionType.InfoAction
| GovernanceActionType.TreasuryWithdrawals
| GovernanceActionType.NewCommittee
| GovernanceActionType.NewConstitution
| GovernanceActionType.NoConfidence
],
).map(([key, field]) => {
const fieldProps = {
Expand Down
Loading