From 8e8c0702d2190bb562c76335cf91f8e271a672ca Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Mon, 30 Sep 2024 12:07:14 -0600 Subject: [PATCH 01/10] implement `stake_reg_deleg_cert` certificate generation This certificate registers a stake address and delegates to a pool simultaneously: From CDDL: stake_reg_deleg_cert = (11, stake_credential, pool_keyhash, coin) add golden test for `stake_reg_deleg_cert` add golden test for `stake_reg_deleg_cert` update golden files Update StakeAddress.hs pretiffy register and delegate to a pool --- .../CLI/EraBased/Commands/StakeAddress.hs | 8 ++++ .../CLI/EraBased/Options/StakeAddress.hs | 23 +++++++++++ .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 31 +++++++++++++++ .../Test/Golden/Governance/StakeAddress.hs | 26 +++++++++++++ .../registerAddressDelegateToPool.cert | 5 +++ .../cardano-cli-golden/files/golden/help.cli | 38 +++++++++++++++++++ .../golden/help/conway_stake-address.cli | 6 +++ ...egistration-and-delegation-certificate.cli | 38 +++++++++++++++++++ .../golden/help/latest_stake-address.cli | 6 +++ ...egistration-and-delegation-certificate.cli | 38 +++++++++++++++++++ 10 files changed, 219 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-delegation-certificate.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-delegation-certificate.cli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs index fb5ed4b194..2a53a5d207 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs @@ -59,6 +59,12 @@ data StakeAddressCmds era StakeIdentifier (Maybe Coin) (File () Out) + | StakeAddressRegistrationAndDelegationCertificateCmd + (ConwayEraOnwards era) + StakeIdentifier + (VerificationKeyOrHashOrFile StakePoolKey) + Coin + (File () Out) deriving Show renderStakeAddressCmds :: StakeAddressCmds era -> Text @@ -71,3 +77,5 @@ renderStakeAddressCmds = \case StakeAddressStakeAndVoteDelegationCertificateCmd{} -> "stake-address stake-and-vote-delegation-certificate" StakeAddressStakeDelegationCertificateCmd{} -> "stake-address stake-delegation-certificate" StakeAddressVoteDelegationCertificateCmd{} -> "stake-address vote-delegation-certificate" + StakeAddressRegistrationAndDelegationCertificateCmd{} -> "stake-address registration-and-stake-delegation-certificate" + \ No newline at end of file diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 8757b5fd75..612606d313 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -36,6 +36,7 @@ pStakeAddressCmds era envCli = , pStakeAddressStakeDelegationCertificateCmd era , pStakeAddressStakeAndVoteDelegationCertificateCmd era , pStakeAddressVoteDelegationCertificateCmd era + , pStakeAddressRegistrationAndDelegationCertificateCmd era ] pStakeAddressKeyGenCmd @@ -206,3 +207,25 @@ pStakeAddressVoteDelegationCertificateCmd era = do [ "Create a stake address vote delegation certificate, which when submitted in a transaction " , "delegates stake to a DRep." ] + +pStakeAddressRegistrationAndDelegationCertificateCmd + :: () + => CardanoEra era + -> Maybe (Parser (StakeAddressCmds era)) +pStakeAddressRegistrationAndDelegationCertificateCmd era = do + w <- forEraMaybeEon era + pure + $ subParser "registration-and-delegation-certificate" + $ Opt.info + ( StakeAddressRegistrationAndDelegationCertificateCmd w + <$> pStakeIdentifier Nothing + <*> pStakePoolVerificationKeyOrHashOrFile Nothing + <*> pKeyRegistDeposit + <*> pOutputFile + ) + $ Opt.progDesc + $ mconcat + [ "Create a stake address registration and delegation certificate, which when submitted in a transaction " + , "registers a stake address and delegates stake to a stake pool." + ] + diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index d4bb27e9fa..0d86dd8a2f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -15,6 +15,7 @@ module Cardano.CLI.EraBased.Run.StakeAddress , runStakeAddressStakeDelegationCertificateCmd , runStakeAddressDeregistrationCertificateCmd , runStakeAddressRegistrationCertificateCmd + , runStakeAddressRegistrationAndDelegationCertificateCmd ) where @@ -67,6 +68,8 @@ runStakeAddressCmds = \case runStakeAddressVoteDelegationCertificateCmd w stakeIdentifier voteDelegationTarget outputFp StakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp -> runStakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp + StakeAddressRegistrationAndDelegationCertificateCmd w stakeIdentifier poolVKeyOrHashOrFile deposit outFp -> + runStakeAddressRegistrationAndDelegationCertificateCmd w stakeIdentifier poolVKeyOrHashOrFile deposit outFp runStakeAddressKeyGenCmd :: () @@ -325,3 +328,31 @@ runStakeAddressDeregistrationCertificateCmd sbe stakeVerifier mDeposit oFp = do where deregCertDesc :: TextEnvelopeDescr deregCertDesc = "Stake Address Deregistration Certificate" + +runStakeAddressRegistrationAndDelegationCertificateCmd + :: () + => ConwayEraOnwards era + -> StakeIdentifier + -> VerificationKeyOrHashOrFile StakePoolKey + -- ^ Delegatee stake pool verification key or verification key file or id + -> Lovelace + -> File () Out + -> ExceptT StakeAddressCmdError IO () +runStakeAddressRegistrationAndDelegationCertificateCmd w stakeVerifier poolVKeyOrHashOrFile deposit outFp = + conwayEraOnwardsConstraints w $ do + StakePoolKeyHash poolStakeVKeyHash <- + modifyError StakeAddressCmdReadKeyFileError $ + readVerificationKeyOrHashOrFile AsStakePoolKey poolVKeyOrHashOrFile + + stakeCred <- + getStakeCredentialFromIdentifier stakeVerifier + & firstExceptT StakeAddressCmdStakeCredentialError + + let deleg = L.DelegStake poolStakeVKeyHash + + let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred deleg deposit + + firstExceptT StakeAddressCmdWriteFileError + . newExceptT + $ writeLazyByteStringFile outFp + $ textEnvelopeToJSON (Just @TextEnvelopeDescr "Stake address registration and stake delegation certificate") certificate diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index f9bc5164b9..31c5387297 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -130,3 +130,29 @@ hprop_golden_conway_stakeaddress_delegate_pool_and_drep = ] H.diffFileVsGoldenFile delegFile delegGold + +hprop_golden_conway_stakeaddress_register_and_delegate_pool :: Property +hprop_golden_conway_stakeaddress_register_and_delegate_pool = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/stake.vkey" + vkeyPool <- noteInputFile "test/cardano-cli-golden/files/input/conway/poolCold.vkey" + certFile <- H.noteTempFile tempDir "cert" + certGold <- + H.note "test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert" + + void $ + execCardanoCLI + [ "conway" + , "stake-address" + , "registration-and-delegation-certificate" + , "--stake-verification-key-file" + , vkeyFile + , "--cold-verification-key-file" + , vkeyPool + , "--key-reg-deposit-amt" + , "2000000" + , "--out-file" + , certFile + ] + + H.diffFileVsGoldenFile certFile certGold \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert new file mode 100644 index 0000000000..09313ce10b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert @@ -0,0 +1,5 @@ +{ + "type": "CertificateConway", + "description": "Stake address registration and stake delegation certificate", + "cborHex": "840b8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab01581cc27cf021914a2b3bcb286d3d741979083422378c577fe757702b69881a001e8480" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index a484484cab..693dc130b3 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7307,6 +7307,7 @@ Usage: cardano-cli conway stake-address | stake-delegation-certificate | stake-and-vote-delegation-certificate | vote-delegation-certificate + | registration-and-delegation-certificate ) Stake address commands. @@ -7420,6 +7421,24 @@ Usage: cardano-cli conway stake-address vote-delegation-certificate Create a stake address vote delegation certificate, which when submitted in a transaction delegates stake to a DRep. +Usage: cardano-cli conway stake-address registration-and-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and delegation certificate, which when + submitted in a transaction registers a stake address and delegates stake to a + stake pool. + Usage: cardano-cli conway stake-pool ( registration-certificate | deregistration-certificate @@ -9239,6 +9258,7 @@ Usage: cardano-cli latest stake-address | stake-delegation-certificate | stake-and-vote-delegation-certificate | vote-delegation-certificate + | registration-and-delegation-certificate ) Stake address commands. @@ -9352,6 +9372,24 @@ Usage: cardano-cli latest stake-address vote-delegation-certificate Create a stake address vote delegation certificate, which when submitted in a transaction delegates stake to a DRep. +Usage: cardano-cli latest stake-address registration-and-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and delegation certificate, which when + submitted in a transaction registers a stake address and delegates stake to a + stake pool. + Usage: cardano-cli latest stake-pool ( registration-certificate | deregistration-certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli index da11f4b04e..60432ead78 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli @@ -7,6 +7,7 @@ Usage: cardano-cli conway stake-address | stake-delegation-certificate | stake-and-vote-delegation-certificate | vote-delegation-certificate + | registration-and-delegation-certificate ) Stake address commands. @@ -33,3 +34,8 @@ Available commands: Create a stake address vote delegation certificate, which when submitted in a transaction delegates stake to a DRep. + registration-and-delegation-certificate + Create a stake address registration and delegation + certificate, which when submitted in a transaction + registers a stake address and delegates stake to a + stake pool. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-delegation-certificate.cli new file mode 100644 index 0000000000..2dafca1ab6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-delegation-certificate.cli @@ -0,0 +1,38 @@ +Usage: cardano-cli conway stake-address registration-and-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and delegation certificate, which when + submitted in a transaction registers a stake address and delegates stake to a + stake pool. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --stake-pool-verification-key STRING + Stake pool verification key (Bech32 or hex-encoded). + --cold-verification-key-file FILEPATH + Filepath of the stake pool verification key. + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli index ab064b3ee2..f9ee830179 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli @@ -7,6 +7,7 @@ Usage: cardano-cli latest stake-address | stake-delegation-certificate | stake-and-vote-delegation-certificate | vote-delegation-certificate + | registration-and-delegation-certificate ) Stake address commands. @@ -33,3 +34,8 @@ Available commands: Create a stake address vote delegation certificate, which when submitted in a transaction delegates stake to a DRep. + registration-and-delegation-certificate + Create a stake address registration and delegation + certificate, which when submitted in a transaction + registers a stake address and delegates stake to a + stake pool. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-delegation-certificate.cli new file mode 100644 index 0000000000..ea54daa06d --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-delegation-certificate.cli @@ -0,0 +1,38 @@ +Usage: cardano-cli latest stake-address registration-and-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and delegation certificate, which when + submitted in a transaction registers a stake address and delegates stake to a + stake pool. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --stake-pool-verification-key STRING + Stake pool verification key (Bech32 or hex-encoded). + --cold-verification-key-file FILEPATH + Filepath of the stake pool verification key. + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text From 0ca39358614490004c425467c61f6b3f2517a390 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Mon, 30 Sep 2024 14:12:05 -0600 Subject: [PATCH 02/10] formatting with fourmolu --- .../CLI/EraBased/Commands/StakeAddress.hs | 1 - .../CLI/EraBased/Options/StakeAddress.hs | 1 - .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 30 +++++++++++++------ .../Test/Golden/Governance/StakeAddress.hs | 5 ++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs index 2a53a5d207..4604a3d59f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs @@ -78,4 +78,3 @@ renderStakeAddressCmds = \case StakeAddressStakeDelegationCertificateCmd{} -> "stake-address stake-delegation-certificate" StakeAddressVoteDelegationCertificateCmd{} -> "stake-address vote-delegation-certificate" StakeAddressRegistrationAndDelegationCertificateCmd{} -> "stake-address registration-and-stake-delegation-certificate" - \ No newline at end of file diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 612606d313..0705f2afdf 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -228,4 +228,3 @@ pStakeAddressRegistrationAndDelegationCertificateCmd era = do [ "Create a stake address registration and delegation certificate, which when submitted in a transaction " , "registers a stake address and delegates stake to a stake pool." ] - diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index 0d86dd8a2f..682f5c4d57 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -68,8 +68,18 @@ runStakeAddressCmds = \case runStakeAddressVoteDelegationCertificateCmd w stakeIdentifier voteDelegationTarget outputFp StakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp -> runStakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp - StakeAddressRegistrationAndDelegationCertificateCmd w stakeIdentifier poolVKeyOrHashOrFile deposit outFp -> - runStakeAddressRegistrationAndDelegationCertificateCmd w stakeIdentifier poolVKeyOrHashOrFile deposit outFp + StakeAddressRegistrationAndDelegationCertificateCmd + w + stakeIdentifier + poolVKeyOrHashOrFile + deposit + outFp -> + runStakeAddressRegistrationAndDelegationCertificateCmd + w + stakeIdentifier + poolVKeyOrHashOrFile + deposit + outFp runStakeAddressKeyGenCmd :: () @@ -338,21 +348,23 @@ runStakeAddressRegistrationAndDelegationCertificateCmd -> Lovelace -> File () Out -> ExceptT StakeAddressCmdError IO () -runStakeAddressRegistrationAndDelegationCertificateCmd w stakeVerifier poolVKeyOrHashOrFile deposit outFp = +runStakeAddressRegistrationAndDelegationCertificateCmd w stakeVerifier poolVKeyOrHashOrFile deposit outFp = conwayEraOnwardsConstraints w $ do StakePoolKeyHash poolStakeVKeyHash <- modifyError StakeAddressCmdReadKeyFileError $ readVerificationKeyOrHashOrFile AsStakePoolKey poolVKeyOrHashOrFile - + stakeCred <- getStakeCredentialFromIdentifier stakeVerifier - & firstExceptT StakeAddressCmdStakeCredentialError - + & firstExceptT StakeAddressCmdStakeCredentialError + let deleg = L.DelegStake poolStakeVKeyHash let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred deleg deposit firstExceptT StakeAddressCmdWriteFileError - . newExceptT - $ writeLazyByteStringFile outFp - $ textEnvelopeToJSON (Just @TextEnvelopeDescr "Stake address registration and stake delegation certificate") certificate + . newExceptT + $ writeLazyByteStringFile outFp + $ textEnvelopeToJSON + (Just @TextEnvelopeDescr "Stake address registration and stake delegation certificate") + certificate diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index 31c5387297..348f537e45 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -138,7 +138,8 @@ hprop_golden_conway_stakeaddress_register_and_delegate_pool = vkeyPool <- noteInputFile "test/cardano-cli-golden/files/input/conway/poolCold.vkey" certFile <- H.noteTempFile tempDir "cert" certGold <- - H.note "test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert" + H.note + "test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPool.cert" void $ execCardanoCLI @@ -155,4 +156,4 @@ hprop_golden_conway_stakeaddress_register_and_delegate_pool = , certFile ] - H.diffFileVsGoldenFile certFile certGold \ No newline at end of file + H.diffFileVsGoldenFile certFile certGold From 11b2342b8ed366bab7ebe09b053277d3da1ccf02 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Mon, 30 Sep 2024 19:26:56 -0600 Subject: [PATCH 03/10] Implement `vote_reg_deleg_cert` --- .../CLI/EraBased/Commands/StakeAddress.hs | 7 +++ .../CLI/EraBased/Options/StakeAddress.hs | 22 ++++++++++ .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 41 +++++++++++++++++ .../Test/Golden/Governance/StakeAddress.hs | 27 ++++++++++++ .../registerAddressDelegateToDrep.cert | 5 +++ .../cardano-cli-golden/files/golden/help.cli | 44 +++++++++++++++++++ .../golden/help/conway_stake-address.cli | 6 +++ ...ration-and-vote-delegation-certificate.cli | 44 +++++++++++++++++++ .../golden/help/latest_stake-address.cli | 6 +++ ...ration-and-vote-delegation-certificate.cli | 44 +++++++++++++++++++ 10 files changed, 246 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToDrep.cert create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-vote-delegation-certificate.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-vote-delegation-certificate.cli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs index 4604a3d59f..7bd87ac739 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs @@ -65,6 +65,12 @@ data StakeAddressCmds era (VerificationKeyOrHashOrFile StakePoolKey) Coin (File () Out) + | StakeAddressRegistrationAndVoteDelegationCertificateCmd + (ConwayEraOnwards era) + StakeIdentifier + VoteDelegationTarget + Coin + (File () Out) deriving Show renderStakeAddressCmds :: StakeAddressCmds era -> Text @@ -78,3 +84,4 @@ renderStakeAddressCmds = \case StakeAddressStakeDelegationCertificateCmd{} -> "stake-address stake-delegation-certificate" StakeAddressVoteDelegationCertificateCmd{} -> "stake-address vote-delegation-certificate" StakeAddressRegistrationAndDelegationCertificateCmd{} -> "stake-address registration-and-stake-delegation-certificate" + StakeAddressRegistrationAndVoteDelegationCertificateCmd{} -> "stake-address registration-and-vote-delegation-certificate" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 0705f2afdf..8995d3b15b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -37,6 +37,7 @@ pStakeAddressCmds era envCli = , pStakeAddressStakeAndVoteDelegationCertificateCmd era , pStakeAddressVoteDelegationCertificateCmd era , pStakeAddressRegistrationAndDelegationCertificateCmd era + , pStakeAddressRegistrationAndVoteDelegationCertificateCmd era ] pStakeAddressKeyGenCmd @@ -228,3 +229,24 @@ pStakeAddressRegistrationAndDelegationCertificateCmd era = do [ "Create a stake address registration and delegation certificate, which when submitted in a transaction " , "registers a stake address and delegates stake to a stake pool." ] + +pStakeAddressRegistrationAndVoteDelegationCertificateCmd + :: () + => CardanoEra era + -> Maybe (Parser (StakeAddressCmds era)) +pStakeAddressRegistrationAndVoteDelegationCertificateCmd era = do + w <- forEraMaybeEon era + pure + $ subParser "registration-and-vote-delegation-certificate" + $ Opt.info + ( StakeAddressRegistrationAndVoteDelegationCertificateCmd w + <$> pStakeIdentifier Nothing + <*> pVoteDelegationTarget + <*> pKeyRegistDeposit + <*> pOutputFile + ) + $ Opt.progDesc + $ mconcat + [ "Create a stake address registration and vote delegation certificate, which when submitted in a transaction " + , "registers a stake address and delegates votes to a DRep or pre-defined voting option." + ] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index 682f5c4d57..563e081121 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -80,6 +80,18 @@ runStakeAddressCmds = \case poolVKeyOrHashOrFile deposit outFp + StakeAddressRegistrationAndVoteDelegationCertificateCmd + w + stakeIdentifier + voteDelegationTarget + keydeposit + outFp -> + runStakeAddressRegistrationAndVoteDelegationCertificateCmd + w + stakeIdentifier + voteDelegationTarget + keydeposit + outFp runStakeAddressKeyGenCmd :: () @@ -368,3 +380,32 @@ runStakeAddressRegistrationAndDelegationCertificateCmd w stakeVerifier poolVKeyO $ textEnvelopeToJSON (Just @TextEnvelopeDescr "Stake address registration and stake delegation certificate") certificate + +runStakeAddressRegistrationAndVoteDelegationCertificateCmd + :: () + => ConwayEraOnwards era + -> StakeIdentifier + -> VoteDelegationTarget + -> Lovelace + -> File () Out + -> ExceptT StakeAddressCmdError IO () +runStakeAddressRegistrationAndVoteDelegationCertificateCmd w stakeVerifier voteDelegationTarget keydeposit outFp = + conwayEraOnwardsConstraints w $ do + stakeCred <- + getStakeCredentialFromIdentifier stakeVerifier + & firstExceptT StakeAddressCmdStakeCredentialError + + drep <- + readVoteDelegationTarget voteDelegationTarget + & firstExceptT StakeAddressCmdDelegationError + + let deleg = L.DelegVote drep + + let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred deleg keydeposit + + firstExceptT StakeAddressCmdWriteFileError + . newExceptT + $ writeLazyByteStringFile outFp + $ textEnvelopeToJSON + (Just @TextEnvelopeDescr "Stake address registration and vote delegation certificate") + certificate diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index 348f537e45..695d68520e 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -157,3 +157,30 @@ hprop_golden_conway_stakeaddress_register_and_delegate_pool = ] H.diffFileVsGoldenFile certFile certGold + +hprop_golden_conway_stakeaddress_register_and_delegate_vote :: Property +hprop_golden_conway_stakeaddress_register_and_delegate_vote = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/stake.vkey" + vkeyDrepFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/drep.vkey" + certFile <- H.noteTempFile tempDir "cert" + certGold <- + H.note + "test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToDrep.cert" + + void $ + execCardanoCLI + [ "conway" + , "stake-address" + , "registration-and-vote-delegation-certificate" + , "--stake-verification-key-file" + , vkeyFile + , "--drep-verification-key-file" + , vkeyDrepFile + , "--key-reg-deposit-amt" + , "2000000" + , "--out-file" + , certFile + ] + + H.diffFileVsGoldenFile certFile certGold diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToDrep.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToDrep.cert new file mode 100644 index 0000000000..275ab3510a --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToDrep.cert @@ -0,0 +1,5 @@ +{ + "type": "CertificateConway", + "description": "Stake address registration and vote delegation certificate", + "cborHex": "840c8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab018200581ce68f9ee70599cb93d9f60678f9c6463c01938c27d9820c7bf93887a51a001e8480" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 693dc130b3..517c1fe0a8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7308,6 +7308,7 @@ Usage: cardano-cli conway stake-address | stake-and-vote-delegation-certificate | vote-delegation-certificate | registration-and-delegation-certificate + | registration-and-vote-delegation-certificate ) Stake address commands. @@ -7439,6 +7440,27 @@ Usage: cardano-cli conway stake-address registration-and-delegation-certificate submitted in a transaction registers a stake address and delegates stake to a stake pool. +Usage: cardano-cli conway stake-address registration-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and vote delegation certificate, which + when submitted in a transaction registers a stake address and delegates votes + to a DRep or pre-defined voting option. + Usage: cardano-cli conway stake-pool ( registration-certificate | deregistration-certificate @@ -9259,6 +9281,7 @@ Usage: cardano-cli latest stake-address | stake-and-vote-delegation-certificate | vote-delegation-certificate | registration-and-delegation-certificate + | registration-and-vote-delegation-certificate ) Stake address commands. @@ -9390,6 +9413,27 @@ Usage: cardano-cli latest stake-address registration-and-delegation-certificate submitted in a transaction registers a stake address and delegates stake to a stake pool. +Usage: cardano-cli latest stake-address registration-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and vote delegation certificate, which + when submitted in a transaction registers a stake address and delegates votes + to a DRep or pre-defined voting option. + Usage: cardano-cli latest stake-pool ( registration-certificate | deregistration-certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli index 60432ead78..c8bbfbe83e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli @@ -8,6 +8,7 @@ Usage: cardano-cli conway stake-address | stake-and-vote-delegation-certificate | vote-delegation-certificate | registration-and-delegation-certificate + | registration-and-vote-delegation-certificate ) Stake address commands. @@ -39,3 +40,8 @@ Available commands: certificate, which when submitted in a transaction registers a stake address and delegates stake to a stake pool. + registration-and-vote-delegation-certificate + Create a stake address registration and vote + delegation certificate, which when submitted in a + transaction registers a stake address and delegates + votes to a DRep or pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-vote-delegation-certificate.cli new file mode 100644 index 0000000000..4f5ad4f0e4 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-and-vote-delegation-certificate.cli @@ -0,0 +1,44 @@ +Usage: cardano-cli conway stake-address registration-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and vote delegation certificate, which + when submitted in a transaction registers a stake address and delegates votes + to a DRep or pre-defined voting option. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --drep-script-hash HASH DRep script hash (hex-encoded). Obtain it with + "cardano-cli hash script ...". + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILEPATH + Filepath of the DRep verification key. + --drep-key-hash HASH DRep verification key hash (either Bech32-encoded or + hex-encoded). + --always-abstain Abstain from voting on all proposals. + --always-no-confidence Always vote no confidence + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli index f9ee830179..6e321acbe3 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli @@ -8,6 +8,7 @@ Usage: cardano-cli latest stake-address | stake-and-vote-delegation-certificate | vote-delegation-certificate | registration-and-delegation-certificate + | registration-and-vote-delegation-certificate ) Stake address commands. @@ -39,3 +40,8 @@ Available commands: certificate, which when submitted in a transaction registers a stake address and delegates stake to a stake pool. + registration-and-vote-delegation-certificate + Create a stake address registration and vote + delegation certificate, which when submitted in a + transaction registers a stake address and delegates + votes to a DRep or pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-vote-delegation-certificate.cli new file mode 100644 index 0000000000..018bbbc659 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-and-vote-delegation-certificate.cli @@ -0,0 +1,44 @@ +Usage: cardano-cli latest stake-address registration-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration and vote delegation certificate, which + when submitted in a transaction registers a stake address and delegates votes + to a DRep or pre-defined voting option. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --drep-script-hash HASH DRep script hash (hex-encoded). Obtain it with + "cardano-cli hash script ...". + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILEPATH + Filepath of the DRep verification key. + --drep-key-hash HASH DRep verification key hash (either Bech32-encoded or + hex-encoded). + --always-abstain Abstain from voting on all proposals. + --always-no-confidence Always vote no confidence + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text From 71c8b87aec64c278208008eaa5f754755f10bfc2 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara <64222734+CarlosLopezDeLara@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:00:57 -0600 Subject: [PATCH 04/10] Update cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Hurlin --- cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index 563e081121..42c013f1d8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -370,9 +370,9 @@ runStakeAddressRegistrationAndDelegationCertificateCmd w stakeVerifier poolVKeyO getStakeCredentialFromIdentifier stakeVerifier & firstExceptT StakeAddressCmdStakeCredentialError - let deleg = L.DelegStake poolStakeVKeyHash + let delegatee = L.DelegStake poolStakeVKeyHash - let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred deleg deposit + let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred delegatee deposit firstExceptT StakeAddressCmdWriteFileError . newExceptT From 0bb30fe82251bea81e9bbdc7ab050b2eeb564457 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara <64222734+CarlosLopezDeLara@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:01:16 -0600 Subject: [PATCH 05/10] Update cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Hurlin --- .../cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index 695d68520e..b66a2d0e74 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -131,6 +131,8 @@ hprop_golden_conway_stakeaddress_delegate_pool_and_drep = H.diffFileVsGoldenFile delegFile delegGold +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway stakeaddress register and delegate pool/"'@ hprop_golden_conway_stakeaddress_register_and_delegate_pool :: Property hprop_golden_conway_stakeaddress_register_and_delegate_pool = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do From 3171dc2641ccc0bfc0a5a1c85090b67d21756310 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara <64222734+CarlosLopezDeLara@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:14:26 -0600 Subject: [PATCH 06/10] Update cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Hurlin --- .../cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index b66a2d0e74..ee8ec4c621 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -160,6 +160,8 @@ hprop_golden_conway_stakeaddress_register_and_delegate_pool = H.diffFileVsGoldenFile certFile certGold +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway stakeaddress register and delegate vote/"'@ hprop_golden_conway_stakeaddress_register_and_delegate_vote :: Property hprop_golden_conway_stakeaddress_register_and_delegate_vote = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do From 6430b6e0ccef63b3797f77bcba4132c0e636b75b Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Tue, 1 Oct 2024 17:26:03 -0600 Subject: [PATCH 07/10] integrate `stake_vote_reg_deleg_cert ` --- .../CLI/EraBased/Commands/StakeAddress.hs | 8 +++ .../CLI/EraBased/Options/StakeAddress.hs | 23 ++++++++ .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 53 +++++++++++++++++- .../cardano-cli-golden/files/golden/help.cli | 54 ++++++++++++++++++ .../golden/help/conway_stake-address.cli | 7 +++ ...-stake-and-vote-delegation-certificate.cli | 56 +++++++++++++++++++ .../golden/help/latest_stake-address.cli | 7 +++ ...-stake-and-vote-delegation-certificate.cli | 56 +++++++++++++++++++ 8 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs index 7bd87ac739..f5c9ad1a63 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs @@ -71,6 +71,13 @@ data StakeAddressCmds era VoteDelegationTarget Coin (File () Out) + | StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd + (ConwayEraOnwards era) + StakeIdentifier + (VerificationKeyOrHashOrFile StakePoolKey) + VoteDelegationTarget + Coin + (File () Out) deriving Show renderStakeAddressCmds :: StakeAddressCmds era -> Text @@ -85,3 +92,4 @@ renderStakeAddressCmds = \case StakeAddressVoteDelegationCertificateCmd{} -> "stake-address vote-delegation-certificate" StakeAddressRegistrationAndDelegationCertificateCmd{} -> "stake-address registration-and-stake-delegation-certificate" StakeAddressRegistrationAndVoteDelegationCertificateCmd{} -> "stake-address registration-and-vote-delegation-certificate" + StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd{} -> "stake-address registration-stake-and-vote-delegation-certificate" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 8995d3b15b..67b348bc43 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -38,6 +38,7 @@ pStakeAddressCmds era envCli = , pStakeAddressVoteDelegationCertificateCmd era , pStakeAddressRegistrationAndDelegationCertificateCmd era , pStakeAddressRegistrationAndVoteDelegationCertificateCmd era + , pStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd era ] pStakeAddressKeyGenCmd @@ -250,3 +251,25 @@ pStakeAddressRegistrationAndVoteDelegationCertificateCmd era = do [ "Create a stake address registration and vote delegation certificate, which when submitted in a transaction " , "registers a stake address and delegates votes to a DRep or pre-defined voting option." ] + +pStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd + :: () + => CardanoEra era + -> Maybe (Parser (StakeAddressCmds era)) +pStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd era = do + w <- forEraMaybeEon era + pure + $ subParser "registration-stake-and-vote-delegation-certificate" + $ Opt.info + ( StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd w + <$> pStakeIdentifier Nothing + <*> pStakePoolVerificationKeyOrHashOrFile Nothing + <*> pVoteDelegationTarget + <*> pKeyRegistDeposit + <*> pOutputFile + ) + $ Opt.progDesc + $ mconcat + [ "Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction " + , "registers a stake address, delgates stake to a pool and and delegates votes to a DRep or pre-defined voting option." + ] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index 42c013f1d8..40173e210e 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -16,6 +16,7 @@ module Cardano.CLI.EraBased.Run.StakeAddress , runStakeAddressDeregistrationCertificateCmd , runStakeAddressRegistrationCertificateCmd , runStakeAddressRegistrationAndDelegationCertificateCmd + , runStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd ) where @@ -92,6 +93,20 @@ runStakeAddressCmds = \case voteDelegationTarget keydeposit outFp + StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd + w + stakeIdentifier + poolVKeyOrHashOrFile + voteDelegationTarget + keydeposit + outFp -> + runStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd + w + stakeIdentifier + poolVKeyOrHashOrFile + voteDelegationTarget + keydeposit + outFp runStakeAddressKeyGenCmd :: () @@ -399,9 +414,43 @@ runStakeAddressRegistrationAndVoteDelegationCertificateCmd w stakeVerifier voteD readVoteDelegationTarget voteDelegationTarget & firstExceptT StakeAddressCmdDelegationError - let deleg = L.DelegVote drep + let delegatee = L.DelegVote drep + + let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred delegatee keydeposit + + firstExceptT StakeAddressCmdWriteFileError + . newExceptT + $ writeLazyByteStringFile outFp + $ textEnvelopeToJSON + (Just @TextEnvelopeDescr "Stake address registration and vote delegation certificate") + certificate + +runStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd + :: () + => ConwayEraOnwards era + -> StakeIdentifier + -> VerificationKeyOrHashOrFile StakePoolKey + -> VoteDelegationTarget + -> Lovelace + -> File () Out + -> ExceptT StakeAddressCmdError IO () +runStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd w stakeVerifier poolVKeyOrHashOrFile voteDelegationTarget keydeposit outFp = + conwayEraOnwardsConstraints w $ do + StakePoolKeyHash poolStakeVKeyHash <- + modifyError StakeAddressCmdReadKeyFileError $ + readVerificationKeyOrHashOrFile AsStakePoolKey poolVKeyOrHashOrFile + + stakeCred <- + getStakeCredentialFromIdentifier stakeVerifier + & firstExceptT StakeAddressCmdStakeCredentialError + + drep <- + readVoteDelegationTarget voteDelegationTarget + & firstExceptT StakeAddressCmdDelegationError + + let delegatee = L.DelegStakeVote poolStakeVKeyHash drep - let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred deleg keydeposit + let certificate = makeStakeAddressAndDRepDelegationCertificate w stakeCred delegatee keydeposit firstExceptT StakeAddressCmdWriteFileError . newExceptT diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 517c1fe0a8..557088d4fc 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7309,6 +7309,7 @@ Usage: cardano-cli conway stake-address | vote-delegation-certificate | registration-and-delegation-certificate | registration-and-vote-delegation-certificate + | registration-stake-and-vote-delegation-certificate ) Stake address commands. @@ -7461,6 +7462,32 @@ Usage: cardano-cli conway stake-address registration-and-vote-delegation-certifi when submitted in a transaction registers a stake address and delegates votes to a DRep or pre-defined voting option. +Usage: cardano-cli conway stake-address registration-stake-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration, stake delegation and vote delegation + certificate, which when submitted in a transaction registers a stake address, + delgates stake to a pool and and delegates votes to a DRep or pre-defined + voting option. + Usage: cardano-cli conway stake-pool ( registration-certificate | deregistration-certificate @@ -9282,6 +9309,7 @@ Usage: cardano-cli latest stake-address | vote-delegation-certificate | registration-and-delegation-certificate | registration-and-vote-delegation-certificate + | registration-stake-and-vote-delegation-certificate ) Stake address commands. @@ -9434,6 +9462,32 @@ Usage: cardano-cli latest stake-address registration-and-vote-delegation-certifi when submitted in a transaction registers a stake address and delegates votes to a DRep or pre-defined voting option. +Usage: cardano-cli latest stake-address registration-stake-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration, stake delegation and vote delegation + certificate, which when submitted in a transaction registers a stake address, + delgates stake to a pool and and delegates votes to a DRep or pre-defined + voting option. + Usage: cardano-cli latest stake-pool ( registration-certificate | deregistration-certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli index c8bbfbe83e..c5ca95d04a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli @@ -9,6 +9,7 @@ Usage: cardano-cli conway stake-address | vote-delegation-certificate | registration-and-delegation-certificate | registration-and-vote-delegation-certificate + | registration-stake-and-vote-delegation-certificate ) Stake address commands. @@ -45,3 +46,9 @@ Available commands: delegation certificate, which when submitted in a transaction registers a stake address and delegates votes to a DRep or pre-defined voting option. + registration-stake-and-vote-delegation-certificate + Create a stake address registration, stake delegation + and vote delegation certificate, which when submitted + in a transaction registers a stake address, delgates + stake to a pool and and delegates votes to a DRep or + pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli new file mode 100644 index 0000000000..32a942b363 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli @@ -0,0 +1,56 @@ +Usage: cardano-cli conway stake-address registration-stake-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration, stake delegation and vote delegation + certificate, which when submitted in a transaction registers a stake address, + delgates stake to a pool and and delegates votes to a DRep or pre-defined + voting option. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --stake-pool-verification-key STRING + Stake pool verification key (Bech32 or hex-encoded). + --cold-verification-key-file FILEPATH + Filepath of the stake pool verification key. + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --drep-script-hash HASH DRep script hash (hex-encoded). Obtain it with + "cardano-cli hash script ...". + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILEPATH + Filepath of the DRep verification key. + --drep-key-hash HASH DRep verification key hash (either Bech32-encoded or + hex-encoded). + --always-abstain Abstain from voting on all proposals. + --always-no-confidence Always vote no confidence + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli index 6e321acbe3..0dc6b1ab37 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli @@ -9,6 +9,7 @@ Usage: cardano-cli latest stake-address | vote-delegation-certificate | registration-and-delegation-certificate | registration-and-vote-delegation-certificate + | registration-stake-and-vote-delegation-certificate ) Stake address commands. @@ -45,3 +46,9 @@ Available commands: delegation certificate, which when submitted in a transaction registers a stake address and delegates votes to a DRep or pre-defined voting option. + registration-stake-and-vote-delegation-certificate + Create a stake address registration, stake delegation + and vote delegation certificate, which when submitted + in a transaction registers a stake address, delgates + stake to a pool and and delegates votes to a DRep or + pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli new file mode 100644 index 0000000000..76d1749b1c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli @@ -0,0 +1,56 @@ +Usage: cardano-cli latest stake-address registration-stake-and-vote-delegation-certificate + ( --stake-verification-key STRING + | --stake-verification-key-file FILEPATH + | --stake-key-hash HASH + | --stake-script-file FILEPATH + | --stake-address ADDRESS + ) + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + ( --drep-script-hash HASH + | --drep-verification-key STRING + | --drep-verification-key-file FILEPATH + | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence + ) + --key-reg-deposit-amt NATURAL + --out-file FILEPATH + + Create a stake address registration, stake delegation and vote delegation + certificate, which when submitted in a transaction registers a stake address, + delgates stake to a pool and and delegates votes to a DRep or pre-defined + voting option. + +Available options: + --stake-verification-key STRING + Stake verification key (Bech32 or hex-encoded). + --stake-verification-key-file FILEPATH + Filepath of the staking verification key. + --stake-key-hash HASH Stake verification key hash (hex-encoded). + --stake-script-file FILEPATH + Filepath of the staking script. + --stake-address ADDRESS Target stake address (bech32 format). + --stake-pool-verification-key STRING + Stake pool verification key (Bech32 or hex-encoded). + --cold-verification-key-file FILEPATH + Filepath of the stake pool verification key. + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --drep-script-hash HASH DRep script hash (hex-encoded). Obtain it with + "cardano-cli hash script ...". + --drep-verification-key STRING + DRep verification key (Bech32 or hex-encoded). + --drep-verification-key-file FILEPATH + Filepath of the DRep verification key. + --drep-key-hash HASH DRep verification key hash (either Bech32-encoded or + hex-encoded). + --always-abstain Abstain from voting on all proposals. + --always-no-confidence Always vote no confidence + --key-reg-deposit-amt NATURAL + Key registration deposit amount. + --out-file FILEPATH The output file. + -h,--help Show this help text From 6b1bb32da72eae92fefaeeeb44c3ff78cce4ef4b Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Tue, 1 Oct 2024 17:53:04 -0600 Subject: [PATCH 08/10] add test for registration-stake-and-vote-delegation-certificate --- .../Test/Golden/Governance/StakeAddress.hs | 32 +++++++++++++++++++ .../registerAddressDelegateToPoolAndDrep.cert | 5 +++ 2 files changed, 37 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPoolAndDrep.cert diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index ee8ec4c621..83c5b15e76 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -188,3 +188,35 @@ hprop_golden_conway_stakeaddress_register_and_delegate_vote = ] H.diffFileVsGoldenFile certFile certGold + +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway stakeaddress register and delegate stake and vote/"'@ +hprop_golden_conway_stakeaddress_register_and_delegate_stake_and_vote :: Property +hprop_golden_conway_stakeaddress_register_and_delegate_stake_and_vote = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + vkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/stake.vkey" + vkeyPool <- noteInputFile "test/cardano-cli-golden/files/input/conway/poolCold.vkey" + vkeyDrepFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/drep.vkey" + certFile <- H.noteTempFile tempDir "cert" + certGold <- + H.note + "test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPoolAndDrep.cert" + + void $ + execCardanoCLI + [ "conway" + , "stake-address" + , "registration-stake-and-vote-delegation-certificate" + , "--stake-verification-key-file" + , vkeyFile + , "--cold-verification-key-file" + , vkeyPool + , "--drep-verification-key-file" + , vkeyDrepFile + , "--key-reg-deposit-amt" + , "2000000" + , "--out-file" + , certFile + ] + + H.diffFileVsGoldenFile certFile certGold \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPoolAndDrep.cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPoolAndDrep.cert new file mode 100644 index 0000000000..3de4e57e93 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/stakeaddress/registerAddressDelegateToPoolAndDrep.cert @@ -0,0 +1,5 @@ +{ + "type": "CertificateConway", + "description": "Stake address registration and vote delegation certificate", + "cborHex": "850d8200581cef1785cf18928f8353c90e76b7a8fc60855472d31a0ea1c1c774ab01581cc27cf021914a2b3bcb286d3d741979083422378c577fe757702b69888200581ce68f9ee70599cb93d9f60678f9c6463c01938c27d9820c7bf93887a51a001e8480" +} From fa3cb3870168b0ab3637f55e3f2ae0ace1f30bb9 Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Tue, 1 Oct 2024 18:01:30 -0600 Subject: [PATCH 09/10] Update StakeAddress.hs --- .../cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs index 83c5b15e76..8dcc952a93 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/StakeAddress.hs @@ -219,4 +219,4 @@ hprop_golden_conway_stakeaddress_register_and_delegate_stake_and_vote = , certFile ] - H.diffFileVsGoldenFile certFile certGold \ No newline at end of file + H.diffFileVsGoldenFile certFile certGold From 7b4d70cf082b08d939f4d8cfcd479d5e43ae808d Mon Sep 17 00:00:00 2001 From: Carlos LopezDeLara Date: Tue, 1 Oct 2024 19:17:01 -0600 Subject: [PATCH 10/10] fix typo --- .../src/Cardano/CLI/EraBased/Options/StakeAddress.hs | 2 +- cardano-cli/test/cardano-cli-golden/files/golden/help.cli | 8 ++++---- .../files/golden/help/conway_stake-address.cli | 2 +- ...registration-stake-and-vote-delegation-certificate.cli | 4 ++-- .../files/golden/help/latest_stake-address.cli | 2 +- ...registration-stake-and-vote-delegation-certificate.cli | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 67b348bc43..a68aa0e68b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -271,5 +271,5 @@ pStakeAddressRegistrationStakeAndVoteDelegationCertificateCmd era = do $ Opt.progDesc $ mconcat [ "Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction " - , "registers a stake address, delgates stake to a pool and and delegates votes to a DRep or pre-defined voting option." + , "registers a stake address, delgates stake to a pool, and delegates votes to a DRep or pre-defined voting option." ] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index 557088d4fc..f783c44d4c 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -7485,8 +7485,8 @@ Usage: cardano-cli conway stake-address registration-stake-and-vote-delegation-c Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, - delgates stake to a pool and and delegates votes to a DRep or pre-defined - voting option. + delgates stake to a pool, and delegates votes to a DRep or pre-defined voting + option. Usage: cardano-cli conway stake-pool ( registration-certificate @@ -9485,8 +9485,8 @@ Usage: cardano-cli latest stake-address registration-stake-and-vote-delegation-c Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, - delgates stake to a pool and and delegates votes to a DRep or pre-defined - voting option. + delgates stake to a pool, and delegates votes to a DRep or pre-defined voting + option. Usage: cardano-cli latest stake-pool ( registration-certificate diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli index c5ca95d04a..c75e238b4a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address.cli @@ -50,5 +50,5 @@ Available commands: Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, delgates - stake to a pool and and delegates votes to a DRep or + stake to a pool, and delegates votes to a DRep or pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli index 32a942b363..484ca20bf8 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_registration-stake-and-vote-delegation-certificate.cli @@ -21,8 +21,8 @@ Usage: cardano-cli conway stake-address registration-stake-and-vote-delegation-c Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, - delgates stake to a pool and and delegates votes to a DRep or pre-defined - voting option. + delgates stake to a pool, and delegates votes to a DRep or pre-defined voting + option. Available options: --stake-verification-key STRING diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli index 0dc6b1ab37..d696d86d57 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address.cli @@ -50,5 +50,5 @@ Available commands: Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, delgates - stake to a pool and and delegates votes to a DRep or + stake to a pool, and delegates votes to a DRep or pre-defined voting option. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli index 76d1749b1c..a7a58efcfb 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-address_registration-stake-and-vote-delegation-certificate.cli @@ -21,8 +21,8 @@ Usage: cardano-cli latest stake-address registration-stake-and-vote-delegation-c Create a stake address registration, stake delegation and vote delegation certificate, which when submitted in a transaction registers a stake address, - delgates stake to a pool and and delegates votes to a DRep or pre-defined - voting option. + delgates stake to a pool, and delegates votes to a DRep or pre-defined voting + option. Available options: --stake-verification-key STRING