cardano-testnet | Remove old era casing functions#6551
cardano-testnet | Remove old era casing functions#6551carbolymer wants to merge 1 commit intomasterfrom
Conversation
9a4ef15 to
2742da4
Compare
2742da4 to
cc230e1
Compare
| -- | Unsafely convert a 'ShelleyBasedEra' witness to an experimental 'Era' witness. | ||
| -- Throws an 'error' for deprecated (pre-Conway) eras. | ||
| unsafeEraFromSbe :: HasCallStack => ShelleyBasedEra era -> Era era | ||
| unsafeEraFromSbe = either (error . show) id . sbeToEra |
There was a problem hiding this comment.
| unsafeEraFromSbe = either (error . show) id . sbeToEra | |
| unsafeEraFromSbe = withFrozenCallStack $ either (error . show) id . sbeToEra |
There was a problem hiding this comment.
Claude suggested:
unsafeEraFromSbe = either (error . prettyToString . prettyError) id . sbeToEra
palas
left a comment
There was a problem hiding this comment.
Looks good, pretty much a refactoring 👍
Jimbo4350
left a comment
There was a problem hiding this comment.
LGTM but have a look at my comment as it's something we should consider.
| Map.foldlWithKey' (compareWithTxId txid) Nothing (L.proposalsActionsMap proposals) | ||
| ) | ||
| sbe | ||
| obtainCommonConstraints (unsafeEraFromSbe sbe) $ do |
There was a problem hiding this comment.
unsafeEraFromSbe is partial but cardano-testnet only ever runs Conway, so the error branch is never hit in practice.
We should consider a parallel AnyNewEpochStateLatest (parameterized on Exp.Era era) in cardano-api for consumers like cardano-testnet who are only interested in testing the latest eras. This keeps AnyNewEpochState intact for foldBlocks from genesis, eliminates the partial helper, and rules out pre-Conway at the type level.
Description
cardano-testnet | Remove old era casing functions
Requires:
Checklist
See Running tests for more details
CHANGELOG.mdfor affected package.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.