Skip to content

Commit

Permalink
ouroboros-consensus upgrade: TriggerHardFork changes
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmayhew committed Dec 6, 2024
1 parent 72f9aab commit f2977ec
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions cardano-node/src/Cardano/Node/Protocol/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Cardano.Tracing.OrphanInstances.Byron ()
import Cardano.Tracing.OrphanInstances.Shelley ()
import Ouroboros.Consensus.Cardano
import qualified Ouroboros.Consensus.Cardano as Consensus
import qualified Ouroboros.Consensus.Cardano.CanHardFork as Consensus
import Ouroboros.Consensus.Cardano.Condense ()
import qualified Ouroboros.Consensus.Cardano.Node as Consensus
import Ouroboros.Consensus.Config (emptyCheckpointsMap)
Expand Down Expand Up @@ -91,17 +90,11 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
-- not-yet-ready eras in released node versions without mainnet nodes
-- prematurely advertising that they could hard fork into the new era.
npcTestShelleyHardForkAtEpoch,
npcTestShelleyHardForkAtVersion,
npcTestAllegraHardForkAtEpoch,
npcTestAllegraHardForkAtVersion,
npcTestMaryHardForkAtEpoch,
npcTestMaryHardForkAtVersion,
npcTestAlonzoHardForkAtEpoch,
npcTestAlonzoHardForkAtVersion,
npcTestBabbageHardForkAtEpoch,
npcTestBabbageHardForkAtVersion,
npcTestConwayHardForkAtEpoch,
npcTestConwayHardForkAtVersion
npcTestConwayHardForkAtEpoch
}
files = do
byronGenesis <-
Expand Down Expand Up @@ -202,37 +195,31 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
-- But we also provide an override to allow for simpler test setups
-- such as triggering at the 0 -> 1 transition .
--
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 2 fromIntegral npcTestShelleyHardForkAtVersion)
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion

-- Alternatively, for testing we can transition at a specific epoch.
--
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
, triggerHardForkAllegra =
case npcTestAllegraHardForkAtEpoch of

Check warning on line 204 in cardano-node/src/Cardano/Node/Protocol/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkSomeConsensusProtocolCardano in module Cardano.Node.Protocol.Cardano: Replace case with maybe ▫︎ Found: "case npcTestAllegraHardForkAtEpoch of\n Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion\n Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo" ▫︎ Perhaps: "maybe\n Consensus.CardanoTriggerHardForkAtDefaultVersion\n Consensus.CardanoTriggerHardForkAtEpoch\n npcTestAllegraHardForkAtEpoch"
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 3 fromIntegral npcTestAllegraHardForkAtVersion)
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
, triggerHardForkMary =
case npcTestMaryHardForkAtEpoch of

Check warning on line 208 in cardano-node/src/Cardano/Node/Protocol/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkSomeConsensusProtocolCardano in module Cardano.Node.Protocol.Cardano: Replace case with maybe ▫︎ Found: "case npcTestMaryHardForkAtEpoch of\n Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion\n Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo" ▫︎ Perhaps: "maybe\n Consensus.CardanoTriggerHardForkAtDefaultVersion\n Consensus.CardanoTriggerHardForkAtEpoch npcTestMaryHardForkAtEpoch"
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 4 fromIntegral npcTestMaryHardForkAtVersion)
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
, triggerHardForkAlonzo =
case npcTestAlonzoHardForkAtEpoch of

Check warning on line 212 in cardano-node/src/Cardano/Node/Protocol/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkSomeConsensusProtocolCardano in module Cardano.Node.Protocol.Cardano: Replace case with maybe ▫︎ Found: "case npcTestAlonzoHardForkAtEpoch of\n Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion\n Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo" ▫︎ Perhaps: "maybe\n Consensus.CardanoTriggerHardForkAtDefaultVersion\n Consensus.CardanoTriggerHardForkAtEpoch\n npcTestAlonzoHardForkAtEpoch"
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 5 fromIntegral npcTestAlonzoHardForkAtVersion)
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
, triggerHardForkBabbage =
case npcTestBabbageHardForkAtEpoch of

Check warning on line 216 in cardano-node/src/Cardano/Node/Protocol/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkSomeConsensusProtocolCardano in module Cardano.Node.Protocol.Cardano: Replace case with maybe ▫︎ Found: "case npcTestBabbageHardForkAtEpoch of\n Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion\n Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo" ▫︎ Perhaps: "maybe\n Consensus.CardanoTriggerHardForkAtDefaultVersion\n Consensus.CardanoTriggerHardForkAtEpoch\n npcTestBabbageHardForkAtEpoch"
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 7 fromIntegral npcTestBabbageHardForkAtVersion)
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
, triggerHardForkConway =
case npcTestConwayHardForkAtEpoch of

Check warning on line 220 in cardano-node/src/Cardano/Node/Protocol/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkSomeConsensusProtocolCardano in module Cardano.Node.Protocol.Cardano: Replace case with maybe ▫︎ Found: "case npcTestConwayHardForkAtEpoch of\n Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion\n Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo" ▫︎ Perhaps: "maybe\n Consensus.CardanoTriggerHardForkAtDefaultVersion\n Consensus.CardanoTriggerHardForkAtEpoch\n npcTestConwayHardForkAtEpoch"
Nothing -> Consensus.TriggerHardForkAtVersion
(maybe 9 fromIntegral npcTestConwayHardForkAtVersion)
Just epochNo -> Consensus.TriggerHardForkAtEpoch epochNo
Nothing -> Consensus.CardanoTriggerHardForkAtDefaultVersion
Just epochNo -> Consensus.CardanoTriggerHardForkAtEpoch epochNo
}
-- TODO: once https://github.com/IntersectMBO/cardano-node/issues/5730 is implemented 'emptyCheckpointsMap' needs to be replaced with the checkpoints map read from a configuration file.
, Consensus.cardanoCheckpoints = emptyCheckpointsMap
Expand Down

0 comments on commit f2977ec

Please sign in to comment.