Skip to content

Commit

Permalink
consensus: rename TriggerHardForkNever to TriggerHardForkNotDuringThi…
Browse files Browse the repository at this point in the history
…sExecution (#396)

See the single commit's message.
  • Loading branch information
nfrisby authored Oct 5, 2023
2 parents 4ddf5d9 + f80c43e commit 903ba3c
Show file tree
Hide file tree
Showing 9 changed files with 68 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 `TriggerHardForkNotDuringThisExecution` 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 = TriggerHardForkNotDuringThisExecution
}

{-------------------------------------------------------------------------------
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
TriggerHardForkNotDuringThisExecution -> 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
TriggerHardForkNotDuringThisExecution

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

{-------------------------------------------------------------------------------
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
TriggerHardForkNotDuringThisExecution -> 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, TriggerHardForkNotDuringThisExecution),
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, TriggerHardForkNotDuringThisExecution)
, allegraHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNotDuringThisExecution)
, maryHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNotDuringThisExecution)
, alonzoHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNotDuringThisExecution)
, babbageHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNotDuringThisExecution)
, conwayHardForkSpec = (SL.ProtVer versionZero 0, TriggerHardForkNotDuringThisExecution)
}

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

{-------------------------------------------------------------------------------
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 `TriggerHardForkNotDuringThisExecution`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)

-- | The trigger condition that will cause the hard fork transition.
--
-- This type is only intended for use as part of a
-- 'Ouroboros.Consensus.Ledger.Basics.LedgerCfg', which means it is "static":
-- it cannot change during an execution of the node process.
data TriggerHardFork =
-- | Trigger the transition when the on-chain protocol major version (from
-- the ledger state) reaches this number.
Expand All @@ -19,6 +23,12 @@ 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 that this option does /not/ imply that "the era
-- will never end". Instead, the era cannot end within this node process
-- before it restarts with different software and/or configuration for this
-- era.
| TriggerHardForkNotDuringThisExecution
deriving (Show, Generic, NoThunks)

0 comments on commit 903ba3c

Please sign in to comment.