Refinements for Multiparty Message-Passing Protocols: Specification-agnostic theory and implementation

Vassor Martin,Yoshida Nobuko
2024-08-09
Abstract:Multiparty message-passing protocols are notoriously difficult to design, due to interaction mismatches that lead to errors such as deadlocks. Existing protocol specification formats have been developed to prevent such errors (e.g. multiparty session types (MPST)). In order to further constrain protocols, specifications can be extended with refinements, i.e. logical predicates to control the behaviour of the protocol based on previous values exchanged. Unfortunately, existing refinement theories and implementations are tightly coupled with specification formats. This paper proposes a framework for multiparty message-passing protocols with refinements and its implementation in Rust. Our work decouples correctness of refinements from the underlying model of computation, which results in a specification-agnostic framework. Our contributions are threefold. First, we introduce a trace system which characterises valid refined traces, i.e. a sequence of sending and receiving actions correct with respect to refinements. Second, we give a correct model of computation named refined communicating system (RCS), which is an extension of communicating automata systems with refinements. We prove that RCS only produce valid refined traces. We show how to generate RCS from mainstream protocol specification formats, such as refined multiparty session types (RMPST) or refined choreography automata. Third, we illustrate the flexibility of the framework by developing both a static analysis technique and an improved model of computation for dynamic refinement evaluation. Finally, we provide a Rust toolchain for decentralised RMPST, evaluate our implementation with a set of benchmarks from the literature, and observe that refinement overhead is negligible.
Programming Languages
What problem does this paper attempt to address?
### What problems does this paper attempt to solve? This paper aims to solve the complexity and error problems in the design of multiparty message - passing protocols. Specifically, the paper focuses on how to ensure the correctness of the protocol by introducing logical constraints (i.e., refinements) to avoid common errors such as deadlocks and message mismatches. #### Background and problem description 1. **Complexity of message - passing programming**: - Message - passing programming is more prone to new errors, such as deadlocks, compared to sequential programming. - To address these complexities, various protocol specification formats (such as multiparty session types (MPST), choreography automata, etc.) have been proposed to prevent problems such as deadlocks and message mismatches. 2. **Limitations of existing refinement theories and implementations**: - Existing refinement theories and implementations are usually tightly coupled with specific specification formats, limiting their flexibility and generality. - This makes it difficult to apply refinements in different models and languages. #### Core problems of the paper The paper proposes a framework for the refinement of multiparty message - passing protocols, and this framework has the following characteristics: - **Specification - independence**: This framework decouples the correctness of refinement from the underlying computational model, making it a specification - independent framework. - **Scalability and flexibility**: This framework can be applied not only to existing protocol specification formats (such as MPST and choreography automata) but also extended to other forms of protocol specification. - **Dynamic evaluation and static analysis**: This framework supports dynamic refinement evaluation and static redundant refinement elimination techniques. #### Specific contributions 1. **Valid refined traces**: - A method for characterizing valid refined traces is proposed to ensure that the execution sequence complies with the refinement conditions. 2. **Refined communicating systems (RCS)**: - The communication system is extended to accommodate refinements, and it is proved that RCS only produces valid refined traces. 3. **Static analysis and improved computational model**: - A static analysis technique is developed to remove redundant refinements, and an improved computational model (decentralized refinement evaluation) is proposed. 4. **Rust toolchain implementation**: - Decentralized RMPST is implemented in Rust, and its performance is evaluated. Through these contributions, the paper solves the generality and flexibility problems of refinement in the design of multiparty message - passing protocols, providing a more powerful and flexible solution.