IntersectMBO / IntersectMBO/ouroboros-consensus

HFC: share implementation of `reconstructSummary` and `summarize`

Open
#1,336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
67
Forks
43
Avg merge
5d 13h
Merged PRs (30d)
43

Description

In order to construct a `Summary` (which is used to create the `EpochInfo` that is passed to the ledger) from a ledger state, we use `reconstructSummary` (see its call sites):
https://github.com/IntersectMBO/ouroboros-consensus/blob/68b9799eebdc7037a99668762ddc69c7e78c106c/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/State/Infra.hs#L160-L253
However, we also have the very similar function `summarize`:
https://github.com/IntersectMBO/ouroboros-consensus/blob/68b9799eebdc7037a99668762ddc69c7e78c106c/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/History/Summary.hs#L291-L357
The latter isn't actually used in the implementation; it is only used for tests (`Test.Consensus.HardFork.History`):
https://github.com/IntersectMBO/ouroboros-consensus/blob/68b9799eebdc7037a99668762ddc69c7e78c106c/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/History/Summary.hs#L286-L288

It is at least surprising that we are testing a function that isn't actually directly used by the actual HFC. In particular, I don't see why the implementations of `reconstructSummary` and `summarize` couldn't be unified (either in terms of each other, or as specializations of a more general function).

Relevant note: AFAICT the bug in `reconstructSummary` that was fixed by https://github.com/input-output-hk/ouroboros-network/pull/3754 was never present in `summarize`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.