| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Shelley.Genesis
Contents
Synopsis
- data ShelleyGenesisStaking = ShelleyGenesisStaking {}
- data ShelleyGenesis = ShelleyGenesis {
- sgSystemStart ∷ !UTCTime
- sgNetworkMagic ∷ !Word32
- sgNetworkId ∷ !Network
- sgActiveSlotsCoeff ∷ !PositiveUnitInterval
- sgSecurityParam ∷ !(NonZero Word64)
- sgEpochLength ∷ !EpochSize
- sgSlotsPerKESPeriod ∷ !Word64
- sgMaxKESEvolutions ∷ !Word64
- sgSlotLength ∷ !NominalDiffTimeMicro
- sgUpdateQuorum ∷ !Word64
- sgMaxLovelaceSupply ∷ !Word64
- sgProtocolParams ∷ !(PParams ShelleyEra)
- sgGenDelegs ∷ !(Map (KeyHash 'GenesisRole) GenDelegPair)
- sgInitialFunds ∷ ListMap Addr Coin
- sgStaking ∷ ShelleyGenesisStaking
- data ValidationErr
- newtype NominalDiffTimeMicro = NominalDiffTimeMicro Micro
- emptyGenesisStaking ∷ ShelleyGenesisStaking
- sgActiveSlotCoeff ∷ ShelleyGenesis → ActiveSlotCoeff
- genesisUTxO ∷ EraTxOut era ⇒ ShelleyGenesis → UTxO era
- initialFundsPseudoTxIn ∷ Addr → TxIn
- validateGenesis ∷ ShelleyGenesis → Either [ValidationErr] ()
- describeValidationErr ∷ ValidationErr → Text
- mkShelleyGlobals ∷ ShelleyGenesis → EpochInfo (Either Text) → Globals
- nominalDiffTimeMicroToMicroseconds ∷ NominalDiffTimeMicro → Micro
- nominalDiffTimeMicroToSeconds ∷ NominalDiffTimeMicro → Pico
- toNominalDiffTimeMicro ∷ NominalDiffTime → Maybe NominalDiffTimeMicro
- toNominalDiffTimeMicroWithRounding ∷ NominalDiffTime → NominalDiffTimeMicro
- fromNominalDiffTimeMicro ∷ NominalDiffTimeMicro → NominalDiffTime
- secondsToNominalDiffTimeMicro ∷ Micro → NominalDiffTimeMicro
- sgInitialFundsL ∷ Lens' ShelleyGenesis (ListMap Addr Coin)
- sgStakingL ∷ Lens' ShelleyGenesis ShelleyGenesisStaking
Documentation
data ShelleyGenesisStaking Source #
Genesis Shelley staking configuration.
This allows us to configure some initial stake pools and delegation to them, in order to test Praos in a static configuration, without requiring on-chain registration and delegation.
For simplicity, pools defined in the genesis staking do not pay deposits for their registration.
Constructors
| ShelleyGenesisStaking | |
Fields
| |
Instances
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
| FromJSON ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods parseJSON ∷ Value → Parser ShelleyGenesis Source # | |||||
| ToJSON ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toJSON ∷ ShelleyGenesis → Value Source # toEncoding ∷ ShelleyGenesis → Encoding Source # toJSONList ∷ [ShelleyGenesis] → Value Source # | |||||
| FromCBOR ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| ToCBOR ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toCBOR ∷ ShelleyGenesis → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy ShelleyGenesis → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ShelleyGenesis] → Size Source # | |||||
| DecCBOR ShelleyGenesis Source # | Genesis are always encoded with the version of era they are defined in. | ||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| EncCBOR ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| ToKeyValuePairs ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toKeyValuePairs ∷ KeyValue e kv ⇒ ShelleyGenesis → [kv] Source # | |||||
| NFData ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods rnf ∷ ShelleyGenesis → () # | |||||
| Generic ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Associated Types
| |||||
| Show ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → ShelleyGenesis → ShowS # show ∷ ShelleyGenesis → String # showList ∷ [ShelleyGenesis] → ShowS # | |||||
| Eq ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods (==) ∷ ShelleyGenesis → ShelleyGenesis → Bool # (/=) ∷ ShelleyGenesis → ShelleyGenesis → Bool # | |||||
| NoThunks ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| type Rep ShelleyGenesis Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis type Rep ShelleyGenesis = D1 ('MetaData "ShelleyGenesis" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "ShelleyGenesis" 'PrefixI 'True) (((S1 ('MetaSel ('Just "sgSystemStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UTCTime) :*: (S1 ('MetaSel ('Just "sgNetworkMagic") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (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 'DecidedStrict) (Rec0 (NonZero Word64))) :*: (S1 ('MetaSel ('Just "sgEpochLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EpochSize) :*: S1 ('MetaSel ('Just "sgSlotsPerKESPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :*: (((S1 ('MetaSel ('Just "sgMaxKESEvolutions") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sgSlotLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NominalDiffTimeMicro)) :*: (S1 ('MetaSel ('Just "sgUpdateQuorum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "sgMaxLovelaceSupply") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :*: ((S1 ('MetaSel ('Just "sgProtocolParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PParams ShelleyEra)) :*: S1 ('MetaSel ('Just "sgGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'GenesisRole) GenDelegPair))) :*: (S1 ('MetaSel ('Just "sgInitialFunds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap Addr Coin)) :*: S1 ('MetaSel ('Just "sgStaking") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShelleyGenesisStaking)))))) | |||||
data ValidationErr Source #
Constructors
| EpochNotLongEnough EpochSize Word64 Rational EpochSize | |
| MaxKESEvolutionsUnsupported Word64 Word | |
| QuorumTooSmall Word64 Word64 Word64 |
Instances
| Show ValidationErr Source # | |
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → ValidationErr → ShowS # show ∷ ValidationErr → String # showList ∷ [ValidationErr] → ShowS # | |
| Eq ValidationErr Source # | |
Defined in Cardano.Ledger.Shelley.Genesis | |
newtype NominalDiffTimeMicro Source #
Unlike that supports NominalDiffTime precision, this type
only supports Pico precision.Micro
Constructors
| NominalDiffTimeMicro Micro |
Instances
| FromJSON NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| ToJSON NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| DecCBOR NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| EncCBOR NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| NFData NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods rnf ∷ NominalDiffTimeMicro → () # | |||||
| Generic NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Associated Types
Methods | |||||
| Num NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods (+) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → NominalDiffTimeMicro # (-) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → NominalDiffTimeMicro # (*) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → NominalDiffTimeMicro # negate ∷ NominalDiffTimeMicro → NominalDiffTimeMicro # abs ∷ NominalDiffTimeMicro → NominalDiffTimeMicro # | |||||
| Fractional NominalDiffTimeMicro Source # | |||||
| Real NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| Show NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → NominalDiffTimeMicro → ShowS # show ∷ NominalDiffTimeMicro → String # showList ∷ [NominalDiffTimeMicro] → ShowS # | |||||
| Eq NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| Ord NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods compare ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → Ordering # (<) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → Bool # (<=) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → Bool # (>) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → Bool # (>=) ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → Bool # max ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → NominalDiffTimeMicro # min ∷ NominalDiffTimeMicro → NominalDiffTimeMicro → NominalDiffTimeMicro # | |||||
| NoThunks NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| type Rep NominalDiffTimeMicro Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis type Rep NominalDiffTimeMicro = D1 ('MetaData "NominalDiffTimeMicro" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.18.0.0-inplace" 'True) (C1 ('MetaCons "NominalDiffTimeMicro" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Micro))) | |||||
emptyGenesisStaking ∷ ShelleyGenesisStaking Source #
Empty genesis staking
genesisUTxO ∷ EraTxOut era ⇒ ShelleyGenesis → UTxO era Source #
initialFundsPseudoTxIn ∷ Addr → TxIn Source #
Compute the TxIn of the initial UTxO pseudo-transaction corresponding
to the given address in the genesis initial funds.
The Shelley initial UTxO is constructed from the sgInitialFunds which
is not a full UTxO but just a map from addresses to coin values.
This gets turned into a UTxO by making a pseudo-transaction for each address,
with the 0th output being the coin value. So to spend from the initial UTxO
we need this same TxIn to use as an input to the spending transaction.
validateGenesis ∷ ShelleyGenesis → Either [ValidationErr] () Source #
Do some basic sanity checking on the Shelley genesis file.
Orphan instances
| EraGenesis ShelleyEra Source # | |||||
Associated Types
| |||||