Skip to content
Merged
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
36 changes: 36 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,39 @@ if os (windows)

constraints:
tasty <1.5.4,

-- master after https://github.com/IntersectMBO/cardano-ledger/pull/6148
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
--sha256: sha256-s/LVusbn3sE+yXYyOJpEg52PY+YVKqwmmEFdHM9ikD0=
tag: 0a72d43f5996c23eae1f6164d7d6a4dfeabe4c7f
subdir:
libs/cardano-data
libs/cardano-ledger-api
libs/small-steps
libs/cardano-ledger-binary
libs/cardano-ledger-core
libs/cardano-protocol
libs/cardano-protocol-tpraos
eras/byron/chain/executable-spec
eras/byron/ledger/executable-spec
eras/shelley/impl
eras/shelley/test-suite
eras/shelley-ma/test-suite
eras/mary/impl
eras/allegra/impl
eras/alonzo/impl
eras/alonzo/test-suite
eras/babbage/impl
eras/conway/impl
eras/dijkstra/impl

allow-newer:
, cardano-keys:cardano-ledger-core
, cardano-keys:cardano-ledger-shelley
, cardano-keys:cardano-protocol
, cardano-config:cardano-ledger-conway
, cardano-config:cardano-ledger-core
, cardano-config:cardano-ledger-dijkstra
, cardano-config:cardano-ledger-shelley
105 changes: 105 additions & 0 deletions changelog.d/20261009_135300_javier.sagredo_praos2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->

### Breaking

