arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1902.06056cs.PL
收藏

数字合同的资源感知会话类型

Resource-Aware Session Types for Digital Contracts

Ankush Das, Stephanie Balzer, Jan Hoffmann, Frank Pfenning, Ishani Santurkar

摘要:

编程数字合同带来了独特的挑战,其中包括(i)表达和执行交互协议,(ii)控制资源使用,以及(iii)防止复制或删除合同资产。本文介绍了Nomos的设计和类型理论基础,Nomos是一种用于解决这些挑战的数字合同的程序设计语言。为了表达和执行协议,Nomos基于共享的二进制会话类型。为了控制资源使用,Nomos采用自动摊销资源分析。为了防止重复或删除资产,Nomos使用线性类型系统。Monad将有效的会话类型语言与通用函数语言集成在一起。Nomos的原型实现具有线性时间类型检查和有效的类型重构功能,包括通过现成的线性优化自动推断资源边界。该语言的有效性通过实施常见智能合约(如拍卖,选举和货币)的案例研究进行评估。Nomos是完全形式化的,包括类型系统,成本语义和事务语义,以在区块链上实例化Nomos合约。类型可靠性证明确保在运行时遵循协议,并且类型在资源消耗上建立可靠的上限,排除可重入性和耗尽漏洞。

英文摘要:

Programming digital contracts comes with unique challenges, which include (i) expressing and enforcing protocols of interaction, (ii) controlling resource usage, and (iii) preventing the duplication or deletion of a contract's assets. This article presents the design and type-theoretic foundation of Nomos, a programming language for digital contracts that addresses these challenges. To express and enforce protocols, Nomos is based on shared binary session types. To control resource usage, Nomos employs automatic amortized resource analysis. To prevent the duplication or deletion of assets, Nomos uses a linear type system. A monad integrates the effectful session-typed language with a general-purpose functional language. Nomos' prototype implementation features linear-time type checking and efficient type reconstruction that includes automatic inference of resource bounds via off-the-shelf linear optimization. The effectiveness of the language is evaluated with case studies about implementing common smart contracts such as auctions, elections, and currencies. Nomos is completely formalized, including the type system, a cost semantics, and a transactional semantics to instantiate Nomos contracts on a blockchain. The type soundness proof ensures that protocols are followed at run-time and that types establish sound upper bounds on the resource consumption, ruling out re-entrancy and out-of-gas vulnerabilities.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