cardano-ledger-api-1.9.1.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
Crypto c ⇒ FromJSON (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Crypto c ⇒ ToJSON (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Generic (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Associated Types

type Rep (TransitionConfig (ShelleyEra c)) ∷ TypeType Source #

Crypto c ⇒ Show (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Crypto c ⇒ Eq (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

Crypto c ⇒ NoThunks (TransitionConfig (ShelleyEra c)) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

type Rep (TransitionConfig (AlonzoEra c)) 
Instance details

Defined in Cardano.Ledger.Alonzo.Transition

type Rep (TransitionConfig (AlonzoEra c)) = D1 ('MetaData "TransitionConfig" "Cardano.Ledger.Alonzo.Transition" "cardano-ledger-alonzo-1.8.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 c)))))
type Rep (TransitionConfig (ConwayEra c)) 
Instance details

Defined in Cardano.Ledger.Conway.Transition

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

Defined in Cardano.Ledger.Shelley.Transition

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

Defined in Cardano.Ledger.Allegra.Transition

data TransitionConfig (AlonzoEra c) 
Instance details

Defined in Cardano.Ledger.Alonzo.Transition

newtype TransitionConfig (BabbageEra c) 
Instance details

Defined in Cardano.Ledger.Babbage.Transition

data TransitionConfig (ConwayEra c) 
Instance details

Defined in Cardano.Ledger.Conway.Transition

newtype TransitionConfig (MaryEra c) 
Instance details

Defined in Cardano.Ledger.Mary.Transition

newtype TransitionConfig (ShelleyEra c) 
Instance details

Defined in Cardano.Ledger.Shelley.Transition

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 (EraCrypto era)) 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

data ShelleyGenesis c 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
Crypto c ⇒ FromJSON (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto c ⇒ ToJSON (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Generic (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Associated Types

type Rep (ShelleyGenesis c) ∷ TypeType Source #

Crypto c ⇒ Show (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto c ⇒ FromCBOR (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto c ⇒ ToCBOR (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Methods

toCBORShelleyGenesis c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (ShelleyGenesis c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ShelleyGenesis c] → Size Source #

Crypto c ⇒ DecCBOR (ShelleyGenesis c)

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

Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto c ⇒ EncCBOR (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Methods

encCBORShelleyGenesis c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (ShelleyGenesis c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ShelleyGenesis c] → Size Source #

Crypto c ⇒ Eq (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto c ⇒ NoThunks (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep (ShelleyGenesis c) 
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep (ShelleyGenesis c) = D1 ('MetaData "ShelleyGenesis" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.11.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 c))) :*: S1 ('MetaSel ('Just "sgGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'Genesis c) (GenDelegPair c)))) :*: (S1 ('MetaSel ('Just "sgInitialFunds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap (Addr c) Coin)) :*: S1 ('MetaSel ('Just "sgStaking") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ShelleyGenesisStaking c)))))))

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.8.0.0-inplace" 'True) (C1 ('MetaCons "AlonzoGenesisWrapper" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAlonzoGenesisWrapper") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UpgradeAlonzoPParams Identity))))

data ConwayGenesis c Source #

Instances

Instances details
Crypto c ⇒ FromJSON (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Crypto c ⇒ ToJSON (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Generic (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Associated Types

type Rep (ConwayGenesis c) ∷ TypeType Source #

Show (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Crypto c ⇒ DecCBOR (ConwayGenesis c)

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

Instance details

Defined in Cardano.Ledger.Conway.Genesis

Crypto c ⇒ EncCBOR (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Methods

encCBORConwayGenesis c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (ConwayGenesis c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ConwayGenesis c] → Size Source #

Eq (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

Crypto c ⇒ NoThunks (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

type Rep (ConwayGenesis c) 
Instance details

Defined in Cardano.Ledger.Conway.Genesis

type Rep (ConwayGenesis c) = D1 ('MetaData "ConwayGenesis" "Cardano.Ledger.Conway.Genesis" "cardano-ledger-conway-1.14.0.0-inplace" 'False) (C1 ('MetaCons "ConwayGenesis" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cgUpgradePParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (UpgradeConwayPParams Identity)) :*: S1 ('MetaSel ('Just "cgConstitution") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Constitution (ConwayEra c)))) :*: (S1 ('MetaSel ('Just "cgCommittee") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Committee (ConwayEra c))) :*: (S1 ('MetaSel ('Just "cgDelegs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap (Credential 'Staking c) (Delegatee c))) :*: S1 ('MetaSel ('Just "cgInitialDReps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap (Credential 'DRepRole c) (DRepState c)))))))

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 (EraCrypto era)) 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 (EraCrypto era)) 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