- The Dijkstra era now runs a new protocol, `Praos2` (in the new module
`Ouroboros.Consensus.Protocol.Praos2`): Praos with the Leios overlay. Every
Dijkstra type in `ouroboros-consensus-cardano` (`StandardDijkstraBlock`, the
`CardanoShelleyEras` list, and the `Dijkstra` patterns of `CardanoBlock`,
`CardanoHeader`, `CardanoGenTx`, the configurations, and so on) changes from
`ShelleyBlock (Praos c) DijkstraEra` to `ShelleyBlock (Praos2 c)
DijkstraEra`. `CardanoHardForkConstraints` additionally requires the new
`LeiosCrypto c`.
- Dijkstra headers are now the Leios block header from `cardano-protocol`,
which adds whether the block body carries a Leios certificate and an optional
endorser block announcement. This changes the wire format of Dijkstra headers
and blocks, and the on-disk encoding of the Dijkstra `ChainDepState`, which
records the latest announcement. The `ChainDepState` encoding of the other
eras is unchanged. The `LeiosEraBlockHeader` instance that adapted the Praos header to
Dijkstra is removed, as is `ShelleyCompatible (Praos c) DijkstraEra`.
- `Praos2` validates the Leios fields of a header, failing with the new
`LeiosEbTooBig`, `LeiosCertWithoutAnnouncement` and `LeiosCertTooYoung`
validation errors. These constructors cannot be built for `Praos`.
- The Praos implementation moved to the new module
`Ouroboros.Consensus.Protocol.PolyPraos`, where its types are indexed by the
protocol so that `Praos` and `Praos2` share them:
- `PraosState` is replaced by `PolyPraosState proto`, which gains the
`praosStateLeiosAnnouncement` field. `PraosState c` is now a synonym for
`PolyPraosState (Praos c)`.
- `PraosValidationErr c` is replaced by `PolyPraosValidationErr proto c`, and
is now a synonym for `PolyPraosValidationErr (Praos c) c`.
- In `Ouroboros.Consensus.Protocol.Praos.Views`, `HeaderView crypto` becomes
`PolyPraosValidateView proto crypto`, which gains the `hvLeios` field and
signs `Signed (ShelleyProtocolHeader proto)` instead of the Praos
`HeaderBody`. `PraosLedgerView` becomes `PolyPraosLedgerView proto`, which
gains the Leios fields `plvCommittee`, `plvQuorumStakeThreshold`,
`plvAnnouncementPeriodLength`, `plvVotePeriodLength`,
`plvDiffusionPeriodLength`, `plvMaxEbBodySize` and `plvMaxEbTxsSize`.
`forecastToPraosLedgerView` is replaced by the method
`forecastToPolyPraosLedgerView` of the new class
`ForecastToPolyPraosLedgerView`.
- `Ouroboros.Consensus.Protocol.Praos` re-exports what it used to define, and
adds the synonyms `PraosLedgerView c` and `PraosValidateView c`.
- `PraosCrypto c` is now defined through the new `PolyPraosCrypto proto c`.
- `praosCheckCanForge` takes the `PraosParams` instead of the whole
`ConsensusConfig (Praos c)`.
- New data family `LeiosOnly proto a b` in
`Ouroboros.Consensus.Protocol.Praos.Common`, which is `a` for the protocols
without Leios and `b` for those with it. It gates the Leios fields and error
constructors of the shared types. Its instances for `TPraos`, `Praos` and
`Praos2` have the constructors `TPraosLacksLeios`, `PraosLacksLeios` and
`Praos2HasLeios`.
The synonyms `WhenLeios proto` (for `LeiosOnly proto ()`, a field only the
protocols with Leios fill) and `VoidUnlessLeios proto` (for
`LeiosOnly proto Void`, a constructor only they can build) name its two
uses, and `pureLeiosOnly` is `pure` at `WhenLeios proto`.
- `ShelleyProtocolHeader` is now defined in
`Ouroboros.Consensus.Protocol.Praos.Common`.
`Ouroboros.Consensus.Shelley.Protocol.Abstract` still re-exports it.
- `blockMatchesHeader` for Shelley-based blocks additionally requires that the
header's claim that the body carries a Leios certificate is true, and that a
body does not carry both a certificate and transactions. This adds the method
`pHeaderContainsLeiosCert` to `ProtocolHeaderSupportsEnvelope` (with
`defaultHeaderContainsLeiosCert` for protocols without Leios) and the method
`blockBodyContainsLeiosCert` to `ShelleyBasedEra` (with
`defaultBlockBodyContainsLeiosCert` for eras without Leios).
- `ProtocolHeaderSupportsKES.mkHeader` takes a proxy for the era of the block
being forged, and the Leios fields of the header as a
`WhenLeios proto (Bool, StrictMaybe EbReferencesAnnouncement)`.
`forgeShelleyBlock` additionally requires `Applicative (WhenLeios proto)`.
- The `EncodeDisk` and `DecodeDisk` instances for the Praos chain-dependent
state are now for `PolyPraosState proto`, and require the new
`SerialisePraosState proto`.
- Integrated a new `cardano-ledger`:
- The on-disk encoding of the ledger state changes in every Shelley-based
era.
- `protocolInfoCardano` no longer seeds the initial stake snapshots itself
when hard-forking at epoch 0 or 1. The ledger's `injectIntoTestState` now
seeds them in every Shelley-based era, and seats the initial Leios committee
in Dijkstra.
- Dijkstra header bodies are built with the ledger's `mkHeaderBody`, which
memoizes their serialisation. The KES signature therefore covers the bytes
of the body as forged (encoded at the era's protocol version) or as
received, instead of a re-encoding at the version in the header's version
info.
- The node-to-node CDDL for Dijkstra headers refers to the ledger's
`dijkstra.header`, instead of aliasing the Conway header.
- `getPoolDistr` for Shelley ledger states reads the stake pool distribution
through the ledger's `nesStakePoolDistrG`, since `nesPd` was removed.

### Non-Breaking

- New `praos2SharedBlockForging` in `Ouroboros.Consensus.Shelley.Node.Praos`,
used to forge Dijkstra blocks. Forging does not yet certify or announce
endorser blocks.
- New `TranslateProto` instances from `Praos` and from `TPraos` to `Praos2`.
- New `minCertificationSlot` in `Ouroboros.Consensus.Leios.Types`: the earliest
slot at which a block may certify an endorser block announced in a given slot,
once the announcement, vote and diffusion periods have elapsed.
- New `TypeSwitch` class in `Ouroboros.Consensus.Protocol.Praos.Common`, used to
build the `LeiosOnly` values that only one kind of protocol can have.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ header
serialisedShelleyHeader<alonzo.header>,
serialisedShelleyHeader<babbage.header>,
serialisedShelleyHeader<conway.header>,
serialisedShelleyHeader<dijkstraPraosHeader>>
serialisedShelleyHeader<dijkstra.header>>

byronHeader = [byronRegularIdx, #6.24(bytes .cbor byron.blockhead)]
/ [byronBoundaryIdx, #6.24(bytes .cbor byron.ebbhead)]
Expand All @@ -16,8 +16,6 @@ byronRegularIdx = [1, base.word32]

serialisedShelleyHeader<era> = #6.24(bytes .cbor era)

dijkstraPraosHeader = conway.header

;# include byron as byron
;# include shelley as shelley
;# include allegra as allegra
Expand Down
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ouroboros-consensus-cardano/golden/shelley/disk/ExtLedgerState
Binary file not shown.
Binary file modified ouroboros-consensus-cardano/golden/shelley/disk/LedgerState
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ import Ouroboros.Consensus.Ledger.SupportsMempool
)
import Ouroboros.Consensus.Protocol.Abstract (ChainDepState)
import Ouroboros.Consensus.Protocol.Praos (Praos)
import Ouroboros.Consensus.Protocol.Praos2 (Praos2)
import Ouroboros.Consensus.Protocol.TPraos (TPraos)
import Ouroboros.Consensus.Shelley.Eras
import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock)
Expand All @@ -253,7 +254,7 @@ type CardanoShelleyEras c =
, ShelleyBlock (TPraos c) AlonzoEra
, ShelleyBlock (Praos c) BabbageEra
, ShelleyBlock (Praos c) ConwayEra
, ShelleyBlock (Praos c) DijkstraEra
, ShelleyBlock (Praos2 c) DijkstraEra
]

