IntersectMBO / IntersectMBO/ouroboros-consensus

db-analyser: fix `--trace-ledger` across eras

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

Description

When crossing an era boundary while using `--trace-ledger`, db-analyser crashes due to
https://github.com/IntersectMBO/ouroboros-consensus/blob/4b668deb5bcf22578cf2899f9091e2410d00e8d1/ouroboros-consensus-cardano/src/tools/Cardano/Tools/DBAnalyser/Block/Cardano.hs#L97

To see why, consider the signature of the offending function (that is used in `emitTraces`):
https://github.com/IntersectMBO/ouroboros-consensus/blob/4b668deb5bcf22578cf2899f9091e2410d00e8d1/ouroboros-consensus-cardano/src/tools/Cardano/Tools/DBAnalyser/Block/Cardano.hs#L87-L93
with
https://github.com/IntersectMBO/ouroboros-consensus/blob/4b668deb5bcf22578cf2899f9091e2410d00e8d1/ouroboros-consensus-cardano/src/tools/Cardano/Tools/DBAnalyser/HasAnalysis.hs#L24-L28
where `wlsState{Before,After}` are ledger states of the *same* block/era, but when comparing the ledger states just before/after an era transition, that is not the case.

The minimum goal of this ticket is to make sure that we don't crash on era transitions.

- The straightforward approach would be to return `Maybe a` from `analyseWithLedgerState` and emit no traces on era transitions.
- Going further slightly, we might want to modify the `emitTraces` interface slightly such that one can also compare ledger states from different eras to e.g. still be able to mark the start of an epoch at the point of the era transition. Conceptually, that would involve providing functions `WithLedgerState blk blk' -> a` for all subsequent pairs of blocks in `CardanoEras`, cf. the existing `InPairs` combinator.

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.