Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Validation rules for registering votes and confirming proposals
This is an implementation of the rules defined in the Byron ledger specification
Synopsis
- data Environment = Environment {}
- data RegistrationEnvironment = RegistrationEnvironment {}
- data State = State {
- vsVotes ∷ !RegisteredVotes
- vsConfirmedProposals ∷ !(Map UpId SlotNumber)
- data Error
- registerVoteWithConfirmation ∷ MonadError Error m ⇒ Annotated ProtocolMagicId ByteString → Environment → State → AVote ByteString → m State
Documentation
data Environment Source #
Environment used to register votes and confirm proposals
Instances
data RegistrationEnvironment Source #
Environment required to validate and register a vote
Instances
Generic RegistrationEnvironment Source # | |
Show RegistrationEnvironment Source # | |
NFData RegistrationEnvironment Source # | |
Defined in Cardano.Chain.Update.Validation.Voting rnf ∷ RegistrationEnvironment → () Source # | |
Eq RegistrationEnvironment Source # | |
type Rep RegistrationEnvironment Source # | |
Defined in Cardano.Chain.Update.Validation.Voting type Rep RegistrationEnvironment = D1 ('MetaData "RegistrationEnvironment" "Cardano.Chain.Update.Validation.Voting" "cardano-ledger-byron-1.0.2.0-inplace" 'False) (C1 ('MetaCons "RegistrationEnvironment" 'PrefixI 'True) (S1 ('MetaSel ('Just "vreRegisteredUpdateProposal") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set UpId)) :*: S1 ('MetaSel ('Just "vreDelegationMap") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Map))) |
State keeps track of registered votes and confirmed proposals
State | |
|
Error captures the ways in which vote registration could fail
VotingInvalidSignature | |
VotingProposalNotRegistered UpId | |
VotingVoterNotDelegate KeyHash | |
VotingVoteAlreadyCast KeyHash |
registerVoteWithConfirmation ∷ MonadError Error m ⇒ Annotated ProtocolMagicId ByteString → Environment → State → AVote ByteString → m State Source #
Register a vote and confirm the corresponding proposal if it passes the
voting threshold. This corresponds to the UPVOTE
rules in the spec.