Skip to content

Commit 9ac443a

Browse files
committed
Add more test cases
1 parent 889f257 commit 9ac443a

File tree

1 file changed

+51
-7
lines changed
  • eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp

1 file changed

+51
-7
lines changed

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/RatifySpec.hs

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ spoAndCCVotingSpec = do
198198
else do
199199
getLastEnactedParameterChange `shouldReturn` SNothing
200200
newRefScriptBaseFee `shouldBe` initialRefScriptBaseFee
201-
fspecify "Constitution cannot be changed if active committee size is below min size"
201+
it "Constitution cannot be changed if active committee size is below min size"
202202
. whenPostBootstrap
203203
$ do
204204
modifyPParams $ \pp ->
@@ -241,9 +241,28 @@ spoAndCCVotingSpec = do
241241
getConstitution `shouldNotReturn` newConstitution
242242
-- https://github.com/IntersectMBO/cardano-ledger/issues/5418
243243
-- TODO: Re-enable after issue is resolved, by removing this override
244-
disableInConformanceIt
245-
"Constitution cannot be changed if an active committee doesn't vote even if the committee threshold is 0" $
246-
whenPostBootstrap $ do
244+
xit
245+
"Constitution cannot be changed if an active committee without hot credentials registered doesn't vote even if the committee threshold is 0"
246+
$ whenPostBootstrap
247+
$ do
248+
modifyPParams $ \pp ->
249+
pp
250+
& ppCommitteeMinSizeL .~ 2
251+
modifyCommittee $ fmap (committeeThresholdL .~ 0 %! 1)
252+
(drep, _, _) <- setupSingleDRep 1_000_000_000
253+
SJust committee <- getCommittee
254+
committeeThreshold committee `shouldBe` 0 %! 1
255+
Map.size (committeeMembers committee) `shouldBe` 2
256+
forM_ (Map.keys $ committeeMembers committee) ccShouldNotBeExpired
257+
(proposal, newConstitution) <- mkConstitutionProposal SNothing
258+
gaiConstitution <- submitProposal proposal
259+
submitYesVote_ (DRepVoter drep) gaiConstitution
260+
passNEpochs 2
261+
getConstitution `shouldReturn` newConstitution
262+
it
263+
"Constitution can be changed if an active committee with hot credentials registered doesn't vote when the committee threshold is 0"
264+
$ whenPostBootstrap
265+
$ do
247266
modifyPParams $ \pp ->
248267
pp
249268
& ppCommitteeMinSizeL .~ 2
@@ -253,12 +272,37 @@ spoAndCCVotingSpec = do
253272
committeeThreshold committee `shouldBe` 0 %! 1
254273
Map.size (committeeMembers committee) `shouldBe` 2
255274
forM_ (Map.keys $ committeeMembers committee) ccShouldNotBeExpired
256-
oldConstitution <- getConstitution
257-
(proposal, _) <- mkConstitutionProposal SNothing
275+
(proposal, newConstitution) <- mkConstitutionProposal SNothing
258276
gaiConstitution <- submitProposal proposal
259277
submitYesVote_ (DRepVoter drep) gaiConstitution
278+
mapM_ registerCommitteeHotKey (Map.keys $ committeeMembers committee)
260279
passNEpochs 2
261-
getConstitution `shouldReturn` oldConstitution
280+
getConstitution `shouldReturn` newConstitution
281+
it
282+
"Constitution can be changed regardless of active committee votes when the committee threshold is 0"
283+
$ whenPostBootstrap
284+
$ do
285+
modifyPParams $ \pp ->
286+
pp
287+
& ppCommitteeMinSizeL .~ 2
288+
modifyCommittee $ fmap (committeeThresholdL .~ 0 %! 1)
289+
(drep, _, _) <- setupSingleDRep 1_000_000_000
290+
SJust committee <- getCommittee
291+
committeeThreshold committee `shouldBe` 0 %! 1
292+
Map.size (committeeMembers committee) `shouldBe` 2
293+
forM_ (Map.keys $ committeeMembers committee) ccShouldNotBeExpired
294+
(proposal, newConstitution) <- mkConstitutionProposal SNothing
295+
gaiConstitution <- submitProposal proposal
296+
submitYesVote_ (DRepVoter drep) gaiConstitution
297+
hotKeys <- mapM registerCommitteeHotKey (Map.keys $ committeeMembers committee)
298+
forM_ hotKeys $ \c ->
299+
oneof
300+
[ return ()
301+
, submitYesVote_ (CommitteeVoter c) gaiConstitution
302+
, submitVote_ VoteNo (CommitteeVoter c) gaiConstitution
303+
]
304+
passNEpochs 2
305+
getConstitution `shouldReturn` newConstitution
262306
it "Constitution cannot be changed if min committee size is 0 and committee threshold is not 0"
263307
. whenPostBootstrap
264308
$ do

0 commit comments

Comments
 (0)