From a3bb67641bd5ea4439d949845b578c001e813924 Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Wed, 23 Oct 2024 18:40:08 +0200 Subject: [PATCH] cardano-testnet | Refactor: use function for creating registration certificate --- .../src/Testnet/Process/Cli/SPO.hs | 8 +- .../RegisterDeregisterStakeAddress.hs | 74 ++++--------------- .../Testnet/Test/Gov/CommitteeAddNew.hs | 28 +++---- .../Cardano/Testnet/Test/Gov/DRepActivity.hs | 25 +++---- .../Testnet/Test/Gov/GovActionTimeout.hs | 28 +++---- .../Cardano/Testnet/Test/Gov/InfoAction.hs | 29 +++----- .../Testnet/Test/Gov/PParamChangeFailsSPO.hs | 31 +++----- .../Test/Gov/ProposeNewConstitution.hs | 30 +++----- .../Testnet/Test/Gov/TreasuryWithdrawal.hs | 30 +++----- 9 files changed, 97 insertions(+), 186 deletions(-) diff --git a/cardano-testnet/src/Testnet/Process/Cli/SPO.hs b/cardano-testnet/src/Testnet/Process/Cli/SPO.hs index 5d7e5db4d2f..e2e7ebc2887 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/SPO.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/SPO.hs @@ -200,10 +200,10 @@ createScriptStakeRegistrationCertificate => TmpAbsolutePath -> AnyCardanoEra -> FilePath -- ^ Script file - -> Int -- ^ Registration deposit amount used only in Conway + -> L.Coin -- ^ Registration deposit amount used only in Conway -> FilePath -- ^ Output file path -> m () -createScriptStakeRegistrationCertificate tempAbsP (AnyCardanoEra cEra) scriptFile deposit outputFp = +createScriptStakeRegistrationCertificate tempAbsP (AnyCardanoEra cEra) scriptFile (L.Coin deposit) outputFp = GHC.withFrozenCallStack $ do let tempAbsPath' = unTmpAbsPath tempAbsP extraArgs = monoidForEraInEon @ConwayEraOnwards cEra $ @@ -221,10 +221,10 @@ createStakeKeyDeregistrationCertificate => TmpAbsolutePath -> ShelleyBasedEra era -> File (VKey StakeKey) In -- ^ Stake verification key file - -> Int -- ^ deposit amount used only in Conway + -> L.Coin -- ^ deposit amount used only in Conway -> FilePath -- ^ Output file path -> m () -createStakeKeyDeregistrationCertificate tempAbsP sbe (File stakeVerKey) deposit outputFp = +createStakeKeyDeregistrationCertificate tempAbsP sbe (File stakeVerKey) (L.Coin deposit) outputFp = GHC.withFrozenCallStack $ do let tempAbsPath' = unTmpAbsPath tempAbsP extraArgs = monoidForEraInEon @ConwayEraOnwards (toCardanoEra sbe) $ diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction/RegisterDeregisterStakeAddress.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction/RegisterDeregisterStakeAddress.hs index dbf8940c4f8..c953145085b 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction/RegisterDeregisterStakeAddress.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction/RegisterDeregisterStakeAddress.hs @@ -9,35 +9,21 @@ module Cardano.Testnet.Test.Cli.Transaction.RegisterDeregisterStakeAddress ) where import Cardano.Api as Api -import Cardano.Api.Ledger (Coin (..), EpochInterval (..)) -import qualified Cardano.Crypto.Hash as L -import qualified Cardano.Ledger.Conway.Governance as L -import qualified Cardano.Ledger.Conway.Governance as Ledger -import qualified Cardano.Ledger.Hashes as L -import qualified Cardano.Ledger.Shelley.LedgerState as L import Cardano.Testnet import Prelude import Control.Monad -import Control.Monad.State.Strict (StateT) import Data.Default.Class -import Data.Maybe -import Data.Maybe.Strict -import Data.String import qualified Data.Text as Text -import GHC.Exts (IsList (..)) -import Lens.Micro import System.FilePath (()) import Testnet.Components.Configuration import Testnet.Components.Query -import Testnet.Defaults -import Testnet.EpochStateProcessing (waitForGovActionVotes) -import Testnet.Process.Cli.DRep import Testnet.Process.Cli.Keys -import Testnet.Process.Cli.Transaction +import Testnet.Process.Cli.SPO (createStakeKeyDeregistrationCertificate, + createStakeKeyRegistrationCertificate) import Testnet.Process.Run (execCli', execCliAny, mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types @@ -83,33 +69,16 @@ hprop_tx_register_deregister_stake_address = integrationWorkspace "register-dere H.note_ $ "Socketpath: " <> unFile socketPath H.note_ $ "Foldblocks config file: " <> unFile configurationFile - -- Create Conway constitution - gov <- H.createDirectoryIfMissing $ work "governance" - - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - stakeCertDeregFp = gov "stake.deregcert" - stakeKeys = KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp - } - - cliStakeAddressKeyGen stakeKeys - - keyDepositStr <- show . unCoin <$> getKeyDeposit epochStateView ceo -- Register stake address - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] - - stakeAddress <- H.noteM $ execCli' execConfig - [ eraName, "stake-address", "build" - , "--stake-verification-key-file", stakeVkeyFp - , "--out-file", "/dev/stdout" - ] + let stakeCertFp = work "stake.regcert" + stakeCertDeregFp = work "stake.deregcert" + stakeKeys = KeyPair { verificationKey = File $ work "stake.vkey" + , signingKey = File $ work "stake.skey" + } + cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -132,7 +101,7 @@ hprop_tx_register_deregister_stake_address = integrationWorkspace "register-dere [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet0 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -143,22 +112,9 @@ hprop_tx_register_deregister_stake_address = integrationWorkspace "register-dere H.noteShowM_ $ waitForBlocks epochStateView 1 - do - (_, stdout', stderr') <- execCliAny execConfig - [ eraName, "query", "stake-address-info" - , "--address", stakeAddress - , "--out-file", "/dev/stdout" - ] - H.note_ stdout' - H.note_ stderr' - -- deregister stake address - void $ execCli' execConfig - [ eraName, "stake-address", "deregistration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertDeregFp - ] + createStakeKeyDeregistrationCertificate + tempAbsPath sbe (verificationKey stakeKeys) keyDeposit stakeCertDeregFp stakeCertDeregTxBodyFp <- H.note $ work "stake.deregistration.txbody" stakeCertDeregTxSignedFp <- H.note $ work "stake.deregistration.tx" @@ -181,7 +137,7 @@ hprop_tx_register_deregister_stake_address = integrationWorkspace "register-dere [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertDeregTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertDeregTxSignedFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs index 7f307524e50..4071e9ade89 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs @@ -42,6 +42,7 @@ import Testnet.EpochStateProcessing (waitForGovActionVotes) import qualified Testnet.Process.Cli.DRep as DRep import Testnet.Process.Cli.Keys import qualified Testnet.Process.Cli.SPO as SPO +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Cli.Transaction import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) @@ -119,23 +120,16 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co let ccColdSKeyFp n = gov "cc-" <> show n <> "-cold.skey" ccColdVKeyFp n = gov "cc-" <> show n <> "-cold.vkey" - stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" + } - cliStakeAddressKeyGen - $ KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp - } - - keyDepositStr <- show . L.unCoin <$> getKeyDeposit epochStateView ceo - -- Register stake address - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] + -- Register new stake address + cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -156,7 +150,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -191,7 +185,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co , "--anchor-url", "https://tinyurl.com/3wrwb2as" , "--anchor-data-hash", proposalAnchorDataHash , "--governance-action-deposit", show minGovActDeposit - , "--deposit-return-stake-verification-key-file", stakeVkeyFp + , "--deposit-return-stake-verification-key-file", verificationKeyFp stakeKeys , "--threshold", "0.2" , "--out-file", updateCommitteeFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs index d35e0737d54..87a3cb874ce 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs @@ -36,6 +36,7 @@ import Testnet.Components.Query import Testnet.Defaults (defaultDRepKeyPair, defaultDelegatorStakeKeyPair) import Testnet.Process.Cli.DRep import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Cli.Transaction import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) @@ -89,23 +90,15 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP gov <- H.createDirectoryIfMissing $ work "governance" - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - stakeKeys = KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp + -- Register stake address + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" } - cliStakeAddressKeyGen stakeKeys - - -- Register stake address - - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? - , "--out-file", stakeCertFp - ] + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -126,7 +119,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs index ff09d20daa2..6916c5c3fcd 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs @@ -11,7 +11,7 @@ module Cardano.Testnet.Test.Gov.GovActionTimeout ) where import Cardano.Api as Api -import Cardano.Api.Ledger (Coin (..), EpochInterval (EpochInterval, unEpochInterval)) +import Cardano.Api.Ledger (EpochInterval (..)) import Cardano.Testnet @@ -26,6 +26,7 @@ import System.FilePath (()) import Testnet.Components.Query import Testnet.Process.Cli.DRep (makeActivityChangeProposal) import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types @@ -85,23 +86,16 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te govActionLifetime <- getGovActionLifetime epochStateView ceo H.note_ $ "govActionLifetime: " <> show govActionLifetime - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - stakeKeys = KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp - } - + -- Register stake address + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" + } cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp - keyDepositStr <- show . unCoin <$> getKeyDeposit epochStateView ceo - -- Register stake address - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -122,7 +116,7 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs index 4da6591ab68..a1567dfc74d 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs @@ -13,7 +13,7 @@ module Cardano.Testnet.Test.Gov.InfoAction import Cardano.Api as Api import Cardano.Api.Error (displayError) -import Cardano.Api.Ledger (Coin (..), EpochInterval (EpochInterval)) +import Cardano.Api.Ledger (EpochInterval (EpochInterval)) import Cardano.Api.Shelley import Cardano.Ledger.Conway.Governance (RatifyState (..)) @@ -36,6 +36,7 @@ import System.FilePath (()) import Testnet.Components.Query import Testnet.Defaults import Testnet.Process.Cli.Keys +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types @@ -93,23 +94,15 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem [ "hash", "anchor-data", "--file-text", proposalAnchorFile ] - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - stakeKeys = KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp + -- Register stake address + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" } - cliStakeAddressKeyGen stakeKeys - - -- Register stake address - keyDepositStr <- show . unCoin <$> getKeyDeposit epochStateView ceo - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -130,7 +123,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet0 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -145,7 +138,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem [ eraName, "governance", "action", "create-info" , "--testnet" , "--governance-action-deposit", show @Int 1_000_000 -- TODO: Get this from the node - , "--deposit-return-stake-verification-key-file", stakeVkeyFp + , "--deposit-return-stake-verification-key-file", verificationKeyFp stakeKeys , "--anchor-url", "https://tinyurl.com/3wrwb2as" , "--anchor-data-hash", proposalAnchorDataHash , "--out-file", infoActionFp diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs index 42a8031294a..5218ba340c5 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs @@ -12,7 +12,7 @@ module Cardano.Testnet.Test.Gov.PParamChangeFailsSPO import Cardano.Api as Api import Cardano.Api.Experimental (Some (..)) -import Cardano.Api.Ledger (Coin (..), EpochInterval (EpochInterval)) +import Cardano.Api.Ledger (EpochInterval (..)) import Cardano.Testnet @@ -31,6 +31,7 @@ import Testnet.Defaults (defaultSpoColdKeyPair, defaultSpoKeys) import Testnet.Process.Cli.DRep import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) import qualified Testnet.Process.Cli.SPO as SPO +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Cli.Transaction (failToSubmitTx, signTx) import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) @@ -87,23 +88,15 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs baseDir <- H.createDirectoryIfMissing $ gov "output" - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - stakingKeys = KeyPair { verificationKey = File stakeVkeyFp - , signingKey= File stakeSKeyFp - } - - cliStakeAddressKeyGen stakingKeys - - keyDepositStr <- show . unCoin <$> getKeyDeposit epochStateView ceo -- Register stake address - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" + } + cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -124,7 +117,7 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -144,7 +137,7 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs (governanceActionTxId, governanceActionIndex) <- makeActivityChangeProposal execConfig epochStateView ceo (baseDir "proposal") - Nothing (EpochInterval 3) stakingKeys wallet0 (EpochInterval 2) + Nothing (EpochInterval 3) stakeKeys wallet0 (EpochInterval 2) failToVoteChangeProposalWithSPOs ceo execConfig epochStateView baseDir "vote" governanceActionTxId governanceActionIndex propVotes wallet1 diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs index 0d97c8b5808..f692fc690cb 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs @@ -10,7 +10,7 @@ module Cardano.Testnet.Test.Gov.ProposeNewConstitution import Cardano.Api as Api import Cardano.Api.Experimental (Some (..)) -import Cardano.Api.Ledger (Coin (..), EpochInterval (..)) +import Cardano.Api.Ledger (EpochInterval (..)) import qualified Cardano.Crypto.Hash as L import qualified Cardano.Ledger.Conway.Governance as L @@ -38,6 +38,7 @@ import Testnet.Defaults import Testnet.EpochStateProcessing (waitForGovActionVotes) import Testnet.Process.Cli.DRep import Testnet.Process.Cli.Keys +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Cli.Transaction import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) @@ -114,22 +115,15 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new [ "hash", "anchor-data", "--file-text", proposalAnchorFile ] - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - - cliStakeAddressKeyGen - $ KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp - } - keyDepositStr <- show . unCoin <$> getKeyDeposit epochStateView ceo -- Register stake address - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" + } + cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -150,7 +144,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -176,7 +170,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new [ "conway", "governance", "action", "create-constitution" , "--testnet" , "--governance-action-deposit", show minDRepDeposit - , "--deposit-return-stake-verification-key-file", stakeVkeyFp + , "--deposit-return-stake-verification-key-file", verificationKeyFp stakeKeys , "--anchor-url", "https://tinyurl.com/3wrwb2as" , "--anchor-data-hash", proposalAnchorDataHash , "--constitution-url", "https://tinyurl.com/2pahcy6z" diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs index 851d6dfeb27..83877be9692 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs @@ -40,6 +40,7 @@ import System.FilePath (()) import Testnet.Components.Query import Testnet.Defaults import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) +import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types @@ -99,22 +100,15 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury txin2 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 -- {{{ Register stake address - let stakeVkeyFp = gov "stake.vkey" - stakeSKeyFp = gov "stake.skey" - stakeCertFp = gov "stake.regcert" - - cliStakeAddressKeyGen - $ KeyPair { verificationKey = File stakeVkeyFp - , signingKey= File stakeSKeyFp - } + let stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File $ gov "stake.vkey" + , signingKey = File $ gov "stake.skey" + } + cliStakeAddressKeyGen stakeKeys + keyDeposit <- getKeyDeposit epochStateView ceo + createStakeKeyRegistrationCertificate + tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp - keyDepositStr <- show . L.unCoin <$> getKeyDeposit epochStateView ceo - void $ execCli' execConfig - [ eraName, "stake-address", "registration-certificate" - , "--stake-verification-key-file", stakeVkeyFp - , "--key-reg-deposit-amt", keyDepositStr - , "--out-file", stakeCertFp - ] stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -133,7 +127,7 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury [ eraName, "transaction", "sign" , "--tx-body-file", stakeCertTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 - , "--signing-key-file", stakeSKeyFp + , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] @@ -152,9 +146,9 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury , "--anchor-url", "https://tinyurl.com/3wrwb2as" , "--anchor-data-hash", proposalAnchorDataHash , "--governance-action-deposit", show govActionDeposit - , "--deposit-return-stake-verification-key-file", stakeVkeyFp + , "--deposit-return-stake-verification-key-file", verificationKeyFp stakeKeys , "--transfer", show withdrawalAmount - , "--funds-receiving-stake-verification-key-file", stakeVkeyFp + , "--funds-receiving-stake-verification-key-file", verificationKeyFp stakeKeys , "--out-file", treasuryWithdrawalActionFp ]