ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.HardFork.Combinator.Abstract.CanHardFork

Synopsis

Documentation

class (All SingleEraBlock xs, All (EqualHashSizeOfHead xs) xs, KnownNat (HashSizeOfHead xs), Typeable xs, IsNonEmpty xs, Measure (HardForkTxMeasurePhase1 xs), HasByteSize (HardForkTxMeasurePhase1 xs), NoThunks (HardForkTxMeasurePhase1 xs), Show (HardForkTxMeasurePhase1 xs), TxMeasurePhase1Metrics (HardForkTxMeasurePhase1 xs), Measure (HardForkTxMeasurePhase2 xs), NoThunks (HardForkTxMeasurePhase2 xs), Show (HardForkTxMeasurePhase2 xs), TxMeasurePhase2Metrics (HardForkTxMeasurePhase2 xs))CanHardFork (xs ∷ [Type]) where Source #

Associated Types

type HardForkTxMeasurePhase1 (xs ∷ [Type]) Source #

A measure that can accurately represent the TxMeasure of any era.

Usually, this can simply be the union of the sets of components of each individual era's TxMeasure. (Which is too awkward of a type to express in Haskell.)

type HardForkTxMeasurePhase2 (xs ∷ [Type]) Source #

Methods

hardForkEraTranslationEraTranslation xs Source #

hardForkChainSelTails AcrossEraTiebreaker xs Source #

hardForkInjTxMeasurePhase1NS WrapTxMeasurePhase1 xs → HardForkTxMeasurePhase1 xs Source #

This is ideally exact.

If that's not possible, the result must not be too small, since this is relied upon to determine which prefix of the mempool's txs will fit in a valid block.

hardForkInjTxMeasurePhase2NS WrapTxMeasurePhase2 xs → HardForkTxMeasurePhase2 xs Source #

hardForkEqGenTxIdNS WrapGenTxId xs → NS WrapGenTxId xs → Bool Source #

Whether two transaction ids of xs are equal, ignoring which era each sits in. Two txids in different eras can be equal; see the OneEraGenTxId Eq instance.

Runs on every mempool lookup, so instances should avoid allocation. rawHashNS is the reference implementation and allocates; the Cardano instance overrides it with an allocation-free walk. There is no class default: every instance names its body explicitly.

hardForkCompareGenTxIdNS WrapGenTxId xs → NS WrapGenTxId xs → Ordering Source #

Order two transaction ids of xs. See hardForkEqGenTxId.

type family HashSizeOfHead (xs ∷ [Type]) ∷ Nat where ... Source #

The hash size shared by all eras of a hard fork, represented by that of the first era.

See EqualHashSizeOfHead superclass constraint in CanHardFork and the ConvertRawHash (HardForkBlock xs) instance.

Equations

HashSizeOfHead (x ': _1) = HashSize x 

rawHashNS ∷ ∀ (xs ∷ [Type]). All SingleEraBlock xs ⇒ NS WrapGenTxId xs → ShortByteString Source #

The raw hash of an era sum, era ignored.

The reference comparison for transaction ids. Non-optimizing CanHardFork instances implement hardForkEqGenTxId/hardForkCompareGenTxId by comparing this hash. It serialises each id via toRawTxIdHash, which allocates.