Skip to content

Commit

Permalink
Modify create-no-confidence to make --prev-governance-action-tx-id an…
Browse files Browse the repository at this point in the history
…d --prev-governance-action-index optional
  • Loading branch information
Jimbo4350 committed May 7, 2024
1 parent ba80816 commit dd9066e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data GovernanceActionCmds era
| GovernanceActionCreateNoConfidenceCmd !(GovernanceActionCreateNoConfidenceCmdArgs era)
| GovernanceActionProtocolParametersUpdateCmd !(GovernanceActionProtocolParametersUpdateCmdArgs era)
| GovernanceActionTreasuryWithdrawalCmd !(GovernanceActionTreasuryWithdrawalCmdArgs era)
| GovernanceActionHardforkInitCmd !(GovernanceActionHardforkInitCmdArgs era)
| GovernanceActionHardforkInitCmd !(GovernanceActionHardforkInitCmdArgs era)
| GovernanceActionInfoCmd !(GovernanceActionInfoCmdArgs era)
| GovernanceActionViewCmd !(GovernanceActionViewCmdArgs era)
deriving Show
Expand Down Expand Up @@ -87,15 +87,14 @@ data GovernanceActionInfoCmdArgs era

data GovernanceActionCreateNoConfidenceCmdArgs era
= GovernanceActionCreateNoConfidenceCmdArgs
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !L.Coin
, returnStakeAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, governanceActionId :: !TxId
, governanceActionIndex :: !Word32
, outFile :: !(File () Out)
{ eon :: !(ConwayEraOnwards era)
, networkId :: !L.Network
, deposit :: !L.Coin
, returnStakeAddress :: !StakeIdentifier
, proposalUrl :: !ProposalUrl
, proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData)
, mPrevGovernanceActionId :: !(Maybe (TxId, Word32))
, outFile :: !(File () Out)
} deriving Show

data GovernanceActionProtocolParametersUpdateCmdArgs era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ pGovernanceActionNoConfidenceCmd era = do
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pTxId "prev-governance-action-tx-id" "Txid of the previous governance action."
<*> pWord32 "prev-governance-action-index" "Action index of the previous governance action."
<*> pPreviousGovernanceAction
<*> pFileOutDirection "out-file" "Output filepath of the no confidence proposal."
)
$ Opt.progDesc "Create a no confidence proposal."
Expand Down Expand Up @@ -395,17 +394,17 @@ pNewProtVer = (,) <$> pProtMajor <*> pProtMinor
[ Opt.long "protocol-major-version"
, Opt.metavar "MAJOR"
, Opt.help $ mconcat
["Specify the major protocol version to fork into. It must be the next natural number "
["Specify the major protocol version to fork into. It must be the next natural number "
, "after the current version and must be supported by the node."
]
]
]

pProtMinor :: Parser Natural
pProtMinor =
Opt.option Opt.auto $ mconcat
[ Opt.long "protocol-minor-version"
, Opt.metavar "MINOR"
, Opt.help "Minor protocol version. Must be zero when the major protocol version is increased."
, Opt.help "Minor protocol version. Must be zero when the major protocol version is increased."
]

pPV :: Parser L.ProtVer
Expand Down
15 changes: 6 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ runGovernanceActionCreateNoConfidenceCmd
, Cmd.returnStakeAddress
, Cmd.proposalUrl
, Cmd.proposalHash
, Cmd.governanceActionId
, Cmd.governanceActionIndex
, Cmd.mPrevGovernanceActionId
, Cmd.outFile
} = do
depositStakeCredential
Expand All @@ -131,12 +130,10 @@ runGovernanceActionCreateNoConfidenceCmd
}

let sbe = conwayEraOnwardsToShelleyBasedEra eon
previousGovernanceAction = MotionOfNoConfidence
$ L.SJust
$ shelleyBasedEraConstraints sbe
$ createPreviousGovernanceActionId
governanceActionId
governanceActionIndex
previousGovernanceAction =
MotionOfNoConfidence $ L.maybeToStrictMaybe
$ shelleyBasedEraConstraints sbe
$ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId

proposalProcedure = createProposalProcedure sbe networkId deposit depositStakeCredential previousGovernanceAction proposalAnchor

Expand Down Expand Up @@ -416,4 +413,4 @@ runGovernanceActionHardforkInitCmd

firstExceptT GovernanceActionsCmdWriteFileError . newExceptT
$ conwayEraOnwardsConstraints eon
$ writeFileTextEnvelope outFile (Just "Hardfork initiation proposal") proposalProcedure
$ writeFileTextEnvelope outFile (Just "Hardfork initiation proposal") proposalProcedure

0 comments on commit dd9066e

Please sign in to comment.