Skip to content

Add Dijkstra ledger era #1567

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 18 commits into
base: main
Choose a base branch
from
Open

Add Dijkstra ledger era #1567

wants to merge 18 commits into from

Conversation

geo2a
Copy link
Contributor

@geo2a geo2a commented Jun 20, 2025

Fixes #1544

Needs IntersectMBO/cardano-ledger#5136 --- the Ledger pr was merged to master; I've updates the s-r-p.

Needs draft integration with cardano-node I've attempted to integrate with cardano-node, but abandoned this effort, as we first need an integration into cardano-api.

@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 2 times, most recently from 17f9373 to c9dd81e Compare June 20, 2025 10:17
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 2 times, most recently from dcb8014 to 77f0949 Compare June 20, 2025 11:21
@jasagredo jasagredo moved this to 🏗 In progress in Consensus Team Backlog Jun 20, 2025
Copy link
Contributor

@jasagredo jasagredo left a comment

Choose a reason for hiding this comment

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

Just a drive-by comment

Comment on lines 123 to 125
-- TODO(geo2a): feels weird to introduce a type alias and immediately deprecate it.
-- Do we still need that?
type StandardDijkstra = DijkstraEra
Copy link
Contributor

Choose a reason for hiding this comment

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

This can probably be removed, and all the others too.

@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 11 times, most recently from d17b50a to 1cf12d9 Compare June 26, 2025 07:37
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 4 times, most recently from ee53699 to eabfb42 Compare July 7, 2025 08:59
@geo2a geo2a marked this pull request as ready for review July 7, 2025 09:19
Copy link
Member

@amesgen amesgen left a comment

Choose a reason for hiding this comment

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

Quick train PR review, looks great!

Also enables #1065 (in a later PR)

Copy link
Member

Choose a reason for hiding this comment

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

For consistency with db-synthesizer, you could also read the (trivial) Dijkstra genesis file in here.

(In general, it would be nice to avoid duplicating this logic, also see #1072:

The ideal path to this solution is to separate out the parts of cardano-node and ouroboros-consensus that read node configuration in favor of a shared component. This will prevent any future divergence.

Yak shaving...)

@geo2a
Copy link
Contributor Author

geo2a commented Jul 10, 2025

Update: this was resolved by additional fix-up for the CDDL spec. I've added a relevant note to AddingAnEra.md.

I'm hitting a bit of a wall with my attempts to update the NodeToNode cddls to be aware of the Dijkstra era. I'm parking this PR for now until I've figured out how to address the failing tests.

The following command will trigger the failing test:

cabal test -O0 cardano-test --test-options '-p "Dijkstra.CDDL"'

Specifically, the tests for serialisedCardanoBlock and tx are failing. I've augmented the test failure handler to create reproducer scripts, which will be placed in ouroboros-consensus-cardano/failing_cddl_tests:

ls -la failing_cddl_tests/
total 176
drwxr-xr-x 1 geo2a users   340 Jul 10 14:03 .
drwxr-xr-x 1 geo2a users   254 Jul 10 14:03 ..
-rw-r--r-- 1 geo2a users   325 Jul 10 14:03 call_cuddle_serialisedCardanoBlock_failing.sh
-rw-r--r-- 1 geo2a users   265 Jul 10 14:03 call_cuddle_tx_failing.sh
-rw------- 1 geo2a users  1752 Jul 10 14:03 serialisedCardanoBlock_failing.cbor
-rw-r--r-- 1 geo2a users 79115 Jul 10 14:03 serialisedCardanoBlock_failing.cddl
-rw------- 1 geo2a users   899 Jul 10 14:03 tx_failing.cbor
-rw-r--r-- 1 geo2a users 80987 Jul 10 14:03 tx_failing.cddl

@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 2 times, most recently from 5edc875 to 30a924e Compare July 11, 2025 08:26
@geo2a geo2a moved this from 🏗 In progress to 🚫 Help needed in Consensus Team Backlog Jul 11, 2025
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch from 30a924e to 86caea9 Compare July 14, 2025 07:40
Copy link
Contributor

@jasagredo jasagredo left a comment

Choose a reason for hiding this comment

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

The PR looks good. Just some minor comments here and there.

-- | The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage
-- and Conway eras enabled, using 'ShelleyNodeToClientVersion8' for the
-- | The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo, Babbage,
-- Conway and Dijkstra eras enabled, using 'ShelleyNodeToClientVersion8' for the
-- Shelley-based eras.
pattern CardanoNodeToClientVersion12 :: BlockNodeToClientVersion (CardanoBlock c)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect many of these old NTC versions could be dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do I know which one of them are not needed anymore? Do I need to look somewhere in cardano-node or ouroborus-network?

@@ -833,6 +897,7 @@ protocolInfoCardano paramsCardano
(Shelley.ShelleyStorageConfig tpraosSlotsPerKESPeriod k)
(Shelley.ShelleyStorageConfig tpraosSlotsPerKESPeriod k)
(Shelley.ShelleyStorageConfig tpraosSlotsPerKESPeriod k)
(Shelley.ShelleyStorageConfig tpraosSlotsPerKESPeriod k)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I didn't realize this was called tpraos even for the praos blocks.

Copy link
Contributor Author

@geo2a geo2a Jul 15, 2025

Choose a reason for hiding this comment

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

Hmmmm, we also have praosSlotsPerKESPeriod in scope, which is defined as SL.sgSlotsPerKESPeriod genesisShelley. In turn, tpraosSlotsPerKESPeriod is defined through a couple more indirection to be the same thing.

So while the values do coincide, it is probably morally right to use tpraosSlotsPerKESPeriod for Praos era blocks.

ShelleyCompatible p DijkstraEra =>
TxLimits (ShelleyBlock p DijkstraEra)
where
type TxMeasure (ShelleyBlock p DijkstraEra) = ConwayMeasure
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we have a DijkstraMeasure that might be a newtype over ConwayMeasure? I guess it is not really necessary though

@@ -178,7 +182,7 @@ fromShelleyLedgerExamples
results =
labelled
[ ("LedgerTip", SomeResult GetLedgerTip (blockPoint blk))
, ("EpochNo", SomeResult GetEpochNo 10)
, ("EpochNo", SomeResult GetEpochNo (EpochNo 10))
Copy link
Contributor

Choose a reason for hiding this comment

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

EpochNo is no longer an instance of Num?

@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch from 86caea9 to f5a1f86 Compare July 15, 2025 12:07
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch from 9772e8b to a8f0463 Compare July 15, 2025 14:30
@geo2a geo2a moved this from 🚫 Help needed to 🏗 In progress in Consensus Team Backlog Jul 15, 2025
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch 2 times, most recently from 1be4de3 to 6c2b2e1 Compare July 15, 2025 17:17
@geo2a geo2a force-pushed the geo2a/issue1544-dijkstra-era branch from 6c2b2e1 to 91eb2fd Compare July 15, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

Add Dijkstra ledger era
4 participants