@@ -73,12 +73,6 @@ data DCert : Type where
7373 regdrep : Credential → Coin → Anchor → DCert
7474 deregdrep : Credential → Coin → DCert
7575 ccreghot : Credential → Maybe Credential → DCert
76- -- The `reg` cert is deprecated in Conway, but it's still present in this era
77- -- for backwards compatibility. This has been added to the spec to make
78- -- conformance testing work properly. We don't talk about this certificate
79- -- in the docs because it has been deprecated and we want to discourage people
80- -- from using it.
81- reg : Credential → Coin → DCert
8276
8377cwitness : DCert → Maybe Credential
8478cwitness (delegate c _ _ _) = just c
@@ -89,14 +83,6 @@ cwitness (regdrep c _ _) = just c
8983cwitness (deregdrep c _) = just c
9084cwitness (ccreghot c _) = just c
9185
92- -- The implementation requires the `reg` cert to be witnessed only if the
93- -- deposit is set. There didn't use to be a field for the deposit, but that was
94- -- added in the Conway era to make it easier to determine, just by looking at
95- -- the transaction, how much deposit was paid for that certificate.
96- cwitness (reg _ zero) = nothing
97- cwitness (reg c (suc _)) = just c
98-
99-
10086-- Certification Types
10187record CertEnv : Type where
10288 field
@@ -112,18 +98,21 @@ record DState : Type where
11298 voteDelegs : VoteDelegs
11399 stakeDelegs : StakeDelegs
114100 rewards : Rewards
101+ deposits : Deposits
115102
116103record PState : Type where
117104 field
118105 pools : Pools
119106 fPools : Pools
120107 retiring : KeyHash ⇀ Epoch
108+ deposits : Deposits
121109
122110record GState : Type where
123111 constructor ⟦_,_⟧ᵛ
124112 field
125113 dreps : DReps
126114 ccHotKeys : Credential ⇀ Maybe Credential
115+ deposits : Deposits
127116
128117record CertState : Type where
129118 constructor ⟦_,_,_⟧ᶜˢ
@@ -139,9 +128,6 @@ record DelegEnv : Type where
139128 delegatees : ℙ Credential
140129```
141130
142-
143-
144-
145131<!--
146132```agda
147133record HasDeposits {a} (A : Type a) : Type a where
@@ -265,6 +251,7 @@ private variable
265251 pools fPools : Pools
266252 retiring : Retiring
267253 wdrls : Withdrawals
254+ deposits deposits' : Deposits
268255
269256 an : Anchor
270257 Γ : CertEnv
@@ -314,19 +301,12 @@ data _⊢_⇀⦇_,DELEG⦈_ : DelegEnv → DState → DCert → DState → Type
314301 fromList ( nothing ∷ just vDelegAbstain ∷ just vDelegNoConfidence ∷ [] )
315302 ∙ mkh ∈ mapˢ just (dom pools) ∪ ❴ nothing ❵
316303 ────────────────────────────────
317- ⟦ pp , pools , delegatees ⟧ ⊢ ⟦ vDelegs , sDelegs , rwds ⟧ ⇀⦇ delegate c mvd mkh d ,DELEG⦈ ⟦ insertIfJust c mvd vDelegs , insertIfJust c mkh sDelegs , rwds ∪ˡ ❴ c , 0 ❵ ⟧
304+ ⟦ pp , pools , delegatees ⟧ ⊢ ⟦ vDelegs , sDelegs , rwds , deposits ⟧ ⇀⦇ delegate c mvd mkh d ,DELEG⦈ ⟦ insertIfJust c mvd vDelegs , insertIfJust c mkh sDelegs , rwds ∪ˡ ❴ c , 0 ❵ , deposits ∪⁺ ❴ CredentialDeposit c , d ❵ ⟧
318305
319306 DELEG-dereg :
320307 ∙ (c , 0) ∈ rwds
321308 ────────────────────────────────
322- ⟦ pp , pools , delegatees ⟧ ⊢ ⟦ vDelegs , sDelegs , rwds ⟧ ⇀⦇ dereg c md ,DELEG⦈ ⟦ vDelegs ∣ ❴ c ❵ ᶜ , sDelegs ∣ ❴ c ❵ ᶜ , rwds ∣ ❴ c ❵ ᶜ ⟧
323-
324- DELEG-reg :
325- ∙ c ∉ dom rwds
326- ∙ d ≡ pp .keyDeposit ⊎ d ≡ 0
327- ────────────────────────────────
328- ⟦ pp , pools , delegatees ⟧ ⊢ ⟦ vDelegs , sDelegs , rwds ⟧ ⇀⦇ reg c d ,DELEG⦈ ⟦ vDelegs , sDelegs , rwds ∪ˡ ❴ c , 0 ❵ ⟧
329-
309+ ⟦ pp , pools , delegatees ⟧ ⊢ ⟦ vDelegs , sDelegs , rwds , deposits ⟧ ⇀⦇ dereg c md ,DELEG⦈ ⟦ vDelegs ∣ ❴ c ❵ ᶜ , sDelegs ∣ ❴ c ❵ ᶜ , rwds ∣ ❴ c ❵ ᶜ , deposits ∣ ❴ CredentialDeposit c ❵ ᶜ ⟧
330310
331311
332312isPoolRegistered : Pools -> KeyHash -> Maybe StakePoolParams
@@ -335,32 +315,45 @@ isPoolRegistered ps kh = lookupᵐ? ps kh
335315-- Auxiliary POOL transition system --
336316data _⊢_⇀⦇_,POOL⦈_ : PoolEnv → PState → DCert → PState → Type where
337317
338- POOL-regpool :
339- let
340- fPool' =
341- if isPoolRegistered pools kh
342- then ❴ kh , poolParams ❵ ∪ˡ fPools
343- else fPools
344- in
318+ POOL-reg :
319+ ∙ Is-just (isPoolRegistered pools kh)
345320 ────────────────────────────────
346321 pp ⊢ ⟦ pools
347322 , fPools
348323 , retiring
324+ , deposits
349325 ⟧ ⇀⦇ regpool kh poolParams ,POOL⦈ ⟦
350326 pools ∪ˡ ❴ kh , poolParams ❵
351- , fPool'
352- , retiring ∣ ❴ kh ❵ ᶜ
327+ , fPools
328+ , retiring
329+ , deposits ∪⁺ ❴ PoolDeposit kh , pp .poolDeposit ❵
330+ ⟧
331+
332+ POOL-rereg :
333+ ∙ Is-nothing (isPoolRegistered pools kh)
334+ ────────────────────────────────
335+ pp ⊢ ⟦ pools
336+ , fPools
337+ , retiring
338+ , deposits
339+ ⟧ ⇀⦇ regpool kh poolParams ,POOL⦈ ⟦
340+ pools
341+ , ❴ kh , poolParams ❵ ∪ˡ fPools
342+ , retiring ∣ ❴ kh ❵ ᶜ
343+ , deposits
353344 ⟧
354345
355346 POOL-retirepool :
356347 ────────────────────────────────
357348 pp ⊢ ⟦ pools
358349 , fPools
359350 , retiring
351+ , deposits
360352 ⟧ ⇀⦇ retirepool kh e ,POOL⦈ ⟦
361353 pools
362354 , fPools
363355 , ❴ kh , e ❵ ∪ˡ retiring
356+ , deposits
364357 ⟧
365358
366359
@@ -370,18 +363,18 @@ data _⊢_⇀⦇_,GOVCERT⦈_ : CertEnv → GState → DCert → GState → Type
370363 GOVCERT-regdrep :
371364 ∙ (d ≡ pp .drepDeposit × c ∉ dom dReps) ⊎ (d ≡ 0 × c ∈ dom dReps)
372365 ────────────────────────────────
373- ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys ⟧ ⇀⦇ regdrep c d an ,GOVCERT⦈ ⟦ ❴ c , e + pp .drepActivity ❵ ∪ˡ dReps , ccKeys ⟧
366+ ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys , deposits ⟧ ⇀⦇ regdrep c d an ,GOVCERT⦈ ⟦ ❴ c , e + pp .drepActivity ❵ ∪ˡ dReps , ccKeys , deposits ∪⁺ ❴ DRepDeposit c , d ❵ ⟧
374367
375368 GOVCERT-deregdrep :
376369 ∙ c ∈ dom dReps
377370 ────────────────────────────────
378- ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys ⟧ ⇀⦇ deregdrep c d ,GOVCERT⦈ ⟦ dReps ∣ ❴ c ❵ ᶜ , ccKeys ⟧
371+ ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys , deposits ⟧ ⇀⦇ deregdrep c d ,GOVCERT⦈ ⟦ dReps ∣ ❴ c ❵ ᶜ , ccKeys , deposits ∣ ❴ DRepDeposit c ❵ ᶜ ⟧
379372
380373 GOVCERT-ccreghot :
381374 ∙ (c , nothing) ∉ ccKeys
382375 ∙ c ∈ cc
383376 ────────────────────────────────
384- ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys ⟧ ⇀⦇ ccreghot c mc ,GOVCERT⦈ ⟦ dReps , ❴ c , mc ❵ ∪ˡ ccKeys ⟧
377+ ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ dReps , ccKeys , deposits ⟧ ⇀⦇ ccreghot c mc ,GOVCERT⦈ ⟦ dReps , ❴ c , mc ❵ ∪ˡ ccKeys , deposits ⟧
385378
386379-- CERT Transition System --
387380data _⊢_⇀⦇_,CERT⦈_ : CertEnv → CertState → DCert → CertState → Type where
@@ -396,7 +389,7 @@ data _⊢_⇀⦇_,CERT⦈_ : CertEnv → CertState → DCert → CertState →
396389 ────────────────────────────────
397390 ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ stᵈ , stᵖ , stᵍ ⟧ ⇀⦇ dCert ,CERT⦈ ⟦ stᵈ , stᵖ' , stᵍ ⟧
398391
399- CERT-vdel :
392+ CERT-gov :
400393 ∙ Γ ⊢ stᵍ ⇀⦇ dCert ,GOVCERT⦈ stᵍ'
401394 ────────────────────────────────
402395 Γ ⊢ ⟦ stᵈ , stᵖ , stᵍ ⟧ ⇀⦇ dCert ,CERT⦈ ⟦ stᵈ , stᵖ , stᵍ' ⟧
@@ -416,7 +409,7 @@ data _⊢_⇀⦇_,PRE-CERT⦈_ : CertEnv → CertState → ⊤ → CertState →
416409 ∙ filter isKeyHash wdrlCreds ⊆ dom voteDelegs
417410 ∙ mapˢ (map₁ stake) (wdrls ˢ) ⊆ rewards ˢ
418411 ────────────────────────────────
419- ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ ⟦ voteDelegs , stakeDelegs , rewards ⟧ , stᵖ , ⟦ dReps , ccHotKeys ⟧ ⟧ ⇀⦇ _ ,PRE-CERT⦈ ⟦ ⟦ voteDelegs , stakeDelegs , constMap wdrlCreds 0 ∪ˡ rewards ⟧ , stᵖ , ⟦ refreshedDReps , ccHotKeys ⟧ ⟧
412+ ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ ⟦ voteDelegs , stakeDelegs , rewards , deposits ⟧ , stᵖ , ⟦ dReps , ccHotKeys , deposits' ⟧ ⟧ ⇀⦇ _ ,PRE-CERT⦈ ⟦ ⟦ voteDelegs , stakeDelegs , constMap wdrlCreds 0 ∪ˡ rewards , deposits ⟧ , stᵖ , ⟦ refreshedDReps , ccHotKeys , deposits' ⟧ ⟧
420413
421414
422415-- POST-CERT Transition Rule --
@@ -427,7 +420,7 @@ data _⊢_⇀⦇_,POST-CERT⦈_ : CertEnv → CertState → ⊤ → CertState
427420 let activeVDelegs = mapˢ vDelegCredential (dom (DRepsOf stᵍ))
428421 ∪ fromList (vDelegNoConfidence ∷ vDelegAbstain ∷ [])
429422 in
430- ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ ⟦ voteDelegs , stakeDelegs , rewards ⟧ , stᵖ , stᵍ ⟧ ⇀⦇ _ ,POST-CERT⦈ ⟦ ⟦ voteDelegs ∣^ activeVDelegs , stakeDelegs , rewards ⟧ , stᵖ , stᵍ ⟧
423+ ⟦ e , pp , vs , wdrls , cc ⟧ ⊢ ⟦ ⟦ voteDelegs , stakeDelegs , rewards , deposits ⟧ , stᵖ , stᵍ ⟧ ⇀⦇ _ ,POST-CERT⦈ ⟦ ⟦ voteDelegs ∣^ activeVDelegs , stakeDelegs , rewards , deposits ⟧ , stᵖ , stᵍ ⟧
431424
432425
433426-- CERTS Transition System --
0 commit comments