IntersectMBO / IntersectMBO/ouroboros-consensus
Don't use header protocol version for encoding Shelley headers
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
Currently (ever since https://github.com/IntersectMBO/ouroboros-network/pull/4349), we use the following logic to serialize headers (was recently touched by #1687, but still the same thing):
https://github.com/IntersectMBO/ouroboros-consensus/blob/61dee3805ff35d9234f4ffe461f296b98335a35e/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos/Header.hs#L151
This seems wrong; `hbProtVer` is the header protocol version, which is a completely arbitrary value not related to Ledger protocol versions, and in particular *not* necessarily equal to the Ledger protocol version from the ledger state that arises by applying the header of this block. (This is a common point of confusion; especially as in the Haskell node, we set it (when forging) to the maximum Ledger protocol version supported by the node, also see #1224)
The goal of this ticket is to stop using `hbProtVer` for this purpose:
- We could propagate the Ledger protocol version upwards, and provide it where we now which Ledger era this header is constructed for.
- Alternatively, we could completely stop using Ledger's `EncCBOR`/`DecCBOR` type classes for headers; then we don't even need to provide a Ledger protocol version for serialization.
We should also use this opportunity to make sure there are no (and won't be) any serialization problems, as the current decoding function for Shelley headers uses the max Ledger protocol version of the current era.
Contributor guide
Assessment
This issue has not been assessed yet.