cardano-ledger-api-1.11.0.0: Public API for the cardano ledger codebase
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Api.Transition

Description

This module is used for defining initial configuration for all. It is also used in testing and benchmarking to initilize a chain in a particular era without going through the trouble of generating all the history for preceeding eras.

Synopsis

Documentation

data family TransitionConfig era Source #

Cumulative configuration that is needed to be able to start in a current era

Instances

Instances details
FromJSON (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

ToJSON (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Generic (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Associated Types

type Rep (TransitionConfig ShelleyEra) ∷ TypeType Source #

Show (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Eq (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

NoThunks (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

newtype TransitionConfig AllegraEra 
Instance details

Defined in Cardano.Ledger.Allegra.Transition

data TransitionConfig AlonzoEra 
Instance details

Defined in Cardano.Ledger.Alonzo.Transition

newtype TransitionConfig BabbageEra 
Instance details

Defined in Cardano.Ledger.Babbage.Transition

data TransitionConfig ConwayEra 
Instance details

Defined in Cardano.Ledger.Conway.Transition

newtype TransitionConfig MaryEra 
Instance details

Defined in Cardano.Ledger.Mary.Transition

newtype TransitionConfig ShelleyEra 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

type Rep (TransitionConfig AlonzoEra) 
Instance details

Defined in Cardano.Ledger.Alonzo.Transition

type Rep (TransitionConfig AlonzoEra) = D1 ('MetaData "TransitionConfig" "Cardano.Ledger.Alonzo.Transition" "cardano-ledger-alonzo-1.13.0.0-inplace" 'False) (C1 ('MetaCons "AlonzoTransitionConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "atcAlonzoGenesis") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AlonzoGenesis) :*: S1 ('MetaSel ('Just "atcMaryTransitionConfig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TransitionConfig MaryEra))))
type Rep (TransitionConfig ConwayEra) 
Instance details

Defined in Cardano.Ledger.Conway.Transition

type Rep (TransitionConfig ConwayEra) = D1 ('MetaData "TransitionConfig" "Cardano.Ledger.Conway.Transition" "cardano-ledger-conway-1.19.0.0-inplace" 'False) (C1 ('MetaCons "ConwayTransitionConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "ctcConwayGenesis") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ConwayGenesis) :*: S1 ('MetaSel ('Just "ctcBabbageTransitionConfig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TransitionConfig BabbageEra))))
type Rep (TransitionConfig ShelleyEra) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

type Rep (TransitionConfig ShelleyEra) = D1 ('MetaData "TransitionConfig" "Cardano.Ledger.Shelley.Transition" "cardano-ledger-shelley-1.16.0.0-inplace" 'True) (C1 ('MetaCons "ShelleyTransitionConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "stcShelleyGenesis") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShelleyGenesis)))

mkTransitionConfig Source #

Arguments

EraTransition era 
TranslationContext era

Translation context necessary for advancing from previous era into the current one. This will usually be the contents of genesis file, if one exists for the current era

TransitionConfig (PreviousEra era)

Transition configuration for the previous era.

TransitionConfig era 

tcShelleyGenesisLEraTransition era ⇒ Lens' (TransitionConfig era) ShelleyGenesis Source #

Lens for the ShelleyGenesis from the TransitionConfig. Default implementation looks in the previous era's config

tcPreviousEraConfigLEraTransition era ⇒ Lens' (TransitionConfig era) (TransitionConfig (PreviousEra era)) Source #

In case when a previous era is available, we should always be able to access TransitionConfig for the previous era, from within the current era's TransitionConfig

tcTranslationContextLEraTransition era ⇒ Lens' (TransitionConfig era) (TranslationContext era) Source #

Lens for the TranslationContext for the current era from the TransitionConfig Translation context is a different name for the Genesis type for each era, they are one and the same concept.

Genesis

class Era era ⇒ EraGenesis era Source #

Associated Types

type Genesis era Source #

type Genesis era = NoGenesis era

Instances

Instances details
EraGenesis AllegraEra 
Instance details

Defined in Cardano.Ledger.Allegra.Era

Associated Types

type Genesis AllegraEra Source #

EraGenesis BabbageEra 
Instance details

Defined in Cardano.Ledger.Babbage.Era

Associated Types

type Genesis BabbageEra Source #

EraGenesis MaryEra 
Instance details

Defined in Cardano.Ledger.Mary.Era

Associated Types

type Genesis MaryEra Source #

data ShelleyGenesis Source #

Shelley genesis information

Note that this is needed only for a pure Shelley network, hence it being defined here rather than in its own module. In mainnet, Shelley will transition naturally from Byron, and thus will never have its own genesis information.

Constructors

ShelleyGenesis 

Fields

Instances

Instances details
FromJSON ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

ToJSON ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Generic ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Associated Types

type Rep ShelleyGenesisTypeType Source #

Show ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

FromCBOR ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

ToCBOR ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

DecCBOR ShelleyGenesis

Genesis are always encoded with the version of era they are defined in.

Instance details

Defined in Cardano.Ledger.Shelley.Genesis

EncCBOR ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Eq ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

NoThunks ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ShelleyGenesis 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ShelleyGenesis = D1 ('MetaData "ShelleyGenesis" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.16.0.0-inplace" 'False) (C1 ('MetaCons "ShelleyGenesis" 'PrefixI 'True) (((S1 ('MetaSel ('Just "sgSystemStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UTCTime) :*: (S1 ('MetaSel ('Just "sgNetworkMagic") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: S1 ('MetaSel ('Just "sgNetworkId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network))) :*: ((S1 ('MetaSel ('Just "sgActiveSlotsCoeff") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PositiveUnitInterval) :*: S1 ('MetaSel ('Just "sgSecurityParam") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "sgEpochLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 EpochSize) :*: S1 ('MetaSel ('Just "sgSlotsPerKESPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64)))) :*: (((S1 ('MetaSel ('Just "sgMaxKESEvolutions") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sgSlotLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NominalDiffTimeMicro)) :*: (S1 ('MetaSel ('Just "sgUpdateQuorum") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sgMaxLovelaceSupply") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "sgProtocolParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PParams ShelleyEra)) :*: S1 ('MetaSel ('Just "sgGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'Genesis) GenDelegPair))) :*: (S1 ('MetaSel ('Just "sgInitialFunds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap Addr Coin)) :*: S1 ('MetaSel ('Just "sgStaking") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShelleyGenesisStaking))))))

newtype AlonzoGenesis Source #

All configuration that is necessary to bootstrap AlonzoEra from ShelleyGenesis

Bundled Patterns

pattern AlonzoGenesisCoinPerWordCostModelsPricesExUnitsExUnitsNaturalNaturalNaturalAlonzoGenesis 

Instances

Instances details
FromJSON AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToJSON AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

Generic AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

Associated Types

type Rep AlonzoGenesisTypeType Source #

Show AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

FromCBOR AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

ToCBOR AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

DecCBOR AlonzoGenesis

Genesis types are always encoded with the version of era they are defined in.

Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

EncCBOR AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

Eq AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

NoThunks AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

type Rep AlonzoGenesis 
Instance details

Defined in Cardano.Ledger.Alonzo.Genesis

type Rep AlonzoGenesis = D1 ('MetaData "AlonzoGenesis" "Cardano.Ledger.Alonzo.Genesis" "cardano-ledger-alonzo-1.13.0.0-inplace" 'True) (C1 ('MetaCons "AlonzoGenesisWrapper" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAlonzoGenesisWrapper") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UpgradeAlonzoPParams Identity))))

data ConwayGenesis Source #

Instances

Instances details
FromJSON ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

ToJSON ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Generic ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Associated Types

type Rep ConwayGenesisTypeType Source #

Show ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

DecCBOR ConwayGenesis

Genesis are always encoded with the version of era they are defined in.

Instance details

Defined in Cardano.Ledger.Conway.Genesis

EncCBOR ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Eq ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

NoThunks ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

type Rep ConwayGenesis 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

data NoGenesis era Source #

Constructors

NoGenesis 

Instances

Instances details
Show (NoGenesis era) 
Instance details

Defined in Cardano.Ledger.Genesis

Methods

showsPrecIntNoGenesis era → ShowS Source #

showNoGenesis era → String Source #

showList ∷ [NoGenesis era] → ShowS Source #

Eq (NoGenesis era) 
Instance details

Defined in Cardano.Ledger.Genesis

Methods

(==)NoGenesis era → NoGenesis era → Bool Source #

(/=)NoGenesis era → NoGenesis era → Bool Source #

Functions for Testing

tcInitialPParamsGEraTransition era ⇒ SimpleGetter (TransitionConfig era) (PParams era) Source #

Get the initial PParams for the current era from the TransitionConfig. Note that this is only useful for testing and fast forward functionality, because this function assumes no on-chain changes to PParams through PParamsUpdate functionality.

Default implementation will use the PParams from the Previous era and the current TranslationContext to construct PParams for the current era.

Warning - Should only be used in testing and benchmarking

tcInitialFundsL ∷ (HasCallStack, EraTransition era) ⇒ Lens' (TransitionConfig era) (ListMap Addr Coin) Source #

Get the initial funds from the TransitionConfig. This value must be non-empty only during testing and benchmarking, it must never contain anything on a real system.

Warning - Should only be used in testing and benchmarking. Will result in an error when NetworkId is set to Mainnet

tcInitialStakingL ∷ (HasCallStack, EraTransition era) ⇒ Lens' (TransitionConfig era) ShelleyGenesisStaking Source #

Get the initial staking from the TransitionConfig. This value must be non-empty only during testing and benchmarking, it must never contain anything on a real system.

Warning - Should only be used in testing and benchmarking. Will result in an error when NetworkId is set to Mainnet

createInitialState ∷ (EraTransition era, HasCallStack) ⇒ TransitionConfig era → NewEpochState era Source #

Helper function for constructing the initial state for any era

Warning - Should only be used in testing and benchmarking. Will result in an error when NetworkId is set to Mainnet

This function does not register any initial funds or delegates.

injectIntoTestState Source #

Arguments

EraTransition era 
TransitionConfig era

Extract data from the given transition configuration and store it in the given state.

Warning - Should only be used in testing and benchmarking. Will result in an error when NetworkId is set to Mainnet.

NewEpochState era 
NewEpochState era