Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --prev-governance-action-tx-id and --prev-governance-action-tx-id optional for create-no-confidence command #753

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -6770,8 +6770,8 @@ Usage: cardano-cli conway governance action create-no-confidence
)
--anchor-url TEXT
--anchor-data-hash HASH
--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--out-file FILE

Create a no confidence proposal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Usage: cardano-cli conway governance action create-no-confidence
)
--anchor-url TEXT
--anchor-data-hash HASH
--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32
[--prev-governance-action-tx-id TXID
--prev-governance-action-index WORD32]
--out-file FILE

Create a no confidence proposal.
Expand Down
Loading