entropyxyz / manul

Round-based distributed protocols
https://docs.rs/manul
GNU Affero General Public License v3.0
1 stars 1 forks source link

Is `BTreeMap` safe to use when serializing? #18

Open fjarri opened 6 days ago

fjarri commented 6 days ago

EchoRoundMessage uses it, and various evidences too. Do serializers generally support it? What happens if keys repeat? We need it to be an error. Should we use Vec instead to be on the safe side? Or we can write a wrapper type that serializes as a Vec.

fjarri commented 1 day ago

Testing some popular format crates:

So there are two problems here:

It seems like we do need to wrap all BTreeMaps in the serialized data into something that serializes as a vector of pairs. And using serde_asn1_der for tests will help uncover places where it wasn't done.