cardano-ledger-core-1.14.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Core.Era

Synopsis

Era

class (Crypto (EraCrypto era), Typeable era, KnownNat (ProtVerLow era), KnownNat (ProtVerHigh era), ProtVerLow era <= ProtVerHigh era, MinVersion <= ProtVerLow era, MinVersion <= ProtVerHigh era, CmpNat (ProtVerLow era) MaxVersion ~ 'LT, CmpNat (ProtVerHigh era) MaxVersion ~ 'LT, ProtVerLow era <= MaxVersion, ProtVerHigh era <= MaxVersion) ⇒ Era era where Source #

Associated Types

type EraCrypto era ∷ Type Source #

type PreviousEra era = (r ∷ Type) | r → era Source #

Map an era to its predecessor.

For example:

type instance PreviousEra (AllegraEra c) = ShelleyEra c

type ProtVerLow era ∷ Nat Source #

Lowest major protocol version for this era

type ProtVerHigh era ∷ Nat Source #

Highest major protocol version for this era. By default se to ProtVerLow

type ProtVerHigh era = ProtVerLow era

Methods

eraNameString Source #

Textual name of the current era.

Designed to be used with TypeApplications:

>>> eraName @(ByronEra StandardCrypto)
Byron

Instances

Instances details
Crypto c ⇒ Era (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Associated Types

type EraCrypto (ByronEra c) Source #

type PreviousEra (ByronEra c) = (r ∷ Type) Source #

type ProtVerLow (ByronEra c) ∷ Nat Source #

type ProtVerHigh (ByronEra c) ∷ Nat Source #

Methods

eraNameString Source #

data ByronEra c Source #

This is the era that preceded Shelley era. It cannot have any other class instances, except for Era type class.

Instances

Instances details
Crypto c ⇒ Era (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Associated Types

type EraCrypto (ByronEra c) Source #

type PreviousEra (ByronEra c) = (r ∷ Type) Source #

type ProtVerLow (ByronEra c) ∷ Nat Source #

type ProtVerHigh (ByronEra c) ∷ Nat Source #

Methods

eraNameString Source #

type EraCrypto (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraCrypto (ByronEra c) = c
type PreviousEra (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type ProtVerHigh (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type ProtVerHigh (ByronEra c) = 1
type ProtVerLow (ByronEra c) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type ProtVerLow (ByronEra c) = 0

Rules

type family EraRule (rule ∷ Symbol) era = (r ∷ Type) | r → rule Source #

Era STS map

type family EraRuleFailure (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #

EraRuleFailure type family is needed for injectivity, which STS' PredicateFailure does not provide for us unfortunately.

Instances

Instances details
type EraRuleFailure "EPOCH" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "EPOCH" era = VoidEraRule "EPOCH" era
type EraRuleFailure "MIR" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "MIR" era = VoidEraRule "MIR" era
type EraRuleFailure "NEWEPOCH" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "NEWEPOCH" era = VoidEraRule "NEWEPOCH" era
type EraRuleFailure "NEWPP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "NEWPP" era = VoidEraRule "NEWPP" era
type EraRuleFailure "POOLREAP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "POOLREAP" era = VoidEraRule "POOLREAP" era
type EraRuleFailure "RUPD" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "RUPD" era = VoidEraRule "RUPD" era
type EraRuleFailure "SNAP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "SNAP" era = VoidEraRule "SNAP" era
type EraRuleFailure "TICK" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "TICK" era = VoidEraRule "TICK" era
type EraRuleFailure "TICKF" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "TICKF" era = VoidEraRule "TICKF" era
type EraRuleFailure "UPEC" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "UPEC" era = VoidEraRule "UPEC" era

type family EraRuleEvent (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #

data VoidEraRule (rule ∷ Symbol) era Source #

This is a type with no inhabitans for the rules. It is used to indicate that a rule does not have a predicate failure as well as marking rules that have been disabled when comparing to prior eras.

Instances

Instances details
Show (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

showsPrecIntVoidEraRule rule era → ShowS Source #

showVoidEraRule rule era → String Source #

showList ∷ [VoidEraRule rule era] → ShowS Source #

(KnownSymbol rule, Era era) ⇒ FromCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

fromCBORDecoder s (VoidEraRule rule era) Source #

labelProxy (VoidEraRule rule era) → Text Source #

(KnownSymbol rule, Era era) ⇒ ToCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

toCBORVoidEraRule rule era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VoidEraRule rule era) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [VoidEraRule rule era] → Size Source #

(KnownSymbol rule, Era era) ⇒ DecCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

decCBORDecoder s (VoidEraRule rule era) Source #

dropCBORProxy (VoidEraRule rule era) → Decoder s () Source #

labelProxy (VoidEraRule rule era) → Text Source #

(KnownSymbol rule, Era era) ⇒ EncCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

encCBORVoidEraRule rule era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VoidEraRule rule era) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VoidEraRule rule era] → Size Source #

NFData (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

rnfVoidEraRule rule era → () Source #

Eq (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

(==)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(/=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

Ord (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

compareVoidEraRule rule era → VoidEraRule rule era → Ordering Source #

(<)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(<=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(>)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(>=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

maxVoidEraRule rule era → VoidEraRule rule era → VoidEraRule rule era Source #

minVoidEraRule rule era → VoidEraRule rule era → VoidEraRule rule era Source #

absurdEraRuleVoidEraRule rule era → a Source #

class EraRuleFailure rule era ~ PredicateFailure (EraRule rule era) ⇒ InjectRuleFailure (rule ∷ Symbol) t era where Source #

Minimal complete definition

Nothing

Methods

injectFailure ∷ t era → EraRuleFailure rule era Source #

default injectFailure ∷ t era ~ EraRuleFailure rule era ⇒ t era → EraRuleFailure rule era Source #

class EraRuleEvent rule era ~ Event (EraRule rule era) ⇒ InjectRuleEvent (rule ∷ Symbol) t era where Source #

Minimal complete definition

Nothing

Methods

injectEvent ∷ t era → EraRuleEvent rule era Source #

default injectEvent ∷ t era ~ EraRuleEvent rule era ⇒ t era → EraRuleEvent rule era Source #

Protocol Version

type AtMostEra (eraName ∷ TypeType) era = ProtVerAtMost era (ProtVerHigh (eraName (EraCrypto era))) Source #

Restrict the era to equal to eraName or come before it.

type AtLeastEra (eraName ∷ TypeType) era = ProtVerAtLeast era (ProtVerLow (eraName (EraCrypto era))) Source #

Restrict the era to equal to eraName or come after it

type ExactEra (inEra ∷ TypeType) era = ProtVerInBounds era (ProtVerLow (inEra (EraCrypto era))) (ProtVerHigh (inEra (EraCrypto era))) Source #

Restrict an era to the specific era through the protocol version. This is equivalent to (inEra (Crypto era) ~ era)

type family ProtVerAtMost era (h ∷ Nat) ∷ Constraint where ... Source #

Requirement for the era's lowest protocol version to be lower or equal to the supplied value

Equations

ProtVerAtMost era h = ProtVerIsInBounds "at most" era h (ProtVerLow era <=? h) 

type family ProtVerAtLeast era (l ∷ Nat) ∷ Constraint where ... Source #

Requirement for the era's highest protocol version to be higher or equal to the supplied value

Equations

ProtVerAtLeast era l = ProtVerIsInBounds "at least" era l (l <=? ProtVerHigh era) 

type ProtVerInBounds era l h = (ProtVerAtLeast era l, ProtVerAtMost era h) Source #

Restrict a lower and upper bounds of the protocol version for the particular era

atLeastEraAtLeastEra eraName era ⇒ () Source #

Enforce era to be at least the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.

For example these will type check

>>> atLeastEra @BabbageEra @(ConwayEra StandardCrypto)
>>> atLeastEra @BabbageEra @(BabbageEra StandardCrypto)

However this will result in a type error

>>> atLeastEra @BabbageEra @(AlonzoEra StandardCrypto)

atMostEraAtMostEra eraName era ⇒ () Source #

Enforce era to be at most the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.

For example these will type check

>>> atMostEra @BabbageEra @(ShelleyEra StandardCrypto)
>>> atMostEra @AlonzoEra @(MaryEra StandardCrypto)

However this will result in a type error

>>> atMostEra @BabbageEra @(ConwayEra StandardCrypto)

eraProtVerLow ∷ ∀ era. Era era ⇒ Version Source #

Get the value level Version of the lowest major protocol version for the supplied era.

eraProtVerHigh ∷ ∀ era. Era era ⇒ Version Source #

Get the value level Version of the highest major protocol version for the supplied era.

toEraCBOR ∷ ∀ era t. (Era era, EncCBOR t) ⇒ t → Encoding Source #

Convert a type that implements EncCBOR to plain Encoding using the lowest protocol version for the supplied era

fromEraCBOR ∷ ∀ era t s. (Era era, DecCBOR t) ⇒ Decoder s t Source #

Convert a type that implements DecCBOR to plain Decoder using the lowest protocol version for the supplied era

fromEraShareCBOR ∷ ∀ era t s. (Era era, DecShareCBOR t) ⇒ Decoder s t Source #

Convert a type that implements DecShareCBOR to plain Decoder using the lowest protocol version for the supplied era

eraDecoder ∷ ∀ era t s. Era era ⇒ Decoder s t → Decoder s t Source #

Convert a versioned Decoder to plain a Decoder using the lowest protocol version for the supplied era