| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.HardFork.Combinator.State
Description
Intended for qualified import
import Ouroboros.Consensus.HardFork.Combinator.State (HardForkState(..)) import qualified Ouroboros.Consensus.HardFork.Combinator.State as State
Synopsis
- data TransitionInfo
- newtype TranslateForecast f g x y = TranslateForecast {
- translateForecastWith :: Bound -> SlotNo -> f x -> Except OutsideForecastRange (Ticked (g y))
- newtype Translate f x y = Translate {
- translateWith :: EpochNo -> f x -> f y
- data Past = Past {}
- data Current f blk = Current {
- currentStart :: !Bound
- currentState :: !(f blk)
- newtype HardForkState f xs = HardForkState {
- getHardForkState :: Telescope (K Past) (Current f) xs
- data Situated h f xs where
- SituatedCurrent :: Current f x -> h x -> Situated h f (x ': xs)
- SituatedNext :: Current f x -> h y -> Situated h f (x ': (y ': xs))
- SituatedFuture :: Current f x -> NS h xs -> Situated h f (x ': (y ': xs))
- SituatedPast :: K Past x -> h x -> Situated h f (x ': xs)
- SituatedShift :: Situated h f xs -> Situated h f (x ': xs)
- initHardForkState :: f x -> HardForkState f (x ': xs)
- tip :: SListI xs => HardForkState f xs -> NS f xs
- match :: SListI xs => NS h xs -> HardForkState f xs -> Either (Mismatch h (Current f) xs) (HardForkState (Product h f) xs)
- sequence :: forall f m xs. (SListI xs, Functor m) => HardForkState (m :.: f) xs -> m (HardForkState f xs)
- fromTZ :: HardForkState f '[blk] -> f blk
- situate :: NS h xs -> HardForkState f xs -> Situated h f xs
- align :: forall xs f f' f''. All SingleEraBlock xs => InPairs (Translate f) xs -> NP (f' -.-> (f -.-> f'')) xs -> HardForkState f' xs -> HardForkState f xs -> HardForkState f'' xs
- reconstructSummary :: Shape xs -> TransitionInfo -> HardForkState f xs -> Summary xs
- getTip :: forall f xs. CanHardFork xs => (forall blk. SingleEraBlock blk => f blk -> Point blk) -> HardForkState f xs -> Point (HardForkBlock xs)
- recover :: forall f xs. CanHardFork xs => Telescope (K Past) f xs -> HardForkState f xs
- mostRecentTransitionInfo :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> TransitionInfo
- reconstructSummaryLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> Summary xs
- epochInfoLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> EpochInfo Identity
- epochInfoPrecomputedTransitionInfo :: Shape xs -> TransitionInfo -> HardForkState f xs -> EpochInfo Identity
- extendToSlot :: forall xs. CanHardFork xs => HardForkLedgerConfig xs -> SlotNo -> HardForkState LedgerState xs -> HardForkState LedgerState xs
Documentation
data TransitionInfo Source #
Knowledge in a particular era of the transition to the next era
Constructors
| TransitionUnknown !(WithOrigin SlotNo) | No transition is yet known for this era We instead record the ledger tip (which must be in this era) NOTE: If we are forecasting, this will be set to the slot number of the
(past) ledger state in which the forecast was created. This means that
when we construct an |
| TransitionKnown !EpochNo | Transition to the next era is known to happen at this |
| TransitionImpossible | The transition is impossible This can be due to one of two reasons:
|
Instances
newtype TranslateForecast f g x y Source #
Translate (a forecast of) f x to (a forecast of) f y
across an era transition.
Typically f will be WrapLedgerView.
In addition to the Bound of the transition, this is also told the
SlotNo we're constructing a forecast for. This enables the translation
function to take into account any scheduled changes that the final ledger
view in the preceding era might have.
Constructors
| TranslateForecast | |
Fields
| |
newtype Translate f x y Source #
Translate f x to f y across an era transition
Typically f will be LedgerState or WrapChainDepState.
Constructors
| Translate | |
Fields
| |
Information about a past era
Instances
| Eq Past Source # | |
| Show Past Source # | |
| Generic Past Source # | |
| NoThunks Past Source # | |
| Serialise Past Source # | |
| type Rep Past Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.State.Types type Rep Past = D1 ('MetaData "Past" "Ouroboros.Consensus.HardFork.Combinator.State.Types" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "Past" 'PrefixI 'True) (S1 ('MetaSel ('Just "pastStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bound) :*: S1 ('MetaSel ('Just "pastEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bound))) | |
Information about the current era
Constructors
| Current | |
Fields
| |
Instances
| Eq (f blk) => Eq (Current f blk) Source # | |
| Show (f blk) => Show (Current f blk) Source # | |
| Generic (Current f blk) Source # | |
| NoThunks (f blk) => NoThunks (Current f blk) Source # | |
| Serialise (f blk) => Serialise (Current f blk) Source # | |
| type Rep (Current f blk) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.State.Types type Rep (Current f blk) = D1 ('MetaData "Current" "Ouroboros.Consensus.HardFork.Combinator.State.Types" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "Current" 'PrefixI 'True) (S1 ('MetaSel ('Just "currentStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bound) :*: S1 ('MetaSel ('Just "currentState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (f blk)))) | |
newtype HardForkState f xs Source #
Generic hard fork state
This is used both for the consensus state and the ledger state.
Constructors
| HardForkState | |
Fields
| |
Instances
data Situated h f xs where Source #
A h situated in time
Constructors
| SituatedCurrent :: Current f x -> h x -> Situated h f (x ': xs) | |
| SituatedNext :: Current f x -> h y -> Situated h f (x ': (y ': xs)) | |
| SituatedFuture :: Current f x -> NS h xs -> Situated h f (x ': (y ': xs)) | |
| SituatedPast :: K Past x -> h x -> Situated h f (x ': xs) | |
| SituatedShift :: Situated h f xs -> Situated h f (x ': xs) |
initHardForkState :: f x -> HardForkState f (x ': xs) Source #
match :: SListI xs => NS h xs -> HardForkState f xs -> Either (Mismatch h (Current f) xs) (HardForkState (Product h f) xs) Source #
sequence :: forall f m xs. (SListI xs, Functor m) => HardForkState (m :.: f) xs -> m (HardForkState f xs) Source #
fromTZ :: HardForkState f '[blk] -> f blk Source #
Arguments
| :: forall xs f f' f''. All SingleEraBlock xs | |
| => InPairs (Translate f) xs | |
| -> NP (f' -.-> (f -.-> f'')) xs | |
| -> HardForkState f' xs | State we are aligning with |
| -> HardForkState f xs | State we are aligning |
| -> HardForkState f'' xs |
Arguments
| :: Shape xs | |
| -> TransitionInfo | At the tip |
| -> HardForkState f xs | |
| -> Summary xs |
Support for defining instances
getTip :: forall f xs. CanHardFork xs => (forall blk. SingleEraBlock blk => f blk -> Point blk) -> HardForkState f xs -> Point (HardForkBlock xs) Source #
Serialisation support
recover :: forall f xs. CanHardFork xs => Telescope (K Past) f xs -> HardForkState f xs Source #
Recover HardForkState from partial information
The primary goal of this is to make sure that for the current state we
really only need to store the underlying f. It is not strictly essential
that this is possible but it helps with the unary hardfork case, and it may
in general help with binary compatibility.
EpochInfo
mostRecentTransitionInfo :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> TransitionInfo Source #
reconstructSummaryLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> Summary xs Source #
epochInfoLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> EpochInfo Identity Source #
epochInfoPrecomputedTransitionInfo :: Shape xs -> TransitionInfo -> HardForkState f xs -> EpochInfo Identity Source #
Construct EpochInfo given precomputed TransitionInfo
Ledger specific functionality
extendToSlot :: forall xs. CanHardFork xs => HardForkLedgerConfig xs -> SlotNo -> HardForkState LedgerState xs -> HardForkState LedgerState xs Source #
Extend the telescope until the specified slot is within the era at the tip