Skip to content

Commit

Permalink
Decouple pparam updates from electBasicCommitte
Browse files Browse the repository at this point in the history
to make the preconditions of tests clearer
  • Loading branch information
teodanciu committed Apr 23, 2024
1 parent 9eb5b79 commit 8f6e06a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ proposalsSpec =
, Node SNothing [SJust <$> b]
]
it "Subtrees are pruned when competing proposals are enacted" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(dRep, committeeMember, GovPurposeId committeeGovActionId) <- electBasicCommittee
a@[ _
, b@(Node p2 _)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ paramChangeAffectsProposalsSpec =
passEpoch -- Make the votes count
pure (gaiParent, gaiChild)
it "Increasing the threshold prevents a hitherto-ratifiable proposal from being ratified" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(drepC, hotCommitteeC, gpiCC) <- electBasicCommittee
setThreshold smallerThreshold
(drepKH, _stakingKH, _paymentKP) <- setupSingleDRep 1_000_000
Expand All @@ -101,6 +102,7 @@ paramChangeAffectsProposalsSpec =
enactThreshold largerThreshold drepC hotCommitteeC
isDRepAccepted gaiChild `shouldReturn` False
it "Decreasing the threshold ratifies a hitherto-unratifiable proposal" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(drepC, hotCommitteeC, gpiCC) <- electBasicCommittee
modifyPParams $ ppGovActionLifetimeL .~ EpochInterval 5
setThreshold largerThreshold
Expand Down Expand Up @@ -162,6 +164,7 @@ paramChangeAffectsProposalsSpec =
passEpoch -- Make the votes count do
pure (gaiParent, gaiChild)
it "Increasing the threshold prevents a hitherto-ratifiable proposal from being ratified" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(drepC, hotCommitteeC, gpiCC) <- electBasicCommittee
setThreshold smallerThreshold
(poolKH1, _paymentC1, _stakingC1) <- setupPoolWithStake $ Coin 1_000_000
Expand All @@ -172,6 +175,7 @@ paramChangeAffectsProposalsSpec =
enactThreshold largerThreshold drepC hotCommitteeC
isSpoAccepted gaiChild `shouldReturn` False
it "Decreasing the threshold ratifies a hitherto-unratifiable proposal" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(drepC, hotCommitteeC, gpiCC) <- electBasicCommittee
modifyPParams $ ppGovActionLifetimeL .~ EpochInterval 5
setThreshold largerThreshold
Expand Down Expand Up @@ -261,6 +265,7 @@ committeeMinSizeAffectsInFlightProposalsSpec =
currentProposalsShouldContain gaiTW
getsNES (nesEsL . esAccountStateL . asTreasuryL) `shouldReturn` treasury
it "TreasuryWithdrawal ratifies due to a decrease in CommitteeMinSize" $ do
modifyPParams $ \pp -> pp & ppCommitteeMaxTermLengthL .~ EpochInterval 20
(drepC, hotCommitteeC, gpiCC) <- electBasicCommittee
modifyPParams $ ppGovActionLifetimeL .~ EpochInterval 10
treasury <- getsNES $ nesEsL . esAccountStateL . asTreasuryL
Expand Down
15 changes: 1 addition & 14 deletions eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/ImpTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,20 +1026,7 @@ electBasicCommittee ::
, GovPurposeId 'CommitteePurpose era
)
electBasicCommittee = do
logEntry "Setting up PParams and DRep"
modifyPParams $ \pp ->
pp
& ppDRepVotingThresholdsL
%~ ( \dvt ->
dvt
{ dvtCommitteeNormal = 1 %! 1
, dvtCommitteeNoConfidence = 1 %! 2
, dvtUpdateToConstitution = 1 %! 2
}
)
& ppCommitteeMaxTermLengthL .~ EpochInterval 20
& ppGovActionLifetimeL .~ EpochInterval 2
& ppGovActionDepositL .~ Coin 123
logEntry "Setting up a DRep"
(drepKH, _, _) <- setupSingleDRep 1_000_000

logEntry "Registering committee member"
Expand Down

0 comments on commit 8f6e06a

Please sign in to comment.