Skip to content

Commit

Permalink
Update create-constitution with --constitution-scipt-hash to allow
Browse files Browse the repository at this point in the history
constitutional scripts
  • Loading branch information
Jimbo4350 committed Feb 19, 2024
1 parent 42a44b4 commit 913a393
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ data GovernanceActionCreateConstitutionCmdArgs era
, proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData)
, constitutionUrl :: !ConstitutionUrl
, constitutionHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData)
, constitutionScript :: !(Maybe ScriptHash)
, outFile :: !(File () Out)
} deriving Show

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pGovernanceActionNewConstitutionCmd era = do
<*> pAnchorDataHash
<*> pConstitutionUrl
<*> pConstitutionHash
<*> optional pConstitutionScriptHash
<*> pFileOutDirection "out-file" "Output filepath of the constitution."
)
$ Opt.progDesc "Create a constitution."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ runGovernanceActionCreateConstitutionCmd
, Cmd.proposalHash
, Cmd.constitutionUrl
, Cmd.constitutionHash
, Cmd.constitutionScript
, Cmd.outFile
} = do

Expand All @@ -179,7 +180,10 @@ runGovernanceActionCreateConstitutionCmd
{ Ledger.anchorUrl = unConstitutionUrl constitutionUrl
, Ledger.anchorDataHash = constitutionHash
}
govAct = ProposeNewConstitution prevGovActId constitutionAnchor
govAct = ProposeNewConstitution
prevGovActId
constitutionAnchor
(toShelleyScriptHash <$> Ledger.maybeToStrictMaybe constitutionScript)
sbe = conwayEraOnwardsToShelleyBasedEra eon
proposalProcedure = createProposalProcedure sbe networkId deposit depositStakeCredential govAct proposalAnchor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ validateTxCertificates _ [] = return TxCertificatesNone
validateTxCertificates era certsAndScriptWitnesses = cardanoEraConstraints era $ do
supported <- conjureWitness era TxCertificatesValidationNotSupported
let certs = map fst certsAndScriptWitnesses
reqWits = Map.fromList $ mapMaybe convert certsAndScriptWitnesses
reqWits = mapMaybe convert certsAndScriptWitnesses
pure $ TxCertificates supported certs $ BuildTxWith reqWits
where
convert
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 @@ -6098,6 +6098,7 @@ Usage: cardano-cli conway governance action create-constitution
--anchor-data-hash HASH
--constitution-url TEXT
--constitution-hash HASH
[--constitution-script-hash HASH]
--out-file FILE

Create a constitution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Usage: cardano-cli conway governance action create-constitution
--anchor-data-hash HASH
--constitution-url TEXT
--constitution-hash HASH
[--constitution-script-hash HASH]
--out-file FILE

Create a constitution.
Expand Down Expand Up @@ -42,5 +43,8 @@ Available options:
--constitution-hash HASH Hash of the constitution data (obtain it with
"cardano-cli conway governance hash anchor-data
...").
--constitution-script-hash HASH
Constitution script hash (hex-encoded). Obtain it
with "cardano-cli conway governance hash script ...".
--out-file FILE Output filepath of the constitution.
-h,--help Show this help text

0 comments on commit 913a393

Please sign in to comment.