77{-# LANGUAGE TypeApplications #-}
88
99module Cardano.Testnet.Test.LedgerEvents.Gov.PredefinedAbstainDRep
10- ( hprop_check_predefined_abstain_drep
10+ ( AutomaticDRepFlag (.. )
11+ , hprop_check_predefined_abstain_drep
1112 , delegateToAutomaticDRep
1213 , desiredPoolNumberProposalTest
1314 , getDesiredPoolNumberValue
@@ -118,37 +119,22 @@ hprop_check_predefined_abstain_drep = H.integrationWorkspace "test-activity" $ \
118119 void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " firstProposal"
119120 wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools initialDesiredNumberOfPools 2
120121
121- -- Take the last two stake delegators and delegate them to "Abstain ".
122- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain1"
123- wallet1 (defaultDelegatorStakeKeyPair 2 )
124- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain2"
125- wallet2 (defaultDelegatorStakeKeyPair 3 )
122+ -- Take the last two stake delegators and delegate them to "AlwaysAbstainDRep ".
123+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain1"
124+ AlwaysAbstainDRep wallet1 (defaultDelegatorStakeKeyPair 2 )
125+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain2"
126+ AlwaysAbstainDRep wallet2 (defaultDelegatorStakeKeyPair 3 )
126127
127128 -- Do some other proposal and vote yes with first DRep only
128129 -- and assert the new proposal passes now.
129130 let newNumberOfDesiredPools2 = newNumberOfDesiredPools + 1
130131 void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " secondProposal"
131132 wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools2 newNumberOfDesiredPools2 2
132133
133- -- | Delegates a staking key pair to the "always abstain" automated DRep
134- delegateToAlwaysAbstain
135- :: (HasCallStack , MonadTest m , MonadIO m , H. MonadAssertion m , MonadCatch m )
136- => H. ExecConfig -- ^ Specifies the CLI execution configuration.
137- -> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained
138- -- using the 'getEpochStateView' function.
139- -> FilePath -- ^ Path to the node configuration file as returned by 'cardanoTestnetDefault'.
140- -> FilePath -- ^ Path to the cardano-node unix socket file.
141- -> ShelleyBasedEra ConwayEra -- ^ The Shelley based era witness for ConwayEra
142- -> FilePath -- ^ Base directory path where generated files will be stored.
143- -> String -- ^ Name for the subfolder that will be created under 'work' folder.
144- -> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
145- -> StakingKeyPair -- ^ Staking key pair used for delegation.
146- -> m ()
147- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe work prefix =
148- delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix
149- " --always-abstain"
134+ -- | Which automatic DRep to delegate to
135+ data AutomaticDRepFlag = AlwaysAbstainDRep
136+ | NoConfidenceDRep
150137
151- -- | Delegates a staking key pair to an automatic DRep.
152138delegateToAutomaticDRep
153139 :: (HasCallStack , MonadTest m , MonadIO m , H. MonadAssertion m , MonadCatch m )
154140 => H. ExecConfig -- ^ Specifies the CLI execution configuration.
@@ -159,13 +145,11 @@ delegateToAutomaticDRep
159145 -> ShelleyBasedEra ConwayEra -- ^ The Shelley based era witness for ConwayEra
160146 -> FilePath -- ^ Base directory path where generated files will be stored.
161147 -> String -- ^ Name for the subfolder that will be created under 'work' folder.
162- -> String -- ^ Additional command-line argument for the delegation .
148+ -> AutomaticDRepFlag -- ^ Which type of automatic DRep to delegate to .
163149 -> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
164150 -> StakingKeyPair -- ^ Staking key pair used for delegation.
165151 -> m ()
166- delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix
167- flag payingWallet skeyPair@ (StakingKeyPair vKeyFile _sKeyFile) = do
168-
152+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix flag payingWallet skeyPair@ (StakingKeyPair vKeyFile _sKeyFile) = do
169153 let era = toCardanoEra sbe
170154 cEra = AnyCardanoEra era
171155
@@ -175,7 +159,9 @@ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath s
175159 let voteDelegationCertificatePath = baseDir </> " delegation-certificate.delegcert"
176160 void $ H. execCli' execConfig
177161 [ " conway" , " stake-address" , " vote-delegation-certificate"
178- , flag
162+ , case flag of
163+ AlwaysAbstainDRep -> " --always-abstain"
164+ NoConfidenceDRep -> " --always-no-confidence"
179165 , " --stake-verification-key-file" , vKeyFile
180166 , " --out-file" , voteDelegationCertificatePath
181167 ]
0 commit comments