Skip to content

Commit 653e068

Browse files
committed
Added Dijkstra era
1 parent 82c3d9b commit 653e068

Some content is hidden

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

80 files changed

+8964
-141
lines changed

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ packages:
3838
eras/babbage/test-suite
3939
eras/conway/impl
4040
eras/conway/test-suite
41+
eras/dijkstra
4142
eras/mary/impl
4243
eras/shelley/impl
4344
eras/shelley/test-suite

docs/NewEra.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Adding a new era to `cardano-ledger`
2+
3+
First you need to crate a new sub-package in the `eras` directory.
4+
It's easiest to just copy the `.cabal` file from the previous era and then make
5+
some changes to that. Change the name of the project to `cardano-ledger-<era>`
6+
and update the description/synopsis.
7+
8+
Next you'll want to add a datatype to represent the new era (e.g. `ConwayEra`).
9+
Then copy over the entire test suite from the previous era and substitute the
10+
era types for the newly added era type. Once the tests are in place, the type
11+
checker will guide you to add all the necessary type family and type class
12+
instances.
13+
14+
Add the `Cardano.Ledger.<era>.Core` module and re-export the `Core` module from
15+
the previous era. Use the `Core` module from the current era whenever you need
16+
to import anything from the core module. Do the same for
17+
`Cardano.Ledger.<era>.State`.
18+
19+
It's a good idea to re-use the data types defined in the previous era at first.
20+
You might need to use `coerce` in a couple of places to change the era parameter
21+
when translating these types. Also, there might be some constraints that expect
22+
the era to be exactly the previous era, you will probably be able to generalize
23+
these functions and type class instances to make them compatible with the new era.
24+
25+
For `EraRule` instances use the same rules as in the previous era.

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

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ library
124124
library testlib
125125
exposed-modules:
126126
Test.Cardano.Ledger.Conway.Arbitrary
127+
Test.Cardano.Ledger.Conway.BinarySpec
127128
Test.Cardano.Ledger.Conway.Binary.Annotator
128129
Test.Cardano.Ledger.Conway.Binary.Cddl
130+
Test.Cardano.Ledger.Conway.Binary.CddlSpec
129131
Test.Cardano.Ledger.Conway.Binary.Regression
130132
Test.Cardano.Ledger.Conway.Binary.RoundTrip
131133
Test.Cardano.Ledger.Conway.CDDL
@@ -137,6 +139,14 @@ library testlib
137139
Test.Cardano.Ledger.Conway.Imp.DelegSpec
138140
Test.Cardano.Ledger.Conway.Imp.EnactSpec
139141
Test.Cardano.Ledger.Conway.Imp.EpochSpec
142+
Test.Cardano.Ledger.Conway.CommitteeRatifySpec
143+
Test.Cardano.Ledger.Conway.DRepRatifySpec
144+
Test.Cardano.Ledger.Conway.GenesisSpec
145+
Test.Cardano.Ledger.Conway.GoldenSpec
146+
Test.Cardano.Ledger.Conway.TxInfoSpec
147+
Test.Cardano.Ledger.Conway.GovActionReorderSpec
148+
Test.Cardano.Ledger.Conway.Plutus.PlutusSpec
149+
Test.Cardano.Ledger.Conway.SPORatifySpec
140150
Test.Cardano.Ledger.Conway.Imp.GovCertSpec
141151
Test.Cardano.Ledger.Conway.Imp.GovSpec
142152
Test.Cardano.Ledger.Conway.Imp.LedgerSpec
@@ -162,6 +172,7 @@ library testlib
162172
-Wunused-packages
163173

164174
build-depends:
175+
aeson,
165176
FailT,
166177
base,
167178
bytestring,
@@ -174,6 +185,7 @@ library testlib
174185
cardano-ledger-core:{cardano-ledger-core, testlib},
175186
cardano-ledger-shelley:{cardano-ledger-shelley, testlib},
176187
cardano-strict-containers,
188+
cardano-slotting:testlib,
177189
containers,
178190
cuddle >=0.3.2,
179191
data-default,
@@ -236,18 +248,8 @@ test-suite tests
236248
hs-source-dirs: test
237249
other-modules:
238250
Paths_cardano_ledger_conway
239-
Test.Cardano.Ledger.Conway.Binary.CddlSpec
240-
Test.Cardano.Ledger.Conway.BinarySpec
241-
Test.Cardano.Ledger.Conway.CommitteeRatifySpec
242-
Test.Cardano.Ledger.Conway.DRepRatifySpec
243-
Test.Cardano.Ledger.Conway.GenesisSpec
244-
Test.Cardano.Ledger.Conway.GoldenSpec
245-
Test.Cardano.Ledger.Conway.GoldenTranslation
246-
Test.Cardano.Ledger.Conway.GovActionReorderSpec
247-
Test.Cardano.Ledger.Conway.Plutus.PlutusSpec
248-
Test.Cardano.Ledger.Conway.SPORatifySpec
249251
Test.Cardano.Ledger.Conway.Spec
250-
Test.Cardano.Ledger.Conway.TxInfoSpec
252+
Test.Cardano.Ledger.Conway.GoldenTranslation
251253

252254
default-language: Haskell2010
253255
ghc-options:
@@ -264,22 +266,9 @@ test-suite tests
264266

265267
build-depends:
266268
HUnit,
267-
aeson,
268269
base,
269-
cardano-data,
270-
cardano-ledger-allegra,
271-
cardano-ledger-alonzo,
272270
cardano-ledger-alonzo:testlib,
273-
cardano-ledger-babbage,
274-
cardano-ledger-binary:{cardano-ledger-binary, testlib},
275271
cardano-ledger-conway,
276272
cardano-ledger-core,
277273
cardano-ledger-core:testlib,
278-
cardano-ledger-shelley,
279-
cardano-slotting:testlib,
280-
cardano-strict-containers,
281-
containers,
282-
data-default,
283-
microlens,
284-
plutus-ledger-api,
285274
testlib,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ toConwayGovPairs cg@(ConwayGovState _ _ _ _ _ _ _) =
398398
, "futurePParams" .= cgsFuturePParams
399399
]
400400

401-
instance EraPParams ConwayEra => EraGov ConwayEra where
401+
instance EraGov ConwayEra where
402402
type GovState ConwayEra = ConwayGovState ConwayEra
403403

404404
curPParamsGovStateL = cgsCurPParamsL

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ module Cardano.Ledger.Conway.PParams (
8181
conwayModifiedPPGroups,
8282
pvtHardForkInitiationL,
8383
pvtMotionNoConfidenceL,
84+
conwayApplyPPUpdates,
85+
emptyConwayPParams,
86+
emptyConwayPParamsUpdate,
87+
asNaturalHKD,
88+
asBoundedIntegralHKD,
8489
) where
8590

8691
import Cardano.Ledger.Alonzo.PParams

0 commit comments

Comments
 (0)