Skip to content

Commit 7449147

Browse files
lehinsaniketd
andcommitted
Remove crypto parametrization
We only retain KES and VRF parametrization, which is applicable to block headers. This means that HASH, ADDRHASH and DSIGN were switched from a type family to a type synonym for a concrete algorithm. This allowed us to remove crypto paramterization from all eras and ledger related types. Co-authored-by: Daniel Lucsanszky <[email protected]> Co-authored-by: Aniket Deshpande <[email protected]>
1 parent 81330ef commit 7449147

File tree

559 files changed

+8497
-10360
lines changed

Some content is hidden

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

559 files changed

+8497
-10360
lines changed

eras/allegra/impl/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Version history for `cardano-ledger-allegra`
22

3+
## 1.7.0.0
4+
5+
* Deprecate `Allegra` type synonym
6+
* Remove crypto parametrization from `AllegraEra`
7+
38
## 1.6.1.0
49

510
* Use `Mismatch` to clarify predicate failures. #4711

eras/allegra/impl/cardano-ledger-allegra.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.0
22
name: cardano-ledger-allegra
3-
version: 1.6.1.0
3+
version: 1.7.0.0
44
license: Apache-2.0
55
maintainer: [email protected]
66
author: IOHK
@@ -66,7 +66,6 @@ library
6666
aeson,
6767
base >=4.14 && <5,
6868
bytestring,
69-
cardano-crypto-class,
7069
cardano-ledger-binary >=1.4,
7170
cardano-ledger-core >=1.17 && <1.18,
7271
cardano-ledger-shelley ^>=1.15,
@@ -108,7 +107,6 @@ library testlib
108107
QuickCheck,
109108
base,
110109
bytestring,
111-
cardano-crypto-class,
112110
cardano-ledger-allegra,
113111
cardano-ledger-core:{cardano-ledger-core, testlib},
114112
cardano-ledger-shelley:{cardano-ledger-shelley, testlib},

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,16 @@ import Cardano.Ledger.Allegra.Translation ()
1919
import Cardano.Ledger.Allegra.Tx ()
2020
import Cardano.Ledger.Allegra.TxSeq ()
2121
import Cardano.Ledger.Allegra.UTxO ()
22-
import Cardano.Ledger.Core
23-
import Cardano.Ledger.Crypto (Crypto, StandardCrypto)
24-
import Cardano.Ledger.Keys (DSignable, Hash)
2522
import Cardano.Ledger.Shelley.API (ApplyBlock, ApplyTx)
2623

