cardano-ledger-core-1.17.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Core

Description

This module defines core type families which we know to vary from era to era.

Families in this module should be indexed on era.

It is intended for qualified import: > import qualified Cardano.Ledger.Core as Core

Synopsis

Era-changing types

class (EraTxBody era, EraTxWits era, EraTxAuxData era, EraPParams era, NoThunks (Tx era), DecCBOR (Annotator (Tx era)), EncCBOR (Tx era), ToCBOR (Tx era), Show (Tx era), Eq (Tx era), EqRaw (Tx era)) ⇒ EraTx era where Source #

A transaction.

Associated Types

type Tx era = (r ∷ Type) | r → era Source #

type TxUpgradeError era ∷ Type Source #

type TxUpgradeError era = Void

Methods

mkBasicTxTxBody era → Tx era Source #

bodyTxLLens' (Tx era) (TxBody era) Source #

witsTxLLens' (Tx era) (TxWits era) Source #

auxDataTxLLens' (Tx era) (StrictMaybe (TxAuxData era)) Source #

sizeTxFSimpleGetter (Tx era) Integer Source #

For fee calculation and estimations of impact on block space

wireSizeTxFSimpleGetter (Tx era) Word32 Source #

For end use by eg. diffusion layer in transaction submission protocol

validateNativeScriptTx era → NativeScript era → Bool Source #

Using information from the transaction validate the supplied native script.

getMinFeeTx Source #

Arguments

PParams era 
Tx era 
Int

Size in bytes of reference scripts present in this transaction

Coin 

Minimum fee calculation excluding witnesses

upgradeTxEraTx (PreviousEra era) ⇒ Tx (PreviousEra era) → Either (TxUpgradeError era) (Tx era) Source #

txIdTxEraTx era ⇒ Tx era → TxId Source #

class (Val (Value era), ToJSON (TxOut era), DecCBOR (Value era), DecCBOR (CompactForm (Value era)), EncCBOR (Value era), ToCBOR (TxOut era), EncCBOR (TxOut era), DecCBOR (TxOut era), DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking), NoThunks (TxOut era), NFData (TxOut era), Show (TxOut era), Eq (TxOut era), EraPParams era) ⇒ EraTxOut era where Source #

Abstract interface into specific fields of a TxOut

Associated Types

type TxOut era = (r ∷ Type) | r → era Source #

The output of a UTxO for a particular era

Methods

mkBasicTxOutHasCallStackAddrValue era → TxOut era Source #

upgradeTxOutEraTxOut (PreviousEra era) ⇒ TxOut (PreviousEra era) → TxOut era Source #

Every era, except Shelley, must be able to upgrade a TxOut from a previous era.

valueTxOutLLens' (TxOut era) (Value era) Source #

compactValueTxOutLHasCallStackLens' (TxOut era) (CompactForm (Value era)) Source #

valueEitherTxOutLLens' (TxOut era) (Either (Value era) (CompactForm (Value era))) Source #

Lens for getting and setting in TxOut either an address or its compact version by doing the least amount of work.

addrTxOutLLens' (TxOut era) Addr Source #

compactAddrTxOutLLens' (TxOut era) CompactAddr Source #

addrEitherTxOutLLens' (TxOut era) (Either Addr CompactAddr) Source #

Lens for getting and setting in TxOut either an address or its compact version by doing the least amount of work.

The utility of this function comes from the fact that TxOut usually stores the address in either one of two forms: compacted or unpacked. In order to avoid extroneous conversions in getTxOutAddr and getTxOutCompactAddr we can define just this functionality. Also sometimes it is crucial to know at the callsite which form of address we have readily available without any conversions (eg. searching millions of TxOuts for a particular address)

getMinCoinSizedTxOutPParams era → Sized (TxOut era) → Coin Source #

Produce the minimum lovelace that a given transaction output must contain. Information about the size of the TxOut is required in some eras. Use getMinCoinTxOut if you don't have the size readily available to you.

getMinCoinTxOutPParams era → TxOut era → Coin Source #

Same as getMinCoinSizedTxOut, except information about the size of TxOut will be computed by serializing the TxOut. If the size turns out to be not needed, then serialization will have no overhead, since it is computed lazily.

isAdaOnlyTxOutFEraTxOut era ⇒ SimpleGetter (TxOut era) Bool Source #

This is a getter that implements an efficient way to check whether TxOut contains ADA only.

class (EraTxOut era, EraTxCert era, EraPParams era, HashAnnotated (TxBody era) EraIndependentTxBody, DecCBOR (Annotator (TxBody era)), EncCBOR (TxBody era), ToCBOR (TxBody era), NoThunks (TxBody era), NFData (TxBody era), Show (TxBody era), Eq (TxBody era), EqRaw (TxBody era)) ⇒ EraTxBody era where Source #

Associated Types

type TxBody era = (r ∷ Type) | r → era Source #

The body of a transaction.

type TxBodyUpgradeError era ∷ Type Source #

Methods

mkBasicTxBodyTxBody era Source #

inputsTxBodyLLens' (TxBody era) (Set TxIn) Source #

outputsTxBodyLLens' (TxBody era) (StrictSeq (TxOut era)) Source #

feeTxBodyLLens' (TxBody era) Coin Source #

withdrawalsTxBodyLLens' (TxBody era) Withdrawals Source #

auxDataHashTxBodyLLens' (TxBody era) (StrictMaybe TxAuxDataHash) Source #

spendableInputsTxBodyFSimpleGetter (TxBody era) (Set TxIn) Source #

This getter will produce all inputs from the UTxO map that this transaction might spend, which ones will depend on the validity of the transaction itself. Starting in Alonzo this will include collateral inputs.

allInputsTxBodyFSimpleGetter (TxBody era) (Set TxIn) Source #

This getter will produce all inputs from the UTxO map that this transaction is referencing, even if some of them cannot be spent by the transaction. For example starting with Babbage era it will also include reference inputs.

certsTxBodyLLens' (TxBody era) (StrictSeq (TxCert era)) Source #

getTotalDepositsTxBody Source #

Arguments

