ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.HardFork.History.EraParams

Synopsis

API

data EraParams Source #

Parameters that can vary across hard forks

Instances

Instances details
Eq EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Show EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Generic EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Associated Types

type Rep EraParams :: Type -> Type #

NoThunks EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Serialise EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep EraParams Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep EraParams = D1 ('MetaData "EraParams" "Ouroboros.Consensus.HardFork.History.EraParams" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "EraParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "eraEpochSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EpochSize) :*: (S1 ('MetaSel ('Just "eraSlotLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotLength) :*: S1 ('MetaSel ('Just "eraSafeZone") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SafeZone))))

data SafeZone Source #

Zone in which it is guaranteed that no hard fork can take place

Constructors

StandardSafeZone !Word64 !SafeBeforeEpoch

Standard safe zone

We record

  • Number of slots from the tip of the ledger. This should be (at least) the number of slots in which we are guaranteed to have k blocks.
  • Optionally, an EpochNo before which no hard fork can take place.
UnsafeIndefiniteSafeZone

Pretend the transition to the next era will not take place.

This constructor is marked as unsafe because it effectively extends the safe zone of this era indefinitely into the future. This means that we might reach invalid conclusions when doing

  • slot to time conversions for blocks that are past the actual safe zone
  • time to slot conversions for the current time, when behind in syncing

This is safe when the code is simply not yet ready to transition to the next era, because in that case, we can be sure that blocks that come in are still from this era. It also means that we can always produce a block, no matter how far ahead of the current ledger we are.

If the code is ready for the transition, just awaiting an update proposal, then LowerBound can be used instead.

This constructor can be regarded as an " extreme " version of LowerBound, and can be used for similar reasons.

Instances

Instances details
Eq SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Show SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Generic SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Associated Types

type Rep SafeZone :: Type -> Type #

Methods

from :: SafeZone -> Rep SafeZone x #

to :: Rep SafeZone x -> SafeZone #

NoThunks SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Serialise SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep SafeZone Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep SafeZone = D1 ('MetaData "SafeZone" "Ouroboros.Consensus.HardFork.History.EraParams" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "StandardSafeZone" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SafeBeforeEpoch)) :+: C1 ('MetaCons "UnsafeIndefiniteSafeZone" 'PrefixI 'False) (U1 :: Type -> Type))

data SafeBeforeEpoch Source #

Lower bound on when a transition can take place

Constructors

NoLowerBound

No such lower bound is known

LowerBound !EpochNo

EpochNo before which a transition is guaranteed not to take place

Often such a value is available, since a new era is planned only after the current era has already been running for a while. For example, at the time of writing, we know the Byron to Shelley transition cannot happen before epoch 180, since we are currently already in epoch 179.

Moreover, for epoch transitions that have already taken place, the exact EpochNo of the transition can be used.

Providing this value is strictly an optimization; for example, it will reduce the frequency with which summaryToEpochInfo must update its summary of the hard fork history.

Instances

Instances details
Eq SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Show SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Generic SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Associated Types

type Rep SafeBeforeEpoch :: Type -> Type #

NoThunks SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

Serialise SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep SafeBeforeEpoch Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.History.EraParams

type Rep SafeBeforeEpoch = D1 ('MetaData "SafeBeforeEpoch" "Ouroboros.Consensus.HardFork.History.EraParams" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "NoLowerBound" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LowerBound" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EpochNo)))

noLowerBoundSafeZone :: Word64 -> SafeZone Source #

The safe zone with given safeFromTip and NoLowerBound

Defaults

defaultEraParams :: SecurityParam -> SlotLength -> EraParams Source #

Default EraParams

We set

  • epoch size to 10k slots
  • the safe zone to 2k slots
  • the upper bound to NoLowerBound

This is primarily useful for tests.

Queries

safeBeforeEpoch :: SafeZone -> Maybe SafeBeforeEpoch Source #

Returns Nothing if the era is unbounded.