Governance Actions
This section defines several concepts and types used to represent governance actions.
{-# OPTIONS --safe #-}
open import Ledger.Conway.Specification.Gov.Base
module Ledger.Conway.Specification.Gov.Actions ( gs : _) ( open GovStructure gs ) where
open import Data.Nat.Properties using ( +-0-monoid )
open import Data.Rational using ( ℚ ; 0ℚ ; 1ℚ )
open import Tactic.Derive.Show
open import Ledger.Prelude as P hiding ( yes ; no )
Roles
There are three distinct roles with specific functions in the governance framework:
constitutional committee (henceforth called CC);
delegate representatives (henceforth called DReps);
stake pool operators (henceforth called SPOs).
data GovRole : Type where
CC DRep SPO : GovRole
instance
unquoteDecl Show-GovRole = derive-Show [ ( quote GovRole , Show-GovRole ) ]
Actors belonging to each governance role are identified by a type of
credential:
GovRoleCredential : GovRole → Type
GovRoleCredential CC = Credential
GovRoleCredential DRep = Credential
GovRoleCredential SPO = KeyHash
Actions
A governance action is one of the seven types described in the table below:
Action
Description
NoConfidence
a motion to create a state of no-confidence in the current constitutional committee
UpdateCommittee
changes to the members of the constitutional committee and/or to its signature threshold and/or terms
NewConstitution
a modification to the off-chain Constitution and the proposal policy script
TriggerHardFork
triggers a non-backwards compatible upgrade of the network; requires a prior software upgrade
ChangePParams
a change to one or more updatable protocol parameters, excluding changes to major protocol versions (“hard forks”)
TreasuryWithdrawal
movements from the treasury
Info
an action that has no effect on-chain, other than an on-chain record
data GovActionType : Type where
NoConfidence : GovActionType
UpdateCommittee : GovActionType
NewConstitution : GovActionType
TriggerHardFork : GovActionType
ChangePParams : GovActionType
TreasuryWithdrawal : GovActionType
Info : GovActionType
record HasGovActionType ( A : Type ) : Type where
field GovActionTypeOf : A → GovActionType
open HasGovActionType ⦃...⦄ public
Governance actions carry the following information:
UpdateCommittee: a map of credentials and terms to
add and a set of credentials to remove from the committee;
NewConstitution: a hash of the new constitution
document and an optional proposal policy;
TriggerHardFork: the protocol version of the epoch to
hard fork into;
ChangePParams: the updates to the parameters;
TreasuryWithdrawal: a map of withdrawals.
GovActionData : GovActionType → Type
GovActionData NoConfidence = ⊤
GovActionData UpdateCommittee = ( Credential ⇀ Epoch ) × ℙ Credential × ℚ
GovActionData NewConstitution = DocHash × Maybe ScriptHash
GovActionData TriggerHardFork = ProtVer
GovActionData ChangePParams = PParamsUpdate
GovActionData TreasuryWithdrawal = Withdrawals
GovActionData Info = ⊤
A governance action consist of a type of governance action together with the
necessary data:
record GovAction : Type where
constructor ⟦_,_⟧ᵍᵃ
field
gaType : GovActionType
gaData : GovActionData gaType
open GovAction public
record HasGovAction ( A : Type ) : Type where
field GovActionOf : A → GovAction
open HasGovAction ⦃...⦄ public
instance
HasGovActionType-GovAction : HasGovActionType GovAction
HasGovActionType-GovAction . GovActionTypeOf = GovAction.gaType
HasCast-GovAction-Sigma : HasCast GovAction ( Σ GovActionType GovActionData )
HasCast-GovAction-Sigma . cast x = x . gaType , x . gaData
Governance actions are uniquely identified by a GovActionID. This type
consists of the TxId of the transaction that proposes the
governance action together with an index that identifies the proposal within the
transaction.
GovActionID : Type
GovActionID = TxId × ℕ
Votes
The Vote type represents the three different voting options:
yes, no, and
abstain.
data Vote : Type where
yes no abstain : Vote
For a Vote to be cast, it must be packaged together with
further information, such as who votes GovVoter and for which
governance action. This information is combined in the GovVote
record. An optional Anchor can be provided to give context about
why a vote was cast in a certain manner.
record GovVoter : Type where
constructor ⟦_,_⟧ᵍᵛ
field
gvRole : GovRole
gvCredential : GovRoleCredential gvRole
record Anchor : Type where
field
url : String
hash : DocHash
DocHash
The type DocHash is abstract but in the implementation it is
instantiated with a 32-bit hash type (like, e.g., ScriptHash).
We keep it separate because it is used for a different purpose.
record GovVote : Type where
field
gid : GovActionID
voter : GovVoter
vote : Vote
anchor : Maybe Anchor
Finally, we define the GovVotes type, an inhabitant of which is
comprised of three maps that collect the votes cast by members of each of the
three governance roles.
record GovVotes : Type where
field
gvCC : Credential ⇀ Vote
gvDRep : Credential ⇀ Vote
gvSPO : KeyHash ⇀ Vote
Vote Delegation
The type VDeleg represents the different ways in which
voting stake can be delegated:
to the credential of a DRep (vDelegCredential);
to an abstention (vDelegAbstain);
to a vote of no confidence (vDelegNoConfidence).
data VDeleg : Type where
vDelegCredential : Credential → VDeleg
vDelegAbstain : VDeleg
vDelegNoConfidence : VDeleg
VoteDelegs : Type
VoteDelegs = Credential ⇀ VDeleg
record HasVoteDelegs { a } ( A : Type a ) : Type a where
field VoteDelegsOf : A → VoteDelegs
open HasVoteDelegs ⦃...⦄ public
Hash Protection
For some governance actions, in addition to obtaining the necessary
votes, enactment requires that the following condition is also
satisfied:
the state obtained by enacting the proposal is in fact the state that was intended
when the proposal was submitted.
This is achieved by requiring actions to unambiguously link to the state they
are modifying via a pointer to the previous modification. A proposal can
only be enacted if it contains the hash of the previously enacted proposal
modifying the same piece of state.
NoConfidence and
UpdateCommittee modify the same state,
while every other type of governance action has its own state that isn’t
shared with any other action. This means that the enactibility of a
proposal can change when other proposals are enacted.
However, not all types of governance actions require this strict
protection. For TreasuryWithdrawal and
Info, enacting them does not change the
state in non-commutative ways, so they can always be enacted.
The types we use to represent this hash protection scheme are as follows.
NeedsHash : GovActionType → Type
NeedsHash NoConfidence = GovActionID
NeedsHash UpdateCommittee = GovActionID
NeedsHash NewConstitution = GovActionID
NeedsHash TriggerHardFork = GovActionID
NeedsHash ChangePParams = GovActionID
NeedsHash TreasuryWithdrawal = ⊤
NeedsHash Info = ⊤
HashProtected : Type → Type
HashProtected A = A × GovActionID
instance
HasCast-HashProtected : ∀ { A : Type } → HasCast ( HashProtected A ) A
HasCast-HashProtected . cast = proj₁
HasCast-HashProtected-MaybeScriptHash : HasCast ( HashProtected ( DocHash × Maybe ScriptHash )) ( Maybe ScriptHash )
HasCast-HashProtected-MaybeScriptHash . cast = proj₂ ∘ proj₁
Governance Proposal Types
To propose a governance action, a GovProposal needs to be
submitted. Beside the proposed action, it contains five other fields which we now
describe.
prevAction: a pointer to the previous action if required
(see Hash Protection );
policy: a pointer to the proposal policy if one is required;
deposit: a deposit, which will be returned to returnAddr;
returnAddr: a reward address to which the deposit will be
returned when the proposal is removed from the state;
anchor: a placeholder which may be used to provide further
information about the proposal.
While the deposit is held, it is added to the deposit pot, similar to stake key
deposits. It is also counted towards the voting stake (but not the block production
stake) of the reward address to which it will be returned, so as not to reduce the
submitter’s voting power when voting on their own (and competing) actions. For a
proposal to be valid, the deposit must be set to the current value of
govActionDeposit. The deposit will be returned when the action is
removed from the state in any way.
Policy : Type
Policy = Maybe ScriptHash
record GovProposal : Type where
field
action : GovAction
prevAction : NeedsHash ( gaType action )
policy : Policy
deposit : Coin
returnAddr : RwdAddr
anchor : Anchor
Governance Action State
The GovActionState type represents the state of an individual
governance action. It contains the individual votes, its lifetime, and information
necessary to enact the action and to repay the deposit.
record GovActionState : Type where
field
votes : GovVotes
returnAddr : RwdAddr
expiresIn : Epoch
action : GovAction
prevAction : NeedsHash ( gaType action )
record HasGovVoter { a } ( A : Type a ) : Type a where
field GovVoterOf : A → GovVoter
open HasGovVoter ⦃...⦄ public
record HasVote { a } ( A : Type a ) : Type a where
field VoteOf : A → Vote
open HasVote ⦃...⦄ public
record HasPolicy { a } ( A : Type a ) : Type a where
field PolicyOf : A → Policy
open HasPolicy ⦃...⦄ public
instance
HasGovVoter-GovVote : HasGovVoter GovVote
HasGovVoter-GovVote . GovVoterOf = GovVote.voter
HasVote-GovVote : HasVote GovVote
HasVote-GovVote . VoteOf = GovVote.vote
HasPolicy-GovProposal : HasPolicy GovProposal
HasPolicy-GovProposal . PolicyOf = GovProposal.policy
HasGovAction-GovProposal : HasGovAction GovProposal
HasGovAction-GovProposal . GovActionOf = GovProposal.action
HasGovAction-GovActionState : HasGovAction GovActionState
HasGovAction-GovActionState . GovActionOf = GovActionState.action
HasGovActionType-GovProposal : HasGovActionType GovProposal
HasGovActionType-GovProposal . GovActionTypeOf = GovActionTypeOf ∘ GovActionOf
HasGovActionType-GovActionState : HasGovActionType GovActionState
HasGovActionType-GovActionState . GovActionTypeOf = GovActionTypeOf ∘ GovActionOf
instance
unquoteDecl DecEq-GovActionType = derive-DecEq (( quote GovActionType , DecEq-GovActionType ) ∷ [] )
unquoteDecl DecEq-GovRole = derive-DecEq (( quote GovRole , DecEq-GovRole ) ∷ [] )
unquoteDecl DecEq-Vote = derive-DecEq (( quote Vote , DecEq-Vote ) ∷ [] )
unquoteDecl DecEq-VDeleg = derive-DecEq (( quote VDeleg , DecEq-VDeleg ) ∷ [] )
DecEq-GovVoter : DecEq GovVoter
DecEq-GovVoter . _≟_ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{12708}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#12715}{\htmlId{12715}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix}$ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{12723}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#12730}{\htmlId{12730}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}$
with c ≟ c'
... | P.yes p = P.yes ( cong $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{12785}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#12767}{\htmlId{12794}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{12795}{\htmlClass{Symbol}{\text{)}}}\,
\,\htmlId{12799}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{12803}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{12805}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#12810}{\htmlId{12810}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{12813}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{12815}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{12820}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{12823}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{12825}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{12830}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#12810}{\htmlId{12832}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{12835}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{12839}{\htmlClass{Symbol}{\text{})}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{12844}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{12859}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{12860}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{12866}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#12873}{\htmlId{12873}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{12881}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#12888}{\htmlId{12888}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{12895}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{12897}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{12902}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{12904}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{12909}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{12924}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{12925}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{12931}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#12938}{\htmlId{12938}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{12946}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#12953}{\htmlId{12953}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{12960}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{12962}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{12967}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{12969}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{12974}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{12989}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{12990}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{12996}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13003}{\htmlId{13003}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{13011}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13018}{\htmlId{13018}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{13025}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13027}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13032}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{13034}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{13039}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{13054}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{13055}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13061}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13068}{\htmlId{13068}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13076}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13083}{\htmlId{13083}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}
\,\htmlId{13094}{\htmlClass{Keyword}{\text{with}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13068}{\htmlId{13099}{\htmlClass{Bound}{\text{c}}}}\, \,\href{Class.DecEq.Core.html#168}{\htmlId{13101}{\htmlClass{Field Operator}{\text{≟}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13083}{\htmlId{13103}{\htmlClass{Bound}{\text{c'}}}}\,
\,\htmlId{13108}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{13112}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{13114}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13120}{\htmlId{13120}{\htmlClass{Bound}{\text{p}}}}\, \,\htmlId{13122}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{13124}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\htmlId{13130}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Relation.Binary.PropositionalEquality.Core.html#1481}{\htmlId{13131}{\htmlClass{Function}{\text{cong}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13138}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13120}{\htmlId{13149}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{13150}{\htmlClass{Symbol}{\text{)}}}\,
\,\htmlId{13154}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{13158}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13160}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13165}{\htmlId{13165}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{13168}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13170}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13175}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{13178}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{13180}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{13185}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13165}{\htmlId{13187}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{13190}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{13194}{\htmlClass{Symbol}{\text{})}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{13199}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{13214}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{13215}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13221}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13228}{\htmlId{13228}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13236}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13243}{\htmlId{13243}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{13250}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13252}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13257}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{13259}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{13264}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{13279}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{13280}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13286}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13293}{\htmlId{13293}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{13301}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13308}{\htmlId{13308}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{13315}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13317}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13322}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{13324}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{13329}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{13344}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{13345}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13351}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13358}{\htmlId{13358}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13366}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13373}{\htmlId{13373}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{13380}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13382}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13387}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{13389}{\htmlClass{Symbol}{\text{()}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#12652}{\htmlId{13394}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{13409}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{13410}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13416}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13423}{\htmlId{13423}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13431}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13438}{\htmlId{13438}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}
\,\htmlId{13449}{\htmlClass{Keyword}{\text{with}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13423}{\htmlId{13454}{\htmlClass{Bound}{\text{c}}}}\, \,\href{Class.DecEq.Core.html#168}{\htmlId{13456}{\htmlClass{Field Operator}{\text{≟}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13438}{\htmlId{13458}{\htmlClass{Bound}{\text{c'}}}}\,
\,\htmlId{13463}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{13467}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{13469}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13475}{\htmlId{13475}{\htmlClass{Bound}{\text{p}}}}\, \,\htmlId{13477}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{13479}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\htmlId{13485}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Relation.Binary.PropositionalEquality.Core.html#1481}{\htmlId{13486}{\htmlClass{Function}{\text{cong}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#978}{\htmlId{13493}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13475}{\htmlId{13503}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{13504}{\htmlClass{Symbol}{\text{)}}}\,
\,\htmlId{13508}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{13512}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13514}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13519}{\htmlId{13519}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{13522}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{13524}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{13529}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{13532}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{13534}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{13539}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13519}{\htmlId{13541}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{13544}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{13548}{\htmlClass{Symbol}{\text{})}}}\,
\,\htmlId{13554}{\htmlClass{Keyword}{\text{unquoteDecl}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13566}{\htmlId{13566}{\htmlClass{Function}{\text{HasCast-GovVote}}}}\, \,\htmlId{13582}{\htmlClass{Symbol}{\text{=}}}\, \,\href{stdlib-classes.Class.HasCast.Derive.html#2690}{\htmlId{13584}{\htmlClass{Function}{\text{derive-HasCast}}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{13599}{\htmlClass{Function Operator}{\text{[}}}}\, \,\htmlId{13601}{\htmlClass{Symbol}{\text{(}}}\,\,\htmlId{13602}{\htmlClass{Keyword}{\text{quote}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#5990}{\htmlId{13608}{\htmlClass{Record}{\text{GovVote}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13566}{\htmlId{13618}{\htmlClass{Function}{\text{HasCast-GovVote}}}}\,\,\htmlId{13633}{\htmlClass{Symbol}{\text{)}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{13635}{\htmlClass{Function Operator}{\text{]}}}}\,
\,\htmlId{13640}{\htmlClass{Keyword}{\text{unquoteDecl}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#13652}{\htmlId{13652}{\htmlClass{Function}{\text{Show-VDeleg}}}}\, \,\htmlId{13664}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Tactic.Derive.Show.html#2038}{\htmlId{13666}{\htmlClass{Function}{\text{derive-Show}}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{13678}{\htmlClass{Function Operator}{\text{[}}}}\, \,\htmlId{13680}{\htmlClass{Symbol}{\text{(}}}\,\,\htmlId{13681}{\htmlClass{Keyword}{\text{quote}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6824}{\htmlId{13687}{\htmlClass{Datatype}{\text{VDeleg}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#13652}{\htmlId{13696}{\htmlClass{Function}{\text{Show-VDeleg}}}}\,\,\htmlId{13707}{\htmlClass{Symbol}{\text{)}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{13709}{\htmlClass{Function Operator}{\text{]}}}}\,
Governance Helper Functions
isGovVoterDRep : GovVoter → Maybe Credential
isGovVoterDRep $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{13857}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#13864}{\htmlId{13864}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix}$ = just c
isGovVoterDRep _ = nothing
isGovVoterCredential : GovVoter → Maybe Credential
isGovVoterCredential $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#970}{\htmlId{13981}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#13988}{\htmlId{13988}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix}$ = just c
isGovVoterCredential $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#973}{\htmlId{14026}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#14033}{\htmlId{14033}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix}$ = just c
isGovVoterCredential _ = nothing
proposedCC : GovAction → ℙ Credential
proposedCC $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2484}{\htmlId{14133}{\htmlClass{InductiveConstructor}{\text{UpdateCommittee}}}}\, \\ \,\htmlId{14151}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#14152}{\htmlId{14152}{\htmlClass{Bound}{\text{x}}}}\, , \,\htmlId{14156}{\htmlClass{Symbol}{\text{\_}}}\, , \,\htmlId{14160}{\htmlClass{Symbol}{\text{\_)}}}\, \end{pmatrix}$ = dom x
proposedCC _ = ∅
DReps : Type
DReps = Credential ⇀ Epoch
record HasDReps { a } ( A : Type a ) : Type a where
field DRepsOf : A → DReps
open HasDReps ⦃...⦄ public
The following function takes a type A with an associated set of
DReps, and an epoch e, and returns the
DReps of A that expire in epoch e or
later.
activeInEpoch : Epoch → Credential × Epoch → Type
activeInEpoch e (_ , expEpoch ) = e ≤ expEpoch
activeDRepsOf : { A : Type } ⦃ _ : HasDReps A ⦄ → A → Epoch → DReps
activeDRepsOf a e = filterᵐ ( activeInEpoch e ) ( DRepsOf a )