Skip to content

Added Dijkstra era #5030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ packages:
eras/babbage/test-suite
eras/conway/impl
eras/conway/test-suite
eras/dijkstra
Copy link
Contributor Author

@Soupstraw Soupstraw May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to put the project directly into eras/dijkstra, since we don't want to have the cardano-ledger-<era>-test packages anymore. This gives us a shorter path to Dijkstra 😉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is fine, especially since that is the ultimate goal for all of the previous eras. 👍

eras/mary/impl
eras/shelley/impl
eras/shelley/test-suite
Expand Down
8 changes: 8 additions & 0 deletions docs/NewEra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Adding a new era to `cardano-ledger`

First you need to crate a new sub-package in the `eras` directory.
It's easiest to just copy the `.cabal` file from the previous era and then make
some changes to that. Change the name of the project to `cardano-ledger-<era>`
and update the description/synopsis.

Next you'll want to add a datatype to represent the new era (e.g. `ConwayEra`).
5 changes: 5 additions & 0 deletions eras/dijkstra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for cardano-ledger-dijkstra

## 0.1.0.0 -- YYYY-mm-dd

* First version. Released on an unsuspecting world.
89 changes: 89 additions & 0 deletions eras/dijkstra/cardano-ledger-dijkstra.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
cabal-version: 3.0
name: cardano-ledger-dijkstra
version: 0.1.0.0
license: Apache-2.0
maintainer: [email protected]
author: IOHK
bug-reports: https://github.com/intersectmbo/cardano-ledger/issues
synopsis: Cardano ledger with nested transactions
description:
This package builds upon the Conway ledger with a nested transactions system.

category: Network
build-type: Simple
extra-source-files: CHANGELOG.md

source-repository head
type: git
location: https://github.com/intersectmbo/cardano-ledger
subdir: eras/dijkstra

flag asserts
description: Enable assertions
default: False

library
exposed-modules:
Cardano.Ledger.Dijkstra
Cardano.Ledger.Dijkstra.Era
hs-source-dirs: src

default-language: Haskell2010
ghc-options:
-Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages

build-depends:
base >=4.14 && <5,
cardano-ledger-conway,
cardano-ledger-mary,
cardano-ledger-core,
if flag(asserts)
ghc-options: -fno-ignore-asserts

library testlib
exposed-modules:
visibility: public
hs-source-dirs: testlib
other-modules: Paths_cardano_ledger_dijkstra
default-language: Haskell2010
ghc-options:
-Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages

build-depends:
base,

test-suite tests
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: test
other-modules:
Paths_cardano_ledger_dijkstra

default-language: Haskell2010
ghc-options:
-Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wredundant-constraints
-Wpartial-fields
-Wunused-packages
-threaded
-rtsopts
-with-rtsopts=-N

build-depends:
base,
cardano-ledger-dijkstra:{cardano-ledger-dijkstra, testlib},
3 changes: 3 additions & 0 deletions eras/dijkstra/src/Cardano/Ledger/Dijkstra.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Cardano.Ledger.Dijkstra (module X) where

import Cardano.Ledger.Dijkstra.Era as X
21 changes: 21 additions & 0 deletions eras/dijkstra/src/Cardano/Ledger/Dijkstra/Era.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}

module Cardano.Ledger.Dijkstra.Era (
DijkstraEra,
) where

import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.Core (Era (..), Value)
import Cardano.Ledger.Mary (MaryValue)

data DijkstraEra

instance Era DijkstraEra where
type PreviousEra DijkstraEra = ConwayEra
type ProtVerLow DijkstraEra = 12
type ProtVerHigh DijkstraEra = 12

eraName = "Dijkstra"

type instance Value DijkstraEra = MaryValue
33 changes: 33 additions & 0 deletions eras/dijkstra/test/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{-# LANGUAGE TypeApplications #-}

module Main where

import Cardano.Ledger.Dijkstra (DijkstraEra)

main :: IO ()
main =
ledgerTestMain $
describe "Dijkstra" $ do
GoldenTranslation.spec
Golden.spec
Spec.spec
Proposals.spec
Binary.spec
Cddl.spec
DRepRatify.spec
CommitteeRatify.spec
SPORatifySpec.spec
Genesis.spec
GovActionReorder.spec
roundTripJsonEraSpec @DijkstraEra
describe "Imp" $
Imp.spec @DijkstraEra
describe "CostModels" $ do
CostModelsSpec.spec @DijkstraEra
describe "TxWits" $ do
TxWitsSpec.spec @DijkstraEra
describe "Plutus" $ do
PlutusSpec.spec
Regression.spec @DijkstraEra
TxInfo.spec

9 changes: 9 additions & 0 deletions hie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ cradle:
- path: "eras/conway/test-suite/test"
component: "cardano-ledger-conway-test:test:cardano-ledger-conway-test"

- path: "eras/dijkstra/src"
component: "lib:cardano-ledger-dijkstra"

- path: "eras/dijkstra/testlib"
component: "cardano-ledger-dijkstra:lib:testlib"

- path: "eras/dijkstra/test"
component: "cardano-ledger-dijkstra:test:tests"

- path: "eras/mary/impl/src"
component: "lib:cardano-ledger-mary"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type MinVersion = 0

-- | Maximum supported version. This is the major protocol version of the latest known
-- protocol version that we want to support, including for development and testing.
type MaxVersion = 12
type MaxVersion = 13

instance Enum Version where
toEnum = errorFail . mkVersion
Expand Down
Loading