Skip to content

Commit 059cd2c

Browse files
committed
Switch to using era names for constraints instead of protocol versions
1 parent afa7458 commit 059cd2c

File tree

53 files changed

+310
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+310
-245
lines changed

eras/allegra/impl/src/Cardano/Ledger/Allegra/Era.hs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,9 @@ module Cardano.Ledger.Allegra.Era (
1919
import Cardano.Ledger.Coin (Coin)
2020
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
2121
import Cardano.Ledger.Internal.Era (AllegraEra)
22-
import Cardano.Ledger.Shelley (ShelleyEra)
2322
import Cardano.Ledger.Shelley.Core
2423
import Cardano.Ledger.Shelley.Rules
2524

26-
instance Era AllegraEra where
27-
type PreviousEra AllegraEra = ShelleyEra
28-
type ProtVerLow AllegraEra = 3
29-
30-
eraName = "Allegra"
31-
3225
instance EraGenesis AllegraEra
3326

3427
--------------------------------------------------------------------------------

eras/allegra/impl/src/Cardano/Ledger/Allegra/Rules/Utxo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ instance
302302
, Environment (EraRule "PPUP" era) ~ PpupEnv era
303303
, State (EraRule "PPUP" era) ~ ShelleyGovState era
304304
, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era)
305-
, ProtVerAtMost era 8
305+
, AtMostEra "Babbage" era
306306
, Eq (EraRuleFailure "PPUP" era)
307307
, Show (EraRuleFailure "PPUP" era)
308308
, EraRule "UTXO" era ~ AllegraUTXO era

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Era.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,12 @@ module Cardano.Ledger.Alonzo.Era (
1717
) where
1818

1919
import Cardano.Ledger.Internal.Era (AlonzoEra)
20-
import Cardano.Ledger.Mary (MaryEra, MaryValue)
20+
import Cardano.Ledger.Mary (MaryValue)
2121
import Cardano.Ledger.Shelley.Core
2222
import Cardano.Ledger.Shelley.Rules
2323

2424
-- =====================================================
2525

26-
instance Era AlonzoEra where
27-
type PreviousEra AlonzoEra = MaryEra
28-
type ProtVerLow AlonzoEra = 5
29-
type ProtVerHigh AlonzoEra = 6
30-
31-
eraName = "Alonzo"
32-
3326
type instance Value AlonzoEra = MaryValue
3427

3528
-------------------------------------------------------------------------------

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/TxInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ transValue (MaryValue c m) = transCoinToValue c <> transMultiAsset m
320320
-- =============================================
321321
-- translate fields like TxCert, Withdrawals, and similar
322322

323-
transTxCert :: (ShelleyEraTxCert era, ProtVerAtMost era 8) => TxCert era -> PV1.DCert
323+
transTxCert :: (ShelleyEraTxCert era, AtMostEra "Babbage" era) => TxCert era -> PV1.DCert
324324
transTxCert txCert =
325325
case transTxCertCommon txCert of
326326
Just cert -> cert

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Ledger.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ instance
165165
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
166166
, State (EraRule "DELEGS" era) ~ CertState era
167167
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
168-
, ProtVerAtMost era 8
168+
, AtMostEra "Babbage" era
169169
, EraCertState era
170170
) =>
171171
STS (AlonzoLEDGER era)

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ utxoTransition ::
474474
forall era.
475475
( EraUTxO era
476476
, AlonzoEraTx era
477-
, ProtVerAtMost era 8
477+
, AtMostEra "Babbage" era
478478
, EraRule "UTXO" era ~ AlonzoUTXO era
479479
, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era
480480
, InjectRuleFailure "UTXO" AlonzoUtxoPredFailure era
@@ -571,7 +571,7 @@ instance
571571
, InjectRuleFailure "UTXO" ShelleyUtxoPredFailure era
572572
, InjectRuleFailure "UTXO" AlonzoUtxoPredFailure era
573573
, InjectRuleFailure "UTXO" AllegraUtxoPredFailure era
574-
, ProtVerAtMost era 8
574+
, AtMostEra "Babbage" era
575575
, EraCertState era
576576
, SafeToHash (TxWits era)
577577
) =>

eras/alonzo/test-suite/src/Test/Cardano/Ledger/Alonzo/Trace.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ instance
6363
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
6464
, State (EraRule "DELEGS" era) ~ CertState era
6565
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
66-
, ProtVerAtMost era 8
66+
, AtMostEra "Babbage" era
6767
, EraCertState era
6868
, Crypto c
6969
) =>

eras/babbage/impl/src/Cardano/Ledger/Babbage/Era.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module Cardano.Ledger.Babbage.Era (
1414
BabbageLEDGER,
1515
) where
1616

17-
import Cardano.Ledger.Alonzo (AlonzoEra)
1817
import Cardano.Ledger.Alonzo.Rules (AlonzoBBODY)
1918
import Cardano.Ledger.Core
2019
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
@@ -34,13 +33,6 @@ import Cardano.Ledger.Shelley.Rules (
3433

3534
-- =====================================================
3635

37-
instance Era BabbageEra where
38-
type PreviousEra BabbageEra = AlonzoEra
39-
type ProtVerLow BabbageEra = 7
40-
type ProtVerHigh BabbageEra = 8
41-
42-
eraName = "Babbage"
43-
4436
instance EraGenesis BabbageEra
4537

4638
type instance TranslationContext BabbageEra = NoGenesis BabbageEra

eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Ledger.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ instance
117117
, Environment (EraRule "DELEGS" era) ~ DelegsEnv era
118118
, State (EraRule "DELEGS" era) ~ CertState era
119119
, Signal (EraRule "DELEGS" era) ~ Seq (TxCert era)
120-
, ProtVerAtMost era 8
120+
, AtMostEra "Babbage" era
121121
, EraCertState era
122122
) =>
123123
STS (BabbageLEDGER era)

eras/conway/impl/src/Cardano/Ledger/Conway/Era.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module Cardano.Ledger.Conway.Era (
3131
hardforkConwayDELEGIncorrectDepositsAndRefunds,
3232
) where
3333

34-
import Cardano.Ledger.Babbage (BabbageEra)
3534
import Cardano.Ledger.BaseTypes (ProtVer (pvMajor), natVersion)
3635
import Cardano.Ledger.Core
3736
import Cardano.Ledger.Internal.Era (ConwayEra)
@@ -46,13 +45,6 @@ import Cardano.Ledger.Shelley.Rules (
4645

4746
-- =====================================================
4847

49-
instance Era ConwayEra where
50-
type PreviousEra ConwayEra = BabbageEra
51-
type ProtVerLow ConwayEra = 9
52-
type ProtVerHigh ConwayEra = 11
53-
54-
eraName = "Conway"
55-
5648
type instance Value ConwayEra = MaryValue
5749

5850
-------------------------------------------------------------------------------

0 commit comments

Comments
 (0)