| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.HardFork.Combinator.Abstract.CanHardFork
Synopsis
- 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
- type HardForkTxMeasurePhase1 (xs ∷ [Type])
- type HardForkTxMeasurePhase2 (xs ∷ [Type])
- hardForkEraTranslation ∷ EraTranslation xs
- hardForkChainSel ∷ Tails AcrossEraTiebreaker xs
- hardForkInjTxMeasurePhase1 ∷ NS WrapTxMeasurePhase1 xs → HardForkTxMeasurePhase1 xs
- hardForkInjTxMeasurePhase2 ∷ NS WrapTxMeasurePhase2 xs → HardForkTxMeasurePhase2 xs
- hardForkEqGenTxId ∷ NS WrapGenTxId xs → NS WrapGenTxId xs → Bool
- hardForkCompareGenTxId ∷ NS WrapGenTxId xs → NS WrapGenTxId xs → Ordering
- type family HashSizeOfHead (xs ∷ [Type]) ∷ Nat where ...
- rawHashNS ∷ ∀ (xs ∷ [Type]). All SingleEraBlock xs ⇒ NS WrapGenTxId xs → ShortByteString
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
hardForkEraTranslation ∷ EraTranslation xs Source #
hardForkChainSel ∷ Tails AcrossEraTiebreaker xs Source #
hardForkInjTxMeasurePhase1 ∷ NS 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.
hardForkInjTxMeasurePhase2 ∷ NS WrapTxMeasurePhase2 xs → HardForkTxMeasurePhase2 xs Source #
hardForkEqGenTxId ∷ NS 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.
hardForkCompareGenTxId ∷ NS WrapGenTxId xs → NS WrapGenTxId xs → Ordering Source #
Order two transaction ids of xs. See hardForkEqGenTxId.
Instances
| SingleEraBlock blk ⇒ CanHardFork '[blk] Source # | |||||||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Abstract.CanHardFork Associated Types
Methods hardForkEraTranslation ∷ EraTranslation '[blk] Source # hardForkChainSel ∷ Tails AcrossEraTiebreaker '[blk] Source # hardForkInjTxMeasurePhase1 ∷ NS WrapTxMeasurePhase1 '[blk] → HardForkTxMeasurePhase1 '[blk] Source # hardForkInjTxMeasurePhase2 ∷ NS WrapTxMeasurePhase2 '[blk] → HardForkTxMeasurePhase2 '[blk] Source # hardForkEqGenTxId ∷ NS WrapGenTxId '[blk] → NS WrapGenTxId '[blk] → Bool Source # hardForkCompareGenTxId ∷ NS WrapGenTxId '[blk] → NS WrapGenTxId '[blk] → Ordering Source # | |||||||||
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.