IntersectMBO / IntersectMBO/cardano-ledger

make the danger in `epochInfo` more apparent.

Open
#2,783 0 comments 0 reactions 0 assignees View on GitHub
:credit_card: technical-debt
Dominant language
Haskell
Stars
295
Forks
179
Avg merge
4d 7h
Merged PRs (30d)
29

Description

We should document and make clearer the circumstances when the methods associated with `epochInfo` return `Left`.

In particular, we often do the following to get the first slot of the next epoch:
```
ei <- liftSTS $ asks epochInfo
EpochNo e <- liftSTS $ epochInfoEpoch ei s
let newEpochNo = EpochNo (e + 1)
firstSlotNextEpoch <- liftSTS $ epochInfoFirst ei newEpochNo
```

This construction works, but would not, for example, if we let `newEpochNo = EpochNo (e + 2)`. This construction could perhaps be a good standalone function.

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.