PParams era 
→ (KeyHash 'StakePoolBool)

Check whether stake pool is registered or not

TxBody era 
Coin 

Compute the total deposits from the certificates in a TxBody.

This is the contribution of a TxBody towards the consumed amount by the transaction

getTotalRefundsTxBody Source #

Arguments

PParams era 
→ (Credential 'StakingMaybe Coin)

Lookup current deposit for Staking credential if one is registered

→ (Credential 'DRepRoleMaybe Coin)

Lookup current deposit for DRep credential if one is registered

TxBody era 
Coin 

Compute the total refunds from the Certs of a TxBody.

This is the contribution of a TxBody towards produced amount by the transaction

getGenesisKeyHashCountTxBodyTxBody era → Int Source #

This function is not used in the ledger rules. It is only used by the downstream tooling to figure out how many witnesses should be supplied for Genesis keys.

upgradeTxBodyEraTxBody (PreviousEra era) ⇒ TxBody (PreviousEra era) → Either (TxBodyUpgradeError era) (TxBody era) Source #

Upgrade the transaction body from the previous era.

This can fail where elements of the transaction body are deprecated. Compare this to translateEraThroughCBOR: - upgradeTxBody will use the Haskell representation, but will not preserve the serialised form. However, it will be suitable for iterated translation through eras. - translateEraThroughCBOR will preserve the binary representation, but is not guaranteed to work through multiple eras - that is, the serialised representation from era n is guaranteed valid in era n + 1, but not necessarily in era n + 2.

txIdTxBodyEraTxBody era ⇒ TxBody era → TxId Source #

class (Era era, Eq (TxAuxData era), EqRaw (TxAuxData era), Show (TxAuxData era), NoThunks (TxAuxData era), ToCBOR (TxAuxData era), EncCBOR (TxAuxData era), DecCBOR (Annotator (TxAuxData era)), HashAnnotated (TxAuxData era) EraIndependentTxAuxData) ⇒ EraTxAuxData era where Source #

TxAuxData which may be attached to a transaction

Associated Types

type TxAuxData era = (r ∷ Type) | r → era Source #

Methods

mkBasicTxAuxDataTxAuxData era Source #

metadataTxAuxDataLLens' (TxAuxData era) (Map Word64 Metadatum) Source #

upgradeTxAuxDataEraTxAuxData (PreviousEra era) ⇒ TxAuxData (PreviousEra era) → TxAuxData era Source #

Every era, except Shelley, must be able to upgrade a TxAuxData from a previous era.

Warning - Important to note that any memoized binary representation will not be preserved. If you need to retain underlying bytes you can use translateEraThroughCBOR

validateTxAuxDataProtVerTxAuxData era → Bool Source #

hashTxAuxDataEraTxAuxData era ⇒ TxAuxData era → TxAuxDataHash Source #

Compute a hash of TxAuxData

class (EraScript era, Eq (TxWits era), EqRaw (TxWits era), Show (TxWits era), Monoid (TxWits era), NoThunks (TxWits era), ToCBOR (TxWits era), EncCBOR (TxWits era), DecCBOR (Annotator (TxWits era))) ⇒ EraTxWits era where Source #

A collection of witnesses in a Tx

Associated Types

type TxWits era = (r ∷ Type) | r → era Source #

class (Era era, Show (Script era), Eq (Script era), EqRaw (Script era), ToCBOR (Script era), EncCBOR (Script era), DecCBOR (Annotator (Script era)), NoThunks (Script era), SafeToHash (Script era), Eq (NativeScript era), Show (NativeScript era), NFData (NativeScript era), NoThunks (NativeScript era), EncCBOR (NativeScript era), DecCBOR (Annotator (NativeScript era))) ⇒ EraScript era where Source #

Typeclass for script data types. Allows for script validation and hashing. You must understand the role of SafeToHash and scriptPrefixTag to make new instances. scriptPrefixTag is a magic number representing the tag of the script language. For each new script language defined, a new tag is chosen and the tag is included in the script hash for a script. The safeToHash constraint ensures that Scripts are never reserialised.

Associated Types

type Script era = (r ∷ Type) | r → era Source #

Scripts which may lock transaction outputs in this era

type NativeScript era = (r ∷ Type) | r → era Source #

Methods

upgradeScriptEraScript (PreviousEra era) ⇒ Script (PreviousEra era) → Script era Source #

Every era, except Shelley, must be able to upgrade a Script from a previous era.

Warning - Important to note that any memoized binary representation will not be preserved, you need to retain underlying bytes you can use translateEraThroughCBOR

scriptPrefixTagScript era → ByteString Source #

getNativeScriptScript era → Maybe (NativeScript era) Source #

fromNativeScriptNativeScript era → Script era Source #

hashScript ∷ ∀ era. EraScript era ⇒ Script era → ScriptHash Source #

Compute ScriptHash of a Script for a particular era.

hashScriptTxWitsLEraTxWits era ⇒ Lens (TxWits era) (TxWits era) (Map ScriptHash (Script era)) [Script era] Source #

This is a helper lens that will hash the scripts when adding as witnesses.

type family Value era ∷ Type Source #

A value is something which quantifies a transaction output.

class (Era era, Eq (PParamsHKD Identity era), Ord (PParamsHKD Identity era), Show (PParamsHKD Identity era), NFData (PParamsHKD Identity era), EncCBOR (PParamsHKD Identity era), DecCBOR (PParamsHKD Identity era), ToCBOR (PParamsHKD Identity era), FromCBOR (PParamsHKD Identity era), NoThunks (PParamsHKD Identity era), ToJSON (PParamsHKD Identity era), FromJSON (PParamsHKD Identity era), Eq (PParamsHKD StrictMaybe era), Ord (PParamsHKD StrictMaybe era), Show (PParamsHKD StrictMaybe era), NFData (PParamsHKD StrictMaybe era), EncCBOR (PParamsHKD StrictMaybe era), DecCBOR (PParamsHKD StrictMaybe era), ToCBOR (PParamsHKD StrictMaybe era), FromCBOR (PParamsHKD StrictMaybe era), NoThunks (PParamsHKD StrictMaybe era), ToJSON (PParamsHKD StrictMaybe era)) ⇒ EraPParams era where Source #

Associated Types

type PParamsHKD (f ∷ TypeType) era = (r ∷ Type) | r → era Source #

Protocol parameters where the fields are represented with a HKD

type UpgradePParams (f ∷ TypeType) era ∷ Type Source #

 

type DowngradePParams (f ∷ TypeType) era ∷ Type Source #

Methods

applyPPUpdatesPParams era → PParamsUpdate era → PParams era Source #

Applies a protocol parameters update

default applyPPUpdates ∷ ∀ a u. (Generic (PParamsHKD Identity era), Generic (PParamsHKD StrictMaybe era), Updatable (Rep (PParamsHKD Identity era) a) (Rep (PParamsHKD StrictMaybe era) u)) ⇒ PParams era → PParamsUpdate era → PParams era Source #

emptyPParamsIdentityPParamsHKD Identity era Source #

emptyPParamsStrictMaybePParamsHKD StrictMaybe era Source #

upgradePParamsHKD ∷ (HKDApplicative f, EraPParams (PreviousEra era)) ⇒ UpgradePParams f era → PParamsHKD f (PreviousEra era) → PParamsHKD f era Source #

Upgrade PParams from previous era to the current one

downgradePParamsHKD ∷ (HKDFunctor f, EraPParams (PreviousEra era)) ⇒ DowngradePParams f era → PParamsHKD f era → PParamsHKD f (PreviousEra era) Source #

Downgrade PParams from the current era to the previous one

hkdMinFeeALHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The linear factor for the minimum fee calculation

hkdMinFeeBLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The constant factor for the minimum fee calculation

hkdMaxBBSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word32) Source #

Maximal block body size

hkdMaxTxSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word32) Source #

Maximal transaction size

hkdMaxBHSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word16) Source #

Maximal block header size

hkdKeyDepositLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The amount of a key registration deposit

hkdPoolDepositLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The amount of a pool registration deposit

hkdEMaxLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f EpochInterval) Source #

epoch bound on pool retirement

hkdNOptLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word16) Source #

Desired number of pools

hkdA0LHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f NonNegativeInterval) Source #

Pool influence

hkdRhoLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Monetary expansion

hkdTauLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Treasury expansion

hkdDL ∷ (HKDFunctor f, ProtVerAtMost era 6) ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Decentralization parameter

ppDGSimpleGetter (PParams era) UnitInterval Source #

Decentralization parameter getter

hkdExtraEntropyL ∷ (HKDFunctor f, ProtVerAtMost era 6) ⇒ Lens' (PParamsHKD f era) (HKD f Nonce) Source #

Extra entropy

hkdProtocolVersionL ∷ (HKDFunctor f, ProtVerAtMost era 8) ⇒ Lens' (PParamsHKD f era) (HKD f ProtVer) Source #

Protocol version

ppProtocolVersionLLens' (PParams era) ProtVer Source #

ppuProtocolVersionLProtVerAtMost era 8 ⇒ Lens' (PParamsUpdate era) (StrictMaybe ProtVer) Source #

PParamsUpdate Protocol version

hkdMinUTxOValueLHKDFunctor f ⇒ ProtVerAtMost era 4 ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

Minimum UTxO value

hkdMinPoolCostLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

Minimum Stake Pool Cost

mkCoinTxOutEraTxOut era ⇒ AddrCoinTxOut era Source #

Era

Era

class (Typeable era, KnownNat (ProtVerLow era), KnownNat (ProtVerHigh era), ProtVerLow era <= ProtVerHigh era, MinVersion <= ProtVerLow era, MinVersion <= ProtVerHigh era, CmpNat (ProtVerLow era) MaxVersion ~ 'LT, CmpNat (ProtVerHigh era) MaxVersion ~ 'LT, ProtVerLow era <= MaxVersion, ProtVerHigh era <= MaxVersion) ⇒ Era era where Source #