27-
type Allegra = AllegraEra StandardCrypto
24+
type Allegra = AllegraEra
25+
26+
{-# DEPRECATED Allegra "In favor of `AllegraEra`" #-}
2827

2928
--------------------------------------------------------------------------------
3029
-- Mempool instances
3130
--------------------------------------------------------------------------------
3231

33-
instance
34-
(Crypto c, DSignable c (Hash c EraIndependentTxBody)) =>
35-
ApplyTx (AllegraEra c)
32+
instance ApplyTx AllegraEra
3633

37-
instance
38-
(Crypto c, DSignable c (Hash c EraIndependentTxBody)) =>
39-
ApplyBlock (AllegraEra c)
34+
instance ApplyBlock AllegraEra

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

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,75 @@ module Cardano.Ledger.Allegra.Era (
1212
) where
1313

1414
import Cardano.Ledger.Coin (Coin)
15-
import Cardano.Ledger.Crypto (Crypto)
1615
import Cardano.Ledger.Genesis (EraGenesis, NoGenesis)
1716
import Cardano.Ledger.Shelley (ShelleyEra)
1817
import Cardano.Ledger.Shelley.Core
1918
import Cardano.Ledger.Shelley.Rules
2019

2120
-- | The Allegra era
22-
data AllegraEra c
21+
data AllegraEra
2322

24-
instance Crypto c => Era (AllegraEra c) where
25-
type PreviousEra (AllegraEra c) = ShelleyEra c
26-
type EraCrypto (AllegraEra c) = c
27-
type ProtVerLow (AllegraEra c) = 3
23+
instance Era AllegraEra where
24+
type PreviousEra AllegraEra = ShelleyEra
25+
type ProtVerLow AllegraEra = 3
2826

2927
eraName = "Allegra"
3028

31-
instance Crypto c => EraGenesis (AllegraEra c)
29+
instance EraGenesis AllegraEra
3230

3331
--------------------------------------------------------------------------------
3432
-- Core instances
3533
--------------------------------------------------------------------------------
3634

3735
-- | No context is needed to translate from Shelley to Allegra.
38-
type instance TranslationContext (AllegraEra c) = NoGenesis (AllegraEra c)
36+
type instance TranslationContext AllegraEra = NoGenesis AllegraEra
3937

40-
type instance Value (AllegraEra _) = Coin
38+
type instance Value AllegraEra = Coin
4139

4240
-- These rules are all inherited from Shelley
4341

44-
type instance EraRule "BBODY" (AllegraEra c) = ShelleyBBODY (AllegraEra c)
42+
type instance EraRule "BBODY" AllegraEra = ShelleyBBODY AllegraEra
4543

46-
type instance EraRule "DELEG" (AllegraEra c) = ShelleyDELEG (AllegraEra c)
44+
type instance EraRule "DELEG" AllegraEra = ShelleyDELEG AllegraEra
4745

48-
type instance EraRule "DELEGS" (AllegraEra c) = ShelleyDELEGS (AllegraEra c)
46+
type instance EraRule "DELEGS" AllegraEra = ShelleyDELEGS AllegraEra
4947

50-
type instance EraRule "DELPL" (AllegraEra c) = ShelleyDELPL (AllegraEra c)
48+
type instance EraRule "DELPL" AllegraEra = ShelleyDELPL AllegraEra
5149

52-
type instance EraRule "EPOCH" (AllegraEra c) = ShelleyEPOCH (AllegraEra c)
50+
type instance EraRule "EPOCH" AllegraEra = ShelleyEPOCH AllegraEra
5351

54-
type instance EraRule "LEDGER" (AllegraEra c) = ShelleyLEDGER (AllegraEra c)
52+
type instance EraRule "LEDGER" AllegraEra = ShelleyLEDGER AllegraEra
5553

56-
type instance EraRule "LEDGERS" (AllegraEra c) = ShelleyLEDGERS (AllegraEra c)
54+
type instance EraRule "LEDGERS" AllegraEra = ShelleyLEDGERS AllegraEra
5755

58-
type instance EraRule "MIR" (AllegraEra c) = ShelleyMIR (AllegraEra c)
56+
type instance EraRule "MIR" AllegraEra = ShelleyMIR AllegraEra
5957

60-
type instance EraRule "NEWEPOCH" (AllegraEra c) = ShelleyNEWEPOCH (AllegraEra c)
58+
type instance EraRule "NEWEPOCH" AllegraEra = ShelleyNEWEPOCH AllegraEra
6159

62-
type instance EraRule "NEWPP" (AllegraEra c) = ShelleyNEWPP (AllegraEra c)
60+
type instance EraRule "NEWPP" AllegraEra = ShelleyNEWPP AllegraEra
6361

64-
type instance EraRule "POOL" (AllegraEra c) = ShelleyPOOL (AllegraEra c)
62+
type instance EraRule "POOL" AllegraEra = ShelleyPOOL AllegraEra
6563

66-
type instance EraRule "POOLREAP" (AllegraEra c) = ShelleyPOOLREAP (AllegraEra c)
64+
type instance EraRule "POOLREAP" AllegraEra = ShelleyPOOLREAP AllegraEra
6765

68-
type instance EraRule "PPUP" (AllegraEra c) = ShelleyPPUP (AllegraEra c)
66+
type instance EraRule "PPUP" AllegraEra = ShelleyPPUP AllegraEra
6967

70-
type instance EraRule "RUPD" (AllegraEra c) = ShelleyRUPD (AllegraEra c)
68+
type instance EraRule "RUPD" AllegraEra = ShelleyRUPD AllegraEra
7169

72-
type instance EraRule "SNAP" (AllegraEra c) = ShelleySNAP (AllegraEra c)
70+
type instance EraRule "SNAP" AllegraEra = ShelleySNAP AllegraEra
7371

74-
type instance EraRule "TICK" (AllegraEra c) = ShelleyTICK (AllegraEra c)
72+
type instance EraRule "TICK" AllegraEra = ShelleyTICK AllegraEra
7573

76-
type instance EraRule "TICKF" (AllegraEra c) = ShelleyTICKF (AllegraEra c)
74+
type instance EraRule "TICKF" AllegraEra = ShelleyTICKF AllegraEra
7775

78-
type instance EraRule "UPEC" (AllegraEra c) = ShelleyUPEC (AllegraEra c)
76+
type instance EraRule "UPEC" AllegraEra = ShelleyUPEC AllegraEra
7977

8078
-- These rules are defined anew in the Allegra era
8179

8280
data AllegraUTXO era
8381

84-
type instance EraRule "UTXO" (AllegraEra c) = AllegraUTXO (AllegraEra c)
82+
type instance EraRule "UTXO" AllegraEra = AllegraUTXO AllegraEra
8583

8684
data AllegraUTXOW era
8785

88-
type instance EraRule "UTXOW" (AllegraEra c) = AllegraUTXOW (AllegraEra c)
86+
type instance EraRule "UTXOW" AllegraEra = AllegraUTXOW AllegraEra

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ module Cardano.Ledger.Allegra.PParams () where
55

66
import Cardano.Ledger.Allegra.Era (AllegraEra)
77
import Cardano.Ledger.Core
8-
import Cardano.Ledger.Crypto
98
import Cardano.Ledger.Shelley.Governance
109
import Cardano.Ledger.Shelley.PParams
1110
import Data.Coerce
1211
import Lens.Micro
1312

14-
instance Crypto c => EraPParams (AllegraEra c) where
15-
type PParamsHKD f (AllegraEra c) = ShelleyPParams f (AllegraEra c)
13+
instance EraPParams AllegraEra where
14+
type PParamsHKD f AllegraEra = ShelleyPParams f AllegraEra
1615

17-
type UpgradePParams f (AllegraEra c) = ()
18-
type DowngradePParams f (AllegraEra c) = ()
16+
type UpgradePParams f AllegraEra = ()
17+
type DowngradePParams f AllegraEra = ()
1918

2019
emptyPParamsIdentity = emptyShelleyPParams
2120
emptyPParamsStrictMaybe = emptyShelleyPParamsUpdate
@@ -41,8 +40,8 @@ instance Crypto c => EraPParams (AllegraEra c) where
4140
hkdMinUTxOValueL = lens sppMinUTxOValue $ \pp x -> pp {sppMinUTxOValue = x}
4241
hkdMinPoolCostL = lens sppMinPoolCost $ \pp x -> pp {sppMinPoolCost = x}
4342

44-
instance Crypto c => EraGov (AllegraEra c) where
45-
type GovState (AllegraEra c) = ShelleyGovState (AllegraEra c)
43+
instance EraGov AllegraEra where
44+
type GovState AllegraEra = ShelleyGovState AllegraEra
4645
emptyGovState = emptyShelleyGovState
4746

4847
getProposedPPUpdates = Just . sgsCurProposals

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ import Cardano.Ledger.Allegra.Rules.Utxo
2222
import Cardano.Ledger.Allegra.Rules.Utxow
2323
import Cardano.Ledger.Shelley.Rules (ShelleyTickEvent)
2424

25-
type instance EraRuleEvent "TICK" (AllegraEra c) = ShelleyTickEvent (AllegraEra c)
25+
type instance EraRuleEvent "TICK" AllegraEra = ShelleyTickEvent AllegraEra

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ import Cardano.Ledger.Shelley.Rules (
2121
ShelleyUtxowPredFailure,
2222
)
2323

24-
type instance EraRuleFailure "BBODY" (AllegraEra c) = ShelleyBbodyPredFailure (AllegraEra c)
24+
type instance EraRuleFailure "BBODY" AllegraEra = ShelleyBbodyPredFailure AllegraEra
2525

26-
instance InjectRuleFailure "BBODY" ShelleyBbodyPredFailure (AllegraEra c)
26+
instance InjectRuleFailure "BBODY" ShelleyBbodyPredFailure AllegraEra
2727

28-
instance InjectRuleFailure "BBODY" ShelleyLedgersPredFailure (AllegraEra c) where
28+
instance InjectRuleFailure "BBODY" ShelleyLedgersPredFailure AllegraEra where
2929
injectFailure = LedgersFailure
3030

31-
instance InjectRuleFailure "BBODY" ShelleyLedgerPredFailure (AllegraEra c) where
31+
instance InjectRuleFailure "BBODY" ShelleyLedgerPredFailure AllegraEra where
3232
injectFailure = LedgersFailure . injectFailure
3333

34-
instance InjectRuleFailure "BBODY" ShelleyUtxowPredFailure (AllegraEra c) where
34+
instance InjectRuleFailure "BBODY" ShelleyUtxowPredFailure AllegraEra where
3535
injectFailure = LedgersFailure . injectFailure
3636

37-
instance InjectRuleFailure "BBODY" ShelleyUtxoPredFailure (AllegraEra c) where
37+
instance InjectRuleFailure "BBODY" ShelleyUtxoPredFailure AllegraEra where
3838
injectFailure = LedgersFailure . injectFailure
3939

40-
instance InjectRuleFailure "BBODY" ShelleyPpupPredFailure (AllegraEra c) where
40+
instance InjectRuleFailure "BBODY" ShelleyPpupPredFailure AllegraEra where
4141
injectFailure = LedgersFailure . injectFailure
4242

43-
instance InjectRuleFailure "BBODY" ShelleyDelegsPredFailure (AllegraEra c) where
43+
instance InjectRuleFailure "BBODY" ShelleyDelegsPredFailure AllegraEra where
4444
injectFailure = LedgersFailure . injectFailure
4545

46-
instance InjectRuleFailure "BBODY" ShelleyDelplPredFailure (AllegraEra c) where
46+
instance InjectRuleFailure "BBODY" ShelleyDelplPredFailure AllegraEra where
4747
injectFailure = LedgersFailure . injectFailure
4848

49-
instance InjectRuleFailure "BBODY" ShelleyPoolPredFailure (AllegraEra c) where
49+
instance InjectRuleFailure "BBODY" ShelleyPoolPredFailure AllegraEra where
5050
injectFailure = LedgersFailure . injectFailure
5151

52-
instance InjectRuleFailure "BBODY" ShelleyDelegPredFailure (AllegraEra c) where
52+
instance InjectRuleFailure "BBODY" ShelleyDelegPredFailure AllegraEra where
5353
injectFailure = LedgersFailure . injectFailure

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import Cardano.Ledger.Shelley.Rules (
1111
ShelleyDelegPredFailure,
1212
)
1313

14-
type instance EraRuleFailure "DELEG" (AllegraEra c) = ShelleyDelegPredFailure (AllegraEra c)
14+
type instance EraRuleFailure "DELEG" AllegraEra = ShelleyDelegPredFailure AllegraEra
1515

16-
instance InjectRuleFailure "DELEG" ShelleyDelegPredFailure (AllegraEra c)
16+
instance InjectRuleFailure "DELEG" ShelleyDelegPredFailure AllegraEra

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import Cardano.Ledger.Shelley.Rules (
1515
ShelleyPoolPredFailure,
1616
)
1717

18-
type instance EraRuleFailure "DELEGS" (AllegraEra c) = ShelleyDelegsPredFailure (AllegraEra c)
18+
type instance EraRuleFailure "DELEGS" AllegraEra = ShelleyDelegsPredFailure AllegraEra
1919

20-
instance InjectRuleFailure "DELEGS" ShelleyDelegsPredFailure (AllegraEra c)
20+
instance InjectRuleFailure "DELEGS" ShelleyDelegsPredFailure AllegraEra
2121

22-
instance InjectRuleFailure "DELEGS" ShelleyDelplPredFailure (AllegraEra c) where
22+
instance InjectRuleFailure "DELEGS" ShelleyDelplPredFailure AllegraEra where
2323
injectFailure = DelplFailure
2424

25-
instance InjectRuleFailure "DELEGS" ShelleyPoolPredFailure (AllegraEra c) where
25+
instance InjectRuleFailure "DELEGS" ShelleyPoolPredFailure AllegraEra where
2626
injectFailure = DelplFailure . injectFailure
2727

28-
instance InjectRuleFailure "DELEGS" ShelleyDelegPredFailure (AllegraEra c) where
28+
instance InjectRuleFailure "DELEGS" ShelleyDelegPredFailure AllegraEra where
2929
injectFailure = DelplFailure . injectFailure

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import Cardano.Ledger.Shelley.Rules (
1515
ShelleyPoolPredFailure,
1616
)
1717

18-
type instance EraRuleFailure "DELPL" (AllegraEra c) = ShelleyDelplPredFailure (AllegraEra c)
18+
type instance EraRuleFailure "DELPL" AllegraEra = ShelleyDelplPredFailure AllegraEra
1919

20-
instance InjectRuleFailure "DELPL" ShelleyDelplPredFailure (AllegraEra c)
20+
instance InjectRuleFailure "DELPL" ShelleyDelplPredFailure AllegraEra
2121

22-
instance InjectRuleFailure "DELPL" ShelleyPoolPredFailure (AllegraEra c) where
22+
instance InjectRuleFailure "DELPL" ShelleyPoolPredFailure AllegraEra where
2323
injectFailure = PoolFailure
2424

25-
instance InjectRuleFailure "DELPL" ShelleyDelegPredFailure (AllegraEra c) where
25+
instance InjectRuleFailure "DELPL" ShelleyDelegPredFailure AllegraEra where
2626
injectFailure = DelegFailure

0 commit comments

Comments
 (0)