@@ -34,11 +34,13 @@ import GHC.Stack (HasCallStack, callStack)
34
34
import Lens.Micro ((^.) )
35
35
import System.FilePath ((</>) )
36
36
37
+ import qualified Testnet.Components.DReps as DRep
37
38
import Testnet.Components.DReps (createCertificatePublicationTxBody , createVotingTxBody ,
38
- generateVoteFiles , retrieveTransactionId , signTx , submitTx )
39
+ retrieveTransactionId , signTx , submitTx )
39
40
import Testnet.Components.Query (EpochStateView , findLargestUtxoForPaymentKey ,
40
41
getCurrentEpochNo , getEpochStateView , getGovState , getMinDRepDeposit )
41
- import Testnet.Defaults (defaultDRepKeyPair , defaultDelegatorStakeKeyPair )
42
+ import qualified Testnet.Components.SPO as SPO
43
+ import Testnet.Defaults (defaultDRepKeyPair , defaultDelegatorStakeKeyPair , defaultSPOKeys )
42
44
import qualified Testnet.Process.Cli as P
43
45
import qualified Testnet.Process.Run as H
44
46
import qualified Testnet.Property.Utils as H
@@ -210,8 +212,6 @@ desiredPoolNumberProposalTest
210
212
-> m (String , Word32 )
211
213
desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo work prefix
212
214
wallet previousProposalInfo votes change expected epochsToWait = do
213
- let sbe = conwayEraOnwardsToShelleyBasedEra ceo
214
-
215
215
baseDir <- H. createDirectoryIfMissing $ work </> prefix
216
216
217
217
let propVotes :: [DefaultDRepVote ]
@@ -222,8 +222,8 @@ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socket
222
222
makeDesiredPoolNumberChangeProposal execConfig epochStateView (File configurationFile) (File socketPath)
223
223
ceo baseDir " proposal" previousProposalInfo (fromIntegral change) wallet
224
224
225
- voteChangeProposal execConfig epochStateView sbe baseDir " vote"
226
- governanceActionTxId governanceActionIndex propVotes wallet
225
+ voteChangeProposal execConfig epochStateView ceo baseDir " vote"
226
+ governanceActionTxId governanceActionIndex propVotes [] wallet
227
227
228
228
(EpochNo epochAfterProp) <- getCurrentEpochNo epochStateView
229
229
H. note_ $ " Epoch after \" " <> prefix <> " \" prop: " <> show epochAfterProp
@@ -331,38 +331,60 @@ makeDesiredPoolNumberChangeProposal execConfig epochStateView configurationFile
331
331
-- a default DRep (from the ones created by 'cardanoTestnetDefault')
332
332
type DefaultDRepVote = (String , Int )
333
333
334
+ -- A pair of a vote string (i.e: "yes", "no", or "abstain") and the number of
335
+ -- a default SPO (from the ones created by 'cardanoTestnetDefault')
336
+ type DefaultSPOVote = (String , Int )
337
+
334
338
-- | Create and issue votes for (or against) a government proposal with default
335
- -- Delegate Representative (DReps created by 'cardanoTestnetDefault') using @cardano-cli@.
339
+ -- Delegate Representative (DReps created by 'cardanoTestnetDefault') and
340
+ -- default Stake Pool Operatorsusing using @cardano-cli@.
336
341
voteChangeProposal :: (MonadTest m , MonadIO m , MonadCatch m , H. MonadAssertion m )
337
342
=> H. ExecConfig -- ^ Specifies the CLI execution configuration.
338
343
-> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained
339
344
-- using the 'getEpochStateView' function.
340
- -> ShelleyBasedEra ConwayEra -- ^ The Shelley-based witness for ConwayEra (i.e: ShelleyBasedEraConway) .
345
+ -> ConwayEraOnwards ConwayEra -- ^ The @ConwayEraOnwards@ witness for the Conway era .
341
346
-> FilePath -- ^ Base directory path where the subdirectory with the intermediate files will be created.
342
347
-> String -- ^ Name for the subdirectory that will be created for storing the intermediate files.
343
348
-> String -- ^ Transaction id of the governance action to vote.
344
349
-> Word32 -- ^ Index of the governance action to vote in the transaction.
345
350
-> [DefaultDRepVote ] -- ^ List of votes to issue as pairs of the vote and the number of DRep that votes it.
351
+ -> [DefaultSPOVote ] -- ^ List of votes to issue as pairs of the vote and the number of DRep that votes it.
346
352
-> PaymentKeyInfo -- ^ Wallet that will pay for the transactions
347
353
-> m ()
348
- voteChangeProposal execConfig epochStateView sbe work prefix
349
- governanceActionTxId governanceActionIndex votes wallet = do
354
+ voteChangeProposal execConfig epochStateView ceo work prefix
355
+ governanceActionTxId governanceActionIndex drepVotes spoVotes wallet = do
350
356
baseDir <- H. createDirectoryIfMissing $ work </> prefix
351
357
352
- let era = toCardanoEra sbe
358
+ let sbe = conwayEraOnwardsToShelleyBasedEra ceo
359
+ era = toCardanoEra sbe
353
360
cEra = AnyCardanoEra era
354
361
355
- voteFiles <- generateVoteFiles execConfig baseDir " vote-files"
356
- governanceActionTxId governanceActionIndex
357
- [(defaultDRepKeyPair idx, vote) | (vote, idx) <- votes]
362
+ drepVoteFiles <- DRep. generateVoteFiles execConfig baseDir " drep-vote-files"
363
+ governanceActionTxId governanceActionIndex
364
+ [(defaultDRepKeyPair idx, vote) | (vote, idx) <- drepVotes]
365
+
366
+ spoVoteFiles <- SPO. generateVoteFiles ceo execConfig baseDir " spo-vote-files"
367
+ governanceActionTxId governanceActionIndex
368
+ [(defaultSPOKeys idx, vote) | (vote, idx) <- spoVotes]
369
+
370
+ let voteFiles = drepVoteFiles ++ spoVoteFiles
358
371
359
372
voteTxBodyFp <- createVotingTxBody execConfig epochStateView sbe baseDir " vote-tx-body"
360
373
voteFiles wallet
361
374
362
375
voteTxFp <- signTx execConfig cEra baseDir " signed-vote-tx" voteTxBodyFp
363
- (paymentKeyInfoPair wallet: [defaultDRepKeyPair n | (_, n) <- votes])
376
+ (paymentKeyInfoPair wallet:
377
+ [defaultDRepKeyPair n | (_, n) <- drepVotes] ++
378
+ [defaultSPOColdKeyPair n | (_, n) <- drepVotes]
379
+ )
364
380
submitTx execConfig cEra voteTxFp
365
381
382
+ defaultSPOColdKeyPair :: Int -> PaymentKeyPair
383
+ defaultSPOColdKeyPair n = PaymentKeyPair { paymentVKey = poolNodeKeysColdVkey spoKeys
384
+ , paymentSKey = poolNodeKeysColdSkey spoKeys
385
+ }
386
+ where spoKeys = defaultSPOKeys n
387
+
366
388
-- | Obtains the @desiredPoolNumberValue@ from the protocol parameters.
367
389
-- The @desiredPoolNumberValue@ or (@k@ in the spec) is the protocol parameter
368
390
-- that defines what is the optimal number of SPOs. It is a tradeoff between
0 commit comments