britram / rains-prototype

draft-trammell-rains-protocol: RAINS, Another Internet Naming System
2 stars 2 forks source link

Add sorting definition of object value for each type #36

Closed fehlmach closed 5 years ago

fehlmach commented 6 years ago

Assertions must be sorted deterministically for signature validation in shards. So far the draft only sorts assertions by their name, But there might be assertions for different types and even several assertions per type. We have to define an order on the types (I suggest their code number) and for each type how the objects of this type are sorted.

britram commented 6 years ago

We have to define an order on the types (I suggest their code number

Yes.

and for each type how the objects of this type are sorted.

Hm. By "lexical order" of the serialized byte string (considered in network byte order); i.e. for v6 addresses :: < 1:: < 1::1 < 1::1:0 < 2:: and so on.

fehlmach commented 6 years ago

That would mean, we encode an object in cbor and then compare the resulting cbor byte strings, right? So we must make sure, that it is clear for each object, how to serialize it in cbor. Which is the case, I think.

britram commented 6 years ago

Yep. We need to do this for signing anyway, so we might as well do it for sorting too.