Skip to content

Commit

Permalink
Add eraProtVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Nov 14, 2024
1 parent a19b353 commit bfa6dfe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ spec ::
spec = do
BabbageImp.spec @era
withImpInit @(LedgerSpec era) $
forM_ [eraProtVerLow @era .. eraProtVerHigh @era] $ \protVer ->
forM_ (eraProtVersions @era) $ \protVer ->
describe ("ConwayImpSpec - " <> show protVer) $
modifyImpInitProtVer protVer $ do
describe "BBODY" Bbody.spec
Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-api/test/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apiSpec =
StateQuery.spec
describe "Imp" $
withImpInit @(LedgerSpec Conway) $
forM_ [eraProtVerLow @Conway .. eraProtVerHigh @Conway] $ \v ->
forM_ (eraProtVersions @Conway) $ \v ->
modifyImpInitProtVer v $ do
ImpQuery.spec @Conway

Expand Down
1 change: 1 addition & 0 deletions libs/cardano-ledger-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.16.0.0

* Add `eraProtVersions`
* Remove deprecated `_unTxId` and `adaOnly`
* Remove deprecated module `Cardano.Ledger.Serialization`
* Remove deprecated `fromSLanguage`
Expand Down
5 changes: 5 additions & 0 deletions libs/cardano-ledger-core/src/Cardano/Ledger/Core/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Cardano.Ledger.Core.Era (
notSupportedInThisEraL,
eraProtVerLow,
eraProtVerHigh,
eraProtVersions,
toEraCBOR,
fromEraCBOR,
fromEraShareCBOR,
Expand Down Expand Up @@ -237,6 +238,10 @@ eraProtVerLow = natVersion @(ProtVerLow era)
eraProtVerHigh :: forall era. Era era => Version
eraProtVerHigh = natVersion @(ProtVerHigh era)

-- | List with all major versions that are used in the particular era.
eraProtVersions :: forall era. Era era => [Version]
eraProtVersions = [eraProtVerLow @era .. eraProtVerHigh @era]

-- | Enforce era to be at least the specified era at the type level. In other words
-- compiler will produce type error when applied to eras prior to the specified era.
-- This function should be used in order to avoid redundant constraints warning.
Expand Down

0 comments on commit bfa6dfe

Please sign in to comment.