Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can do session types already in stable Rust without const generics. Each "enum variant" can be its own separate type, and such types can only be instantiated by a method on the type representing the previous state, which also consumes that previous state.

We've used them in our Bulletproofs MPC (multi-party computation) where cryptographic requirement is not to replay the protocol from the mid-point. Since the user is supposed to perform these transitions within their application on top of network messages, such strongly-typed API guarantees that, if their program has compiled successfully, then:

1) Steps are performed in correct order. 2) The protocol cannot be replayed from the intermediate state.

We have wrote about it here: https://medium.com/interstellar/bulletproofs-pre-release-fcb... - scroll to "strongly-typed multiparty computation".



Here is updated link to the original article on MPC by Cathie Yun: https://medium.com/@cathieyun/bulletproof-multi-party-comput...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: