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

定理携带交易:运行时验证以确保智能合约安全的接口规范

Theorem-Carrying Transactions: Runtime Verification to Ensure Interface Specifications for Smart Contract Safety

Thomas Ball, Nikolaj S. Bjørner, Ashley J. Chen, Shuo Chen, Yang Chen, Zhongxin Guo, Tzu-Han Hsu, Peng Liu, Nanqing Luo

AI总结:

针对智能合约安全,提出定理携带交易(TCT)技术,结合具体执行与符号证明,在运行时验证交易符合接口规范,开销极低,成功应用于代币合约和Uniswap。

摘要:

自以太坊诞生以来,智能合约中的安全漏洞和陷阱就一直影响着以太坊社区。从概念上讲,以太坊的145万个合约构成了一个单一的“巨型程序”,其行为由合约的复杂组合决定。尽管存在无法预见的代码级复杂性,程序员能否确信这个巨型程序符合高级安全规范?静态代码验证由于规模和高度多态性而无法忠实于这个巨型程序。在本文中,我们提出了一种可行的方法来实现这一目标。我们的技术称为定理携带交易(TCT),它结合了具体执行和符号证明的优点。在TCT协议下,每笔交易都携带一个定理,证明其遵守被调用合约中指定的属性,运行时系统在执行交易前检查该定理。一旦定理被证明,它将被重复用于未来的交易,因此TCT的运行时开销最小。作为案例研究,我们证明了TCT无需预见代码级复杂性(如整数溢出和重入)即可保护代币合约。TCT还成功应用于Uniswap代码库,展示了复杂的去中心化金融(DeFi)场景。我们的评估显示,运行时开销可忽略不计,比最先进的合约代码安全运行时检查方法低两个数量级。

英文摘要:

Security bugs and trapdoors in smart contracts have been impacting the Ethereum community since its inception. Conceptually, the 1.45-million Ethereum's contracts form a single "gigantic program" whose behaviors are determined by the complex compositions of contracts. Can programmers be assured that this gigantic program conforms to high-level safety specifications, despite unforeseeable code-level intricacies? Static code verification cannot be faithful to this gigantic program due to its scale and high polymorphism. In this paper, we present a viable approach to achieve this goal. Our technology, called Theorem-Carrying Transactions (TCT), combines the benefits of concrete execution and symbolic proofs. Under the TCT protocol, every transaction carries a theorem that proves its adherence to the specified properties in the invoked contracts, and the runtime system checks the theorem before executing the transaction. Once a theorem is proven, it will be reused for future transactions, so TCT's runtime overhead is minimal. As case studies, we demonstrate that TCT secures token contracts without foreseeing code-level intricacies, such as integer overflow and reentrancy. TCT is also successfully applied to a Uniswap codebase, showcasing a complex decentralized finance (DeFi) scenario. Our evaluation shows a negligible runtime overhead, two orders of magnitude lower than a state-of-the-art approach for runtime checking of contract code safety.

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

↑