Skip to content

Introduce BlockHeader type class #5541

@lehins

Description

@lehins

We need a proper interface for the block header in order to make it safer and get rid of BHeaderView:

class EraBlockHeader h era | era -> h where
  blockHeaderSizeBHeaderL :: SimpleGetter (Block h era) BHeaderView
  blockIssuerBHeaderL :: LensSimpleGetter (Block h era) (KeyHash BlockIssuer)
  blockBodySizeBHeaderL :: Lens' (Block h era) BHeaderView
  ...

Then there would be separate type classes:

class EraBlockHeader h era => ShelleyEraBlockHeader h era where
  prevEpochNonceBHeaderL :: Lens' (Block h era) PrevEpochNonce

class EraBlockHeader h era => DijkstraEraBlockHeader h era where
   --- Peras related lenses

This would prevent ugliness like this: https://github.com/IntersectMBO/ouroboros-consensus/blob/1940605fbbfb50032ab78e2268b85065c703cd2a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs#L196-L202
Where we have a bottom in bhviewPrevEpochNonce
And ugliness like this: #5467 (comment)

Metadata

Metadata

Assignees

Labels

💳 technical-debtIssues related to technical debt we introducedmaintenanceTasks that are planned to be done as part of the regular maintenance of the project.peras

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions