Skip to content

Commit 8be0f19

Browse files
authored
Merge pull request #2962 from IntersectMBO/test
GovTool - v2.0.11-patch4
2 parents 610310f + bbed5d9 commit 8be0f19

File tree

15 files changed

+757
-138
lines changed

15 files changed

+757
-138
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ changes.
1414

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

1819
### Fixed
1920

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

2426
### Changed
2527

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

2932
### Removed
3033

docs/GOVERNANCE_ACTION_SUBMISSION.md

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ interface GovernanceAction {
3333
references: [{ label: string; uri: string }];
3434
}
3535

36-
interface InfoProps {
37-
hash: string;
36+
type VotingAnchor = {
3837
url: string;
38+
hash: string;
3939
}
4040

41-
interface TreasuryProps {
42-
amount: string;
43-
hash: string;
41+
type InfoProps = VotingAnchor;
42+
43+
type TreasuryProps {
4444
withdrawals: { receivingAddress: string; amount: string }[];
45-
}
45+
} & VotingAnchor;
4646

4747
type ProtocolParamsUpdate = {
4848
adaPerUtxo: string;
@@ -77,14 +77,44 @@ type ProtocolParamsUpdate = {
7777
treasuryGrowthRate: UnitInterval;
7878
};
7979

80-
interface ProtocolParameterChangeProps {
80+
type ProtocolParameterChangeProps {
8181
prevGovernanceActionHash: string;
8282
prevGovernanceActionIndex: number;
83-
url: string;
84-
hash: string;
85-
8683
protocolParamsUpdate: Partial<ProtocolParamsUpdate>;
87-
}
84+
} & VotingAnchor;
85+
86+
type HardForkInitiationProps = {
87+
prevGovernanceActionHash: string;
88+
prevGovernanceActionIndex: number;
89+
major: number;
90+
minor: number;
91+
} & VotingAnchor;
92+
93+
type NewConstitutionProps = {
94+
prevGovernanceActionHash: string;
95+
prevGovernanceActionIndex: number;
96+
constitutionUrl: string;
97+
constitutionHash: string;
98+
scriptHash: string;
99+
} & VotingAnchor;
100+
101+
type UpdateCommitteeProps = {
102+
prevGovernanceActionHash?: string;
103+
prevGovernanceActionIndex?: number;
104+
quorumThreshold: QuorumThreshold;
105+
newCommittee?: CommitteeToAdd[];
106+
removeCommittee?: string[];
107+
} & VotingAnchor;
108+
109+
type CommitteeToAdd = {
110+
expiryEpoch: number;
111+
committee: string;
112+
};
113+
114+
type QuorumThreshold = {
115+
numerator: number;
116+
denominator: number;
117+
};
88118

89119
const createGovernanceActionJsonLD: (
90120
governanceAction: GovernanceAction
@@ -100,6 +130,22 @@ const buildTreasuryGovernanceAction: (
100130
treasuryProps: TreasuryProps
101131
) => Promise<VotingProposalBuilder | undefined>;
102132

133+
const buildProtocolParameterChangeGovernanceAction: (
134+
protocolParameterChangeProps: ProtocolParameterChangeProps
135+
) => Promise<VotingProposalBuilder | undefined>;
136+
137+
const buildHardForkInitiationGovernanceAction: (
138+
hardForkInitiationProps: HardForkInitiationProps
139+
) => Promise<VotingProposalBuilder | undefined>;
140+
141+
const buildNewConstitutionGovernanceAction: (
142+
newConstitutionProps: NewConstitutionProps
143+
) => Promise<VotingProposalBuilder | undefined>;
144+
145+
const buildUpdateCommitteeGovernanceAction: (
146+
updateCommitteeProps: UpdateCommitteeProps
147+
) => Promise<VotingProposalBuilder | undefined>;
148+
103149
const buildSignSubmitConwayCertTx: (params: {
104150
govActionBuilder: VotingProposalBuilder;
105151
type: "createGovAction";
@@ -165,44 +211,37 @@ const {
165211
buildNewInfoGovernanceAction,
166212
buildProtocolParameterChangeGovernanceAction,
167213
buildHardForkInitiationGovernanceAction,
214+
buildTreasuryGovernanceAction,
215+
buildNewConstitutionGovernanceAction,
216+
buildUpdateCommitteeGovernanceAction,
217+
buildNoConfidenceGovernanceAction,
168218
} = useCardano();
169219

170220
// Info Governance Action
171-
const govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
221+
let govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
172222

173-
// sign and submit the transaction
174-
await buildSignSubmitConwayCertTx({
175-
govActionBuilder,
176-
type: "createGovAction",
177-
});
223+
// And for the other type of governance actions:
178224

179-
// Treasury Governance Action
180-
const { buildTreasuryGovernanceAction } = useCardano();
225+
govActionBuilder = await buildNoConfidenceGovernanceAction({ hash, url });
181226

182227
// hash of the generated Governance Action metadata, url of the metadata, amount of the transaction, receiving address is the stake key address
183-
const govActionBuilder = await buildTreasuryGovernanceAction({
228+
govActionBuilder = await buildTreasuryGovernanceAction({
184229
hash,
185230
url,
186231
withdrawals: [{ amount, receivingAddress }],
187232
});
188233

189-
// Protocol Parameter Change Governance Action
190-
const { buildProtocolParameterChangeGovernanceAction } = useCardano();
191-
192234
// 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
193-
const govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
235+
govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
194236
prevGovernanceActionHash,
195237
prevGovernanceActionIndex,
196238
url,
197239
hash,
198240
protocolParamsUpdate,
199241
});
200242

201-
// Hard Fork Initiation Governance Action
202-
const { buildHardForkInitiationGovernanceAction } = useCardano();
203-
204243
// 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
205-
const govActionBuilder = await buildHardForkInitiationGovernanceAction({
244+
govActionBuilder = await buildHardForkInitiationGovernanceAction({
206245
prevGovernanceActionHash,
207246
prevGovernanceActionIndex,
208247
url,
@@ -211,6 +250,24 @@ const govActionBuilder = await buildHardForkInitiationGovernanceAction({
211250
minor,
212251
});
213252

253+
// 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
254+
govActionBuilder = await buildNewConstitutionGovernanceAction({
255+
prevGovernanceActionHash,
256+
prevGovernanceActionIndex,
257+
constitutionUrl,
258+
constitutionHash,
259+
scriptHash,
260+
});
261+
262+
// 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
263+
govActionBuilder = await buildUpdateCommitteeGovernanceAction({
264+
prevGovernanceActionHash,
265+
prevGovernanceActionIndex,
266+
quorumThreshold,
267+
newCommittee,
268+
removeCommittee,
269+
});
270+
214271
// sign and submit the transaction
215272
await buildSignSubmitConwayCertTx({
216273
govActionBuilder,

govtool/backend/sql/get-network-metrics.sql

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ DRepDistr AS (
2121
CurrentEpoch AS (
2222
SELECT MAX(no) AS no FROM epoch
2323
),
24+
CommitteeMembers AS (
25+
SELECT DISTINCT ON (cm.committee_hash_id)
26+
cr.id,
27+
block.time,
28+
encode(cold_key_hash.raw, 'hex') cold_key,
29+
encode(hot_key_hash.raw, 'hex') hot_key
30+
FROM committee_registration cr
31+
JOIN tx ON tx.id = cr.tx_id
32+
JOIN block ON block.id = tx.block_id
33+
JOIN committee_hash cold_key_hash ON cr.cold_key_id = cold_key_hash.id
34+
JOIN committee_hash hot_key_hash ON cr.hot_key_id = hot_key_hash.id
35+
JOIN committee_member cm ON cm.committee_hash_id = cold_key_hash.id OR cm.committee_hash_id = hot_key_hash.id
36+
LEFT JOIN committee_de_registration cdr ON cdr.cold_key_id = cold_key_hash.id
37+
CROSS JOIN CurrentEpoch
38+
WHERE
39+
cdr.id IS NULL AND cm.expiration_epoch > CurrentEpoch.no
40+
),
41+
NoOfCommitteeMembers AS (
42+
SELECT COUNT(*) total FROM CommitteeMembers
43+
),
2444
ActiveDRepBoundaryEpoch AS (
2545
SELECT epoch_no - drep_activity AS epoch_no FROM DRepActivity
2646
),
@@ -187,9 +207,6 @@ AlwaysNoConfidenceVotingPower AS (
187207
TotalDRepDistr AS (
188208
SELECT SUM(COALESCE(amount, 0))::bigint total_drep_distr FROM drep_distr where epoch_no = (SELECT no from CurrentEpoch)
189209
),
190-
CommitteeMembersCount AS (
191-
SELECT COUNT(*) AS no_of_committee_members FROM committee_member
192-
),
193210
LatestGovAction AS (
194211
SELECT gap.id, gap.enacted_epoch
195212
FROM gov_action_proposal gap
@@ -223,7 +240,7 @@ SELECT
223240
AlwaysAbstainVotingPower.amount AS always_abstain_voting_power,
224241
AlwaysNoConfidenceVotingPower.amount AS always_no_confidence_voting_power,
225242
meta.network_name,
226-
CommitteeMembersCount.no_of_committee_members,
243+
NoOfCommitteeMembers.total no_of_committee_members,
227244
CommitteeThreshold.quorum_numerator,
228245
CommitteeThreshold.quorum_denominator
229246
FROM CurrentEpoch
@@ -242,6 +259,6 @@ CROSS JOIN TotalActiveCIP119CompliantDReps
242259
CROSS JOIN TotalRegisteredDirectVoters
243260
CROSS JOIN AlwaysAbstainVotingPower
244261
CROSS JOIN AlwaysNoConfidenceVotingPower
245-
CROSS JOIN CommitteeMembersCount
262+
CROSS JOIN NoOfCommitteeMembers
246263
CROSS JOIN CommitteeThreshold
247264
CROSS JOIN meta;

govtool/frontend/package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@hookform/resolvers": "^3.3.1",
3030
"@intersect.mbo/govtool-outcomes-pillar-ui": "1.0.0",
3131
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
32-
"@intersect.mbo/pdf-ui": "^0.5.11",
32+
"@intersect.mbo/pdf-ui": "^0.6.0",
3333
"@mui/icons-material": "^5.14.3",
3434
"@mui/material": "^5.14.4",
3535
"@rollup/plugin-babel": "^6.0.4",

govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/CreateGovernanceActionForm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export const CreateGovernanceActionForm = ({
4747
type! as
4848
| GovernanceActionType.InfoAction
4949
| GovernanceActionType.TreasuryWithdrawals
50+
| GovernanceActionType.NewCommittee
51+
| GovernanceActionType.NewConstitution
52+
| GovernanceActionType.NoConfidence
5053
],
5154
).some(
5255
(field) => !watch(field as unknown as Parameters<typeof watch>[0]),
@@ -67,6 +70,9 @@ export const CreateGovernanceActionForm = ({
6770
type! as
6871
| GovernanceActionType.InfoAction
6972
| GovernanceActionType.TreasuryWithdrawals
73+
| GovernanceActionType.NewCommittee
74+
| GovernanceActionType.NewConstitution
75+
| GovernanceActionType.NoConfidence
7076
],
7177
).map(([key, field]) => {
7278
const fieldProps = {

0 commit comments

Comments
 (0)