Skip to content

Commit

Permalink
Add imp tests for VotersDoNotExist
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Jun 28, 2024
1 parent 4510227 commit 8a48f58
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/GovSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,32 @@ votingSpec =
. constitutionAnchorL
expectNoCurrentProposals
conAnchor `shouldNotBe` anchor
it "VotersDoNotExist" $ do
pp <- getsNES $ nesEsL . curPParamsEpochStateL
let ProtVer major minor = pp ^. ppProtocolVersionL
gaId <- submitGovAction $ HardForkInitiation SNothing $ ProtVer major (succ minor)
hotCred <- KeyHashObj <$> freshKeyHash
submitFailingVote (CommitteeVoter hotCred) gaId $
[injectFailure $ VotersDoNotExist [CommitteeVoter hotCred]]
poolId <- freshKeyHash
submitFailingVote (StakePoolVoter poolId) gaId $
[injectFailure $ VotersDoNotExist [StakePoolVoter poolId]]
dRepCred <- KeyHashObj <$> freshKeyHash
whenPostBootstrap $ do
submitFailingVote (DRepVoter dRepCred) gaId $
[injectFailure $ VotersDoNotExist [(DRepVoter dRepCred)]]
it "DRep votes are removed" $ do
pp <- getsNES $ nesEsL . curPParamsEpochStateL
let ProtVer major minor = pp ^. ppProtocolVersionL
gaId <- submitGovAction $ HardForkInitiation SNothing $ ProtVer major (succ minor)
dRepCred <- KeyHashObj <$> registerDRep
submitVote_ VoteNo (DRepVoter dRepCred) gaId
gas <- getGovActionState gaId
gasDRepVotes gas `shouldBe` [(dRepCred, VoteNo)]
let deposit = pp ^. ppDRepDepositL
submitTx_ $ mkBasicTx (mkBasicTxBody & certsTxBodyL .~ [UnRegDRepTxCert dRepCred deposit])
gasAfterRemoval <- getGovActionState gaId
gasDRepVotes gasAfterRemoval `shouldBe` []

constitutionSpec ::
forall era.
Expand Down

0 comments on commit 8a48f58

Please sign in to comment.