Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- sequenceHardForkState :: forall m f xs. ( All Top xs, Functor m) => HardForkState (m :.: f) xs -> m ( HardForkState 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
- epochInfoLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> EpochInfo ( Except PastHorizonException )
- epochInfoPrecomputedTransitionInfo :: Shape xs -> TransitionInfo -> HardForkState f xs -> EpochInfo ( Except PastHorizonException )
- mostRecentTransitionInfo :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> TransitionInfo
- reconstructSummaryLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> Summary xs
- 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
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
Show TransitionInfo Source # | |
Generic TransitionInfo Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.State.Types from :: TransitionInfo -> Rep TransitionInfo x Source # to :: Rep TransitionInfo x -> TransitionInfo Source # |
|
NoThunks TransitionInfo Source # | |
type Rep TransitionInfo Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.State.Types
type
Rep
TransitionInfo
=
D1
('
MetaData
"TransitionInfo" "Ouroboros.Consensus.HardFork.Combinator.State.Types" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" '
False
) (
C1
('
MetaCons
"TransitionUnknown" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
(
WithOrigin
SlotNo
)))
:+:
(
C1
('
MetaCons
"TransitionKnown" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
SourceStrict
'
DecidedStrict
) (
Rec0
EpochNo
))
:+:
C1
('
MetaCons
"TransitionImpossible" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)))
|
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.
TranslateForecast | |
|
newtype Translate f x y Source #
Translate
f x
to
f y
across an era transition
Typically
f
will be
LedgerState
or
WrapChainDepState
.
Translate | |
|
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.1-DT4Cvwf63DZKctsEvaJqCU" '
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
Current | |
|
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.1-DT4Cvwf63DZKctsEvaJqCU" '
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.
HardForkState | |
|
Instances
sequenceHardForkState :: forall m f xs. ( All Top xs, Functor m) => HardForkState (m :.: f) xs -> m ( HardForkState f xs) Source #
Thin wrapper around
sequence
data Situated h f xs where Source #
A
h
situated in time
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 #
:: 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 |
:: 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
epochInfoLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> EpochInfo ( Except PastHorizonException ) Source #
epochInfoPrecomputedTransitionInfo :: Shape xs -> TransitionInfo -> HardForkState f xs -> EpochInfo ( Except PastHorizonException ) Source #
Construct
EpochInfo
given precomputed
TransitionInfo
The transition and state arguments are acquired either from a ticked ledger state or a ticked ledger view.
mostRecentTransitionInfo :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> TransitionInfo Source #
reconstructSummaryLedger :: All SingleEraBlock xs => HardForkLedgerConfig xs -> HardForkState LedgerState xs -> Summary xs Source #
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