Skip to content

Commit

Permalink
consensus: rename TriggerHardForkNever to TriggerHardForkCannotBeKnown
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrisby committed Oct 3, 2023
1 parent 49c7f76 commit 39668a4
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

### Patch

- `TriggerHardForkNever` was renamed to `TriggerHardForkCannotBeKnown` upstream.

<!--
### Non-Breaking
- A bullet item for the Non-Breaking category.
-->
<!--
### Breaking
- A bullet item for the Breaking category.
-->
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ instance NoHardForks ByronBlock where
byronEraParamsNeverHardForks (byronGenesisConfig (configBlock cfg))
toPartialLedgerConfig _ cfg = ByronPartialLedgerConfig {
byronLedgerConfig = cfg
, byronTriggerHardFork = TriggerHardForkNever
, byronTriggerHardFork = TriggerHardForkCannotBeKnown
}

{-------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ byronTransition ByronPartialLedgerConfig{..} shelleyMajorVersion state =
instance SingleEraBlock ByronBlock where
singleEraTransition pcfg _eraParams _eraStart ledgerState =
case byronTriggerHardFork pcfg of
TriggerHardForkNever -> Nothing
TriggerHardForkCannotBeKnown -> Nothing
TriggerHardForkAtEpoch epoch -> Just epoch
TriggerHardForkAtVersion shelleyMajorVersion ->
byronTransition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ protocolInfoCardano paramsCardano
mkPartialLedgerConfigShelley
transitionConfigConway
maxMajorProtVer
TriggerHardForkNever
TriggerHardForkCannotBeKnown

-- Cardano

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ instance
. configLedger
toPartialLedgerConfig _ cfg = ShelleyPartialLedgerConfig {
shelleyLedgerConfig = cfg
, shelleyTriggerHardFork = TriggerHardForkNever
, shelleyTriggerHardFork = TriggerHardForkCannotBeKnown
}

{-------------------------------------------------------------------------------
Expand Down Expand Up @@ -183,7 +183,7 @@ instance
-- For evidence of this behaviour, replace the cased-on expression by:
-- > @traceShowId $ shelleyTriggerHardFork pcf@
case shelleyTriggerHardFork pcfg of
TriggerHardForkNever -> Nothing
TriggerHardForkCannotBeKnown -> Nothing
TriggerHardForkAtEpoch epoch -> Just epoch
TriggerHardForkAtVersion shelleyMajorVersion ->
shelleyTransition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Ouroboros.Consensus.Byron.Node (ByronLeaderCredentials,
import Ouroboros.Consensus.Cardano.Block (CardanoBlock)
import Ouroboros.Consensus.Cardano.Node (CardanoHardForkConstraints,
CardanoHardForkTriggers (..), ProtocolParams (..),
TriggerHardFork (TriggerHardForkAtEpoch, TriggerHardForkNever),
TriggerHardFork (TriggerHardForkAtEpoch, TriggerHardForkCannotBeKnown),
protocolInfoCardano)
import Ouroboros.Consensus.Config.SecurityParam (SecurityParam (..))
import qualified Ouroboros.Consensus.Mempool as Mempool
Expand Down Expand Up @@ -115,12 +115,12 @@ hfSpecTransitionTrigger era = snd . selectEra era
stayInByron :: HardForkSpec
stayInByron =
HardForkSpec {
shelleyHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
, allegraHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
, maryHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
, alonzoHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
, babbageHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
, conwayHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNever)
shelleyHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
, allegraHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
, maryHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
, alonzoHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
, babbageHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
, conwayHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkCannotBeKnown)
}

versionZero :: SL.Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ protocolInfoShelleyBasedHardFork protocolParamsShelleyBased
-> PartialLedgerConfig (ShelleyBlock proto2 era2)
toPartialLedgerConfig2 cfg = ShelleyPartialLedgerConfig {
shelleyLedgerConfig = cfg
, shelleyTriggerHardFork = TriggerHardForkNever
, shelleyTriggerHardFork = TriggerHardForkCannotBeKnown
}

{-------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Patch
- A bullet item for the Patch category.
-->
<!--
### Non-Breaking
- A bullet item for the Non-Breaking category.
-->
### Breaking

- Renamed `TriggerHardForkNever` to `TriggerHardForkCannotBeKnown`.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ data TriggerHardFork =
-- | For testing only, trigger the transition at a specific hard-coded
-- epoch, irrespective of the ledger state.
| TriggerHardForkAtEpoch !EpochNo
-- | Never trigger a hard fork
| TriggerHardForkNever
-- | Ledger states in this era cannot determine when the hard fork
-- transition will happen.
--
-- It's crucial to note this era could eventually end via a hard fork
-- transition. But that could only happen once it is no longer configured
-- to use this setting (eg in a subsequent software release). Therefore,
-- this option does /not/ imply that "the era will never end", merely that
-- "the era cannot end within this node process before it and restarts with
-- different software and/or configuration for this era".
| TriggerHardForkCannotBeKnown
deriving (Show, Generic, NoThunks)

0 comments on commit 39668a4

Please sign in to comment.