Skip to content

Commit 222456d

Browse files
committed
Align the Leios parameters with the latest CIP-164
CIP-164 now governs the voting committee by size: leiosCommitteeSize replaces leiosCommitteeStakeCoverage, and the quorum constraint τ < σ(N_c) becomes a property of the stake distribution rather than of the parameters, so paramsWellFormed can no longer impose it.
1 parent 283e901 commit 222456d

2 files changed

Lines changed: 35 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
### WIP
66

7-
- Add the nine Leios protocol parameters to `PParams`, in the network and security groups, with their `PParamsUpdate` companions (CIP-164 Table 3; cardano-ledger #5965).
8-
- Require `τ < σ_c` in `paramsWellFormed`, and positivity of the Leios periods and size bounds.
7+
- Add the nine Leios protocol parameters to `PParams`, in the network and security groups, with their `PParamsUpdate` companions (CIP-164 Table 3; cardano-ledger #5965). The committee is governed by size (`leiosCommitteeSize`), and zero-valued Leios parameters stay well-formed as the protocol's disabled state.
98
- Move cert-deposit helpers from `Utxo` to `Certs`.
109
- Fix `updateCertDeposits`: use `foldl` (CERTS is head-first).
1110
- Add `HasCoin-UTxOState` and `HasCoin-LedgerState` instances; the latter sums UTxO total, rewards balance, and all three deposit fields.

src/Ledger/Dijkstra/Specification/PParams.lagda.md

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Ledger.Dijkstra.Specification.PParams
2626
2727
open import Data.Product.Properties
2828
open import Data.Nat.Properties using (m+1+n≢m)
29-
open import Data.Rational as ℚ using (ℚ)
29+
open import Data.Rational using (ℚ)
3030
open import Relation.Nullary.Decidable
3131
open import Data.List.Relation.Unary.Any using (Any; here; there)
3232
@@ -36,7 +36,7 @@ open import Ledger.Prelude
3636
open import Ledger.Core.Specification.Crypto
3737
open import Ledger.Core.Specification.Epoch
3838
-- open import Ledger.Dijkstra.Specification.Script.Base
39-
open import Ledger.Prelude.Numeric using (UnitInterval; fromUnitInterval; ℕ⁺)
39+
open import Ledger.Prelude.Numeric using (UnitInterval; ℕ⁺)
4040
4141
4242
private variable
@@ -114,12 +114,12 @@ record PParams : Type where
114114
pv : ProtVer -- retired, keep for now
115115
116116
-- Network group (Leios)
117-
leiosHeaderDiffusionPeriod : ℕ
117+
leiosHeaderPeriod : ℕ
118118
leiosVotingPeriod : ℕ
119119
leiosDiffusionPeriod : ℕ
120120
leiosMaxEBSize : ℕ
121121
leiosMaxEBTxsSize : ℕ
122-
leiosCommitteeStakeCoverage : UnitInterval
122+
leiosCommitteeSize : ℕ
123123
leiosQuorumStakeThreshold : UnitInterval
124124
leiosMaxEBExUnits : ExUnits
125125
leiosMaxRefScriptSizePerEB : ℕ
@@ -168,14 +168,16 @@ Leios adds the *endorser block* (EB), an ordered list of transaction references
168168
that a block producer announces alongside its ranking block; a committee of
169169
stake pools votes on the EB, and a certificate carried by the following ranking
170170
block brings the referenced transactions into the ledger. Three of the nine
171-
parameters measure a Leios round in slots (header diffusion, voting, and the
172-
additional diffusion that follows voting), four bound an EB (its reference list,
173-
the transactions listed, their script execution, and their reference scripts),
174-
and two are fractions of the total active stake:
175-
`leiosCommitteeStakeCoverage`{.AgdaField} (`σ_c`) is the stake the committee is
176-
selected to cover, `leiosQuorumStakeThreshold`{.AgdaField} (`τ`) the stake a
177-
certificate's signers must carry. The ranking block keeps its existing bound
178-
`maxBlockSize`{.AgdaField}, so Leios adds no field for it.
171+
parameters measure a Leios round in wall-clock time (header diffusion, voting,
172+
and the additional diffusion that follows voting), four bound an EB (its
173+
reference list, the transactions listed, their script execution, and their
174+
reference scripts), `leiosCommitteeSize`{.AgdaField} (`N_c`) is the number of
175+
committee seats — the committee being the `N_c` pools with the most active
176+
stake — and `leiosQuorumStakeThreshold`{.AgdaField} (`τ`) is the fraction of
177+
the total active stake a certificate's signers must carry. The ranking block
178+
keeps its existing bound `maxBlockSize`{.AgdaField}, so Leios adds no field for
179+
it. Zero-valued Leios parameters are meaningful: they are the protocol's
180+
disabled state during rollout.
179181

180182
The field names are this specification's; the cardano-ledger proposal
181183
[#5965][cl-5965], which maps the same parameters onto the Haskell `PParams`,
@@ -197,49 +199,39 @@ is the proposal's own addition, the per-EB analogue of
197199
`maxBlockExUnits`{.AgdaField} `a`{.AgdaField} `b`{.AgdaField}
198200
`minFeeRefScriptCoinsPerByte`{.AgdaField} `coinsPerUTxOByte`{.AgdaField}
199201
`govActionDeposit`{.AgdaField}
200-
`leiosHeaderDiffusionPeriod`{.AgdaField} `leiosVotingPeriod`{.AgdaField}
202+
`leiosHeaderPeriod`{.AgdaField} `leiosVotingPeriod`{.AgdaField}
201203
`leiosDiffusionPeriod`{.AgdaField} `leiosMaxEBSize`{.AgdaField}
202-
`leiosMaxEBTxsSize`{.AgdaField} `leiosCommitteeStakeCoverage`{.AgdaField}
204+
`leiosMaxEBTxsSize`{.AgdaField} `leiosCommitteeSize`{.AgdaField}
203205
`leiosQuorumStakeThreshold`{.AgdaField} `leiosMaxEBExUnits`{.AgdaField}
204206
`leiosMaxRefScriptSizePerEB`{.AgdaField}
205207

206208

207209
## Protocol Parameter Well Formedness
208210

209-
Besides the positivity of `positivePParams`{.AgdaFunction},
210-
`paramsWellFormed`{.AgdaFunction} imposes [CIP-164][cip-164]'s normative
211-
constraint that the quorum threshold lie strictly below the committee's stake
212-
coverage. That constraint relates two fields, so a
213-
`PParamsUpdate`{.AgdaRecord}, which carries each field independently, cannot be
214-
checked for it on its own; `ppdWellFormed`{.AgdaFunction} imposes it on the
215-
parameters an update yields.
211+
The Leios parameters are deliberately absent from
212+
`positivePParams`{.AgdaFunction}: zero values are the protocol's disabled
213+
state, and governance must be able to reach it. CIP-164's quorum constraint
214+
`τ < σ(N_c)` relates the threshold to the stake coverage of the selected
215+
committee, a property of the stake distribution rather than of the parameters,
216+
so it cannot be imposed here.
216217

217218
```agda
218219
positivePParams : PParams → List ℕ
219220
positivePParams pp = ( maxBlockSize ∷ maxTxSize ∷ maxHeaderSize
220221
∷ maxValSize ∷ coinsPerUTxOByte
221222
∷ poolDeposit ∷ collateralPercentage ∷ ccMaxTermLength
222-
∷ govActionLifetime ∷ govActionDeposit ∷ drepDeposit
223-
∷ leiosHeaderDiffusionPeriod ∷ leiosVotingPeriod
224-
∷ leiosDiffusionPeriod ∷ leiosMaxEBSize
225-
∷ leiosMaxEBTxsSize ∷ leiosMaxRefScriptSizePerEB ∷ [] )
223+
∷ govActionLifetime ∷ govActionDeposit ∷ drepDeposit ∷ [] )
226224
where open PParams pp
227225
228226
paramsWellFormed : PParams → Type
229-
paramsWellFormed pp = 0 ∉ fromList (positivePParams pp)
230-
× τ ℚ.< σ
231-
where
232-
open PParams pp
233-
τ σ : ℚ
234-
τ = fromUnitInterval leiosQuorumStakeThreshold
235-
σ = fromUnitInterval leiosCommitteeStakeCoverage
227+
paramsWellFormed pp = 0 ∉ fromList (positivePParams pp)
236228
```
237229

238230
<!--
239231
```agda
240232
paramsWF-elim : (pp : PParams) → paramsWellFormed pp → (n : ℕ) → n ∈ˡ (positivePParams pp) → n > 0
241233
paramsWF-elim pp pwf (suc n) x = z<s
242-
paramsWF-elim pp (pwf , _) 0 0∈ = ⊥-elim (pwf (to ∈-fromList 0∈))
234+
paramsWF-elim pp pwf 0 0∈ = ⊥-elim (pwf (to ∈-fromList 0∈))
243235
where open Equivalence
244236
245237
record HasPParams {a} (A : Type a) : Type a where
@@ -278,12 +270,12 @@ module PParamsUpdate where
278270
maxCollateralInputs : Maybe ℕ
279271
maxTxExUnits maxBlockExUnits : Maybe ExUnits
280272
pv : Maybe ProtVer -- retired, keep for now
281-
leiosHeaderDiffusionPeriod : Maybe ℕ
273+
leiosHeaderPeriod : Maybe ℕ
282274
leiosVotingPeriod : Maybe ℕ
283275
leiosDiffusionPeriod : Maybe ℕ
284276
leiosMaxEBSize : Maybe ℕ
285277
leiosMaxEBTxsSize : Maybe ℕ
286-
leiosCommitteeStakeCoverage : Maybe UnitInterval
278+
leiosCommitteeSize : Maybe
287279
leiosQuorumStakeThreshold : Maybe UnitInterval
288280
leiosMaxEBExUnits : Maybe ExUnits
289281
leiosMaxRefScriptSizePerEB : Maybe ℕ
@@ -317,7 +309,7 @@ module PParamsUpdate where
317309
just 0 ∉ fromList ( maxBlockSize ∷ maxTxSize ∷ maxHeaderSize ∷ maxValSize
318310
∷ coinsPerUTxOByte ∷ poolDeposit ∷ collateralPercentage ∷ ccMaxTermLength
319311
∷ govActionLifetime ∷ govActionDeposit ∷ drepDeposit
320-
leiosHeaderDiffusionPeriod ∷ leiosVotingPeriod ∷ leiosDiffusionPeriod
312+
leiosHeaderPeriod ∷ leiosVotingPeriod ∷ leiosDiffusionPeriod
321313
∷ leiosMaxEBSize ∷ leiosMaxEBTxsSize ∷ leiosMaxRefScriptSizePerEB ∷ [] )
322314
where open PParamsUpdate ppu
323315
```
@@ -338,12 +330,12 @@ module PParamsUpdate where
338330
∷ is-just maxTxExUnits
339331
∷ is-just maxBlockExUnits
340332
∷ is-just pv
341-
∷ is-just leiosHeaderDiffusionPeriod
333+
∷ is-just leiosHeaderPeriod
342334
∷ is-just leiosVotingPeriod
343335
∷ is-just leiosDiffusionPeriod
344336
∷ is-just leiosMaxEBSize
345337
∷ is-just leiosMaxEBTxsSize
346-
∷ is-just leiosCommitteeStakeCoverage
338+
∷ is-just leiosCommitteeSize
347339
∷ is-just leiosQuorumStakeThreshold
348340
∷ is-just leiosMaxEBExUnits
349341
∷ is-just leiosMaxRefScriptSizePerEB
@@ -404,12 +396,12 @@ module PParamsUpdate where
404396
∷ is-just coinsPerUTxOByte
405397
∷ is-just govActionDeposit
406398
∷ is-just minFeeRefScriptCoinsPerByte
407-
∷ is-just leiosHeaderDiffusionPeriod
399+
∷ is-just leiosHeaderPeriod
408400
∷ is-just leiosVotingPeriod
409401
∷ is-just leiosDiffusionPeriod
410402
∷ is-just leiosMaxEBSize
411403
∷ is-just leiosMaxEBTxsSize
412-
∷ is-just leiosCommitteeStakeCoverage
404+
∷ is-just leiosCommitteeSize
413405
∷ is-just leiosQuorumStakeThreshold
414406
∷ is-just leiosMaxEBExUnits
415407
∷ is-just leiosMaxRefScriptSizePerEB
@@ -457,12 +449,12 @@ module PParamsUpdate where
457449
; maxTxExUnits = U.maxTxExUnits ?↗ P.maxTxExUnits
458450
; maxBlockExUnits = U.maxBlockExUnits ?↗ P.maxBlockExUnits
459451
; pv = U.pv ?↗ P.pv
460-
; leiosHeaderDiffusionPeriod = U.leiosHeaderDiffusionPeriod ?↗ P.leiosHeaderDiffusionPeriod
452+
; leiosHeaderPeriod = U.leiosHeaderPeriod ?↗ P.leiosHeaderPeriod
461453
; leiosVotingPeriod = U.leiosVotingPeriod ?↗ P.leiosVotingPeriod
462454
; leiosDiffusionPeriod = U.leiosDiffusionPeriod ?↗ P.leiosDiffusionPeriod
463455
; leiosMaxEBSize = U.leiosMaxEBSize ?↗ P.leiosMaxEBSize
464456
; leiosMaxEBTxsSize = U.leiosMaxEBTxsSize ?↗ P.leiosMaxEBTxsSize
465-
; leiosCommitteeStakeCoverage = U.leiosCommitteeStakeCoverage ?↗ P.leiosCommitteeStakeCoverage
457+
; leiosCommitteeSize = U.leiosCommitteeSize ?↗ P.leiosCommitteeSize
466458
; leiosQuorumStakeThreshold = U.leiosQuorumStakeThreshold ?↗ P.leiosQuorumStakeThreshold
467459
; leiosMaxEBExUnits = U.leiosMaxEBExUnits ?↗ P.leiosMaxEBExUnits
468460
; leiosMaxRefScriptSizePerEB = U.leiosMaxRefScriptSizePerEB ?↗ P.leiosMaxRefScriptSizePerEB

0 commit comments

Comments
 (0)