IntersectMBO/cardano-ledger

Use separate serialization/types for ledger queries

amesgen opened this issue · 0 comments

The Local State Query mini-protocol supports a variety of messages involving types from Ledger (see here for the definition).
Currently, serialization of queries uses the {Enc,Dec,To,From}CBOR instances provided by ledger.

These ledger queries have to be backwards-compatible across node releases; only the serialization is allowed to vary (gated behind the NodeToClient version). However, it is currently easy to make mistakes here:

Both cases are currently handled by vendoring old Ledger code in Consensus. While this works, it is not ideal, rather, quoting @lehins:

There are three things that need to be done to solve this properly IMHO:

  • Separate types for queries, so that we don't get into situation like above where we can't roundtrip the result of the query because the type was expanded with new information
  • Separate type class that supports serialization versioning parameterized on NoteToClient protocol version.
  • CDDL specification for all types and versions (#4396)