Skip to content

Commit

Permalink
#657 Add resignation certificate script-based CC member
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Mar 19, 2024
1 parent df8c56a commit eac7a84
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ data GovernanceCommitteeCreateHotKeyAuthorizationCertificateCmdArgs era =
data GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs era =
GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs
{ eon :: !(ConwayEraOnwards era)
, vkeyColdKeySource :: !(VerificationKeyOrHashOrFile CommitteeColdKey)
, vkeyColdKeySource :: !(VerificationKeyOrHashOrFileOrScriptHash CommitteeColdKey)
, anchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era))))
, outFile :: !(File () Out)
} deriving Show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,19 @@ pGovernanceCommitteeCreateColdKeyResignationCertificateCmd era = do
[ "Create cold key resignation certificate for a Constitutional Committee Member"
]
where
mkParser w = GovernanceCommitteeCreateColdKeyResignationCertificateCmd <$>
(
GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs w <$>
pCommitteeColdVerificationKeyOrHashOrFile <*>
pAnchor <*>
pOutputFile
)
mkParser w =
GovernanceCommitteeCreateColdKeyResignationCertificateCmd <$>
(GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs w <$>
coldVKeyOrFileOrScriptHash <*> pAnchor <*> pOutputFile)
coldVKeyOrFileOrScriptHash =
asum
[ VkhfshKeyHashFile . VerificationKeyOrFile <$> pCommitteeColdVerificationKeyOrFile
, VkhfshKeyHashFile . VerificationKeyHash <$> pCommitteeColdVerificationKeyHash
, VkhfshScriptHash <$>
pScriptHash
"cold-script-hash"
"Cold Native or Plutus script file hash (hex-encoded). Obtain it with \"cardano-cli conway governance hash script ...\"."
]

pAnchor :: Parser (Maybe (L.Anchor L.StandardCrypto))
pAnchor =
Expand Down
18 changes: 9 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Committee.hs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,18 @@ runGovernanceCommitteeColdKeyResignationCertificate :: ()
-> ExceptT GovernanceCommitteeError IO ()
runGovernanceCommitteeColdKeyResignationCertificate
Cmd.GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs
{ Cmd.eon = w
, Cmd.vkeyColdKeySource = coldVkOrHashOrFp
, Cmd.anchor = anchor
, Cmd.outFile = oFp
{ Cmd.eon
, Cmd.vkeyColdKeySource
, Cmd.anchor
, Cmd.outFile
} =
conwayEraOnwardsConstraints w $ do
CommitteeColdKeyHash coldVKHash <- modifyError GovernanceCommitteeCmdKeyReadError $
readVerificationKeyOrHashOrTextEnvFile AsCommitteeColdKey coldVkOrHashOrFp
conwayEraOnwardsConstraints eon $ do
coldVKeyCred <- modifyError GovernanceCommitteeCmdKeyReadError $
readVerificaitonKeyOrHashOrFileOrScriptHash AsCommitteeColdKey unCommitteeColdKeyHash vkeyColdKeySource

makeCommitteeColdkeyResignationCertificate (CommitteeColdkeyResignationRequirements w coldVKHash anchor)
makeCommitteeColdkeyResignationCertificate (CommitteeColdkeyResignationRequirements eon coldVKeyCred anchor)
& textEnvelopeToJSON (Just genKeyDelegCertDesc)
& writeLazyByteStringFile oFp
& writeLazyByteStringFile outFile
& firstExceptT GovernanceCommitteeCmdTextEnvWriteError . newExceptT

where
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -6402,6 +6402,7 @@ Usage: cardano-cli conway governance committee create-cold-key-resignation-certi
( --cold-verification-key STRING
| --cold-verification-key-file FILE
| --cold-verification-key-hash STRING
| --cold-script-hash HASH
)
[--resignation-metadata-url TEXT
--resignation-metadata-hash HASH]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Usage: cardano-cli conway governance committee create-cold-key-resignation-certi
( --cold-verification-key STRING
| --cold-verification-key-file FILE
| --cold-verification-key-hash STRING
| --cold-script-hash HASH
)
[--resignation-metadata-url TEXT
--resignation-metadata-hash HASH]
Expand All @@ -16,6 +17,9 @@ Available options:
Filepath of the Consitutional Committee cold key.
--cold-verification-key-hash STRING
Constitutional Committee key hash (hex-encoded).
--cold-script-hash HASH Cold Native or Plutus script file hash (hex-encoded).
Obtain it with "cardano-cli conway governance hash
script ...".
--resignation-metadata-url TEXT
Constitutional Committee cold key resignation
certificate URL
Expand Down

0 comments on commit eac7a84

Please sign in to comment.