| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Committee.Class
Description
Generic interface used by implementations of voting committees.
Synopsis
- class CryptoSupportsVoteSigning crypto ⇒ CryptoSupportsVotingCommittee crypto committee where
- data VotingCommittee crypto committee
- data VotingCommitteeInput crypto committee
- data VotingCommitteeError crypto committee
- data EligibilityWitness crypto committee
- data Vote crypto committee
- data Cert crypto committee
- mkVotingCommittee ∷ VotingCommitteeInput crypto committee → Either (VotingCommitteeError crypto committee) (VotingCommittee crypto committee)
- checkShouldVote ∷ VotingCommittee crypto committee → PoolId → PrivateKey crypto → ElectionId crypto → Either (VotingCommitteeError crypto committee) (Maybe (EligibilityWitness crypto committee))
- forgeVote ∷ EligibilityWitness crypto committee → PrivateKey crypto → ElectionId crypto → VoteCandidate crypto → Vote crypto committee
- verifyVote ∷ VotingCommittee crypto committee → Vote crypto committee → Either (VotingCommitteeError crypto committee) (EligibilityWitness crypto committee)
- eligiblePartyVoteWeight ∷ VotingCommittee crypto committee → EligibilityWitness crypto committee → VoteWeight
- forgeCert ∷ VotesWithSameTarget crypto committee → Cert crypto committee
- verifyCert ∷ VotingCommittee crypto committee → Cert crypto committee → Either (VotingCommitteeError crypto committee) (NE [EligibilityWitness crypto committee])
- data VotesWithSameTarget crypto committee
- getElectionIdFromVotes ∷ VotesWithSameTarget crypto committee → ElectionId crypto
- getVoteCandidateFromVotes ∷ VotesWithSameTarget crypto committee → VoteCandidate crypto
- getRawVotes ∷ VotesWithSameTarget crypto committee → NE [Vote crypto committee]
- data VotesWithSameTargetError crypto committee
- = EmptyVotes
- | TargetMismatch (NE [Vote crypto committee]) (NE [Vote crypto committee])
- ensureSameTarget ∷ (Eq (ElectionId crypto), Eq (VoteCandidate crypto)) ⇒ (Vote crypto committee → (ElectionId crypto, VoteCandidate crypto)) → [Vote crypto committee] → Either (VotesWithSameTargetError crypto committee) (VotesWithSameTarget crypto committee)
Voting committee interface
class CryptoSupportsVoteSigning crypto ⇒ CryptoSupportsVotingCommittee crypto committee where Source #
Interface for voting committee schemes.
This class is parametrized by the crypto primitives and the committee selection data structure. Instances define how to check whether a party should vote and how to compute the voting weight of a committee member.
Associated Types
data VotingCommittee crypto committee Source #
Structure storing the voting committee context
data VotingCommitteeInput crypto committee Source #
Input information needed to construct a voting committee
data VotingCommitteeError crypto committee Source #
Errors that can occur when operating on a voting committee
data EligibilityWitness crypto committee Source #
Witness attesting that a party is eligible to vote in a given election
NOTE: this is not necessarily the same as the cryptographic proof of eligibility used in concrete votes and certificates sent over the wire.
data Vote crypto committee Source #
Abstract vote cast by a committee member in a given election
data Cert crypto committee Source #
Abstract certificate attesting the winner of a given election
Methods
mkVotingCommittee ∷ VotingCommitteeInput crypto committee → Either (VotingCommitteeError crypto committee) (VotingCommittee crypto committee) Source #
Construct a voting committee
checkShouldVote ∷ VotingCommittee crypto committee → PoolId → PrivateKey crypto → ElectionId crypto → Either (VotingCommitteeError crypto committee) (Maybe (EligibilityWitness crypto committee)) Source #
Check whether we should vote in a given election
forgeVote ∷ EligibilityWitness crypto committee → PrivateKey crypto → ElectionId crypto → VoteCandidate crypto → Vote crypto committee Source #
Forge a vote for a given election and candidate
verifyVote ∷ VotingCommittee crypto committee → Vote crypto committee → Either (VotingCommitteeError crypto committee) (EligibilityWitness crypto committee) Source #
Verify a vote cast by a committee member in a given election
eligiblePartyVoteWeight ∷ VotingCommittee crypto committee → EligibilityWitness crypto committee → VoteWeight Source #
Compute the voting weight of a eligibile party
forgeCert ∷ VotesWithSameTarget crypto committee → Cert crypto committee Source #
Forge a certificate attesting the winner of a given election
verifyCert ∷ VotingCommittee crypto committee → Cert crypto committee → Either (VotingCommitteeError crypto committee) (NE [EligibilityWitness crypto committee]) Source #
Verify a certificate attesting the winner of a given election
Votes with same target
data VotesWithSameTarget crypto committee Source #
Collection of votes all targeting the same election and candidate
getElectionIdFromVotes ∷ VotesWithSameTarget crypto committee → ElectionId crypto Source #
Get the election identifier targeted by a collection of votes
getVoteCandidateFromVotes ∷ VotesWithSameTarget crypto committee → VoteCandidate crypto Source #
Get the vote candidate targeted by a collection of votes
getRawVotes ∷ VotesWithSameTarget crypto committee → NE [Vote crypto committee] Source #
Get the raw votes from a collection of votes with the same target.
NOTE: this returns votes in ascending seat index order.
data VotesWithSameTargetError crypto committee Source #
Errors when votes do not all target the same election and candidate
Constructors
| EmptyVotes | |
| TargetMismatch (NE [Vote crypto committee]) (NE [Vote crypto committee]) |
ensureSameTarget ∷ (Eq (ElectionId crypto), Eq (VoteCandidate crypto)) ⇒ (Vote crypto committee → (ElectionId crypto, VoteCandidate crypto)) → [Vote crypto committee] → Either (VotesWithSameTargetError crypto committee) (VotesWithSameTarget crypto committee) Source #
Check that a list of votes all target the same election and candidate