@@ -12,51 +12,28 @@ module Ouroboros.Consensus.Shelley.Node.Praos (
12
12
ProtocolParamsBabbage (.. )
13
13
, praosBlockForging
14
14
, praosSharedBlockForging
15
- , protocolInfoPraosBabbage
16
- , protocolInfoPraosShelleyBased
17
15
) where
18
16
19
- import qualified Cardano.Ledger.BaseTypes as SL (mkActiveSlotCoeff )
20
- import qualified Cardano.Ledger.Era as Core
21
17
import qualified Cardano.Ledger.Shelley.API as SL
22
18
import qualified Cardano.Protocol.TPraos.OCert as Absolute
23
19
import qualified Cardano.Protocol.TPraos.OCert as SL
24
- import Cardano.Slotting.EpochInfo (EpochInfo , fixedEpochInfo )
25
- import Cardano.Slotting.Time (SystemStart (SystemStart ), mkSlotLength )
26
- import Control.Monad.Except (Except )
27
20
import Ouroboros.Consensus.Block
28
- import Ouroboros.Consensus.Config (SecurityParam (SecurityParam ),
29
- TopLevelConfig (.. ), configConsensus )
30
- import qualified Ouroboros.Consensus.HardFork.History as History
31
- import Ouroboros.Consensus.HeaderValidation
32
- (HeaderState (HeaderState ))
33
- import Ouroboros.Consensus.Ledger.Abstract (LedgerConfig )
34
- import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState (.. ))
21
+ import Ouroboros.Consensus.Config (configConsensus )
35
22
import Ouroboros.Consensus.Mempool.TxLimits
36
23
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
37
- import Ouroboros.Consensus.Node (ProtocolInfo (.. ))
38
- import Ouroboros.Consensus.Protocol.Abstract (ConsensusConfig )
39
24
import qualified Ouroboros.Consensus.Protocol.Ledger.HotKey as HotKey
40
- import Ouroboros.Consensus.Protocol.Praos (ConsensusConfig (.. ),
41
- Praos , PraosParams (.. ), PraosState (.. ),
25
+ import Ouroboros.Consensus.Protocol.Praos (Praos , PraosParams (.. ),
42
26
praosCheckCanForge )
43
27
import Ouroboros.Consensus.Protocol.Praos.Common
44
- (MaxMajorProtVer (MaxMajorProtVer ),
45
- PraosCanBeLeader (praosCanBeLeaderOpCert ))
28
+ (PraosCanBeLeader (praosCanBeLeaderOpCert ))
46
29
import Ouroboros.Consensus.Shelley.Eras (BabbageEra , EraCrypto ,
47
30
ShelleyBasedEra (shelleyBasedEraName ))
48
- import Ouroboros.Consensus.Shelley.Ledger
49
- (CodecConfig (ShelleyCodecConfig ), LedgerState (.. ),
50
- ShelleyBlock , ShelleyCompatible , ShelleyTransition (.. ),
51
- StorageConfig (.. ), forgeShelleyBlock ,
52
- mkShelleyBlockConfig , mkShelleyLedgerConfig )
31
+ import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock ,
32
+ ShelleyCompatible , forgeShelleyBlock )
53
33
import Ouroboros.Consensus.Shelley.Node
54
- (ProtocolParamsShelleyBased (.. ),
55
- ShelleyLeaderCredentials (.. ), validateGenesis )
56
- import Ouroboros.Consensus.Shelley.Node.Common (ShelleyEraWithCrypto ,
57
- shelleyBlockIssuerVKey )
34
+ (ShelleyLeaderCredentials (.. ))
35
+ import Ouroboros.Consensus.Shelley.Node.Common (ShelleyEraWithCrypto )
58
36
import Ouroboros.Consensus.Shelley.Protocol.Praos ()
59
- import Ouroboros.Consensus.Util.Assert (assertWithMsg )
60
37
import Ouroboros.Consensus.Util.IOLike (IOLike )
61
38
62
39
{- ------------------------------------------------------------------------------
@@ -143,141 +120,3 @@ data ProtocolParamsBabbage c = ProtocolParamsBabbage
143
120
babbageMaxTxCapacityOverrides :: TxLimits. Overrides (ShelleyBlock (Praos c ) (BabbageEra c ))
144
121
}
145
122
146
- protocolInfoPraosBabbage ::
147
- forall m c .
148
- ( IOLike m ,
149
- ShelleyCompatible (Praos c ) (BabbageEra c ),
150
- TxLimits (ShelleyBlock (Praos c ) (BabbageEra c ))
151
- ) =>
152
- ProtocolParamsShelleyBased (BabbageEra c ) ->
153
- ProtocolParamsBabbage c ->
154
- ProtocolInfo m (ShelleyBlock (Praos c ) (BabbageEra c ))
155
- protocolInfoPraosBabbage
156
- protocolParamsShelleyBased
157
- ProtocolParamsBabbage
158
- { babbageProtVer = protVer,
159
- babbageMaxTxCapacityOverrides = maxTxCapacityOverrides
160
- } =
161
- protocolInfoPraosShelleyBased
162
- protocolParamsShelleyBased
163
- (error " Babbage currently pretending to be Alonzo" )
164
- protVer
165
- maxTxCapacityOverrides
166
-
167
- protocolInfoPraosShelleyBased ::
168
- forall m era c .
169
- ( IOLike m ,
170
- ShelleyCompatible (Praos c ) era ,
171
- TxLimits (ShelleyBlock (Praos c ) era ),
172
- c ~ EraCrypto era
173
- ) =>
174
- ProtocolParamsShelleyBased era ->
175
- Core. TranslationContext era ->
176
- SL. ProtVer ->
177
- TxLimits. Overrides (ShelleyBlock (Praos c ) era ) ->
178
- ProtocolInfo m (ShelleyBlock (Praos c ) era )
179
- protocolInfoPraosShelleyBased
180
- ProtocolParamsShelleyBased
181
- { shelleyBasedGenesis = genesis,
182
- shelleyBasedInitialNonce = initialNonce,
183
- shelleyBasedLeaderCredentials = credentialss
184
- }
185
- transCtxt
186
- protVer
187
- maxTxCapacityOverrides =
188
- assertWithMsg (validateGenesis genesis) $
189
- ProtocolInfo
190
- { pInfoConfig = topLevelConfig,
191
- pInfoInitLedger = initExtLedgerState,
192
- pInfoBlockForging =
193
- traverse
194
- (praosBlockForging praosParams maxTxCapacityOverrides)
195
- credentialss
196
- }
197
- where
198
- additionalGenesisConfig :: SL. AdditionalGenesisConfig era
199
- additionalGenesisConfig = transCtxt
200
-
201
- maxMajorProtVer :: MaxMajorProtVer
202
- maxMajorProtVer = MaxMajorProtVer $ SL. pvMajor protVer
203
-
204
- topLevelConfig :: TopLevelConfig (ShelleyBlock (Praos c ) era )
205
- topLevelConfig =
206
- TopLevelConfig
207
- { topLevelConfigProtocol = consensusConfig,
208
- topLevelConfigLedger = ledgerConfig,
209
- topLevelConfigBlock = blockConfig,
210
- topLevelConfigCodec = ShelleyCodecConfig ,
211
- topLevelConfigStorage = storageConfig
212
- }
213
-
214
- consensusConfig :: ConsensusConfig (BlockProtocol (ShelleyBlock (Praos c ) era ))
215
- consensusConfig =
216
- PraosConfig
217
- { praosParams,
218
- praosEpochInfo = epochInfo
219
- }
220
-
221
- ledgerConfig :: LedgerConfig (ShelleyBlock (Praos c ) era )
222
- ledgerConfig = mkShelleyLedgerConfig genesis transCtxt epochInfo maxMajorProtVer
223
-
224
- epochInfo :: EpochInfo (Except History. PastHorizonException )
225
- epochInfo =
226
- fixedEpochInfo
227
- (SL. sgEpochLength genesis)
228
- (mkSlotLength $ SL. sgSlotLength genesis)
229
-
230
- praosParams :: PraosParams
231
- praosParams =
232
- PraosParams
233
- { praosSlotsPerKESPeriod = SL. sgSlotsPerKESPeriod genesis,
234
- praosLeaderF = SL. mkActiveSlotCoeff $ SL. sgActiveSlotsCoeff genesis,
235
- praosSecurityParam = SecurityParam $ SL. sgSecurityParam genesis,
236
- praosMaxKESEvo = SL. sgMaxKESEvolutions genesis,
237
- praosQuorum = SL. sgUpdateQuorum genesis,
238
- praosMaxMajorPV = maxMajorProtVer,
239
- praosMaxLovelaceSupply = SL. sgMaxLovelaceSupply genesis,
240
- praosNetworkId = SL. sgNetworkId genesis,
241
- praosSystemStart = SystemStart $ SL. sgSystemStart genesis
242
- }
243
-
244
- blockConfig :: BlockConfig (ShelleyBlock (Praos c ) era )
245
- blockConfig =
246
- mkShelleyBlockConfig
247
- protVer
248
- genesis
249
- (shelleyBlockIssuerVKey <$> credentialss)
250
-
251
- storageConfig :: StorageConfig (ShelleyBlock (Praos c ) era )
252
- storageConfig =
253
- ShelleyStorageConfig
254
- { shelleyStorageConfigSlotsPerKESPeriod = praosSlotsPerKESPeriod praosParams,
255
- shelleyStorageConfigSecurityParam = praosSecurityParam praosParams
256
- }
257
-
258
- initLedgerState :: LedgerState (ShelleyBlock (Praos c ) era )
259
- initLedgerState =
260
- ShelleyLedgerState
261
- { shelleyLedgerTip = Origin ,
262
- shelleyLedgerState = SL. initialState genesis additionalGenesisConfig,
263
- shelleyLedgerTransition = ShelleyTransitionInfo {shelleyAfterVoting = 0 }
264
- }
265
-
266
- initChainDepState :: PraosState c
267
- initChainDepState =
268
- PraosState
269
- { praosStateLastSlot = Origin ,
270
- praosStateOCertCounters = mempty ,
271
- praosStateEvolvingNonce = initialNonce,
272
- praosStateCandidateNonce = initialNonce,
273
- praosStateEpochNonce = initialNonce,
274
- praosStateLabNonce = initialNonce,
275
- praosStateLastEpochBlockNonce = initialNonce
276
- }
277
-
278
- initExtLedgerState :: ExtLedgerState (ShelleyBlock (Praos c ) era )
279
- initExtLedgerState =
280
- ExtLedgerState
281
- { ledgerState = initLedgerState,
282
- headerState = HeaderState Origin initChainDepState
283
- }
0 commit comments