论文标题

提取在COQ中测试和验证的智能合约

Extracting Smart Contracts Tested and Verified in Coq

论文作者

Annenkov, Danil, Milo, Mikkel, Nielsen, Jakob Botsch, Spitters, Bas

论文摘要

我们根据Metacoq的认证擦除将COQ程序提取到功能性语言中。为此,我们实施了一个删除未使用的参数的优化通行证。我们证明通行证正确的WRT。传统的功能语言逐个呼叫操作语义。我们将其应用于两种功能性的智能合同语言,流动性和MIDLANG,以及功能性语言ELM。我们的发展是在可以实现智能合同验证的音乐会框架的背景下完成的。我们贡献了经过验证的董事会投票智能合同,其选民隐私为最高的智能合同,以使每笔投票都私密,除非在所有其他各方的勾结下。我们还使用QuickChick将基于物业的测试集成到音乐会中,我们的开发是第一个支持互动智能合约的测试属性的开发。我们测试了几个复杂合同,例如DAO型合同,托管合同,分散财务(DEFI)合同的实施,该合同包括定制令牌标准(TEZOS FA2)等。总的来说,这为我们提供了一种在COQ中编写依赖程序,半自动测试,验证并提取到功能性智能合同语言的方法,同时将仅MetaCoq的值得信赖的计算基础和漂亮的构造保留到这些语言中。

We implement extraction of Coq programs to functional languages based on MetaCoq's certified erasure. As part of this, we implement an optimisation pass removing unused arguments. We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. We apply this to two functional smart contract languages, Liquidity and Midlang, and to the functional language Elm. Our development is done in the context of the ConCert framework that enables smart contract verification. We contribute a verified boardroom voting smart contract featuring maximum voter privacy such that each vote is kept private except under collusion of all other parties. We also integrate property-based testing into ConCert using QuickChick and our development is the first to support testing properties of interacting smart contracts. We test several complex contracts such as a DAO-like contract, an escrow contract, an implementation of a Decentralized Finance (DeFi) contract which includes a custom token standard (Tezos FA2), and more. In total, this gives us a way to write dependent programs in Coq, test them semi-automatically, verify, and then extract to functional smart contract languages, while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源