-
Prisma: A Tierless Language for Enforcing Contract-Client Protocols in Decentralized Applications (Extended Version)
Authors:
David Richter,
David Kretzler,
Pascal Weisenburger,
Guido Salvaneschi,
Sebastian Faust,
Mira Mezini
Abstract:
Decentralized applications (dApps) consist of smart contracts that run on blockchains and clients that model collaborating parties. dApps are used to model financial and legal business functionality. Today, contracts and clients are written as separate programs -- in different programming languages -- communicating via send and receive operations. This makes distributed program flow awkward to exp…
▽ More
Decentralized applications (dApps) consist of smart contracts that run on blockchains and clients that model collaborating parties. dApps are used to model financial and legal business functionality. Today, contracts and clients are written as separate programs -- in different programming languages -- communicating via send and receive operations. This makes distributed program flow awkward to express and reason about, increasing the potential for mismatches in the client-contract interface, which can be exploited by malicious clients, potentially leading to huge financial losses. In this paper, we present Prisma, a language for tierless decentralized applications, where the contract and its clients are defined in one unit and pairs of send and receive actions that "belong together" are encapsulated into a single direct-style operation, which is executed differently by sending and receiving parties. This enables expressing distributed program flow via standard control flow and renders mismatching communication impossible. We prove formally that our compiler preserves program behavior in presence of an attacker controlling the client code. We systematically compare Prisma with mainstream and advanced programming models for dApps and provide empirical evidence for its expressiveness and performance.
△ Less
Submitted 15 May, 2023; v1 submitted 16 May, 2022;
originally announced May 2022.
-
Stateful Entities: Object-oriented Cloud Applications as Distributed Dataflows
Authors:
Kyriakos Psarakis,
Wouter Zorgdrager,
Marios Fragkoulis,
Guido Salvaneschi,
Asterios Katsifodimos
Abstract:
Although the cloud has reached a state of robustness, the burden of using its resources falls on the shoulders of programmers who struggle to keep up with ever-growing cloud infrastructure services and abstractions. As a result, state management, scaling, operation, and failure management of scalable cloud applications, require disproportionately more effort than developing the applications' actua…
▽ More
Although the cloud has reached a state of robustness, the burden of using its resources falls on the shoulders of programmers who struggle to keep up with ever-growing cloud infrastructure services and abstractions. As a result, state management, scaling, operation, and failure management of scalable cloud applications, require disproportionately more effort than developing the applications' actual business logic.
Our vision aims to raise the abstraction level for programming scalable cloud applications by compiling stateful entities -- a programming model enabling imperative transactional programs authored in Python -- into stateful streaming dataflows. We propose a compiler pipeline that analyzes the abstract syntax tree of stateful entities and transforms them into an intermediate representation based on stateful dataflow graphs. It then compiles that intermediate representation into different dataflow engines, leveraging their exactly-once message processing guarantees to prevent state or failure management primitives from "leaking" into the level of the programming model. Preliminary experiments with a proof of concept implementation show that despite program transformation and translation to dataflows, stateful entities can perform at sub-100ms latency even for transactional workloads.
△ Less
Submitted 3 September, 2023; v1 submitted 17 November, 2021;
originally announced December 2021.
-
TCEP: Transitions in Operator Placement to Adapt to Dynamic Network Environments
Authors:
Manisha Luthra,
Boris Koldehofe,
Niels Danger,
Pascal Weisenburger,
Guido Salvaneschi,
Ioannis Stavrakakis
Abstract:
Distributed Complex Event Processing (DCEP) is a commonly used paradigm to detect and act on situational changes of many applications, including the Internet of Things (IoT). DCEP achieves this using a simple specification of analytical tasks on data streams called operators and their distributed execution on a set of infrastructure. The adaptivity of DCEP to the dynamics of IoT applications is es…
▽ More
Distributed Complex Event Processing (DCEP) is a commonly used paradigm to detect and act on situational changes of many applications, including the Internet of Things (IoT). DCEP achieves this using a simple specification of analytical tasks on data streams called operators and their distributed execution on a set of infrastructure. The adaptivity of DCEP to the dynamics of IoT applications is essential and very challenging in the face of changing demands concerning Quality of Service. In our previous work, we addressed this issue by enabling transitions, which allow for the adaptive use of multiple operator placement mechanisms. In this article, we extend the transition methodology by optimizing the costs of transition and analyzing the behaviour using multiple operator placement mechanisms. Furthermore, we provide an extensive evaluation on the costs of transition imposed by operator migrations and learning, as it can inflict overhead on the performance if operated uncoordinatedly.
△ Less
Submitted 23 June, 2021;
originally announced June 2021.
-
Handling Bidirectional Control Flow: Technical Report
Authors:
Yizhou Zhang,
Guido Salvaneschi,
Andrew C. Myers
Abstract:
Pressed by the difficulty of writing asynchronous, event-driven code, mainstream languages have recently been building in support for a variety of advanced control-flow features. Meanwhile, experimental language designs have suggested effect handlers as a unifying solution to programmer-defined control effects, subsuming exceptions, generators, and async--await. Despite these trends, complex contr…
▽ More
Pressed by the difficulty of writing asynchronous, event-driven code, mainstream languages have recently been building in support for a variety of advanced control-flow features. Meanwhile, experimental language designs have suggested effect handlers as a unifying solution to programmer-defined control effects, subsuming exceptions, generators, and async--await. Despite these trends, complex control flow---in particular, control flow exhibiting a bidirectional pattern---remains challenging to manage.
We introduce bidirectional algebraic effects, a new programming abstraction that supports bidirectional control transfer in a more natural way. Handlers of bidirectional effects can raise further effects to transfer control back to the site where the initiating effect was raised, and can use themselves to handle their own effects. We present applications of this expressive power, which falls out naturally as we push toward the unification of effectful programming with object-oriented programming. We pin down the mechanism and the unification formally using a core language that generalizes to effect operations and effect handlers.
The usual propagation semantics of control effects such as exceptions conflicts with modular reasoning in the presence of effect polymorphism---it breaks parametricity. Bidirectionality exacerbates the problem. Hence, we set out to show the core language, which builds on the existing tunneling semantics for algebraic effects, is not only type-safe (no effects go unhandled), but also abstraction-safe (no effects are accidentally handled). We devise a step-indexed logical-relations model, and construct its parametricity and soundness proofs. These core results are fully mechanized in Coq. Preliminary experiments show that as a first-class language feature, bidirectional handlers can be implemented efficiently.
△ Less
Submitted 18 October, 2020;
originally announced October 2020.
-
Implementing a Language for Distributed Systems: Choices and Experiences with Type Level and Macro Programming in Scala
Authors:
Pascal Weisenburger,
Guido Salvaneschi
Abstract:
Multitier programming languages reduce the complexity of developing distributed systems by developing the distributed system in a single coherent code base. The compiler or the runtime separate the code for the components of the distributed system, enabling abstraction over low level implementation details such as data representation, serialization and network protocols. Our ScalaLoci language all…
▽ More
Multitier programming languages reduce the complexity of developing distributed systems by developing the distributed system in a single coherent code base. The compiler or the runtime separate the code for the components of the distributed system, enabling abstraction over low level implementation details such as data representation, serialization and network protocols. Our ScalaLoci language allows developers to declare the different components and their architectural relation at the type level, allowing static reasoning about about distribution and remote communication and guaranteeing static type safety across components. The compiler splits the multitier program into the component-specific code and automatically generates the communication boilerplate. Communication between components can be modeled by declaratively specifying data flows between components using reactive programming.
In this paper, we report on the implementation of our design and our experience with embedding our language features into Scala as a host language. We show how a combination of Scala's advanced type level programming and its macro system can be used to enrich the language with new abstractions. We comment on the challenges we encountered and the solutions we developed for our current implementation and outline suggestions for an improved macro system to support the such use cases of embedding of domain-specific abstractions.
△ Less
Submitted 14 February, 2020;
originally announced February 2020.
-
Type-safe, Polyvariadic Event Correlation
Authors:
Oliver Bračevac,
Guido Salvaneschi,
Sebastian Erdweg,
Mira Mezini
Abstract:
The pivotal role that event correlation technology plays in todays applications has lead to the emergence of different families of event correlation approaches with a multitude of specialized correlation semantics, including computation models that support the composition and extension of different semantics. However, type-safe embeddings of extensible and composable event patterns into statically…
▽ More
The pivotal role that event correlation technology plays in todays applications has lead to the emergence of different families of event correlation approaches with a multitude of specialized correlation semantics, including computation models that support the composition and extension of different semantics. However, type-safe embeddings of extensible and composable event patterns into statically-typed general-purpose programming languages have not been systematically explored so far. Event correlation technology has often adopted well-known and intuitive notations from database queries, for which approaches to type-safe embedding do exist. However, we argue in the paper that these approaches, which are essentially descendants of the work on monadic comprehensions, are not well-suited for event correlations and, thus, cannot without further ado be reused/re-purposed for embedding event patterns. To close this gap we propose PolyJoin, a novel approach to type-safe embedding for fully polyvariadic event patterns with polymorphic correlation semantics. Our approach is based on a tagless final encoding with uncurried higher-order abstract syntax (HOAS) representation of event patterns with n variables, for arbitrary $n \in \mathbb{N}$. Thus, our embedding is defined in terms of the host language without code generation and exploits the host language type system to model and type check the type system of the pattern language. Hence, by construction it impossible to define ill-typed patterns. We show that it is possible to have a purely library-level embedding of event patterns, in the familiar join query notation, which is not restricted to monads. PolyJoin is practical, type-safe and extensible. An implementation of it in pure multicore OCaml is readily usable.
△ Less
Submitted 5 July, 2019;
originally announced July 2019.
-
How to Avoid Making a Billion-Dollar Mistake: Type-Safe Data Plane Programming with SafeP4
Authors:
Matthias Eichholz,
Eric Campbell,
Nate Foster,
Guido Salvaneschi,
Mira Mezini
Abstract:
The P4 programming language offers high-level, declarative abstractions that bring the flexibility of software to the domain of networking. Unfortunately, the main abstraction used to represent packet data in P4, namely header types, lacks basic safety guarantees. Over the last few years, experience with an increasing number of programs has shown the risks of the unsafe approach, which often leads…
▽ More
The P4 programming language offers high-level, declarative abstractions that bring the flexibility of software to the domain of networking. Unfortunately, the main abstraction used to represent packet data in P4, namely header types, lacks basic safety guarantees. Over the last few years, experience with an increasing number of programs has shown the risks of the unsafe approach, which often leads to subtle software bugs.
This paper proposes SafeP4, a domain-specific language for programmable data planes in which all packet data is guaranteed to have a well-defined meaning and satisfy essential safety guarantees. We equip SafeP4 with a formal semantics and a static type system that statically guarantees header validity---a common source of safety bugs according to our analysis of real-world P4 programs. Statically ensuring header validity is challenging because the set of valid headers can be modified at runtime, making it a dynamic program property. Our type system achieves static safety by using a form of path-sensitive reasoning that tracks dynamic information from conditional statements, routing tables, and the control plane. Our evaluation shows that SafeP4's type system can effectively eliminate common failures in many real-world programs.
△ Less
Submitted 24 June, 2019; v1 submitted 17 June, 2019;
originally announced June 2019.
-
Proceedings First Workshop on Architectures, Languages and Paradigms for IoT
Authors:
Danilo Pianini,
Guido Salvaneschi
Abstract:
The 1st workshop on Architectures, Languages and Paradigms for IoT (ALP4IoT 2017), was held in Turin on September 19th, 2017. ALP4IoT was a satellite event of the 13th International Conference on integrated Formal Methods (iFM 2017). The workshop aimed at critically reviewing the state-of-the-art and the state-of-the-practice of formal techniques and software methods for the IoT, presenting open p…
▽ More
The 1st workshop on Architectures, Languages and Paradigms for IoT (ALP4IoT 2017), was held in Turin on September 19th, 2017. ALP4IoT was a satellite event of the 13th International Conference on integrated Formal Methods (iFM 2017). The workshop aimed at critically reviewing the state-of-the-art and the state-of-the-practice of formal techniques and software methods for the IoT, presenting open problems and challenges and triggering a discussion among the participants with different views and backgrounds. The Internet of Things is ushering a dramatic increase in number and variety of interconnected and smart objects. Communication capabilities and computational power are growingly embedded in everyday devices, including personal smart devices, public displays, cars, drones, and electronic tags. This state of the things opens an unprecedented range of research opportunities: the inherent distribution, mobility, situatedness, and heterogeneity of such devices call for proper scientific understanding of the foundations of such systems as well as for novel software methods. The workshop solicited original contributions on architectures, languages, paradigms, and techniques with potential practical and theoretical impact on software systems targeting the IoT, welcoming inter-disciplinary approaches.
△ Less
Submitted 3 February, 2018;
originally announced February 2018.
-
CPL: A Core Language for Cloud Computing -- Technical Report
Authors:
Oliver Bračevac,
Sebastian Erdweg,
Guido Salvaneschi,
Mira Mezini
Abstract:
Running distributed applications in the cloud involves deployment. That is, distribution and configuration of application services and middleware infrastructure. The considerable complexity of these tasks resulted in the emergence of declarative JSON-based domain-specific deployment languages to develop deployment programs. However, existing deployment programs unsafely compose artifacts written i…
▽ More
Running distributed applications in the cloud involves deployment. That is, distribution and configuration of application services and middleware infrastructure. The considerable complexity of these tasks resulted in the emergence of declarative JSON-based domain-specific deployment languages to develop deployment programs. However, existing deployment programs unsafely compose artifacts written in different languages, leading to bugs that are hard to detect before run time. Furthermore, deployment languages do not provide extension points for custom implementations of existing cloud services such as application-specific load balancing policies.
To address these shortcomings, we propose CPL (Cloud Platform Language), a statically-typed core language for programming both distributed applications as well as their deployment on a cloud platform. In CPL, application services and deployment programs interact through statically typed, extensible interfaces, and an application can trigger further deployment at run time. We provide a formal semantics of CPL and demonstrate that it enables type-safe, composable and extensible libraries of service combinators, such as load balancing and fault tolerance.
△ Less
Submitted 5 February, 2016; v1 submitted 2 February, 2016;
originally announced February 2016.
-
Context-Oriented Programming: A Programming Paradigm for Autonomic Systems
Authors:
Guido Salvaneschi,
Carlo Ghezzi,
Matteo Pradella
Abstract:
Dynamic software adaptability is one of the central features leveraged by autonomic computing. However, developing software that changes its behavior at run time adapting to the operational conditions is a challenging task. Several approaches have been proposed in the literature to attack this problem at different and complementary abstraction levels: software architecture, middleware, and program…
▽ More
Dynamic software adaptability is one of the central features leveraged by autonomic computing. However, developing software that changes its behavior at run time adapting to the operational conditions is a challenging task. Several approaches have been proposed in the literature to attack this problem at different and complementary abstraction levels: software architecture, middleware, and programming level. We focus on the support that ad-hoc programming language constructs may provide to support dynamically adaptive behaviors. We introduce context-oriented programming languages and we present a framework that positions the supported paradigm in the MAPE-K autonomic loop. We discuss the advantages of using context-oriented programming languages instead of other mainstream approaches based on dynamic aspect oriented programming languages and present a case study that shows how the proposed programming style naturally fits dynamic adaptation requirements. Finally, we discuss some known problems and outline a number of open research challenges.
△ Less
Submitted 30 March, 2012; v1 submitted 30 April, 2011;
originally announced May 2011.
-
JavaCtx: Seamless Toolchain Integration for Context-Oriented Programming
Authors:
Guido Salvaneschi,
Carlo Ghezzi,
Matteo Pradella
Abstract:
Context-oriented programming is an emerging paradigm addressing at the language level the issue of dynamic software adaptation and modularization of context-specific concerns. In this paper we propose JavaCtx, a tool which employs coding conventions to generate the context-aware semantics for Java programs and subsequently weave it into the application. The contribution of JavaCtx is twofold: the…
▽ More
Context-oriented programming is an emerging paradigm addressing at the language level the issue of dynamic software adaptation and modularization of context-specific concerns. In this paper we propose JavaCtx, a tool which employs coding conventions to generate the context-aware semantics for Java programs and subsequently weave it into the application. The contribution of JavaCtx is twofold: the design of a set of coding conventions which allow to write context-oriented software in plain Java and the concept of context-oriented semantics injection, which allows to introduce the context-aware semantics without a source-to-source compilations process which disrupts the structure of the code. Both these points allow to seamless integrate JavaCtx in the existing industrial-strength appliances and by far ease the development of context-oriented software.
△ Less
Submitted 7 April, 2011;
originally announced April 2011.