7
7
{-# LANGUAGE TypeApplications #-}
8
8
9
9
module Cardano.Testnet.Test.LedgerEvents.Gov.PredefinedAbstainDRep
10
- ( hprop_check_predefined_abstain_drep
10
+ ( AutomaticDRepFlag (.. )
11
+ , hprop_check_predefined_abstain_drep
11
12
, delegateToAutomaticDRep
12
13
, desiredPoolNumberProposalTest
13
14
, getDesiredPoolNumberValue
@@ -118,37 +119,22 @@ hprop_check_predefined_abstain_drep = H.integrationWorkspace "test-activity" $ \
118
119
void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " firstProposal"
119
120
wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools initialDesiredNumberOfPools 2
120
121
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 )
126
127
127
128
-- Do some other proposal and vote yes with first DRep only
128
129
-- and assert the new proposal passes now.
129
130
let newNumberOfDesiredPools2 = newNumberOfDesiredPools + 1
130
131
void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " secondProposal"
131
132
wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools2 newNumberOfDesiredPools2 2
132
133
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
150
137
151
- -- | Delegates a staking key pair to an automatic DRep.
152
138
delegateToAutomaticDRep
153
139
:: (HasCallStack , MonadTest m , MonadIO m , H. MonadAssertion m , MonadCatch m )
154
140
=> H. ExecConfig -- ^ Specifies the CLI execution configuration.
@@ -159,13 +145,11 @@ delegateToAutomaticDRep
159
145
-> ShelleyBasedEra ConwayEra -- ^ The Shelley based era witness for ConwayEra
160
146
-> FilePath -- ^ Base directory path where generated files will be stored.
161
147
-> 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 .
163
149
-> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
164
150
-> StakingKeyPair -- ^ Staking key pair used for delegation.
165
151
-> 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
169
153
let era = toCardanoEra sbe
170
154
cEra = AnyCardanoEra era
171
155
@@ -175,7 +159,9 @@ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath s
175
159
let voteDelegationCertificatePath = baseDir </> " delegation-certificate.delegcert"
176
160
void $ H. execCli' execConfig
177
161
[ " conway" , " stake-address" , " vote-delegation-certificate"
178
- , flag
162
+ , case flag of
163
+ AlwaysAbstainDRep -> " --always-abstain"
164
+ NoConfidenceDRep -> " --always-no-confidence"
179
165
, " --stake-verification-key-file" , vKeyFile
180
166
, " --out-file" , voteDelegationCertificatePath
181
167
]
0 commit comments