Skip to content

Commit

Permalink
Restrict voting during bootstrap phase
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Apr 18, 2024
1 parent f27bc78 commit 153555a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Gov.hs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,22 @@ checkVotersAreValid committeeState votes =
DRepVoter {} -> isDRepVotingAllowed (gasAction gas)
StakePoolVoter {} -> isStakePoolVotingAllowed (gasAction gas)

checkBootstrapVotes ::
forall era.
EraPParams era =>
PParams era ->
[(Voter (EraCrypto era), GovActionState era)] ->
Test (ConwayGovPredFailure era)
checkBootstrapVotes pp votes
| HF.bootstrap (pp ^. ppProtocolVersionL) =
checkDisallowedVotes votes (flip canVoteOn) DisallowedVotesDuringBootstrap
| otherwise = pure ()
where
canVoteOn gas =
\case
DRepVoter {} | gasAction gas == InfoAction -> True
_ -> isBootstrapAction $ gasAction gas

actionWellFormed :: ConwayEraPParams era => GovAction era -> Test (ConwayGovPredFailure era)
actionWellFormed ga = failureUnless isWellFormed $ MalformedProposal ga
where
Expand Down Expand Up @@ -443,7 +459,9 @@ govTransition = do
([], [])
votingProcedures
curGovActionIds = proposalsActionsMap proposals

failOnNonEmpty unknownGovActionIds GovActionsDoNotExist
runTest $ checkBootstrapVotes pp knownVotes
runTest $ checkVotesAreNotForExpiredActions currentEpoch knownVotes
runTest $ checkVotersAreValid committeeState knownVotes

Expand Down

0 comments on commit 153555a

Please sign in to comment.