Skip to content

Commit 4b2ba70

Browse files
authored
Merge pull request #2963 from IntersectMBO/staging
GovTool - v2.0.11-patch4
2 parents d176709 + 8be0f19 commit 4b2ba70

File tree

25 files changed

+880
-330
lines changed

25 files changed

+880
-330
lines changed

.github/workflows/merge.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818

1919
jobs:
2020
check-build-deploy:
21-
environment: ${{ (github.ref_name == 'main' && 'prod-govtool') || (github.ref_name == 'staging' && 'pre-prod-govtool') || (github.ref_name == 'test' && 'qa-govtool') || (github.ref_name == 'develop' && 'dev-govtool') }}
21+
environment: ${{ (github.ref_name == 'main' && 'prod-govtool') || (github.ref_name == 'staging' && 'pre-prod-govtool') || (github.ref_name == 'test' && 'qa-govtool') || (github.ref_name == 'develop' && 'dev-govtool') }}
2222
strategy:
2323
fail-fast: false
2424
matrix:
@@ -87,7 +87,6 @@ jobs:
8787
set -o pipefail
8888
sudo chmod +x lint.sh && ./lint.sh 2>&1 | tee code_lint_output.txt
8989
90-
9190
- name: Unit tests
9291
id: unit_tests
9392
run: |
@@ -135,6 +134,7 @@ jobs:
135134
NPMRC_TOKEN=${{ secrets.NPMRC_TOKEN }}
136135
VITE_USERSNAP_SPACE_API_KEY=${{ secrets.VITE_USERSNAP_SPACE_API_KEY }}
137136
VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED=${{ secrets.VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED }}
137+
VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED=${{ secrets.VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED }}
138138
VITE_PDF_API_URL=${{ secrets.VITE_PDF_API_URL }}
139139
VITE_IPFS_GATEWAY=${{ secrets.IPFS_GATEWAY }}
140140
VITE_IPFS_PROJECT_ID=${{ secrets.IPFS_PROJECT_ID }}
@@ -151,15 +151,15 @@ jobs:
151151
- name: Scan Docker image with Dockle
152152
id: dockle
153153
run: |
154-
wget -q https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz
155-
tar zxf dockle_0.4.14_Linux-64bit.tar.gz
156-
sudo mv dockle /usr/local/bin
154+
wget -q https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz
155+
tar zxf dockle_0.4.14_Linux-64bit.tar.gz
156+
sudo mv dockle /usr/local/bin
157157
158-
dockle --exit-code 1 --exit-level fatal --format json -ak GHC_RELEASE_KEY -ak CABAL_INSTALL_RELEASE_KEY -ak STACK_RELEASE_KEY -ak KEY_SHA512 --input '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' --output ${{ matrix.workdir }}/dockle_scan_output.json
159-
echo " dockle exited w/ $?"
160-
cat ${{ matrix.workdir }}/dockle_scan_output.json
158+
dockle --exit-code 1 --exit-level fatal --format json -ak GHC_RELEASE_KEY -ak CABAL_INSTALL_RELEASE_KEY -ak STACK_RELEASE_KEY -ak KEY_SHA512 --input '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' --output ${{ matrix.workdir }}/dockle_scan_output.json
159+
echo " dockle exited w/ $?"
160+
cat ${{ matrix.workdir }}/dockle_scan_output.json
161161
162-
echo "outcome=success" >> $GITHUB_OUTPUT
162+
echo "outcome=success" >> $GITHUB_OUTPUT
163163
164164
- name: Push Docker image to GHCR
165165
run: |

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/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARG VITE_SENTRY_DSN
99
ARG NPMRC_TOKEN
1010
ARG VITE_USERSNAP_SPACE_API_KEY
1111
ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true'
12+
ARG VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED='false'
1213
ARG VITE_PDF_API_URL
1314
ARG VITE_IPFS_GATEWAY
1415
ARG VITE_IPFS_PROJECT_ID
@@ -26,6 +27,7 @@ RUN \
2627
: "${NPMRC_TOKEN:?Build argument NPMRC_TOKEN is not set}" && \
2728
: "${VITE_USERSNAP_SPACE_API_KEY:?Build argument VITE_USERSNAP_SPACE_API_KEY is not set}" && \
2829
: "${VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED:?Build argument VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED is not set}" && \
30+
: "${VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED:?Build argument VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED is not set}" && \
2931
: "${VITE_IPFS_GATEWAY:?Build argument VITE_IPFS_GATEWAY is not set}" && \
3032
: "${VITE_IPFS_PROJECT_ID:?Build argument VITE_IPFS_PROJECT_ID is not set}"
3133

govtool/frontend/Dockerfile.qovery

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARG VITE_SENTRY_DSN
99
ARG NPMRC_TOKEN
1010
ARG VITE_USERSNAP_SPACE_API_KEY
1111
ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED
12+
ARG VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED
1213
ARG VITE_PDF_API_URL
1314
ARG VITE_IPFS_GATEWAY
1415
ARG VITE_IPFS_PROJECT_ID

0 commit comments

Comments
 (0)