type ShelleyBasedLedgerEras :: Type -> [Type]
Expand Down Expand Up @@ -281,7 +282,7 @@ pattern TagMary :: f (ShelleyBlock (TPraos c) MaryEra) -> NS f (CardanoEras c)
pattern TagAlonzo :: f (ShelleyBlock (TPraos c) AlonzoEra) -> NS f (CardanoEras c)
pattern TagBabbage :: f (ShelleyBlock (Praos c) BabbageEra) -> NS f (CardanoEras c)
pattern TagConway :: f (ShelleyBlock (Praos c) ConwayEra) -> NS f (CardanoEras c)
pattern TagDijkstra :: f (ShelleyBlock (Praos c) DijkstraEra) -> NS f (CardanoEras c)
pattern TagDijkstra :: f (ShelleyBlock (Praos2 c) DijkstraEra) -> NS f (CardanoEras c)

pattern TagByron x = Z x
pattern TagShelley x = S (Z x)
Expand All @@ -303,7 +304,8 @@ pattern EraMary :: K () (ShelleyBlock (TPraos c) MaryEra) -> EraIndex (CardanoEr
pattern EraAlonzo :: K () (ShelleyBlock (TPraos c) AlonzoEra) -> EraIndex (CardanoEras c)
pattern EraBabbage :: K () (ShelleyBlock (Praos c) BabbageEra) -> EraIndex (CardanoEras c)
pattern EraConway :: K () (ShelleyBlock (Praos c) ConwayEra) -> EraIndex (CardanoEras c)
pattern EraDijkstra :: K () (ShelleyBlock (Praos c) DijkstraEra) -> EraIndex (CardanoEras c)
pattern EraDijkstra ::
K () (ShelleyBlock (Praos2 c) DijkstraEra) -> EraIndex (CardanoEras c)

pattern EraByron x = EraIndex (TagByron x)
pattern EraShelley x = EraIndex (TagShelley x)
Expand Down Expand Up @@ -387,7 +389,7 @@ pattern TeleDijkstra ::
g (ShelleyBlock (TPraos c) AlonzoEra) ->
g (ShelleyBlock (Praos c) BabbageEra) ->
g (ShelleyBlock (Praos c) ConwayEra) ->
f (ShelleyBlock (Praos c) DijkstraEra) ->
f (ShelleyBlock (Praos2 c) DijkstraEra) ->
Telescope g f (CardanoEras c)

-- Here we use layout and adjacency to make it obvious that we haven't
Expand Down Expand Up @@ -448,7 +450,7 @@ pattern BlockBabbage b = HardForkBlock (OneEraBlock (TagBabbage (I b)))
pattern BlockConway :: ShelleyBlock (Praos c) ConwayEra -> CardanoBlock c
pattern BlockConway b = HardForkBlock (OneEraBlock (TagConway (I b)))

pattern BlockDijkstra :: ShelleyBlock (Praos c) DijkstraEra -> CardanoBlock c
pattern BlockDijkstra :: ShelleyBlock (Praos2 c) DijkstraEra -> CardanoBlock c
pattern BlockDijkstra b = HardForkBlock (OneEraBlock (TagDijkstra (I b)))

{-# COMPLETE
Expand Down Expand Up @@ -503,7 +505,7 @@ pattern HeaderConway ::
pattern HeaderConway h = HardForkHeader (OneEraHeader (TagConway h))

pattern HeaderDijkstra ::
Header (ShelleyBlock (Praos c) DijkstraEra) ->
Header (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoHeader c
pattern HeaderDijkstra h = HardForkHeader (OneEraHeader (TagDijkstra h))

Expand Down Expand Up @@ -546,7 +548,7 @@ pattern GenTxBabbage tx = HardForkGenTx (OneEraGenTx (TagBabbage tx))
pattern GenTxConway :: GenTx (ShelleyBlock (Praos c) ConwayEra) -> CardanoGenTx c
pattern GenTxConway tx = HardForkGenTx (OneEraGenTx (TagConway tx))

pattern GenTxDijkstra :: GenTx (ShelleyBlock (Praos c) DijkstraEra) -> CardanoGenTx c
pattern GenTxDijkstra :: GenTx (ShelleyBlock (Praos2 c) DijkstraEra) -> CardanoGenTx c
pattern GenTxDijkstra tx = HardForkGenTx (OneEraGenTx (TagDijkstra tx))

{-# COMPLETE
Expand Down Expand Up @@ -604,7 +606,7 @@ pattern GenTxIdConway txid =
HardForkGenTxId (OneEraGenTxId (TagConway (WrapGenTxId txid)))

pattern GenTxIdDijkstra ::
GenTxId (ShelleyBlock (Praos c) DijkstraEra) ->
GenTxId (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoGenTxId c
pattern GenTxIdDijkstra txid =
HardForkGenTxId (OneEraGenTxId (TagDijkstra (WrapGenTxId txid)))
Expand Down Expand Up @@ -678,7 +680,7 @@ pattern ApplyTxErrConway err =
HardForkApplyTxErrFromEra (OneEraApplyTxErr (TagConway (WrapApplyTxErr err)))

pattern ApplyTxErrDijkstra ::
ApplyTxErr (ShelleyBlock (Praos c) DijkstraEra) ->
ApplyTxErr (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoApplyTxErr c
pattern ApplyTxErrDijkstra err =
HardForkApplyTxErrFromEra (OneEraApplyTxErr (TagDijkstra (WrapApplyTxErr err)))
Expand Down Expand Up @@ -767,7 +769,7 @@ pattern LedgerErrorConway err =
(OneEraLedgerError (TagConway (WrapLedgerErr err)))

pattern LedgerErrorDijkstra ::
LedgerError (ShelleyBlock (Praos c) DijkstraEra) ->
LedgerError (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoLedgerError c
pattern LedgerErrorDijkstra err =
HardForkLedgerErrorFromEra
Expand Down Expand Up @@ -840,7 +842,7 @@ pattern OtherHeaderEnvelopeErrorConway err =
HardForkEnvelopeErrFromEra (OneEraEnvelopeErr (TagConway (WrapEnvelopeErr err)))

pattern OtherHeaderEnvelopeErrorDijkstra ::
OtherHeaderEnvelopeError (ShelleyBlock (Praos c) DijkstraEra) ->
OtherHeaderEnvelopeError (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoOtherHeaderEnvelopeError c
pattern OtherHeaderEnvelopeErrorDijkstra err =
HardForkEnvelopeErrFromEra (OneEraEnvelopeErr (TagDijkstra (WrapEnvelopeErr err)))
Expand Down Expand Up @@ -904,7 +906,7 @@ pattern TipInfoConway ::
pattern TipInfoConway ti = OneEraTipInfo (TagConway (WrapTipInfo ti))

pattern TipInfoDijkstra ::
TipInfo (ShelleyBlock (Praos c) DijkstraEra) ->
TipInfo (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoTipInfo c
pattern TipInfoDijkstra ti = OneEraTipInfo (TagDijkstra (WrapTipInfo ti))

Expand Down Expand Up @@ -987,7 +989,7 @@ pattern QueryIfCurrentConway ::
pattern QueryIfCurrentDijkstra ::
() =>
CardanoQueryResult c result ~ a =>
BlockQuery (ShelleyBlock (Praos c) DijkstraEra) fp result ->
BlockQuery (ShelleyBlock (Praos2 c) DijkstraEra) fp result ->
CardanoQuery c fp a

-- Here we use layout and adjacency to make it obvious that we haven't
Expand Down Expand Up @@ -1151,7 +1153,7 @@ pattern CardanoCodecConfig ::
CodecConfig (ShelleyBlock (TPraos c) AlonzoEra) ->
CodecConfig (ShelleyBlock (Praos c) BabbageEra) ->
CodecConfig (ShelleyBlock (Praos c) ConwayEra) ->
CodecConfig (ShelleyBlock (Praos c) DijkstraEra) ->
CodecConfig (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoCodecConfig c
pattern CardanoCodecConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo cfgBabbage cfgConway cfgDijkstra =
HardForkCodecConfig
Expand Down Expand Up @@ -1189,7 +1191,7 @@ pattern CardanoBlockConfig ::
BlockConfig (ShelleyBlock (TPraos c) AlonzoEra) ->
BlockConfig (ShelleyBlock (Praos c) BabbageEra) ->
BlockConfig (ShelleyBlock (Praos c) ConwayEra) ->
BlockConfig (ShelleyBlock (Praos c) DijkstraEra) ->
BlockConfig (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoBlockConfig c
pattern CardanoBlockConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo cfgBabbage cfgConway cfgDijkstra =
HardForkBlockConfig
Expand Down Expand Up @@ -1227,7 +1229,7 @@ pattern CardanoStorageConfig ::
StorageConfig (ShelleyBlock (TPraos c) AlonzoEra) ->
StorageConfig (ShelleyBlock (Praos c) BabbageEra) ->
StorageConfig (ShelleyBlock (Praos c) ConwayEra) ->
StorageConfig (ShelleyBlock (Praos c) DijkstraEra) ->
StorageConfig (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoStorageConfig c
pattern CardanoStorageConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo cfgBabbage cfgConway cfgDijkstra =
HardForkStorageConfig
Expand Down Expand Up @@ -1268,7 +1270,7 @@ pattern CardanoConsensusConfig ::
PartialConsensusConfig (BlockProtocol (ShelleyBlock (TPraos c) AlonzoEra)) ->
PartialConsensusConfig (BlockProtocol (ShelleyBlock (Praos c) BabbageEra)) ->
PartialConsensusConfig (BlockProtocol (ShelleyBlock (Praos c) ConwayEra)) ->
PartialConsensusConfig (BlockProtocol (ShelleyBlock (Praos c) DijkstraEra)) ->
PartialConsensusConfig (BlockProtocol (ShelleyBlock (Praos2 c) DijkstraEra)) ->
CardanoConsensusConfig c
pattern CardanoConsensusConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo cfgBabbage cfgConway cfgDijkstra <-
HardForkConsensusConfig
Expand Down Expand Up @@ -1308,7 +1310,7 @@ pattern CardanoLedgerConfig ::
PartialLedgerConfig (ShelleyBlock (TPraos c) AlonzoEra) ->
PartialLedgerConfig (ShelleyBlock (Praos c) BabbageEra) ->
PartialLedgerConfig (ShelleyBlock (Praos c) ConwayEra) ->
PartialLedgerConfig (ShelleyBlock (Praos c) DijkstraEra) ->
PartialLedgerConfig (ShelleyBlock (Praos2 c) DijkstraEra) ->
CardanoLedgerConfig c
pattern CardanoLedgerConfig cfgByron cfgShelley cfgAllegra cfgMary cfgAlonzo cfgBabbage cfgConway cfgDijkstra <-
HardForkLedgerConfig
Expand Down Expand Up @@ -1404,7 +1406,7 @@ pattern LedgerStateConway st <-
)

pattern LedgerStateDijkstra ::
LedgerState (ShelleyBlock (Praos c) DijkstraEra) mk ->
LedgerState (ShelleyBlock (Praos2 c) DijkstraEra) mk ->
CardanoLedgerState c mk
pattern LedgerStateDijkstra st <-
HardForkLedgerState
Expand Down Expand Up @@ -1485,7 +1487,7 @@ pattern ChainDepStateConway st <-
(TeleConway _ _ _ _ _ _ (State.Current{currentState = WrapChainDepState st}))

pattern ChainDepStateDijkstra ::
ChainDepState (BlockProtocol (ShelleyBlock (Praos c) DijkstraEra)) ->
ChainDepState (BlockProtocol (ShelleyBlock (Praos2 c) DijkstraEra)) ->
CardanoChainDepState c
pattern ChainDepStateDijkstra st <-
State.HardForkState
Expand Down
Loading
Loading