Proof using.
intros.
unfold msg_serialize, msg_deserialize.
destruct a;
cheerios_crush;
simpl;
(unfold RequestVote_deserialize ||
unfold RequestVoteReply_deserialize ||
unfold AppendEntries_deserialize ||
unfold AppendEntriesReply_deserialize);
cheerios_crush.
Qed.
Global Instance msg_Serializer : Serializer msg :=
{| serialize := msg_serialize;
deserialize := msg_deserialize;
serialize_deserialize_id := msg_serialize_deserialize_id |}.
Definition serialize_serverType (t : serverType) :=
match t with
| Follower => serialize x00
| Candidate => serialize x01
| Leader => serialize x02
end.
Definition deserialize_serverType : ByteListReader.t serverType :=
tag <- deserialize;;
match tag with
| x00 => ByteListReader.ret Follower
| x01 => ByteListReader.ret Candidate
| x02 => ByteListReader.ret Leader
| _ => ByteListReader.error
end.

Lemma serverType_serialize_deserialize_id :
serialize_deserialize_id_spec serialize_serverType deserialize_serverType.