@@ -69,16 +69,16 @@ import Ouroboros.Consensus.Util.IOLike (IOLike)
69
69
70
70
-- | Create a 'BlockForging' record for a single era.
71
71
praosBlockForging ::
72
- forall m era c .
73
- ( ShelleyCompatible (Praos c ) era ,
74
- c ~ EraCrypto era ,
75
- TxLimits (ShelleyBlock (Praos c ) era ),
76
- IOLike m
77
- ) =>
78
- PraosParams ->
79
- TxLimits. Overrides (ShelleyBlock (Praos c ) era ) ->
80
- ShelleyLeaderCredentials (EraCrypto era ) ->
81
- m (BlockForging m (ShelleyBlock (Praos c ) era ))
72
+ forall m era c .
73
+ ( ShelleyCompatible (Praos c ) era
74
+ , c ~ EraCrypto era
75
+ , TxLimits (ShelleyBlock (Praos c ) era )
76
+ , IOLike m
77
+ )
78
+ => PraosParams
79
+ -> TxLimits. Overrides (ShelleyBlock (Praos c ) era )
80
+ -> ShelleyLeaderCredentials (EraCrypto era )
81
+ -> m (BlockForging m (ShelleyBlock (Praos c ) era ))
82
82
praosBlockForging praosParams maxTxCapacityOverrides credentials = do
83
83
hotKey <- HotKey. mkHotKey @ m @ c initSignKey startPeriod praosMaxKESEvo
84
84
pure $ praosSharedBlockForging hotKey slotToPeriod credentials maxTxCapacityOverrides
@@ -102,10 +102,10 @@ praosBlockForging praosParams maxTxCapacityOverrides credentials = do
102
102
-- The name of the era (separated by a @_@) will be appended to each
103
103
-- 'forgeLabel'.
104
104
praosSharedBlockForging ::
105
- forall m c era .
106
- ( ShelleyEraWithCrypto c (Praos c ) era ,
107
- IOLike m
108
- )
105
+ forall m c era .
106
+ ( ShelleyEraWithCrypto c (Praos c ) era
107
+ , IOLike m
108
+ )
109
109
=> HotKey. HotKey c m
110
110
-> (SlotNo -> Absolute. KESPeriod )
111
111
-> ShelleyLeaderCredentials c
@@ -114,55 +114,55 @@ praosSharedBlockForging ::
114
114
praosSharedBlockForging
115
115
hotKey
116
116
slotToPeriod
117
- ShelleyLeaderCredentials
118
- { shelleyLeaderCredentialsCanBeLeader = canBeLeader,
119
- shelleyLeaderCredentialsLabel = label
117
+ ShelleyLeaderCredentials {
118
+ shelleyLeaderCredentialsCanBeLeader = canBeLeader
119
+ , shelleyLeaderCredentialsLabel = label
120
120
}
121
121
maxTxCapacityOverrides = do
122
- BlockForging
123
- { forgeLabel = label <> " _" <> shelleyBasedEraName (Proxy @ era ),
124
- canBeLeader = canBeLeader,
125
- updateForgeState = \ _ curSlot _ ->
126
- forgeStateUpdateInfoFromUpdateInfo
127
- <$> HotKey. evolve hotKey (slotToPeriod curSlot),
128
- checkCanForge = \ cfg curSlot _tickedChainDepState _isLeader ->
129
- praosCheckCanForge
130
- (configConsensus cfg)
131
- curSlot,
132
- forgeBlock = \ cfg ->
133
- forgeShelleyBlock
134
- hotKey
135
- canBeLeader
136
- cfg
137
- maxTxCapacityOverrides
138
- }
122
+ BlockForging
123
+ { forgeLabel = label <> " _" <> shelleyBasedEraName (Proxy @ era ),
124
+ canBeLeader = canBeLeader,
125
+ updateForgeState = \ _ curSlot _ ->
126
+ forgeStateUpdateInfoFromUpdateInfo
127
+ <$> HotKey. evolve hotKey (slotToPeriod curSlot),
128
+ checkCanForge = \ cfg curSlot _tickedChainDepState _isLeader ->
129
+ praosCheckCanForge
130
+ (configConsensus cfg)
131
+ curSlot,
132
+ forgeBlock = \ cfg ->
133
+ forgeShelleyBlock
134
+ hotKey
135
+ canBeLeader
136
+ cfg
137
+ maxTxCapacityOverrides
138
+ }
139
139
140
140
{- ------------------------------------------------------------------------------
141
141
ProtocolInfo
142
142
-------------------------------------------------------------------------------}
143
143
144
144
-- | Parameters needed to run Babbage
145
- data ProtocolParamsBabbage c = ProtocolParamsBabbage
146
- { babbageProtVer :: SL. ProtVer,
147
- babbageMaxTxCapacityOverrides :: TxLimits. Overrides (ShelleyBlock (Praos c ) (BabbageEra c ))
145
+ data ProtocolParamsBabbage c = ProtocolParamsBabbage {
146
+ babbageProtVer :: SL. ProtVer
147
+ , babbageMaxTxCapacityOverrides :: TxLimits. Overrides (ShelleyBlock (Praos c ) (BabbageEra c ))
148
148
}
149
149
150
150
protocolInfoPraosBabbage ::
151
- forall m c .
152
- ( IOLike m ,
153
- ShelleyCompatible (Praos c ) (BabbageEra c ),
154
- TxLimits (ShelleyBlock (Praos c ) (BabbageEra c ))
155
- ) =>
156
- ProtocolParamsShelleyBased (BabbageEra c ) ->
157
- AlonzoGenesis ->
158
- ProtocolParamsBabbage c ->
159
- ProtocolInfo m (ShelleyBlock (Praos c ) (BabbageEra c ))
151
+ forall m c .
152
+ ( IOLike m ,
153
+ ShelleyCompatible (Praos c ) (BabbageEra c ),
154
+ TxLimits (ShelleyBlock (Praos c ) (BabbageEra c ))
155
+ )
156
+ => ProtocolParamsShelleyBased (BabbageEra c )
157
+ -> AlonzoGenesis
158
+ -> ProtocolParamsBabbage c
159
+ -> ProtocolInfo m (ShelleyBlock (Praos c ) (BabbageEra c ))
160
160
protocolInfoPraosBabbage
161
161
protocolParamsShelleyBased
162
162
genesisAlonzo
163
- ProtocolParamsBabbage
164
- { babbageProtVer = protVer,
165
- babbageMaxTxCapacityOverrides = maxTxCapacityOverrides
163
+ ProtocolParamsBabbage {
164
+ babbageProtVer = protVer
165
+ , babbageMaxTxCapacityOverrides = maxTxCapacityOverrides
166
166
} =
167
167
protocolInfoPraosShelleyBased
168
168
protocolParamsShelleyBased
@@ -171,27 +171,27 @@ protocolInfoPraosBabbage
171
171
maxTxCapacityOverrides
172
172
173
173
-- | Parameters needed to run Conway
174
- data ProtocolParamsConway c = ProtocolParamsConway
175
- { conwayProtVer :: SL. ProtVer,
176
- conwayMaxTxCapacityOverrides :: TxLimits. Overrides (ShelleyBlock (Praos c ) (ConwayEra c ))
174
+ data ProtocolParamsConway c = ProtocolParamsConway {
175
+ conwayProtVer :: SL. ProtVer
176
+ , conwayMaxTxCapacityOverrides :: TxLimits. Overrides (ShelleyBlock (Praos c ) (ConwayEra c ))
177
177
}
178
178
179
179
protocolInfoPraosConway ::
180
- forall m c .
181
- ( IOLike m ,
182
- ShelleyCompatible (Praos c ) (ConwayEra c ),
183
- TxLimits (ShelleyBlock (Praos c ) (ConwayEra c ))
184
- ) =>
185
- ProtocolParamsShelleyBased (ConwayEra c ) ->
186
- (AlonzoGenesis , ConwayGenesis c ) ->
187
- ProtocolParamsConway c ->
188
- ProtocolInfo m (ShelleyBlock (Praos c ) (ConwayEra c ))
180
+ forall m c .
181
+ ( IOLike m ,
182
+ ShelleyCompatible (Praos c ) (ConwayEra c ),
183
+ TxLimits (ShelleyBlock (Praos c ) (ConwayEra c ))
184
+ )
185
+ => ProtocolParamsShelleyBased (ConwayEra c )
186
+ -> (AlonzoGenesis , ConwayGenesis c )
187
+ -> ProtocolParamsConway c
188
+ -> ProtocolInfo m (ShelleyBlock (Praos c ) (ConwayEra c ))
189
189
protocolInfoPraosConway
190
190
protocolParamsShelleyBased
191
191
(genesisAlonzo, genesisConway)
192
- ProtocolParamsConway
193
- { conwayProtVer = protVer,
194
- conwayMaxTxCapacityOverrides = maxTxCapacityOverrides
192
+ ProtocolParamsConway {
193
+ conwayProtVer = protVer
194
+ , conwayMaxTxCapacityOverrides = maxTxCapacityOverrides
195
195
} =
196
196
protocolInfoPraosShelleyBased
197
197
protocolParamsShelleyBased
@@ -200,30 +200,30 @@ protocolInfoPraosConway
200
200
maxTxCapacityOverrides
201
201
202
202
protocolInfoPraosShelleyBased ::
203
- forall m era c .
204
- ( IOLike m ,
205
- ShelleyCompatible (Praos c ) era ,
206
- TxLimits (ShelleyBlock (Praos c ) era ),
207
- c ~ EraCrypto era
208
- ) =>
209
- ProtocolParamsShelleyBased era ->
210
- (SL. AdditionalGenesisConfig era , Core. TranslationContext era ) ->
211
- SL. ProtVer ->
212
- TxLimits. Overrides (ShelleyBlock (Praos c ) era ) ->
213
- ProtocolInfo m (ShelleyBlock (Praos c ) era )
203
+ forall m era c .
204
+ ( IOLike m ,
205
+ ShelleyCompatible (Praos c ) era ,
206
+ TxLimits (ShelleyBlock (Praos c ) era ),
207
+ c ~ EraCrypto era
208
+ )
209
+ => ProtocolParamsShelleyBased era
210
+ -> (SL. AdditionalGenesisConfig era , Core. TranslationContext era )
211
+ -> SL. ProtVer
212
+ -> TxLimits. Overrides (ShelleyBlock (Praos c ) era )
213
+ -> ProtocolInfo m (ShelleyBlock (Praos c ) era )
214
214
protocolInfoPraosShelleyBased
215
- ProtocolParamsShelleyBased
216
- { shelleyBasedGenesis = genesis,
217
- shelleyBasedInitialNonce = initialNonce,
218
- shelleyBasedLeaderCredentials = credentialss
215
+ ProtocolParamsShelleyBased {
216
+ shelleyBasedGenesis = genesis
217
+ , shelleyBasedInitialNonce = initialNonce
218
+ , shelleyBasedLeaderCredentials = credentialss
219
219
}
220
220
(additionalGenesisConfig, transCtxt)
221
221
protVer
222
222
maxTxCapacityOverrides =
223
223
assertWithMsg (validateGenesis genesis) $
224
224
ProtocolInfo
225
- { pInfoConfig = topLevelConfig,
226
- pInfoInitLedger = initExtLedgerState,
225
+ { pInfoConfig = topLevelConfig,
226
+ pInfoInitLedger = initExtLedgerState,
227
227
pInfoBlockForging =
228
228
traverse
229
229
(praosBlockForging praosParams maxTxCapacityOverrides)
@@ -234,20 +234,18 @@ protocolInfoPraosShelleyBased
234
234
maxMajorProtVer = MaxMajorProtVer $ SL. pvMajor protVer
235
235
236
236
topLevelConfig :: TopLevelConfig (ShelleyBlock (Praos c ) era )
237
- topLevelConfig =
238
- TopLevelConfig
239
- { topLevelConfigProtocol = consensusConfig,
240
- topLevelConfigLedger = ledgerConfig,
241
- topLevelConfigBlock = blockConfig,
242
- topLevelConfigCodec = ShelleyCodecConfig ,
243
- topLevelConfigStorage = storageConfig
237
+ topLevelConfig = TopLevelConfig {
238
+ topLevelConfigProtocol = consensusConfig
239
+ , topLevelConfigLedger = ledgerConfig
240
+ , topLevelConfigBlock = blockConfig
241
+ , topLevelConfigCodec = ShelleyCodecConfig
242
+ , topLevelConfigStorage = storageConfig
244
243
}
245
244
246
245
consensusConfig :: ConsensusConfig (BlockProtocol (ShelleyBlock (Praos c ) era ))
247
- consensusConfig =
248
- PraosConfig
249
- { praosParams,
250
- praosEpochInfo = epochInfo
246
+ consensusConfig = PraosConfig {
247
+ praosParams
248
+ , praosEpochInfo = epochInfo
251
249
}
252
250
253
251
ledgerConfig :: LedgerConfig (ShelleyBlock (Praos c ) era )
@@ -260,17 +258,16 @@ protocolInfoPraosShelleyBased
260
258
(mkSlotLength $ SL. sgSlotLength genesis)
261
259
262
260
praosParams :: PraosParams
263
- praosParams =
264
- PraosParams
265
- { praosSlotsPerKESPeriod = SL. sgSlotsPerKESPeriod genesis,
266
- praosLeaderF = SL. mkActiveSlotCoeff $ SL. sgActiveSlotsCoeff genesis,
267
- praosSecurityParam = SecurityParam $ SL. sgSecurityParam genesis,
268
- praosMaxKESEvo = SL. sgMaxKESEvolutions genesis,
269
- praosQuorum = SL. sgUpdateQuorum genesis,
270
- praosMaxMajorPV = maxMajorProtVer,
271
- praosMaxLovelaceSupply = SL. sgMaxLovelaceSupply genesis,
272
- praosNetworkId = SL. sgNetworkId genesis,
273
- praosSystemStart = SystemStart $ SL. sgSystemStart genesis
261
+ praosParams = PraosParams {
262
+ praosSlotsPerKESPeriod = SL. sgSlotsPerKESPeriod genesis
263
+ , praosLeaderF = SL. mkActiveSlotCoeff $ SL. sgActiveSlotsCoeff genesis
264
+ , praosSecurityParam = SecurityParam $ SL. sgSecurityParam genesis
265
+ , praosMaxKESEvo = SL. sgMaxKESEvolutions genesis
266
+ , praosQuorum = SL. sgUpdateQuorum genesis
267
+ , praosMaxMajorPV = maxMajorProtVer
268
+ , praosMaxLovelaceSupply = SL. sgMaxLovelaceSupply genesis
269
+ , praosNetworkId = SL. sgNetworkId genesis
270
+ , praosSystemStart = SystemStart $ SL. sgSystemStart genesis
274
271
}
275
272
276
273
blockConfig :: BlockConfig (ShelleyBlock (Praos c ) era )
@@ -281,35 +278,31 @@ protocolInfoPraosShelleyBased
281
278
(shelleyBlockIssuerVKey <$> credentialss)
282
279
283
280
storageConfig :: StorageConfig (ShelleyBlock (Praos c ) era )
284
- storageConfig =
285
- ShelleyStorageConfig
286
- { shelleyStorageConfigSlotsPerKESPeriod = praosSlotsPerKESPeriod praosParams,
287
- shelleyStorageConfigSecurityParam = praosSecurityParam praosParams
281
+ storageConfig = ShelleyStorageConfig {
282
+ shelleyStorageConfigSlotsPerKESPeriod = praosSlotsPerKESPeriod praosParams
283
+ , shelleyStorageConfigSecurityParam = praosSecurityParam praosParams
288
284
}
289
285
290
286
initLedgerState :: LedgerState (ShelleyBlock (Praos c ) era )
291
- initLedgerState =
292
- ShelleyLedgerState
293
- { shelleyLedgerTip = Origin ,
294
- shelleyLedgerState = SL. initialState genesis additionalGenesisConfig,
295
- shelleyLedgerTransition = ShelleyTransitionInfo {shelleyAfterVoting = 0 }
287
+ initLedgerState = ShelleyLedgerState {
288
+ shelleyLedgerTip = Origin
289
+ , shelleyLedgerState = SL. initialState genesis additionalGenesisConfig
290
+ , shelleyLedgerTransition = ShelleyTransitionInfo {shelleyAfterVoting = 0 }
296
291
}
297
292
298
293
initChainDepState :: PraosState c
299
- initChainDepState =
300
- PraosState
301
- { praosStateLastSlot = Origin ,
302
- praosStateOCertCounters = mempty ,
303
- praosStateEvolvingNonce = initialNonce,
304
- praosStateCandidateNonce = initialNonce,
305
- praosStateEpochNonce = initialNonce,
306
- praosStateLabNonce = initialNonce,
307
- praosStateLastEpochBlockNonce = initialNonce
294
+ initChainDepState = PraosState {
295
+ praosStateLastSlot = Origin
296
+ , praosStateOCertCounters = mempty
297
+ , praosStateEvolvingNonce = initialNonce
298
+ , praosStateCandidateNonce = initialNonce
299
+ , praosStateEpochNonce = initialNonce
300
+ , praosStateLabNonce = initialNonce
301
+ , praosStateLastEpochBlockNonce = initialNonce
308
302
}
309
303
310
304
initExtLedgerState :: ExtLedgerState (ShelleyBlock (Praos c ) era )
311
- initExtLedgerState =
312
- ExtLedgerState
313
- { ledgerState = initLedgerState,
314
- headerState = HeaderState Origin initChainDepState
305
+ initExtLedgerState = ExtLedgerState {
306
+ ledgerState = initLedgerState
307
+ , headerState = HeaderState Origin initChainDepState
315
308
}
0 commit comments