| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Shelley.Genesis
Synopsis
- data ShelleyGenesisStaking = ShelleyGenesisStaking {}
- data ShelleyExtraConfig = ShelleyExtraConfig {}
- 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
- sgExtraConfig ∷ !(StrictMaybe ShelleyExtraConfig)
- 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
- sgExtraConfigL ∷ Lens' ShelleyGenesis (StrictMaybe ShelleyExtraConfig)
- data InjectionData k v
- = NoInjection
- | InjectionFromFile !FsPath !(Hash Blake2b_256 ByteString)
- | EmbeddedInjection !(ListMap k v)
- foldInjectionData ∷ ∀ k v m h acc. (MonadST m, MonadThrow m, FromJSON v, FromJSONKey k) ⇒ HasFS m h → InjectionData k v → (acc → (k, v) → acc) → acc → m acc
- data InjectionError
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 ShelleyExtraConfig Source #
Extra configuration for injecting Genesis data
Constructors
| ShelleyExtraConfig | |
Fields
| |
Instances
| FromJSON ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| ToJSON ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toJSON ∷ ShelleyExtraConfig → Value Source # toEncoding ∷ ShelleyExtraConfig → Encoding Source # toJSONList ∷ [ShelleyExtraConfig] → Value Source # | |||||
| DecCBOR ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| EncCBOR ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| ToKeyValuePairs ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toKeyValuePairs ∷ KeyValue e kv ⇒ ShelleyExtraConfig → [kv] Source # | |||||
| Default ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| NFData ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods rnf ∷ ShelleyExtraConfig → () # | |||||
| Generic ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Associated Types
Methods | |||||
| Show ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → ShelleyExtraConfig → ShowS # show ∷ ShelleyExtraConfig → String # showList ∷ [ShelleyExtraConfig] → ShowS # | |||||
| Eq ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods | |||||
| NoThunks ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| type Rep ShelleyExtraConfig Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis type Rep ShelleyExtraConfig = D1 ('MetaData "ShelleyExtraConfig" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.19.0.0-inplace" 'False) (C1 ('MetaCons "ShelleyExtraConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "secInitialFunds") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (InjectionData Addr Coin)) :*: (S1 ('MetaSel ('Just "secStakePools") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (InjectionData (KeyHash 'StakePool) StakePoolParams)) :*: S1 ('MetaSel ('Just "secStakeCredentials") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (InjectionData (KeyHash 'Staking) (KeyHash 'StakePool)))))) | |||||
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.19.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) :*: S1 ('MetaSel ('Just "sgExtraConfig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe ShelleyExtraConfig))))))) | |||||
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.19.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.
Streaming injection
data InjectionData k v Source #
Source for injectable data
Constructors
| NoInjection | No injection data |
| InjectionFromFile !FsPath !(Hash Blake2b_256 ByteString) | Load data from a JSON file with hash verification |
| EmbeddedInjection !(ListMap k v) | Embedded data from memory |
Instances
| (FromJSON k, FromJSON v, FromJSONKey k, Ord k) ⇒ FromJSON (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods parseJSON ∷ Value → Parser (InjectionData k v) Source # parseJSONList ∷ Value → Parser [InjectionData k v] Source # omittedField ∷ Maybe (InjectionData k v) Source # | |||||
| (ToJSON k, ToJSON v, ToJSONKey k) ⇒ ToJSON (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods toJSON ∷ InjectionData k v → Value Source # toEncoding ∷ InjectionData k v → Encoding Source # toJSONList ∷ [InjectionData k v] → Value Source # toEncodingList ∷ [InjectionData k v] → Encoding Source # omitField ∷ InjectionData k v → Bool Source # | |||||
| (DecCBOR k, DecCBOR v) ⇒ DecCBOR (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| (EncCBOR k, EncCBOR v) ⇒ EncCBOR (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods encCBOR ∷ InjectionData k v → Encoding Source # | |||||
| Default (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods def ∷ InjectionData k v Source # | |||||
| (NFData k, NFData v) ⇒ NFData (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods rnf ∷ InjectionData k v → () # | |||||
| Generic (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Associated Types
Methods from ∷ InjectionData k v → Rep (InjectionData k v) x # to ∷ Rep (InjectionData k v) x → InjectionData k v # | |||||
| (Show k, Show v) ⇒ Show (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → InjectionData k v → ShowS # show ∷ InjectionData k v → String # showList ∷ [InjectionData k v] → ShowS # | |||||
| (Ord k, Ord v) ⇒ Eq (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis Methods (==) ∷ InjectionData k v → InjectionData k v → Bool # (/=) ∷ InjectionData k v → InjectionData k v → Bool # | |||||
| (NoThunks k, NoThunks v) ⇒ NoThunks (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
| type Rep (InjectionData k v) Source # | |||||
Defined in Cardano.Ledger.Shelley.Genesis type Rep (InjectionData k v) = D1 ('MetaData "InjectionData" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.19.0.0-inplace" 'False) (C1 ('MetaCons "NoInjection" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "InjectionFromFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FsPath) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash Blake2b_256 ByteString))) :+: C1 ('MetaCons "EmbeddedInjection" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ListMap k v))))) | |||||
foldInjectionData ∷ ∀ k v m h acc. (MonadST m, MonadThrow m, FromJSON v, FromJSONKey k) ⇒ HasFS m h → InjectionData k v → (acc → (k, v) → acc) → acc → m acc Source #
Fold over a source of injected data: for EmbeddedInjection the data is folded in memory, while for InjectionFromFile the data is streamed, hashed, and parsed incrementally, with content hash verification at the end.
data InjectionError Source #
Errors that can occur during injection source resolution
Constructors
| InjectionHashMismatch !FsPath !Text !Text | |
| InjectionParseError !FsPath !String | |
| InjectionNotAllowedOnMainnet | |
| InjectionConflictingSources !String |
Instances
| Exception InjectionError Source # | |
Defined in Cardano.Ledger.Shelley.Genesis | |
| Show InjectionError Source # | |
Defined in Cardano.Ledger.Shelley.Genesis Methods showsPrec ∷ Int → InjectionError → ShowS # show ∷ InjectionError → String # showList ∷ [InjectionError] → ShowS # | |
| Eq InjectionError Source # | |
Defined in Cardano.Ledger.Shelley.Genesis Methods (==) ∷ InjectionError → InjectionError → Bool # (/=) ∷ InjectionError → InjectionError → Bool # | |
Orphan instances
| EraGenesis ShelleyEra Source # | |||||
Associated Types
| |||||