-
Notifications
You must be signed in to change notification settings - Fork 0
Description
To coordinate the end of a cooldown period, we need to be able to store certificates in blocks. As they are too large to be stored in headers (which would be preferable in an ideal world as they are a Consensus concern, not a Ledger concern), we store them in block bodies instead.
As the block body is nowadays purely managed by the Ledger, we should closely collaborate with them on this (we already talked to them at the Peras Paris workshop).
Status quo of block bodies
Some hints through the many layers of abstraction:
-
In Consensus, a
CardanoBlockis aHardForkBlock, which is an n-ary sum, with each summand being the block type of a particular era. -
Apart from Byron, all eras are Shelley-based eras, and use
ShelleyBlockwith different parameters.protois the Consensus protocol, which is eitherTPraos(transitional Praos, a legacy protocol) orPraos(the current protocol)erais the Ledger era, ie (on a really high level) which features are supported by transactions, whose details are largely irrelevant for Consensus.
See https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-table.md for a reference.
-
A
ShelleyBlockcontains a LedgerBlock, which contains a header (instantiated by the Consensus layer) and aBlockBody, which is era-dependent. The most recent concrete instantiation isAlonzoBlockBodyat the moment.Fundamentally, it contains nothing but a sequence of transactions.
Implementation approaches
-
We could adapt the
BlockBodyinstance for the Dijkstra Ledger era (as that one is still experimental ATM) and add aMaybe PerasCertfield to it. It also needs to count towards the hash.This means that Ledger needs to be aware of Peras certificates.
-
We could not modify the Ledger at all, and rather store the Peras certificate in
ShelleyBlockin Consensus. This means we now need to define the hash of a block body ourselves, ie hashing the LedgerBlockBodyhash together with the serialization of the (optional) Peras certificate. -
Like 2, but add a new type parameter to
Block(maybeconsensusBlockBody). -
No longer use
BlockinShelleyBlock, instead,ShelleyBlockshould look like this:data ShelleyBlock proto era = ShelleyBlock { shelleyBlockHeader :: !(ShelleyProtocolHeader proto) , shelleyBlockBody :: !(SL.BlockBody era) , shelleyBlockPerasCert :: !(StrictMaybe (PerasCert (ShelleyBlock proto era))) , shelleyBlockHeaderHash :: !ShelleyHash }
We can also coordinate with Leios a bit, as they will also need to store certificates in block bodies.