cardano-ledger
cardano-ledger copied to clipboard
Lighter-weight codec for the ledger state file on disk
While investigating Issue https://github.com/IntersectMBO/ouroboros-consensus/issues/868, it became apparent that part of the problem is simply how much is allocated when serializing the ledger state. The UTxO map is a notable outlier, but it's not the only non-trivial cost in there (~70 seconds wall clock with the UTxO versus ~20 seconds wall clock with an empty UTxO map).
@lehins mentioned an idea to use a "raw" byte strings (ie CBOR major type 2) instead of the fully granular CBOR encoding of each individual UTxO. This is unacceptable for on-chain/on-the-wire data, but it's fine for the local file that persists the ledger state between the node's executions.