writeStateVector = (encoder, sv) => {
  encoding.writeVarUint(encoder.restEncoder, sv.size);
  Array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {
    encoding.writeVarUint(encoder.restEncoder, client); // @todo use a special client decoder that is based on mapping

    encoding.writeVarUint(encoder.restEncoder, clock);
  });
  return encoder;
}
@param {DSEncoderV1 | DSEncoderV2} encoder
@param {Map<number,number>} sv
@function