Skip to content

Commit c607a8d

Browse files
authored
Merge pull request #4238 from input-output-hk/remove-protocolInfo-variants
Remove dead `protocolInfoPraosBabbage` and `protocolInfoPraosShelleyBased`.
2 parents 115837f + 09bcfc7 commit c607a8d

File tree

2 files changed

+11
-168
lines changed

2 files changed

+11
-168
lines changed

ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Node/Praos.hs

+7-168
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,28 @@ module Ouroboros.Consensus.Shelley.Node.Praos (
1212
ProtocolParamsBabbage (..)
1313
, praosBlockForging
1414
, praosSharedBlockForging
15-
, protocolInfoPraosBabbage
16-
, protocolInfoPraosShelleyBased
1715
) where
1816

19-
import qualified Cardano.Ledger.BaseTypes as SL (mkActiveSlotCoeff)
20-
import qualified Cardano.Ledger.Era as Core
2117
import qualified Cardano.Ledger.Shelley.API as SL
2218
import qualified Cardano.Protocol.TPraos.OCert as Absolute
2319
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)
2720
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)
3522
import Ouroboros.Consensus.Mempool.TxLimits
3623
import qualified Ouroboros.Consensus.Mempool.TxLimits as TxLimits
37-
import Ouroboros.Consensus.Node (ProtocolInfo (..))
38-
import Ouroboros.Consensus.Protocol.Abstract (ConsensusConfig)
3924
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 (..),
4226
praosCheckCanForge)
4327
import Ouroboros.Consensus.Protocol.Praos.Common
44-
(MaxMajorProtVer (MaxMajorProtVer),
45-
PraosCanBeLeader (praosCanBeLeaderOpCert))
28+
(PraosCanBeLeader (praosCanBeLeaderOpCert))
4629
import Ouroboros.Consensus.Shelley.Eras (BabbageEra, EraCrypto,
4730
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)
5333
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)
5836
import Ouroboros.Consensus.Shelley.Protocol.Praos ()
59-
import Ouroboros.Consensus.Util.Assert (assertWithMsg)
6037
import Ouroboros.Consensus.Util.IOLike (IOLike)
6138

6239
{-------------------------------------------------------------------------------
@@ -143,141 +120,3 @@ data ProtocolParamsBabbage c = ProtocolParamsBabbage
143120
babbageMaxTxCapacityOverrides :: TxLimits.Overrides (ShelleyBlock (Praos c) (BabbageEra c))
144121
}
145122

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-
}

ouroboros-consensus/docs/interface-CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ https://keepachangelog.com/en/1.1.0/, adapted to our plan explained above.
5858

5959
## Circa 2022-11-23
6060

61+
- Removed dead `protocolInfoPraosBabbage` and `protocolInfoPraosShelleyBased`.
62+
63+
## Circa 2022-11-23
64+
6165
- Added `ouroboros-consensus-diffusion`, a top level integration package of
6266
`ouroboros-network` & `ouroboros-consensus`
6367

0 commit comments

Comments
 (0)