1- \section{Protocol parameters }
1+ \section{Protocol Parameters }
22\label{sec:protocol-parameters}
33This section defines the adjustable protocol parameters of the Cardano ledger.
44These parameters are used in block validation and can affect various features of the system,
@@ -12,6 +12,7 @@ open import Data.Rational using (ℚ)
1212open import Relation.Nullary.Decidable
1313
1414open import Tactic.Derive.DecEq
15+ open import Tactic.Derive.Show
1516
1617open import Ledger.Prelude
1718open import Ledger.Crypto
@@ -33,12 +34,13 @@ The \AgdaRecord{Acnt} record has two fields, \AgdaField{treasury} and \AgdaField
3334the \AgdaBound{acnt} field in \AgdaRecord{NewEpochState} keeps track of the total assets that
3435remain in treasury and reserves.
3536
36- \begin{figure*}[h! ]
37+ \begin{figure*}[ht ]
3738\begin{AgdaMultiCode}
3839\begin{code}
3940record Acnt : Type where
4041\end{code}
4142\begin{code}[hide]
43+ constructor ⟦_,_⟧ᵃ
4244 field
4345\end{code}
4446\begin{code}
@@ -47,6 +49,10 @@ record Acnt : Type where
4749ProtVer : Type
4850ProtVer = ℕ × ℕ
4951
52+ instance
53+ Show-ProtVer : Show ProtVer
54+ Show-ProtVer = Show-×
55+
5056data pvCanFollow : ProtVer → ProtVer → Type where
5157 canFollowMajor : pvCanFollow (m , n) (m + 1 , 0)
5258 canFollowMinor : pvCanFollow (m , n) (m , n + 1)
@@ -57,11 +63,15 @@ data pvCanFollow : ProtVer → ProtVer → Type where
5763\end{figure*}
5864\end{NoConway}
5965
60- \begin{figure*}[h! ]
66+ \begin{figure*}[ht ]
6167\begin{AgdaMultiCode}
6268\begin{code}
6369data PParamGroup : Type where
64- NetworkGroup EconomicGroup TechnicalGroup GovernanceGroup SecurityGroup : PParamGroup
70+ NetworkGroup : PParamGroup
71+ EconomicGroup : PParamGroup
72+ TechnicalGroup : PParamGroup
73+ GovernanceGroup : PParamGroup
74+ SecurityGroup : PParamGroup
6575
6676record DrepThresholds : Type where
6777\end{code}
@@ -86,53 +96,74 @@ record PParams : Type where
8696\end{code}
8797\emph{Network group}
8898\begin{code}
89- maxBlockSize maxTxSize : ℕ
90- maxHeaderSize maxValSize : ℕ
99+ maxBlockSize : ℕ
100+ maxTxSize : ℕ
101+ maxHeaderSize : ℕ
102+ maxTxExUnits : ExUnits
103+ maxBlockExUnits : ExUnits
104+ maxValSize : ℕ
91105 maxCollateralInputs : ℕ
92- maxTxExUnits maxBlockExUnits : ExUnits
93106\end{code}
94107\begin{code}[hide]
95108 pv : ProtVer -- retired, keep for now
96109\end{code}
97110\emph{Economic group}
98111\begin{code}
99- a b : ℕ
112+ a : ℕ
113+ b : ℕ
100114 keyDeposit : Coin
101115 poolDeposit : Coin
102116 coinsPerUTxOByte : Coin
103- minFeeRefScriptCoinsPerByte : ℚ
104117 prices : Prices
118+ minFeeRefScriptCoinsPerByte : ℚ
105119\end{code}
106120\begin{code}[hide]
107121 minUTxOValue : Coin -- retired, keep for now
108122\end{code}
109123\emph{Technical group}
110124\begin{code}
111- a0 : ℚ
112125 Emax : Epoch
113126 nopt : ℕ
127+ a0 : ℚ
114128 collateralPercentage : ℕ
129+ \end{code}
130+ \begin{code}[hide]
115131 -- costmdls : Language →/⇀ CostModel (Does not work with DecEq)
132+ \end{code}
133+ \begin{code}
116134 costmdls : CostModel
117135\end{code}
118136\emph{Governance group}
119137\begin{code}
120- drepThresholds : DrepThresholds
121138 poolThresholds : PoolThresholds
139+ drepThresholds : DrepThresholds
140+ ccMinSize : ℕ
141+ ccMaxTermLength : ℕ
122142 govActionLifetime : ℕ
123- govActionDeposit drepDeposit : Coin
143+ govActionDeposit : Coin
144+ drepDeposit : Coin
124145 drepActivity : Epoch
125- ccMinSize ccMaxTermLength : ℕ
126-
146+ \end{code}
147+ \end{AgdaMultiCode}
148+ \caption{Protocol parameter definitions}
149+ \label{fig:protocol-parameter-declarations}
150+ \end{figure*}
151+ \begin{figure*}
152+ \begin{code}
127153paramsWellFormed : PParams → Type
128154paramsWellFormed pp =
129155 0 ∉ fromList ( maxBlockSize ∷ maxTxSize ∷ maxHeaderSize ∷ maxValSize
130156 ∷ minUTxOValue ∷ poolDeposit ∷ collateralPercentage ∷ ccMaxTermLength
131157 ∷ govActionLifetime ∷ govActionDeposit ∷ drepDeposit ∷ [] )
132158 where open PParams pp
133159\end{code}
160+ \caption{Protocol parameter well-formedness}
161+ \label{fig:protocol-parameter-well-formedness}
162+ \end{figure*}
134163\begin{code}[hide]
135164instance
165+ Show-ℚ = Show _ ∋ record {M}
166+ where import Data.Rational.Show as M
136167 unquoteDecl DecEq-DrepThresholds = derive-DecEq
137168 ((quote DrepThresholds , DecEq-DrepThresholds) ∷ [])
138169 unquoteDecl DecEq-PoolThresholds = derive-DecEq
@@ -141,6 +172,12 @@ instance
141172 ((quote PParams , DecEq-PParams) ∷ [])
142173 unquoteDecl DecEq-PParamGroup = derive-DecEq
143174 ((quote PParamGroup , DecEq-PParamGroup) ∷ [])
175+ unquoteDecl Show-DrepThresholds = derive-Show
176+ ((quote DrepThresholds , Show-DrepThresholds) ∷ [])
177+ unquoteDecl Show-PoolThresholds = derive-Show
178+ ((quote PoolThresholds , Show-PoolThresholds) ∷ [])
179+ unquoteDecl Show-PParams = derive-Show
180+ ((quote PParams , Show-PParams) ∷ [])
144181
145182module PParamsUpdate where
146183 record PParamsUpdate : Type where
@@ -296,10 +333,6 @@ module PParamsUpdate where
296333 ((quote PParamsUpdate , DecEq-PParamsUpdate) ∷ [])
297334
298335\end{code}
299- \end{AgdaMultiCode}
300- \caption{Protocol parameter declarations}
301- \label{fig:protocol-parameter-declarations}
302- \end{figure*}
303336% Retiring ProtVer's documentation since ProtVer is retired.
304337% \ProtVer represents the protocol version used in the Cardano ledger.
305338% It is a pair of natural numbers, representing the major and minor version,
@@ -365,7 +398,7 @@ can be applied and it has a set of groups associated with it. An
365398update is well formed if it has at least one group (i.e. if it updates
366399something) and if it preserves well-formedness.
367400
368- \begin{figure*}[h! ]
401+ \begin{figure*}[ht ]
369402\begin{AgdaMultiCode}
370403\begin{code}[hide]
371404record PParamsDiff : Type₁ where
0 commit comments