@@ -32,11 +32,13 @@ import GHC.Stack (callStack)
32
32
import Lens.Micro ((^?) )
33
33
import System.FilePath ((</>) )
34
34
35
+ import qualified Testnet.Components.DReps as DRep
35
36
import Testnet.Components.DReps (createCertificatePublicationTxBody , createVotingTxBody ,
36
- generateVoteFiles , retrieveTransactionId , signTx , submitTx )
37
+ retrieveTransactionId , signTx , submitTx )
37
38
import Testnet.Components.Query (EpochStateView , findLargestUtxoForPaymentKey ,
38
39
getCurrentEpochNo , getEpochStateView , getMinDRepDeposit )
39
- import Testnet.Defaults (defaultDRepKeyPair , defaultDelegatorStakeKeyPair )
40
+ import qualified Testnet.Components.SPO as SPO
41
+ import Testnet.Defaults (defaultDRepKeyPair , defaultDelegatorStakeKeyPair , defaultSPOKeys )
40
42
import qualified Testnet.Process.Cli as P
41
43
import qualified Testnet.Process.Run as H
42
44
import qualified Testnet.Property.Utils as H
@@ -51,7 +53,7 @@ import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO
51
53
-- @desiredNumberOfPools@ parameter) to check that it fails, when the first DRep votes "yes" and the
52
54
-- last two vote "no". Later we chack that if we change the stake holders under the DReps that vote
53
55
-- "no" to delegate to the automate "always abstain" DRep, the same kind of proposal passes.
54
- --
56
+ --
55
57
-- This test is meant to ensure that delegating to "always abstain" has the desired effect of
56
58
-- counting as abstaining for the stake delegated.
57
59
--
@@ -205,8 +207,6 @@ desiredPoolNumberProposalTest
205
207
-> m (String , Word32 )
206
208
desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo work prefix
207
209
wallet previousProposalInfo votes change expected epochsToWait = do
208
- let sbe = conwayEraOnwardsToShelleyBasedEra ceo
209
-
210
210
baseDir <- H. createDirectoryIfMissing $ work </> prefix
211
211
212
212
let propVotes :: [DefaultDRepVote ]
@@ -217,8 +217,8 @@ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socket
217
217
makeDesiredPoolNumberChangeProposal execConfig epochStateView (File configurationFile) (File socketPath)
218
218
ceo baseDir " proposal" previousProposalInfo (fromIntegral change) wallet
219
219
220
- voteChangeProposal execConfig epochStateView sbe baseDir " vote"
221
- governanceActionTxId governanceActionIndex propVotes wallet
220
+ voteChangeProposal execConfig epochStateView ceo baseDir " vote"
221
+ governanceActionTxId governanceActionIndex propVotes [] wallet
222
222
223
223
(EpochNo epochAfterProp) <- getCurrentEpochNo epochStateView
224
224
H. note_ $ " Epoch after \" " <> prefix <> " \" prop: " <> show epochAfterProp
@@ -324,38 +324,60 @@ makeDesiredPoolNumberChangeProposal execConfig epochStateView configurationFile
324
324
-- a default DRep (from the ones created by 'cardanoTestnetDefault')
325
325
type DefaultDRepVote = (String , Int )
326
326
327
+ -- A pair of a vote string (i.e: "yes", "no", or "abstain") and the number of
328
+ -- a default SPO (from the ones created by 'cardanoTestnetDefault')
329
+ type DefaultSPOVote = (String , Int )
330
+
327
331
-- | Create and issue votes for (or against) a government proposal with default
328
- -- Delegate Representative (DReps created by 'cardanoTestnetDefault') using @cardano-cli@.
332
+ -- Delegate Representative (DReps created by 'cardanoTestnetDefault') and
333
+ -- default Stake Pool Operatorsusing using @cardano-cli@.
329
334
voteChangeProposal :: (MonadTest m , MonadIO m , MonadCatch m , H. MonadAssertion m )
330
335
=> H. ExecConfig -- ^ Specifies the CLI execution configuration.
331
336
-> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained
332
337
-- using the 'getEpochStateView' function.
333
- -> ShelleyBasedEra ConwayEra -- ^ The Shelley-based witness for ConwayEra (i.e: ShelleyBasedEraConway) .
338
+ -> ConwayEraOnwards ConwayEra -- ^ The @ConwayEraOnwards@ witness for the Conway era .
334
339
-> FilePath -- ^ Base directory path where the subdirectory with the intermediate files will be created.
335
340
-> String -- ^ Name for the subdirectory that will be created for storing the intermediate files.
336
341
-> String -- ^ Transaction id of the governance action to vote.
337
342
-> Word32 -- ^ Index of the governance action to vote in the transaction.
338
343
-> [DefaultDRepVote ] -- ^ List of votes to issue as pairs of the vote and the number of DRep that votes it.
344
+ -> [DefaultSPOVote ] -- ^ List of votes to issue as pairs of the vote and the number of DRep that votes it.
339
345
-> PaymentKeyInfo -- ^ Wallet that will pay for the transactions
340
346
-> m ()
341
- voteChangeProposal execConfig epochStateView sbe work prefix
342
- governanceActionTxId governanceActionIndex votes wallet = do
347
+ voteChangeProposal execConfig epochStateView ceo work prefix
348
+ governanceActionTxId governanceActionIndex drepVotes spoVotes wallet = do
343
349
baseDir <- H. createDirectoryIfMissing $ work </> prefix
344
350
345
- let era = toCardanoEra sbe
351
+ let sbe = conwayEraOnwardsToShelleyBasedEra ceo
352
+ era = toCardanoEra sbe
346
353
cEra = AnyCardanoEra era
347
354
348
- voteFiles <- generateVoteFiles execConfig baseDir " vote-files"
349
- governanceActionTxId governanceActionIndex
350
- [(defaultDRepKeyPair idx, vote) | (vote, idx) <- votes]
355
+ drepVoteFiles <- DRep. generateVoteFiles execConfig baseDir " drep-vote-files"
356
+ governanceActionTxId governanceActionIndex
357
+ [(defaultDRepKeyPair idx, vote) | (vote, idx) <- drepVotes]
358
+
359
+ spoVoteFiles <- SPO. generateVoteFiles ceo execConfig baseDir " spo-vote-files"
360
+ governanceActionTxId governanceActionIndex
361
+ [(defaultSPOKeys idx, vote) | (vote, idx) <- spoVotes]
362
+
363
+ let voteFiles = drepVoteFiles ++ spoVoteFiles
351
364
352
365
voteTxBodyFp <- createVotingTxBody execConfig epochStateView sbe baseDir " vote-tx-body"
353
366
voteFiles wallet
354
367
355
368
voteTxFp <- signTx execConfig cEra baseDir " signed-vote-tx" voteTxBodyFp
356
- (paymentKeyInfoPair wallet: [defaultDRepKeyPair n | (_, n) <- votes])
369
+ (paymentKeyInfoPair wallet:
370
+ [defaultDRepKeyPair n | (_, n) <- drepVotes] ++
371
+ [defaultSPOColdKeyPair n | (_, n) <- drepVotes]
372
+ )
357
373
submitTx execConfig cEra voteTxFp
358
374
375
+ defaultSPOColdKeyPair :: Int -> PaymentKeyPair
376
+ defaultSPOColdKeyPair n = PaymentKeyPair { paymentVKey = poolNodeKeysColdVkey spoKeys
377
+ , paymentSKey = poolNodeKeysColdSkey spoKeys
378
+ }
379
+ where spoKeys = defaultSPOKeys n
380
+
359
381
-- | Obtains the @desiredPoolNumberValue@ from the protocol parameters.
360
382
-- The @desiredPoolNumberValue@ or (@k@ in the spec) is the protocol parameter
361
383
-- that defines what is the optimal number of SPOs. It is a tradeoff between
0 commit comments