Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- class (EraTxOut era, EraGov era, EraGenesis era, ToJSON (TransitionConfig era), FromJSON (TransitionConfig era), Default (StashedAVVMAddresses era)) ⇒ EraTransition era
- data family TransitionConfig era
- mkLatestTransitionConfig ∷ ShelleyGenesis → AlonzoGenesis → ConwayGenesis → TransitionConfig LatestKnownEra
- mkTransitionConfig ∷ EraTransition era ⇒ TranslationContext era → TransitionConfig (PreviousEra era) → TransitionConfig era
- mkShelleyTransitionConfig ∷ ShelleyGenesis → TransitionConfig ShelleyEra
- tcShelleyGenesisL ∷ EraTransition era ⇒ Lens' (TransitionConfig era) ShelleyGenesis
- tcPreviousEraConfigL ∷ EraTransition era ⇒ Lens' (TransitionConfig era) (TransitionConfig (PreviousEra era))
- tcTranslationContextL ∷ EraTransition era ⇒ Lens' (TransitionConfig era) (TranslationContext era)
- class Era era ⇒ EraGenesis era where
- type Genesis era
- data ShelleyGenesis = ShelleyGenesis {
- sgSystemStart ∷ !UTCTime
- sgNetworkMagic ∷ !Word32
- sgNetworkId ∷ !Network
- sgActiveSlotsCoeff ∷ !PositiveUnitInterval
- sgSecurityParam ∷ !Word64
- sgEpochLength ∷ !EpochSize
- sgSlotsPerKESPeriod ∷ !Word64
- sgMaxKESEvolutions ∷ !Word64
- sgSlotLength ∷ !NominalDiffTimeMicro
- sgUpdateQuorum ∷ !Word64
- sgMaxLovelaceSupply ∷ !Word64
- sgProtocolParams ∷ !(PParams ShelleyEra)
- sgGenDelegs ∷ !(Map (KeyHash 'Genesis) GenDelegPair)
- sgInitialFunds ∷ ListMap Addr Coin
- sgStaking ∷ ShelleyGenesisStaking
- newtype AlonzoGenesis where
- AlonzoGenesisWrapper { }
- pattern AlonzoGenesis ∷ CoinPerWord → CostModels → Prices → ExUnits → ExUnits → Natural → Natural → Natural → AlonzoGenesis
- data ConwayGenesis = ConwayGenesis {}
- data NoGenesis era = NoGenesis
- tcInitialPParamsG ∷ EraTransition era ⇒ SimpleGetter (TransitionConfig era) (PParams era)
- tcInitialFundsL ∷ (HasCallStack, EraTransition era) ⇒ Lens' (TransitionConfig era) (ListMap Addr Coin)
- tcInitialStakingL ∷ (HasCallStack, EraTransition era) ⇒ Lens' (TransitionConfig era) ShelleyGenesisStaking
- createInitialState ∷ (EraTransition era, HasCallStack) ⇒ TransitionConfig era → NewEpochState era
- injectIntoTestState ∷ EraTransition era ⇒ TransitionConfig era → NewEpochState era → NewEpochState era
Documentation
class (EraTxOut era, EraGov era, EraGenesis era, ToJSON (TransitionConfig era), FromJSON (TransitionConfig era), Default (StashedAVVMAddresses era)) ⇒ EraTransition era Source #
Instances
data family TransitionConfig era Source #
Cumulative configuration that is needed to be able to start in a current era
Instances
mkLatestTransitionConfig ∷ ShelleyGenesis → AlonzoGenesis → ConwayGenesis → TransitionConfig LatestKnownEra Source #
∷ 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 |
mkShelleyTransitionConfig ∷ ShelleyGenesis → TransitionConfig ShelleyEra Source #
Constructor for the base Shelley TransitionConfig
tcShelleyGenesisL ∷ EraTransition era ⇒ Lens' (TransitionConfig era) ShelleyGenesis Source #
Lens for the ShelleyGenesis
from the TransitionConfig
. Default implementation
looks in the previous era's config
tcPreviousEraConfigL ∷ EraTransition 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
tcTranslationContextL ∷ EraTransition 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 #
Instances
EraGenesis AllegraEra | |
Defined in Cardano.Ledger.Allegra.Era type Genesis AllegraEra Source # | |
EraGenesis BabbageEra | |
Defined in Cardano.Ledger.Babbage.Era type Genesis BabbageEra Source # | |
EraGenesis MaryEra | |
Defined in Cardano.Ledger.Mary.Era |
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.
ShelleyGenesis | |
|
Instances
newtype AlonzoGenesis Source #
All configuration that is necessary to bootstrap AlonzoEra from ShelleyGenesis
pattern AlonzoGenesis ∷ CoinPerWord → CostModels → Prices → ExUnits → ExUnits → Natural → Natural → Natural → AlonzoGenesis |
Instances
data ConwayGenesis Source #
Instances
Functions for Testing
tcInitialPParamsG ∷ EraTransition 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.
∷ 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 |
→ NewEpochState era | |
→ NewEpochState era |