Certificates¶
record StakePoolParams : Type where field owners : ℙ KeyHash cost : Coin margin : UnitInterval pledge : Coin rewardAccount : Credential CCHotKeys : Type CCHotKeys = Credential ⇀ Maybe Credential PoolEnv : Type PoolEnv = PParams Pools : Type Pools = KeyHash ⇀ StakePoolParams Retiring : Type Retiring = KeyHash ⇀ Epoch
In the Dijkstra era, the Rewards map represents
account balances, not just staking rewards. An account's balance may increase
via staking rewards (at epoch boundaries) or via direct deposits (CIP-159).
Withdrawals decrease the balance. The name Rewards is retained for backwards
compatibility.
Rewards : Type Rewards = Credential ⇀ Coin Stake : Type Stake = Credential ⇀ Coin StakeDelegs : Type StakeDelegs = Credential ⇀ KeyHash data DCert : Type where delegate : Credential → Maybe VDeleg → Maybe KeyHash → Coin → DCert dereg : Credential → Maybe Coin → DCert regpool : KeyHash → StakePoolParams → DCert retirepool : KeyHash → Epoch → DCert regdrep : Credential → Coin → Anchor → DCert deregdrep : Credential → Coin → DCert ccreghot : Credential → Maybe Credential → DCert cwitness : DCert → Maybe Credential cwitness (delegate c _ _ _) = just c cwitness (dereg c _) = just c cwitness (regpool kh _) = just $ KeyHashObj kh cwitness (retirepool kh _) = just $ KeyHashObj kh cwitness (regdrep c _ _) = just c cwitness (deregdrep c _) = just c cwitness (ccreghot c _) = just c -- Certification Types record CertEnv : Type where field epoch : Epoch pp : PParams votes : List GovVote wdrls : Withdrawals coldCreds : ℙ Credential directDeposits : DirectDeposits record DState : Type where constructor ⟦_,_,_,_⟧ᵈ field voteDelegs : VoteDelegs stakeDelegs : StakeDelegs rewards : Rewards deposits : Credential ⇀ Coin record PState : Type where field pools : Pools fPools : Pools retiring : KeyHash ⇀ Epoch deposits : KeyHash ⇀ Coin record GState : Type where constructor ⟦_,_,_⟧ᵛ field dreps : DReps ccHotKeys : Credential ⇀ Maybe Credential deposits : Credential ⇀ Coin record CertState : Type where constructor ⟦_,_,_⟧ᶜˢ field dState : DState pState : PState gState : GState record DelegEnv : Type where field pparams : PParams pools : Pools delegatees : ℙ Credential
rewardsBalance : DState → Coin rewardsBalance ds = ∑[ x ← RewardsOf ds ] x
Cert-State Deposit Accounting¶
Functions in this section compute the effect that a DCert list has on
the three deposit fields (DState.deposits, PState.deposits,
GState.deposits) carried by a CertState. They describe
the deposit evolution for a single DCert and mirror that of the corresponding
CERT sub-rule.
Helper Functions¶
The three deposit fields carried by a CertState have types
Credential ⇀ Coin, KeyHash ⇀ Coin, and Credential ⇀ Coin, respectively,
and we package them up as a triple of values which are computed via
coinFromDepositTriple. By definition,
coinFromDeposits cs ≡ coinFromDepositTriple (depositTripleOf cs).
DepositTriple : Type DepositTriple = (Credential ⇀ Coin) × (KeyHash ⇀ Coin) × (Credential ⇀ Coin) depositTripleOf : CertState → DepositTriple depositTripleOf cs = DepositsOf (DStateOf cs) , DepositsOf (PStateOf cs) , DepositsOf (GStateOf cs) coinFromDepositTriple : DepositTriple → Coin coinFromDepositTriple (dd , dp , dg) = getCoin dd + getCoin dp + getCoin dg module _ (pp : PParams) where updateCertDeposit : DCert → DepositTriple → DepositTriple updateCertDeposit cert (dd , dp , dg) = case cert of λ where (delegate c _ _ d) → (dd ∪⁺ ❴ c , d ❵ , dp , dg) (dereg c _) → (dd ∣ ❴ c ❵ ᶜ , dp , dg) (regpool kh _) → (dd , dp ∪ˡ ❴ kh , pp .poolDeposit ❵ , dg) (regdrep c d _) → (dd , dp , dg ∪⁺ ❴ c , d ❵) (deregdrep c _) → (dd , dp , dg ∣ ❴ c ❵ ᶜ) _ → (dd , dp , dg) updateCertDepositsStep : CertState → DCert → CertState updateCertDepositsStep cs c = let (dd , dp , dg) = updateCertDeposit c (depositTripleOf cs) in $\begin{pmatrix} \,\htmlId{10268}{\htmlClass{Keyword}{\text{record}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#3007}{\htmlId{10275}{\htmlClass{Function}{\text{dState}}}}\, \,\htmlId{10282}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#2600}{\htmlId{10284}{\htmlClass{Field}{\text{deposits}}}}\, \,\htmlId{10293}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#10202}{\htmlId{10295}{\htmlClass{Bound}{\text{dd}}}}\, \,\htmlId{10298}{\htmlClass{Symbol}{\text{}}}}\, \\ \,\htmlId{10302}{\htmlClass{Keyword}{\text{record}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#3027}{\htmlId{10309}{\htmlClass{Function}{\text{pState}}}}\, \,\htmlId{10316}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#2749}{\htmlId{10318}{\htmlClass{Field}{\text{deposits}}}}\, \,\htmlId{10327}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#10207}{\htmlId{10329}{\htmlClass{Bound}{\text{dp}}}}\, \,\htmlId{10332}{\htmlClass{Symbol}{\text{}}}}\, \\ \,\htmlId{10336}{\htmlClass{Keyword}{\text{record}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#3047}{\htmlId{10343}{\htmlClass{Function}{\text{gState}}}}\, \,\htmlId{10350}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#2909}{\htmlId{10352}{\htmlClass{Field}{\text{deposits}}}}\, \,\htmlId{10361}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#10212}{\htmlId{10363}{\htmlClass{Bound}{\text{dg}}}}\, \,\htmlId{10366}{\htmlClass{Symbol}{\text{}}}}\, \end{pmatrix}$ where open CertState cs
Note that any drift between the updateCertDepositsStep and the
CERT sub-rule semantics is a soundness problem: it would allow the UTXO
batch-balance equation to accept transactions whose actual CertState evolution
doesn't balance.
TODO. Add a property in Certs.Properties for this invariant.
coinFromDeposits : CertState → Coin coinFromDeposits cs = coinFromDepositTriple (depositTripleOf cs) module _ (pp : PParams) (certState : CertState) where -- Iterated cert-deposit accounting starting from certState. Returns a new -- CertState with deposit fields accumulated from the given DCert list. updateCertDeposits : List DCert → CertState updateCertDeposits = foldl (updateCertDepositsStep pp) certState -- CERTS processes DCert lists head-first via `BS-ind`; this corresponds to a -- *left* fold; a right fold would be unsound on non-commutative sequences. depositsChange : List DCert → ℤ depositsChange certs = coinFromDeposits (updateCertDeposits certs) - coinFromDeposits certState newCertDeposits : List DCert → Coin newCertDeposits certs = posPart (depositsChange certs) refundCertDeposits : List DCert → Coin refundCertDeposits certs = negPart (depositsChange certs)
Auxiliary Transition Systems¶
DELEG Transition System¶
data _⊢_⇀⦇_,DELEG⦈_ : DelegEnv → DState → DCert → DState → Type where DELEG-delegate : ∙ (c ∉ dom rwds → d ≡ pp .keyDeposit) ∙ (c ∈ dom rwds → d ≡ 0) ∙ mvd ∈ mapˢ (just ∘ vDelegCredential) delegatees ∪ fromList ( nothing ∷ just vDelegAbstain ∷ just vDelegNoConfidence ∷ [] ) ∙ mkh ∈ mapˢ just (dom pools) ∪ ❴ nothing ❵ ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{12453}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{12458}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7871}{\htmlId{12466}{\htmlClass{Generalizable}{\text{delegatees}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7459}{\htmlId{12483}{\htmlClass{Generalizable}{\text{vDelegs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7383}{\htmlId{12493}{\htmlClass{Generalizable}{\text{sDelegs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7315}{\htmlId{12503}{\htmlClass{Generalizable}{\text{rwds}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{12510}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ delegate c mvd mkh d ,DELEG⦈ $\begin{pmatrix} \,\href{Axiom.Set.Map.html#9262}{\htmlId{12555}{\htmlClass{Function}{\text{insertIfJust}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12568}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#8083}{\htmlId{12570}{\htmlClass{Generalizable}{\text{mvd}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7459}{\htmlId{12574}{\htmlClass{Generalizable}{\text{vDelegs}}}}\, \\ \,\href{Axiom.Set.Map.html#9262}{\htmlId{12584}{\htmlClass{Function}{\text{insertIfJust}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12597}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7997}{\htmlId{12599}{\htmlClass{Generalizable}{\text{mkh}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7383}{\htmlId{12603}{\htmlClass{Generalizable}{\text{sDelegs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7315}{\htmlId{12613}{\htmlClass{Generalizable}{\text{rwds}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{12618}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12621}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12623}{\htmlClass{Generalizable}{\text{c}}}}\, , \,\htmlId{12627}{\htmlClass{Number}{\text{0}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12629}{\htmlClass{Field Operator}{\text{❵}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{12633}{\htmlClass{Generalizable}{\text{deposits}}}}\, \,\href{Axiom.Set.Map.Dec.html#2149}{\htmlId{12642}{\htmlClass{Function Operator}{\text{∪⁺}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12645}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12647}{\htmlClass{Generalizable}{\text{c}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#7763}{\htmlId{12651}{\htmlClass{Generalizable}{\text{d}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12653}{\htmlClass{Field Operator}{\text{❵}}}}\, \end{pmatrix}$ DELEG-dereg : ∙ (c , 0) ∈ rwds ∙ (c , d) ∈ deposits ∙ md ≡ nothing ⊎ md ≡ just d ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{12800}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{12805}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7871}{\htmlId{12813}{\htmlClass{Generalizable}{\text{delegatees}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7459}{\htmlId{12830}{\htmlClass{Generalizable}{\text{vDelegs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7383}{\htmlId{12840}{\htmlClass{Generalizable}{\text{sDelegs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7315}{\htmlId{12850}{\htmlClass{Generalizable}{\text{rwds}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{12857}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ dereg c md ,DELEG⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7459}{\htmlId{12892}{\htmlClass{Generalizable}{\text{vDelegs}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12900}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12902}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12904}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12906}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12908}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7383}{\htmlId{12912}{\htmlClass{Generalizable}{\text{sDelegs}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12920}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12922}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12924}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12926}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12928}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7315}{\htmlId{12932}{\htmlClass{Generalizable}{\text{rwds}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12937}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12939}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12941}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12943}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12945}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{12949}{\htmlClass{Generalizable}{\text{deposits}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12958}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12960}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{12962}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{12964}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{12966}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \end{pmatrix}$ isPoolRegistered : Pools -> KeyHash -> Maybe StakePoolParams isPoolRegistered ps kh = lookupᵐ? ps kh
POOL Transition System¶
data _⊢_⇀⦇_,POOL⦈_ : PoolEnv → PState → DCert → PState → Type where POOL-reg : ∙ Is-nothing (isPoolRegistered pools kh) ──────────────────────────────── pp ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{13305}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{13322}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{13340}{\htmlClass{Generalizable}{\text{retiring}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{13360}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ regpool kh poolParams ,POOL⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{13425}{\htmlClass{Generalizable}{\text{pools}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{13431}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13434}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7973}{\htmlId{13436}{\htmlClass{Generalizable}{\text{kh}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#8027}{\htmlId{13441}{\htmlClass{Generalizable}{\text{poolParams}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13452}{\htmlClass{Field Operator}{\text{❵}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{13465}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{13483}{\htmlClass{Generalizable}{\text{retiring}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{13503}{\htmlClass{Generalizable}{\text{deposits}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{13512}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13515}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7973}{\htmlId{13517}{\htmlClass{Generalizable}{\text{kh}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{13522}{\htmlClass{Generalizable}{\text{pp}}}}\, \,\htmlId{13525}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Dijkstra.Specification.PParams.html#3077}{\htmlId{13526}{\htmlClass{Field}{\text{poolDeposit}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13538}{\htmlClass{Field Operator}{\text{❵}}}}\, \end{pmatrix}$ POOL-rereg : ∙ Is-just (isPoolRegistered pools kh) ──────────────────────────────── pp ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{13657}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{13674}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{13692}{\htmlClass{Generalizable}{\text{retiring}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{13712}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ regpool kh poolParams ,POOL⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{13777}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Class.HasSingleton.html#288}{\htmlId{13794}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7973}{\htmlId{13796}{\htmlClass{Generalizable}{\text{kh}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#8027}{\htmlId{13801}{\htmlClass{Generalizable}{\text{poolParams}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13812}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{13814}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{13817}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{13835}{\htmlClass{Generalizable}{\text{retiring}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{13844}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13846}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7973}{\htmlId{13848}{\htmlClass{Generalizable}{\text{kh}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{13851}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{13853}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{13866}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ POOL-retirepool : ──────────────────────────────── pp ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{13955}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{13972}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{13990}{\htmlClass{Generalizable}{\text{retiring}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14010}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ retirepool kh e ,POOL⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7497}{\htmlId{14069}{\htmlClass{Generalizable}{\text{pools}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7503}{\htmlId{14086}{\htmlClass{Generalizable}{\text{fPools}}}}\, \\ \,\href{Class.HasSingleton.html#288}{\htmlId{14104}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7973}{\htmlId{14106}{\htmlClass{Generalizable}{\text{kh}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{14111}{\htmlClass{Generalizable}{\text{e}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14113}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{14115}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7530}{\htmlId{14118}{\htmlClass{Generalizable}{\text{retiring}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14138}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$
GOVCERT Transition System¶
data _⊢_⇀⦇_,GOVCERT⦈_ : CertEnv → GState → DCert → GState → Type where GOVCERT-regdrep : ∙ (d ≡ pp .drepDeposit × c ∉ dom dReps) ⊎ (d ≡ 0 × c ∈ dom dReps) ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{14427}{\htmlClass{Generalizable}{\text{e}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{14431}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7944}{\htmlId{14436}{\htmlClass{Generalizable}{\text{vs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7566}{\htmlId{14441}{\htmlClass{Generalizable}{\text{wdrls}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8173}{\htmlId{14449}{\htmlClass{Generalizable}{\text{cc}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7605}{\htmlId{14454}{\htmlClass{Generalizable}{\text{dd}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{14463}{\htmlClass{Generalizable}{\text{dReps}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{14471}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14480}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ regdrep c d an ,GOVCERT⦈ $\begin{pmatrix} \,\href{Class.HasSingleton.html#288}{\htmlId{14521}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{14523}{\htmlClass{Generalizable}{\text{c}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{14527}{\htmlClass{Generalizable}{\text{e}}}}\, \,\href{Class.HasAdd.Core.html#162}{\htmlId{14529}{\htmlClass{Field Operator}{\text{+}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{14531}{\htmlClass{Generalizable}{\text{pp}}}}\, \,\htmlId{14534}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Dijkstra.Specification.PParams.html#4207}{\htmlId{14535}{\htmlClass{Field}{\text{drepActivity}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14548}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{14550}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{14553}{\htmlClass{Generalizable}{\text{dReps}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{14561}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14570}{\htmlClass{Generalizable}{\text{deposits}}}}\, \,\href{Axiom.Set.Map.Dec.html#2149}{\htmlId{14579}{\htmlClass{Function Operator}{\text{∪⁺}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14582}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{14584}{\htmlClass{Generalizable}{\text{c}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#7763}{\htmlId{14588}{\htmlClass{Generalizable}{\text{d}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14590}{\htmlClass{Field Operator}{\text{❵}}}}\, \end{pmatrix}$ GOVCERT-deregdrep : ∙ c ∈ dom dReps ∙ (c , d) ∈ deposits ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{14709}{\htmlClass{Generalizable}{\text{e}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{14713}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7944}{\htmlId{14718}{\htmlClass{Generalizable}{\text{vs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7566}{\htmlId{14723}{\htmlClass{Generalizable}{\text{wdrls}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8173}{\htmlId{14731}{\htmlClass{Generalizable}{\text{cc}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7605}{\htmlId{14736}{\htmlClass{Generalizable}{\text{dd}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{14745}{\htmlClass{Generalizable}{\text{dReps}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{14753}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14762}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ deregdrep c d ,GOVCERT⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{14802}{\htmlClass{Generalizable}{\text{dReps}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{14808}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14810}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{14812}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14814}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{14816}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{14820}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{14829}{\htmlClass{Generalizable}{\text{deposits}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{14838}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14840}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{14842}{\htmlClass{Generalizable}{\text{c}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{14844}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{14846}{\htmlClass{Function Operator}{\text{ᶜ}}}}\, \end{pmatrix}$ GOVCERT-ccreghot : ∙ (c , nothing) ∉ ccKeys ∙ c ∈ cc ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{14961}{\htmlClass{Generalizable}{\text{e}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{14965}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7944}{\htmlId{14970}{\htmlClass{Generalizable}{\text{vs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7566}{\htmlId{14975}{\htmlClass{Generalizable}{\text{wdrls}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8173}{\htmlId{14983}{\htmlClass{Generalizable}{\text{cc}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7605}{\htmlId{14988}{\htmlClass{Generalizable}{\text{dd}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{14997}{\htmlClass{Generalizable}{\text{dReps}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{15005}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{15014}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$ ⇀⦇ ccreghot c mc ,GOVCERT⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7350}{\htmlId{15054}{\htmlClass{Generalizable}{\text{dReps}}}}\, \\ \,\href{Class.HasSingleton.html#288}{\htmlId{15062}{\htmlClass{Field Operator}{\text{❴}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7811}{\htmlId{15064}{\htmlClass{Generalizable}{\text{c}}}}\, , \,\href{Ledger.Dijkstra.Specification.Certs.html#7838}{\htmlId{15068}{\htmlClass{Generalizable}{\text{mc}}}}\, \,\href{Class.HasSingleton.html#288}{\htmlId{15071}{\htmlClass{Field Operator}{\text{❵}}}}\, \,\href{Axiom.Set.Map.html#7640}{\htmlId{15073}{\htmlClass{Function Operator}{\text{∪ˡ}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#7422}{\htmlId{15076}{\htmlClass{Generalizable}{\text{ccKeys}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7679}{\htmlId{15085}{\htmlClass{Generalizable}{\text{deposits}}}}\, \end{pmatrix}$
CERT Transition System¶
data _⊢_⇀⦇_,CERT⦈_ : CertEnv → CertState → DCert → CertState → Type where CERT-deleg : ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{15251}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#2673}{\htmlId{15256}{\htmlClass{Field}{\text{PState.pools}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15269}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Class.IsSet.html#916}{\htmlId{15275}{\htmlClass{Function}{\text{dom}}}}\, \,\htmlId{15279}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Dijkstra.Specification.Certs.html#2839}{\htmlId{15280}{\htmlClass{Field}{\text{GState.dreps}}}}\, \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15293}{\htmlClass{Generalizable}{\text{stᵍ}}}}\,\,\htmlId{15296}{\htmlClass{Symbol}{\text{)}}}\, \end{pmatrix}$ ⊢ stᵈ ⇀⦇ dCert ,DELEG⦈ stᵈ' ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{15375}{\htmlClass{Generalizable}{\text{e}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{15379}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7944}{\htmlId{15384}{\htmlClass{Generalizable}{\text{vs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7566}{\htmlId{15389}{\htmlClass{Generalizable}{\text{wdrls}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8173}{\htmlId{15397}{\htmlClass{Generalizable}{\text{cc}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7605}{\htmlId{15402}{\htmlClass{Generalizable}{\text{dd}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8113}{\htmlId{15411}{\htmlClass{Generalizable}{\text{stᵈ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15417}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15423}{\htmlClass{Generalizable}{\text{stᵍ}}}}\, \end{pmatrix}$ ⇀⦇ dCert ,CERT⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8117}{\htmlId{15447}{\htmlClass{Generalizable}{\text{stᵈ'}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15454}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15460}{\htmlClass{Generalizable}{\text{stᵍ}}}}\, \end{pmatrix}$ CERT-pool : ∙ pp ⊢ stᵖ ⇀⦇ dCert ,POOL⦈ stᵖ' ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#7922}{\htmlId{15564}{\htmlClass{Generalizable}{\text{e}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8059}{\htmlId{15568}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7944}{\htmlId{15573}{\htmlClass{Generalizable}{\text{vs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7566}{\htmlId{15578}{\htmlClass{Generalizable}{\text{wdrls}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8173}{\htmlId{15586}{\htmlClass{Generalizable}{\text{cc}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#7605}{\htmlId{15591}{\htmlClass{Generalizable}{\text{dd}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8113}{\htmlId{15600}{\htmlClass{Generalizable}{\text{stᵈ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15606}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15612}{\htmlClass{Generalizable}{\text{stᵍ}}}}\, \end{pmatrix}$ ⇀⦇ dCert ,CERT⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8113}{\htmlId{15636}{\htmlClass{Generalizable}{\text{stᵈ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8157}{\htmlId{15642}{\htmlClass{Generalizable}{\text{stᵖ'}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15649}{\htmlClass{Generalizable}{\text{stᵍ}}}}\, \end{pmatrix}$ CERT-gov : ∙ Γ ⊢ stᵍ ⇀⦇ dCert ,GOVCERT⦈ stᵍ' ──────────────────────────────── Γ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8113}{\htmlId{15758}{\htmlClass{Generalizable}{\text{stᵈ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15764}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8133}{\htmlId{15770}{\htmlClass{Generalizable}{\text{stᵍ}}}}\, \end{pmatrix}$ ⇀⦇ dCert ,CERT⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Certs.html#8113}{\htmlId{15794}{\htmlClass{Generalizable}{\text{stᵈ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8153}{\htmlId{15800}{\htmlClass{Generalizable}{\text{stᵖ}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Certs.html#8137}{\htmlId{15806}{\htmlClass{Generalizable}{\text{stᵍ'}}}}\, \end{pmatrix}$
CERTS Transition System¶
_⊢_⇀⦇_,CERTS⦈_ : CertEnv → CertState → List DCert → CertState → Type _⊢_⇀⦇_,CERTS⦈_ = ReflexiveTransitiveClosure {sts = _⊢_⇀⦇_,CERT⦈_}