Associated Types

type PreviousEra era = (r ∷ Type) | r → era Source #

Map an era to its predecessor.

For example:

type instance PreviousEra (AllegraEra c) = ShelleyEra c

type ProtVerLow era ∷ Nat Source #

Lowest major protocol version for this era

type ProtVerHigh era ∷ Nat Source #

Highest major protocol version for this era. By default se to ProtVerLow

type ProtVerHigh era = ProtVerLow era

Methods

eraNameString Source #

Textual name of the current era.

Designed to be used with TypeApplications:

>>> eraName @ByronEra
Byron

Instances

Instances details
Era ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Associated Types

type PreviousEra ByronEra = (r ∷ Type) Source #

type ProtVerLow ByronEraNat Source #

type ProtVerHigh ByronEraNat Source #

Methods

eraNameString Source #

data ByronEra Source #

This is the era that preceded Shelley era. It cannot have any other class instances, except for Era type class.

Instances

Instances details
Era ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Associated Types

type PreviousEra ByronEra = (r ∷ Type) Source #

type ProtVerLow ByronEraNat Source #

type ProtVerHigh ByronEraNat Source #

Methods

eraNameString Source #

type PreviousEra ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type ProtVerHigh ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type ProtVerLow ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Rules

type family EraRule (rule ∷ Symbol) era = (r ∷ Type) | r → rule Source #

Era STS map

