Validate prototype by adding an extra table
Until now we have only had the UTxO table on the UTxO-HD prototype. In the foreseeable future, we will add more tables to the implementation, possibly delegations.
We should add some other table to the prototype to make sure that we will be able to do so in the future without major modifications to the prototype. The table might be trivial, but it should give us enough confidence that we will be able to support other types of tables that can capture the other large maps that exist in the ledger state.
Possible approach
A possible way to approach this is to use SOP in the LedgerStateKind:
type MapKind = Type -> Type -> Type -> Type
type LedgerStateKind = NP MapKind '[UTxO :: Type, OtherMap] -> Type
data LedgerTables (LedgerState ByronBlock) mk = NoByronLedgerTables
newtype LedgerTables (LedgerState (ShelleyBlock proto era)) mk = ShelleyLedgerTables {
npTables :: ZipUncurry mk [ (SL.TxIn (EraCrypto era), Core.TxOut era) -- k and v for UTxO
, (OtherKey era, OtherValue era) ] -- k and v for OtherMap
}
In this way, functions that deal with tables would become NPs of functions. For example:
mapLedgerTables :: NP (mk1 -.2-> mk2) KVs -> LedgerTables l mk1 -> LedgerTables l mk2
(-.2-> is meant to be like -.-> but applies to 2 types, key and value)