Skip to content

Commit 4c1b265

Browse files
committed
Add a precondition to acceptedByCC to accept on those actions committee cannot vote
1 parent f6ee32d commit 4c1b265

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Ledger/Conway/Specification/Ratify.lagda.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,11 @@ utilizes the following auxiliary definitions.
284284

285285
+ all commitee members vote `no`{.AgdaInductiveConstructor}.
286286

287-
+ `mT`{.AgdaFunction}: This is the threshold of the `CC`{.AgdaInductiveConstructor}.
288-
It may be `nothing`{.AgdaInductiveConstructor}.
287+
+ `mT`{.AgdaFunction}: This is the threshold of the
288+
`CC`{.AgdaInductiveConstructor}. In case it is
289+
`nothing`{.AgdaInductiveConstructor}, the `CC`{.AgdaInductiveConstructor} is
290+
not allowed to vote and the action is accepted automatically (e.g., for
291+
`NoConfidence` or `UpdateCommittee` actions).
289292

290293
+ `stakeDistr`{.AgdaFunction} computes the stake distribution. Note that every
291294
constitutional committe member has a stake of 1, giving them equal voting power.
@@ -363,8 +366,7 @@ module AcceptedByCC (currentEpoch : Epoch)
363366
acceptedStake = ∑[ x ← stakeDistr ∣ actualVotes ⁻¹ Vote.yes ] x
364367
totalStake = ∑[ x ← stakeDistr ∣ dom (actualVotes ∣^ (❴ Vote.yes ❵ ∪ ❴ Vote.no ❵)) ] x
365368
366-
accepted = (acceptedStake /₀ totalStake) ≥ t
367-
× (sizeActiveCC ≥ ccMinSize ⊎ (Is-nothing mT × ccMinSize ≡ 0))
369+
accepted = Is-just mT → (sizeActiveCC ≥ ccMinSize) × (acceptedStake /₀ totalStake) ≥ t
368370
```
369371

370372
```agda
@@ -667,8 +669,12 @@ opaque
667669
Is-nothing? {x = x} = All.dec (const $ no id) x
668670
where import Data.Maybe.Relation.Unary.All as All
669671
672+
Is-just? : ∀ {A : Set} {x : Maybe A} → Dec (Is-just x)
673+
Is-just? {x = x} = Any.dec (const $ yes tt) x
674+
where import Data.Maybe.Relation.Unary.Any as Any
675+
670676
acceptedByCC? : ∀ Γ es st → Dec (acceptedByCC Γ es st)
671-
acceptedByCC? _ _ _ = _ ℚ.≤? _ ×-dec (_ ≥? _ ⊎-dec (Is-nothing? ×-dec ¿ _ ¿))
677+
acceptedByCC? _ _ _ = Is-just? →-dec (_ ≥? _ ×-dec _ ℚ.≤? _ )
672678
673679
acceptedByDRep? : ∀ Γ es st → Dec (acceptedByDRep Γ es st)
674680
acceptedByDRep? _ _ _ = _ ℚ.≤? _

0 commit comments

Comments
 (0)