type family EraRuleFailure (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #

EraRuleFailure type family is needed for injectivity, which STS' PredicateFailure does not provide for us unfortunately.

Instances

Instances details
type EraRuleFailure "EPOCH" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "EPOCH" era = VoidEraRule "EPOCH" era
type EraRuleFailure "MIR" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "MIR" era = VoidEraRule "MIR" era
type EraRuleFailure "NEWEPOCH" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "NEWEPOCH" era = VoidEraRule "NEWEPOCH" era
type EraRuleFailure "NEWPP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "NEWPP" era = VoidEraRule "NEWPP" era
type EraRuleFailure "POOLREAP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "POOLREAP" era = VoidEraRule "POOLREAP" era
type EraRuleFailure "RUPD" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "RUPD" era = VoidEraRule "RUPD" era
type EraRuleFailure "SNAP" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "SNAP" era = VoidEraRule "SNAP" era
type EraRuleFailure "TICK" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "TICK" era = VoidEraRule "TICK" era
type EraRuleFailure "TICKF" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "TICKF" era = VoidEraRule "TICKF" era
type EraRuleFailure "UPEC" era Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type EraRuleFailure "UPEC" era = VoidEraRule "UPEC" era

type family EraRuleEvent (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #

data VoidEraRule (rule ∷ Symbol) era Source #

This is a type with no inhabitans for the rules. It is used to indicate that a rule does not have a predicate failure as well as marking rules that have been disabled when comparing to prior eras.

Instances

Instances details
Show (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

showsPrecIntVoidEraRule rule era → ShowS Source #

showVoidEraRule rule era → String Source #

showList ∷ [VoidEraRule rule era] → ShowS Source #

(KnownSymbol rule, Era era) ⇒ FromCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

fromCBORDecoder s (VoidEraRule rule era) Source #

labelProxy (VoidEraRule rule era) → Text Source #

(KnownSymbol rule, Era era) ⇒ ToCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

toCBORVoidEraRule rule era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VoidEraRule rule era) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [VoidEraRule rule era] → Size Source #

(KnownSymbol rule, Era era) ⇒ DecCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

decCBORDecoder s (VoidEraRule rule era) Source #

dropCBORProxy (VoidEraRule rule era) → Decoder s () Source #

labelProxy (VoidEraRule rule era) → Text Source #

(KnownSymbol rule, Era era) ⇒ EncCBOR (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

encCBORVoidEraRule rule era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VoidEraRule rule era) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VoidEraRule rule era] → Size Source #

NFData (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

rnfVoidEraRule rule era → () Source #

Eq (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

(==)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(/=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

Ord (VoidEraRule rule era) Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

Methods

compareVoidEraRule rule era → VoidEraRule rule era → Ordering Source #

(<)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(<=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(>)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

(>=)VoidEraRule rule era → VoidEraRule rule era → Bool Source #

maxVoidEraRule rule era → VoidEraRule rule era → VoidEraRule rule era Source #

minVoidEraRule rule era → VoidEraRule rule era → VoidEraRule rule era Source #

absurdEraRuleVoidEraRule rule era → a Source #

class EraRuleFailure rule era ~ PredicateFailure (EraRule rule era) ⇒ InjectRuleFailure (rule ∷ Symbol) t era where Source #

Minimal complete definition

Nothing

Methods

injectFailure ∷ t era → EraRuleFailure rule era Source #

default injectFailure ∷ t era ~ EraRuleFailure rule era ⇒ t era → EraRuleFailure rule era Source #

class EraRuleEvent rule era ~ Event (EraRule rule era) ⇒ InjectRuleEvent (rule ∷ Symbol) t era where Source #

Minimal complete definition

Nothing

Methods

injectEvent ∷ t era → EraRuleEvent rule era Source #

default injectEvent ∷ t era ~ EraRuleEvent rule era ⇒ t era → EraRuleEvent rule era Source #

Protocol Version

type AtMostEra eraMostEra era = ProtVerAtMost era (ProtVerHigh eraMostEra) Source #

Restrict the era to equal to eraName or come before it.

type AtLeastEra atLeastEra era = ProtVerAtLeast era (ProtVerLow atLeastEra) Source #

Restrict the era to equal to atLeastEra or come after it

type ExactEra inEra era = ProtVerInBounds era (ProtVerLow inEra) (ProtVerHigh inEra) Source #

Restrict an era to the specific era through the protocol version. This is equivalent to (inEra (Crypto era) ~ era)

type family ProtVerAtMost era (h ∷ Nat) ∷ Constraint where ... Source #

Requirement for the era's lowest protocol version to be lower or equal to the supplied value

Equations

ProtVerAtMost era h = ProtVerIsInBounds "at most" era h (ProtVerLow era <=? h) 

type family ProtVerAtLeast era (l ∷ Nat) ∷ Constraint where ... Source #

Requirement for the era's highest protocol version to be higher or equal to the supplied value

Equations

ProtVerAtLeast era l = ProtVerIsInBounds "at least" era l (l <=? ProtVerHigh era) 

type ProtVerInBounds era l h = (ProtVerAtLeast era l, ProtVerAtMost era h) Source #

Restrict a lower and upper bounds of the protocol version for the particular era

atLeastEraAtLeastEra eraName era ⇒ () Source #

Enforce era to be at least the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.

For example these will type check

>>> atLeastEra @BabbageEra @ConwayEra
>>> atLeastEra @BabbageEra @BabbageEra

However this will result in a type error

>>> atLeastEra @BabbageEra @AlonzoEra

atMostEraAtMostEra eraName era ⇒ () Source #

Enforce era to be at most the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.

For example these will type check

>>> atMostEra @BabbageEra @ShelleyEra
>>> atMostEra @AlonzoEra @MaryEra

However this will result in a type error

>>> atMostEra @BabbageEra @ConwayEra

eraProtVerLow ∷ ∀ era. Era era ⇒ Version Source #

Get the value level Version of the lowest major protocol version for the supplied era.

eraProtVerHigh ∷ ∀ era. Era era ⇒ Version Source #

Get the value level Version of the highest major protocol version for the supplied era.

eraProtVersions ∷ ∀ era. Era era ⇒ [Version] Source #

List with all major versions that are used in the particular era.

toEraCBOR ∷ ∀ era t. (Era era, EncCBOR t) ⇒ t → Encoding Source #

Convert a type that implements EncCBOR to plain Encoding using the lowest protocol version for the supplied era.

fromEraCBOR ∷ ∀ era t s. (Era era, DecCBOR t) ⇒ Decoder s t Source #

Convert a type that implements DecCBOR to plain Decoder using the lowest protocol version for the supplied era

This action should not be used for decoders that require access to original bytes, use toPlainDecoder instead.

fromEraShareCBOR ∷ ∀ era t s. (Era era, DecShareCBOR t) ⇒ Decoder s t Source #

Convert a type that implements DecShareCBOR to plain Decoder using the lowest protocol version for the supplied era

This action should not be used for decoders that require access to original bytes, use toPlainDecoder instead.

eraDecoder ∷ ∀ era t s. Era era ⇒ Decoder s t → Decoder s t Source #

Convert a versioned Decoder to plain a Decoder using the lowest protocol version for the supplied era

This action should not be used for decoders that require access to original bytes, use toPlainDecoder instead.

  • Segregated Witness

The idea of segregated witnessing is to alter the encoding of transactions in a block such that the witnesses (the information needed to verify the validity of the transactions) can be stored separately from the body (the information needed to update the ledger state). In this way, a node which only cares about replaying transactions need not even decode the witness information.

In order to do this, we introduce two concepts: - A TxSeq, which represents the decoded structure of a sequence of transactions as represented in the encoded block; that is, with witnessing, metadata and other non-body parts split separately.

class (EraTx era, Eq (TxSeq era), Show (TxSeq era), EncCBORGroup (TxSeq era), DecCBOR (Annotator (TxSeq era))) ⇒ EraSegWits era where Source #

Indicates that an era supports segregated witnessing.

This class embodies an isomorphism between 'TxSeq era' and 'StrictSeq (Tx era)', witnessed by fromTxSeq and toTxSeq.

Associated Types

type TxSeq era = (r ∷ Type) | r → era Source #

Methods

fromTxSeqTxSeq era → StrictSeq (Tx era) Source #

toTxSeqStrictSeq (Tx era) → TxSeq era Source #

hashTxSeqTxSeq era → Hash HASH EraIndependentBlockBody Source #

Get the block body hash from the TxSeq. Note that this is not a regular "hash the stored bytes" function since the block body hash forms a small Merkle tree.

numSegComponentsWord64 Source #

The number of segregated components

bBodySize ∷ ∀ era. EraSegWits era ⇒ ProtVerTxSeq era → Int Source #

Rewards

data RewardType Source #

The staking rewards in Cardano are all either:

  • member rewards - rewards given to a registered stake credential which has delegated to a stake pool, or
  • leader rewards - rewards given to a registered stake pool (in particular, given to the stake credential in the stake pool registration certificate).

See Figure 47, "Functions used in the Reward Splitting", of the formal specification for more details.

Constructors

MemberReward 
LeaderReward 

Instances

Instances details
ToJSON RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Bounded RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Enum RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Generic RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Associated Types

type Rep RewardTypeTypeType Source #

Show RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

DecCBOR RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

EncCBOR RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Methods

encCBORRewardTypeEncoding Source #

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

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

NFData RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Methods

rnfRewardType → () Source #

Eq RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Ord RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

NoThunks RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

type Rep RewardType Source # 
Instance details

Defined in Cardano.Ledger.Rewards

type Rep RewardType = D1 ('MetaData "RewardType" "Cardano.Ledger.Rewards" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "MemberReward" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "LeaderReward" 'PrefixI 'False) (U1TypeType))

data Reward Source #

The Reward type captures:

  • if the reward is a member or leader reward
  • the stake pool ID associated with the reward
  • the number of Lovelace in the reward

Constructors

Reward 

Instances

Instances details
ToJSON Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Generic Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Associated Types

type Rep RewardTypeType Source #

Methods

fromRewardRep Reward x Source #

toRep Reward x → Reward Source #

Show Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

DecCBOR Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

EncCBOR Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Methods

encCBORRewardEncoding Source #

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

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

NFData Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Methods

rnfReward → () Source #

Eq Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

Methods

(==)RewardRewardBool Source #

(/=)RewardRewardBool Source #

Ord Reward Source #

Note that this Ord instance is chosen to align precisely with the Allegra reward aggregation, as given by the function aggregateRewards so that findMax returns the expected value.

Instance details

Defined in Cardano.Ledger.Rewards

NoThunks Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

type Rep Reward Source # 
Instance details

Defined in Cardano.Ledger.Rewards

type Rep Reward = D1 ('MetaData "Reward" "Cardano.Ledger.Rewards" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "Reward" 'PrefixI 'True) (S1 ('MetaSel ('Just "rewardType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RewardType) :*: (S1 ('MetaSel ('Just "rewardPool") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool)) :*: S1 ('MetaSel ('Just "rewardAmount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin))))

Re-exports

class (KnownNat (SizeHash h), Typeable h) ⇒ HashAlgorithm h Source #

Minimal complete definition

hashAlgorithmName, digest

Instances

Instances details
HashAlgorithm Blake2b_224 
Instance details

Defined in Cardano.Crypto.Hash.Blake2b

Associated Types

type SizeHash Blake2b_224Nat Source #

HashAlgorithm Blake2b_256 
Instance details

Defined in Cardano.Crypto.Hash.Blake2b

Associated Types

type SizeHash Blake2b_256Nat Source #

HashAlgorithm Keccak256 
Instance details

Defined in Cardano.Crypto.Hash.Keccak256

Associated Types

type SizeHash Keccak256Nat Source #

HashAlgorithm NeverHash 
Instance details

Defined in Cardano.Crypto.Hash.NeverUsed

Associated Types

type SizeHash NeverHashNat Source #

HashAlgorithm RIPEMD160 
Instance details

Defined in Cardano.Crypto.Hash.RIPEMD160

Associated Types

type SizeHash RIPEMD160Nat Source #

HashAlgorithm SHA256 
Instance details

Defined in Cardano.Crypto.Hash.SHA256

Associated Types

type SizeHash SHA256Nat Source #

HashAlgorithm SHA3_256 
Instance details

Defined in Cardano.Crypto.Hash.SHA3_256

Associated Types

type SizeHash SHA3_256Nat Source #

(KnownNat n, CmpNat n 33 ~ 'LT) ⇒ HashAlgorithm (Blake2bPrefix n) 
Instance details

Defined in Cardano.Crypto.Hash.Short

Associated Types

type SizeHash (Blake2bPrefix n) ∷ Nat Source #

data Hash h a Source #

Instances

Instances details
HashAlgorithm h ⇒ IsString (Q (TExp (Hash h a)))

This instance is meant to be used with TemplateHaskell

>>> import Cardano.Crypto.Hash.Class (Hash)
>>> import Cardano.Crypto.Hash.Short (ShortHash)
>>> :set -XTemplateHaskell
>>> :set -XOverloadedStrings
>>> let hash = $$("0xBADC0FFEE0DDF00D") :: Hash ShortHash ()
>>> print hash
"badc0ffee0ddf00d"
>>> let hash = $$("0123456789abcdef") :: Hash ShortHash ()
>>> print hash
"0123456789abcdef"
>>> let hash = $$("deadbeef") :: Hash ShortHash ()
<interactive>:5:15: error:
    • <Hash blake2b_prefix_8>: Expected in decoded form to be: 8 bytes, but got: 4
    • In the Template Haskell splice $$("deadbeef")
      In the expression: $$("deadbeef") :: Hash ShortHash ()
      In an equation for ‘hash’:
          hash = $$("deadbeef") :: Hash ShortHash ()
>>> let hash = $$("123") :: Hash ShortHash ()
<interactive>:6:15: error:
    • <Hash blake2b_prefix_8>: Malformed hex: invalid bytestring size
    • In the Template Haskell splice $$("123")
      In the expression: $$("123") :: Hash ShortHash ()
      In an equation for ‘hash’: hash = $$("123") :: Hash ShortHash ()
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

fromStringStringQ (TExp (Hash h a)) Source #

HashAlgorithm h ⇒ FromJSON (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

HashAlgorithm h ⇒ FromJSONKey (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

HashAlgorithm h ⇒ ToJSON (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

toJSONHash h a → Value Source #

toEncodingHash h a → Encoding Source #

toJSONList ∷ [Hash h a] → Value Source #

toEncodingList ∷ [Hash h a] → Encoding Source #

omitFieldHash h a → Bool Source #

HashAlgorithm h ⇒ ToJSONKey (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

HashAlgorithm h ⇒ IsString (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

fromStringStringHash h a Source #

Generic (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Associated Types

type Rep (Hash h a) ∷ TypeType Source #

Methods

fromHash h a → Rep (Hash h a) x Source #

toRep (Hash h a) x → Hash h a Source #

HashAlgorithm h ⇒ Read (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Show (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

showsPrecIntHash h a → ShowS Source #

showHash h a → String Source #

showList ∷ [Hash h a] → ShowS Source #

(HashAlgorithm h, Typeable a) ⇒ FromCBOR (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

fromCBORDecoder s (Hash h a) Source #

labelProxy (Hash h a) → Text Source #

(HashAlgorithm h, Typeable a) ⇒ ToCBOR (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

toCBORHash h a → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (Hash h a) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [Hash h a] → Size Source #

SignableRepresentation (Hash a b) Source # 
Instance details

Defined in Cardano.Ledger.Orphans

(HashAlgorithm h, Typeable a) ⇒ DecCBOR (Hash h a) 
Instance details

Defined in Cardano.Ledger.Binary.Decoding.DecCBOR

Methods

decCBORDecoder s (Hash h a) Source #

dropCBORProxy (Hash h a) → Decoder s () Source #

labelProxy (Hash h a) → Text Source #

(HashAlgorithm h, Typeable a) ⇒ EncCBOR (Hash h a) 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORHash h a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Hash h a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Hash h a] → Size Source #

HashAlgorithm h ⇒ SafeToHash (Hash h i) Source #

Hash of a hash. Hash is always safe to hash. Do you even hash?

Instance details

Defined in Cardano.Ledger.Hashes

HashAlgorithm h ⇒ Default (Hash h b) Source # 
Instance details

Defined in Cardano.Ledger.Orphans

Methods

defHash h b Source #

NFData (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

rnfHash h a → () Source #

Eq (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

(==)Hash h a → Hash h a → Bool Source #

(/=)Hash h a → Hash h a → Bool Source #

Ord (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

compareHash h a → Hash h a → Ordering Source #

(<)Hash h a → Hash h a → Bool Source #

(<=)Hash h a → Hash h a → Bool Source #

(>)Hash h a → Hash h a → Bool Source #

(>=)Hash h a → Hash h a → Bool Source #

maxHash h a → Hash h a → Hash h a Source #

minHash h a → Hash h a → Hash h a Source #

HeapWords (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

heapWordsHash h a → Int Source #

HashAlgorithm h ⇒ MemPack (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

typeNameString Source #

packedByteCountHash h a → Int Source #

packMHash h a → Pack s () Source #

unpackMBuffer b ⇒ Unpack b (Hash h a) Source #

NoThunks (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

HashAlgorithm h ⇒ IsString (Code Q (Hash h a)) 
Instance details

Defined in Cardano.Crypto.Hash.Class

Methods

fromStringStringCode Q (Hash h a) Source #

type Rep (Hash h a) 
Instance details

Defined in Cardano.Crypto.Hash.Class

type Rep (Hash h a) = D1 ('MetaData "Hash" "Cardano.Crypto.Hash.Class" "cardano-crypto-class-2.2.0.0-26c5fd30d06a5d79fe778ccc9b3b70cb764a47cb3e1af3de4f34878e2972d13e" 'True) (C1 ('MetaCons "UnsafeHashRep" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PackedBytes (SizeHash h)))))

data KeyRole Source #

The role of a key.

All key roles are fixed and unique, except for the Witness role. In particular, keys can be cast to a Witness role with the help of asWitness, because same witness can be valid for many roles.

In fact, it is perfectly allowable for a key to be used in many roles by the end user; there is nothing prohibiting somebody using the same underlying key or a script as their payment and staking credential, as well as the key for their stake pool. However, in the ledger code mixing up keys with different roles could be catastrophic, that is why we have this separation.

Instances

Instances details
Show KeyRole Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

class SafeToHash x ⇒ HashAnnotated x i | x → i where Source #

Types that are SafeToHash AND have the type uniquely determines the index type tag of SafeHash index

The SafeToHash and the HashAnnotated classes are designed so that their instances can be easily derived (because their methods have default methods when the type is a newtype around a type that is SafeToHash). For example,

Minimal complete definition

Nothing

Methods

hashAnnotated ∷ x → SafeHash i Source #

Create a (SafeHash i), given (HashAnnotated x i) instance.

class SafeToHash t where Source #

Only Types that preserve their serialisation bytes are members of the class SafeToHash. There are only a limited number of primitive direct instances of SafeToHash, all but two of them are present in this file. Instead of making explicit instances, we almost always use a newtype (around a type S) where their is already an instance (SafeToHash S). In that case the newtype has its SafeToHash instance derived using newtype deriving. The prime example of s is MemoBytes. The only exceptions are the legacy Shelley types: Metadata and ShelleyTx, that preserve their serialization bytes using a different mechanism than the use of MemoBytes. SafeToHash is a superclass requirement of the classes HashAnnotated which provide more convenient ways to construct SafeHashes than using makeHashWithExplicitProxys.

Minimal complete definition

originalBytes

Methods

originalBytes ∷ t → ByteString Source #

Extract the original bytes from t

originalBytesSize ∷ t → Int Source #

makeHashWithExplicitProxysProxy i → t → SafeHash i Source #

Instances

Instances details
SafeToHash ByteString Source # 
Instance details

Defined in Cardano.Ledger.Hashes

SafeToHash ShortByteString Source # 
Instance details

Defined in Cardano.Ledger.Hashes

SafeToHash AnchorData Source # 
Instance details

Defined in Cardano.Ledger.BaseTypes

SafeToHash PlutusBinary Source # 
Instance details

Defined in Cardano.Ledger.Plutus.Language

SafeToHash (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

SafeToHash (BinaryData era) Source # 
Instance details

Defined in Cardano.Ledger.Plutus.Data

SafeToHash (Data era) Source # 
Instance details

Defined in Cardano.Ledger.Plutus.Data

SafeToHash (Plutus l) Source # 
Instance details

Defined in Cardano.Ledger.Plutus.Language

HashAlgorithm h ⇒ SafeToHash (Hash h i) Source #

Hash of a hash. Hash is always safe to hash. Do you even hash?

Instance details

Defined in Cardano.Ledger.Hashes

SafeToHash (MemoBytes t era) Source # 
Instance details

Defined in Cardano.Ledger.MemoBytes.Internal

data SafeHash i Source #

A SafeHash is a hash of something that is safe to hash. Such types store their own serialisation bytes. The prime example is (MemoBytes t), but other examples are things that consist of only ByteStrings (i.e. they are their own serialization) or for some other reason store their original bytes.

We do NOT export the constructor SafeHash, but instead export other functions such as hashAnnotated and extractHash which have constraints that limit their application to types which preserve their original serialization bytes.

Instances

Instances details
FromJSON (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSON (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Show (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable i ⇒ FromCBOR (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable i ⇒ ToCBOR (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

toCBORSafeHash i → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (SafeHash i) → Size Source #

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

Typeable i ⇒ DecCBOR (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable i ⇒ EncCBOR (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

encCBORSafeHash i → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (SafeHash i) → Size Source #

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

SafeToHash (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Default (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

defSafeHash i Source #

NFData (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfSafeHash i → () Source #

Eq (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

(==)SafeHash i → SafeHash i → Bool Source #

(/=)SafeHash i → SafeHash i → Bool Source #

Ord (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

compareSafeHash i → SafeHash i → Ordering Source #

(<)SafeHash i → SafeHash i → Bool Source #

(<=)SafeHash i → SafeHash i → Bool Source #

(>)SafeHash i → SafeHash i → Bool Source #

(>=)SafeHash i → SafeHash i → Bool Source #

maxSafeHash i → SafeHash i → SafeHash i Source #

minSafeHash i → SafeHash i → SafeHash i Source #

HeapWords (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

heapWordsSafeHash i → Int Source #

HeapWords (StrictMaybe DataHash) Source # 
Instance details

Defined in Cardano.Ledger.Plutus.Data

NoThunks (SafeHash i) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

newtype TxAuxDataHash Source #

Instances

Instances details
ToJSON TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Generic TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep TxAuxDataHashTypeType Source #

Show TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

DecCBOR TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

EncCBOR TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

NFData TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfTxAuxDataHash → () Source #

Eq TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Ord TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

NoThunks TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep TxAuxDataHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep TxAuxDataHash = D1 ('MetaData "TxAuxDataHash" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.17.0.0-inplace" 'True) (C1 ('MetaCons "TxAuxDataHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "unTxAuxDataHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SafeHash EraIndependentTxAuxData))))

newtype VRFVerKeyHash (r ∷ KeyRoleVRF) Source #

Discriminated hash of VRF Verification Key

Instances

Instances details
FromJSON (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

FromJSONKey (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSON (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSONKey (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Generic (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep (VRFVerKeyHash r) ∷ TypeType Source #

Show (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable r ⇒ FromCBOR (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable r ⇒ ToCBOR (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

toCBORVRFVerKeyHash r → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VRFVerKeyHash r) → Size Source #

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

Typeable r ⇒ DecCBOR (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Typeable r ⇒ EncCBOR (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

encCBORVRFVerKeyHash r → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VRFVerKeyHash r) → Size Source #

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

Default (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

defVRFVerKeyHash r Source #

NFData (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfVRFVerKeyHash r → () Source #

Eq (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Ord (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

NoThunks (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep (VRFVerKeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

newtype ScriptHash Source #

Instances

Instances details
FromJSON ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

FromJSONKey ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSON ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSONKey ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Generic ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep ScriptHashTypeType Source #

Show ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

FromCBOR ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToCBOR ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

toCBORScriptHashEncoding Source #

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

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

DecCBOR ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

EncCBOR ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

encCBORScriptHashEncoding Source #

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

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

NFData ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfScriptHash → () Source #

Eq ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Ord ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

NoThunks ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep ScriptHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep ScriptHash = D1 ('MetaData "ScriptHash" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.17.0.0-inplace" 'True) (C1 ('MetaCons "ScriptHash" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash ADDRHASH EraIndependentScript))))

newtype KeyHash (r ∷ KeyRole) Source #

Discriminated hash of public Key

Constructors

KeyHash 

Instances

Instances details
HasKeyRole KeyHash Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) (r' ∷ KeyRole). KeyHash r → KeyHash r' Source #

FromJSON (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

FromJSONKey (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSON (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

ToJSONKey (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Generic (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep (KeyHash r) ∷ TypeType Source #

Methods

fromKeyHash r → Rep (KeyHash r) x Source #

toRep (KeyHash r) x → KeyHash r Source #

Show (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

showsPrecIntKeyHash r → ShowS Source #

showKeyHash r → String Source #

showList ∷ [KeyHash r] → ShowS Source #

Typeable r ⇒ FromCBOR (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

fromCBORDecoder s (KeyHash r) Source #

labelProxy (KeyHash r) → Text Source #

Typeable r ⇒ ToCBOR (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

toCBORKeyHash r → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (KeyHash r) → Size Source #

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

Typeable r ⇒ DecCBOR (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

decCBORDecoder s (KeyHash r) Source #

dropCBORProxy (KeyHash r) → Decoder s () Source #

labelProxy (KeyHash r) → Text Source #

Typeable r ⇒ EncCBOR (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

encCBORKeyHash r → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (KeyHash r) → Size Source #

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

Default (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

defKeyHash r Source #

NFData (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfKeyHash r → () Source #

Eq (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

(==)KeyHash r → KeyHash r → Bool Source #

(/=)KeyHash r → KeyHash r → Bool Source #

Ord (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

compareKeyHash r → KeyHash r → Ordering Source #

(<)KeyHash r → KeyHash r → Bool Source #

(<=)KeyHash r → KeyHash r → Bool Source #

(>)KeyHash r → KeyHash r → Bool Source #

(>=)KeyHash r → KeyHash r → Bool Source #

maxKeyHash r → KeyHash r → KeyHash r Source #

minKeyHash r → KeyHash r → KeyHash r Source #

NoThunks (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep (KeyHash r) Source # 
Instance details

Defined in Cardano.Ledger.Hashes

type ADDRHASH = Blake2b_224 Source #

Hashing algorithm used for hashing cryptographic keys and scripts. As the type synonym name alludes, this is the hashing algorithm used for addresses.

type HASH = Blake2b_256 Source #

Hashing algorithm used for hashing everything, except addresses, for which ADDRHASH is used.

hashKeyVKey kd → KeyHash kd Source #

Hash a given public key

extractHashSafeHash i → Hash HASH i Source #

Extract the hash out of a SafeHash

castSafeHash ∷ ∀ i j. SafeHash i → SafeHash j Source #

To change the index parameter of SafeHash (which is a phantom type) use castSafeHash

class (Era era, ToJSON (TxCert era), DecCBOR (TxCert era), EncCBOR (TxCert era), ToCBOR (TxCert era), FromCBOR (TxCert era), NoThunks (TxCert era), NFData (TxCert era), Show (TxCert era), Ord (TxCert era), Eq (TxCert era)) ⇒ EraTxCert era where Source #

Associated Types

type TxCert era = (r ∷ Type) | r → era Source #

type TxCertUpgradeError era ∷ Type Source #

Methods

upgradeTxCertEraTxCert (PreviousEra era) ⇒ TxCert (PreviousEra era) → Either (TxCertUpgradeError era) (TxCert era) Source #

Every era, except Shelley, must be able to upgrade a TxCert from a previous era. However, not all certificates can be upgraded, because some eras lose some of the certificates, thus return type is an Either. Eg. from Babbage to Conway: MIR and Genesis certificates were removed.

getVKeyWitnessTxCertTxCert era → Maybe (KeyHash 'Witness) Source #

Return a witness key whenever a certificate requires one

getScriptWitnessTxCertTxCert era → Maybe ScriptHash Source #

Return a ScriptHash for certificate types that require a witness

mkRegPoolTxCertPoolParamsTxCert era Source #

getRegPoolTxCertTxCert era → Maybe PoolParams Source #

mkRetirePoolTxCertKeyHash 'StakePoolEpochNoTxCert era Source #

getRetirePoolTxCertTxCert era → Maybe (KeyHash 'StakePool, EpochNo) Source #

lookupRegStakeTxCertTxCert era → Maybe (Credential 'Staking) Source #

Extract staking credential from any certificate that can register such credential

lookupUnRegStakeTxCertTxCert era → Maybe (Credential 'Staking) Source #

Extract staking credential from any certificate that can unregister such credential

getTotalDepositsTxCerts Source #

Arguments

Foldable f 
PParams era 
→ (KeyHash 'StakePoolBool)

Check whether stake pool is registered or not

→ f (TxCert era) 
Coin 

Compute the total deposits from a list of certificates.

getTotalRefundsTxCerts Source #

Arguments

Foldable f 
PParams era 
→ (Credential 'StakingMaybe Coin)

Lookup current deposit for Staking credential if one is registered

→ (Credential 'DRepRoleMaybe Coin)

Lookup current deposit for DRep credential if one is registered

→ f (TxCert era) 
Coin 

Compute the total refunds from a list of certificates.

pattern RegPoolTxCertEraTxCert era ⇒ PoolParamsTxCert era Source #

data PoolCert Source #

Constructors

RegPool !PoolParams

A stake pool registration certificate.

RetirePool !(KeyHash 'StakePool) !EpochNo

A stake pool retirement certificate.

Instances

Instances details
ToJSON PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

Generic PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

Associated Types

type Rep PoolCertTypeType Source #

Show PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

EncCBOR PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

Methods

encCBORPoolCertEncoding Source #

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

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

NFData PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

Methods

rnfPoolCert → () Source #

Eq PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

Ord PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

NoThunks PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

type Rep PoolCert Source # 
Instance details

Defined in Cardano.Ledger.Core.TxCert

isRegStakeTxCertEraTxCert era ⇒ TxCert era → Bool Source #

Check if supplied TxCert is a stake registering certificate

isUnRegStakeTxCertEraTxCert era ⇒ TxCert era → Bool Source #

Check if supplied TxCert is a stake un-registering certificate

class (Era era, Eq (PParamsHKD Identity era), Ord (PParamsHKD Identity era), Show (PParamsHKD Identity era), NFData (PParamsHKD Identity era), EncCBOR (PParamsHKD Identity era), DecCBOR (PParamsHKD Identity era), ToCBOR (PParamsHKD Identity era), FromCBOR (PParamsHKD Identity era), NoThunks (PParamsHKD Identity era), ToJSON (PParamsHKD Identity era), FromJSON (PParamsHKD Identity era), Eq (PParamsHKD StrictMaybe era), Ord (PParamsHKD StrictMaybe era), Show (PParamsHKD StrictMaybe era), NFData (PParamsHKD StrictMaybe era), EncCBOR (PParamsHKD StrictMaybe era), DecCBOR (PParamsHKD StrictMaybe era), ToCBOR (PParamsHKD StrictMaybe era), FromCBOR (PParamsHKD StrictMaybe era), NoThunks (PParamsHKD StrictMaybe era), ToJSON (PParamsHKD StrictMaybe era)) ⇒ EraPParams era where Source #

Associated Types

type PParamsHKD (f ∷ TypeType) era = (r ∷ Type) | r → era Source #

Protocol parameters where the fields are represented with a HKD

type UpgradePParams (f ∷ TypeType) era ∷ Type Source #

 

type DowngradePParams (f ∷ TypeType) era ∷ Type Source #

Methods

applyPPUpdatesPParams era → PParamsUpdate era → PParams era Source #

Applies a protocol parameters update

default applyPPUpdates ∷ ∀ a u. (Generic (PParamsHKD Identity era), Generic (PParamsHKD StrictMaybe era), Updatable (Rep (PParamsHKD Identity era) a) (Rep (PParamsHKD StrictMaybe era) u)) ⇒ PParams era → PParamsUpdate era → PParams era Source #

emptyPParamsIdentityPParamsHKD Identity era Source #

emptyPParamsStrictMaybePParamsHKD StrictMaybe era Source #

upgradePParamsHKD ∷ (HKDApplicative f, EraPParams (PreviousEra era)) ⇒ UpgradePParams f era → PParamsHKD f (PreviousEra era) → PParamsHKD f era Source #

Upgrade PParams from previous era to the current one

downgradePParamsHKD ∷ (HKDFunctor f, EraPParams (PreviousEra era)) ⇒ DowngradePParams f era → PParamsHKD f era → PParamsHKD f (PreviousEra era) Source #

Downgrade PParams from the current era to the previous one

hkdMinFeeALHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The linear factor for the minimum fee calculation

hkdMinFeeBLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The constant factor for the minimum fee calculation

hkdMaxBBSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word32) Source #

Maximal block body size

hkdMaxTxSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word32) Source #

Maximal transaction size

hkdMaxBHSizeLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word16) Source #

Maximal block header size

hkdKeyDepositLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The amount of a key registration deposit

hkdPoolDepositLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

The amount of a pool registration deposit

hkdEMaxLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f EpochInterval) Source #

epoch bound on pool retirement

hkdNOptLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Word16) Source #

Desired number of pools

hkdA0LHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f NonNegativeInterval) Source #

Pool influence

hkdRhoLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Monetary expansion

hkdTauLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Treasury expansion

hkdDL ∷ (HKDFunctor f, ProtVerAtMost era 6) ⇒ Lens' (PParamsHKD f era) (HKD f UnitInterval) Source #

Decentralization parameter

ppDGSimpleGetter (PParams era) UnitInterval Source #

Decentralization parameter getter

hkdExtraEntropyL ∷ (HKDFunctor f, ProtVerAtMost era 6) ⇒ Lens' (PParamsHKD f era) (HKD f Nonce) Source #

Extra entropy

hkdProtocolVersionL ∷ (HKDFunctor f, ProtVerAtMost era 8) ⇒ Lens' (PParamsHKD f era) (HKD f ProtVer) Source #

Protocol version

ppProtocolVersionLLens' (PParams era) ProtVer Source #

ppuProtocolVersionLProtVerAtMost era 8 ⇒ Lens' (PParamsUpdate era) (StrictMaybe ProtVer) Source #

PParamsUpdate Protocol version

hkdMinUTxOValueLHKDFunctor f ⇒ ProtVerAtMost era 4 ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

Minimum UTxO value

hkdMinPoolCostLHKDFunctor f ⇒ Lens' (PParamsHKD f era) (HKD f Coin) Source #

Minimum Stake Pool Cost

newtype PParams era Source #

Protocol parameters

Constructors

PParams (PParamsHKD Identity era) 

Instances

Instances details
FromJSON (PParamsHKD Identity era) ⇒ FromJSON (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

ToJSON (PParamsHKD Identity era) ⇒ ToJSON (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Generic (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Associated Types

type Rep (PParams era) ∷ TypeType Source #

Methods

fromPParams era → Rep (PParams era) x Source #

toRep (PParams era) x → PParams era Source #

Show (PParamsHKD Identity era) ⇒ Show (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

showsPrecIntPParams era → ShowS Source #

showPParams era → String Source #

showList ∷ [PParams era] → ShowS Source #

(Typeable era, FromCBOR (PParamsHKD Identity era)) ⇒ FromCBOR (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

fromCBORDecoder s (PParams era) Source #

labelProxy (PParams era) → Text Source #

(Typeable era, ToCBOR (PParamsHKD Identity era)) ⇒ ToCBOR (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

toCBORPParams era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (PParams era) → Size Source #

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

(Typeable era, DecCBOR (PParamsHKD Identity era)) ⇒ DecCBOR (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

decCBORDecoder s (PParams era) Source #

dropCBORProxy (PParams era) → Decoder s () Source #

labelProxy (PParams era) → Text Source #

(Typeable era, EncCBOR (PParamsHKD Identity era)) ⇒ EncCBOR (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

encCBORPParams era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (PParams era) → Size Source #

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

EraPParams era ⇒ Default (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

defPParams era Source #

NFData (PParamsHKD Identity era) ⇒ NFData (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

rnfPParams era → () Source #

Eq (PParamsHKD Identity era) ⇒ Eq (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

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

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

Ord (PParamsHKD Identity era) ⇒ Ord (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

comparePParams era → PParams era → Ordering Source #

(<)PParams era → PParams era → Bool Source #

(<=)PParams era → PParams era → Bool Source #

(>)PParams era → PParams era → Bool Source #

(>=)PParams era → PParams era → Bool Source #

maxPParams era → PParams era → PParams era Source #

minPParams era → PParams era → PParams era Source #

NoThunks (PParamsHKD Identity era) ⇒ NoThunks (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

type Rep (PParams era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

type Rep (PParams era) = D1 ('MetaData "PParams" "Cardano.Ledger.Core.PParams" "cardano-ledger-core-1.17.0.0-inplace" 'True) (C1 ('MetaCons "PParams" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PParamsHKD Identity era))))

newtype PParamsUpdate era Source #

The type of updates to Protocol parameters

Instances

Instances details
FromJSON (PParamsHKD StrictMaybe era) ⇒ FromJSON (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

ToJSON (PParamsHKD StrictMaybe era) ⇒ ToJSON (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Generic (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Associated Types

type Rep (PParamsUpdate era) ∷ TypeType Source #

Methods

fromPParamsUpdate era → Rep (PParamsUpdate era) x Source #

toRep (PParamsUpdate era) x → PParamsUpdate era Source #

Show (PParamsHKD StrictMaybe era) ⇒ Show (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

(Typeable era, FromCBOR (PParamsHKD StrictMaybe era)) ⇒ FromCBOR (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

(Typeable era, ToCBOR (PParamsHKD StrictMaybe era)) ⇒ ToCBOR (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

toCBORPParamsUpdate era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (PParamsUpdate era) → Size Source #

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

(Typeable era, DecCBOR (PParamsHKD StrictMaybe era)) ⇒ DecCBOR (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

(Typeable era, EncCBOR (PParamsHKD StrictMaybe era)) ⇒ EncCBOR (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

encCBORPParamsUpdate era → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (PParamsUpdate era) → Size Source #

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

EraPParams era ⇒ Default (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

defPParamsUpdate era Source #

NFData (PParamsHKD StrictMaybe era) ⇒ NFData (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

rnfPParamsUpdate era → () Source #

Eq (PParamsHKD StrictMaybe era) ⇒ Eq (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

Methods

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

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

Ord (PParamsHKD StrictMaybe era) ⇒ Ord (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

NoThunks (PParamsHKD StrictMaybe era) ⇒ NoThunks (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

type Rep (PParamsUpdate era) Source # 
Instance details

Defined in Cardano.Ledger.Core.PParams

type Rep (PParamsUpdate era) = D1 ('MetaData "PParamsUpdate" "Cardano.Ledger.Core.PParams" "cardano-ledger-core-1.17.0.0-inplace" 'True) (C1 ('MetaCons "PParamsUpdate" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PParamsHKD StrictMaybe era))))

genericApplyPPUpdates ∷ ∀ era a u. (Generic (PParamsHKD Identity era), Generic (PParamsHKD StrictMaybe era), Updatable (Rep (PParamsHKD Identity era) a) (Rep (PParamsHKD StrictMaybe era) u)) ⇒ PParams era → PParamsUpdate era → PParams era Source #

PParams lens

ppMinFeeAL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Coin Source #

The linear factor for the minimum fee calculation

ppMinFeeBL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Coin Source #

The constant factor for the minimum fee calculation

ppMaxBBSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Word32 Source #

Maximal block body size

ppMaxTxSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Word32 Source #

Maximal transaction size

ppMaxBHSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Word16 Source #

Maximal block header size

ppKeyDepositL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Coin Source #

The amount of a key registration deposit

ppPoolDepositL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Coin Source #

The amount of a pool registration deposit

ppEMaxL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) EpochInterval Source #

epoch bound on pool retirement

ppNOptL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Word16 Source #

Desired number of pools

ppA0L ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) NonNegativeInterval Source #

Pool influence

ppRhoL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) UnitInterval Source #

Monetary expansion

ppTauL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) UnitInterval Source #

Treasury expansion

ppDL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 6) ⇒ Lens' (PParams era) UnitInterval Source #

Decentralization parameter

ppExtraEntropyL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 6) ⇒ Lens' (PParams era) Nonce Source #

Extra entropy

ppMinUTxOValueL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 4) ⇒ Lens' (PParams era) Coin Source #

Minimum UTxO value

ppMinPoolCostL ∷ ∀ era. EraPParams era ⇒ Lens' (PParams era) Coin Source #

Minimum Stake Pool Cost

PParamsUpdate lens

ppuMinFeeAL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

The linear factor for the minimum fee calculation

ppuMinFeeBL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

The constant factor for the minimum fee calculation

ppuMaxBBSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Word32) Source #

Maximal block body size

ppuMaxTxSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Word32) Source #

Maximal transaction size

ppuMaxBHSizeL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Word16) Source #

Maximal block header size

ppuKeyDepositL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

The amount of a key registration deposit

ppuPoolDepositL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

The amount of a pool registration deposit

ppuEMaxL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe EpochInterval) Source #

epoch bound on pool retirement

ppuNOptL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Word16) Source #

Desired number of pools

ppuA0L ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe NonNegativeInterval) Source #

Pool influence

ppuRhoL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe UnitInterval) Source #

Monetary expansion

ppuTauL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe UnitInterval) Source #

Treasury expansion

ppuDL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 6) ⇒ Lens' (PParamsUpdate era) (StrictMaybe UnitInterval) Source #

Decentralization parameter

ppuExtraEntropyL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 6) ⇒ Lens' (PParamsUpdate era) (StrictMaybe Nonce) Source #

Extra entropy

ppuMinUTxOValueL ∷ ∀ era. (EraPParams era, ProtVerAtMost era 4) ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

Minimum UTxO value

ppuMinPoolCostL ∷ ∀ era. EraPParams era ⇒ Lens' (PParamsUpdate era) (StrictMaybe Coin) Source #

Minimum Stake Pool Cost

Utility

mapPParams ∷ (PParamsHKD Identity era1 → PParamsHKD Identity era2) → PParams era1 → PParams era2 Source #

PParamsUpdate to Data

data PParam era where Source #

Pair the tag, and exisitenially hide the type of the lens for the field with that Lens'

Constructors

PParamToPlutusData t ⇒ WordLens' (PParamsUpdate era) (StrictMaybe t) → PParam era 

makePParamMap ∷ [PParam era] → Map Word (PParam era) Source #

Turn a list into a Map, this assures we have no duplicates.

type family PreviousEra era = (r ∷ Type) | r → era Source #

Map an era to its predecessor.

For example:

type instance PreviousEra (AllegraEra c) = ShelleyEra c

Instances

Instances details
type PreviousEra ByronEra Source # 
Instance details

Defined in Cardano.Ledger.Core.Era

type family TranslationContext era ∷ Type Source #

Per-era context used for TranslateEra.

This context will be passed to the translation instances of all types of that particular era. In practice, most instances won't need the context, but this approach makes the translation composable (as opposed to having a separate context per type).

type family TranslationError era f ∷ Type Source #

Most translations should be infallible (default instance), but we leave the door open for partial translations.

For a partial translation, override the default type to be () or a concrete error type.

class (Era era, Era (PreviousEra era)) ⇒ TranslateEra era f Source #

Translation of types between eras, e.g., from Shelley to Allegra.

When era is just a phantom type parameter, an empty standalone deriving can be used:

newtype Foo era = Foo Int

instance TranslateEra AllegraEra Foo

Note that one could use DerivingAnyClass (deriving (TranslateEra (Allegra c))), but this would introduce an undesired coupling between the era-parametric type and (a) particular era(s). The intention is to have a module with orphan instances per era.

In most cases, the era parameter won't be phantom, and a manual instance will have to be written:

newtype Bar era = Bar (TxBody era)

instance TranslateEra AllegraEra Bar where
    translateEra ctxt = Bar <$> translateEra ctxt

-- With the following instance being in scope:
instance TranslatEra AllegraEra TxBody

Note: we use PreviousEra instead of NextEra as an era definitely knows its predecessor, but not necessarily its successor. Moreover, one could argue that it makes more sense to define the translation from era A to era B where era B is defined, than where era A is defined.

translateEraTranslateEra era f ⇒ TranslationContext era → f (PreviousEra era) → Except (TranslationError era f) (f era) Source #

Translate a type f parameterised by the era from an era to the era after it.

The translation is a given the translation context of era.

A default instance is provided for when the two types are Coercible.

translateEraMaybe ∷ (TranslateEra era f, TranslationError era f ~ ()) ⇒ TranslationContext era → f (PreviousEra era) → Maybe (f era) Source #

Variant of translateEra for when TranslationError is (), converting the result to a Maybe.

translateEra' ∷ (TranslateEra era f, TranslationError era f ~ Void) ⇒ TranslationContext era → f (PreviousEra era) → f era Source #

Variant of translateEra for when TranslationError is Void and the translation thus cannot fail.

translateEraThroughCBOR Source #

Arguments

∷ ∀ era ti to. (Era era, ToCBOR (ti (PreviousEra era)), DecCBOR (Annotator (to era))) 
Text

Label for error reporting

→ ti (PreviousEra era) 
Except DecoderError (to era) 

Translate a type through its binary representation from previous era to the current one.