REPROSEC / dolev-yao-star-extrinsic

DY* with extrinsic proofs
https://reprosec.org/
Mozilla Public License 2.0
8 stars 0 forks source link

Cleanup DY.Lib.State.{Labeled,Typed} #15

Closed TWal closed 1 month ago

TWal commented 1 month ago

A few things could be reworked.

As pointed by @cwaldm (https://github.com/REPROSEC/dolev-yao-star-extrinsic/issues/12#issuecomment-2092901645), the DY.Lib.State.Labeled predicates have type session_pred whereas the state predicates in DY.Core are state_predicate.

Other things could be cleaned.

cwaldm commented 1 month ago

I would prefer, if the Event and State API are similar, that is, I think we should either split the Event API as well or collapse Labeled and Typed state. Maybe there is a way to unify both even more? For example, https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/event/DY.Lib.Event.Typed.fst#L96-L108 is the same as https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/state/DY.Lib.State.Tagged.fst#L79-L91 and https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/event/DY.Lib.Event.Typed.fst#L83-L86 is the same as https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/state/DY.Lib.State.Tagged.fst#L73-L75 although it has a different name. Similarly, https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/event/DY.Lib.Event.Typed.fst#L74-L81 looks like https://github.com/REPROSEC/dolev-yao-star-extrinsic/blob/6fe7c9d40a097a5bdb2622fe95a0ebf8e9df3f75/src/lib/state/DY.Lib.State.Typed.fst#L32-L35

TWal commented 1 month ago

Ah, your comment and my pull-request crossed each other!

I found that we could not merge DY.Lib.State.Tagged and DY.Lib.State.Typed as easily as it is done in DY.Lib.Event.Typed (we can merge the crypto functions, but not much more, see the PR for more info). But we can do it anyway for consistency between state and event APIs.

I agree that there is a lot of similar code between DY.Lib.State.Tagged and DY.Lib.Event but I don't think we can factor them much more, I already tried to put as much things in DY.Lib.SplitPredicate.