Last year we presented a domain-specific language and a compiler for secure multi-party computation (MPC). The compiler targets a state-of-the-art backend that specializes in low-level numerical computations. While the DSL helps to focus on the critical privacy-preserving domain, for a practical system we need a way to easily connect with the outside world. This would enable us to compose multiple DSL programs as well as intertwine them with business logic.
This year we present a Scala framework in which we can both a) write privacy-preserving programs and b) compose them with general Scala code. As a result, a user not only gets domain-specific annotations and error-messages for the privacy-preserving part of their code, but they can also run full pipelines of non-trivial programs in a single, cohesive environment. Scala/Dotty are excellent languages to implement such a framework:
- Indeed, the privacy-preserving program can be naturally embedded using meta-programming features. This allows us to benefit from Scala's type system as well as specialize some typing rules relevant to the domain. - Additionally, by virtue of the same meta-programming features, we can retrieve the result of the domain-specific language and combine it with any Scala library. A nice side-effect of this is the ability to change the execution model for the DSL seamlessly, using good old functional programming features like typeclasses.
The pattern of composing embedded, often quoted, DSLs with external logic is well known in the Scala community, with Spark and Quill being prime exponents. We find that this pattern applies elegantly to the world of privacy-preserving computations as well.
Manohar is a Senior Software Engineer at Inpher, a company developing solutions for secure computing. He has a PhD in Programming Languages (advised by Martin Odersky) and worked on Program Synthesis tools as a post-doc at MSR India.
Jakob is a Software Engineer at Inpher. His introduction to Scala was in its 1.x days, and he has been using it ever since.