Zero-knowledge (ZK) proof systems have emerged as a promising solution for building security-sensitive applications. However, bugs in ZK applications are extremely difficult to detect and can allow a malicious party to silently exploit the system without leaving any observable trace. This paper presents Coda, a novel statically-typed language for building zero-knowledge applications. Critically, Coda makes it possible to formally specify and statically check properties of a ZK application through a rich refinement type system. One of the key challenges in formally verifying ZK applications is that they require reasoning about polynomial equations over large prime fields that go beyond the capabilities of automated theorem provers. Coda mitigates this challenge by generating a set of Coq lemmas that can be proven in an interactive manner with the help of a tactic library. We have used Coda to re-implement 79 arithmetic circuits from widely-used Circom libraries and applications. Our evaluation shows that Coda makes it possible to specify important and formally verify correctness properties of these circuits. Our evaluation also revealed 6 previously-unknown vulnerabilities in the original Circom projects.
翻译:零知识(ZK)证明系统已成为构建安全敏感应用程序的有前途的解决方案。然而,ZK应用程序中的错误极其难以检测,可能允许恶意方在不留下任何可观察迹象的情况下悄悄利用系统。本文介绍了Coda,一种新颖的用于构建零知识应用程序的静态类型语言。关键是,通过丰富的细化类型系统,Coda使得可以正式指定和静态检查ZK应用程序的属性。正式验证ZK应用程序的主要挑战之一在于,它们需要推理大素数域上的多项式方程,这超出了自动定理证明器的能力。 Coda通过生成一组Coq引理来缓解这个挑战,这些引理可以在交互式环境中使用策略库进行证明。我们使用Coda重新实现了广泛使用的Circom库和应用程序中的79个算术电路。我们的评估显示Coda使得可以指定这些电路的重要性和正式验证正确性属性。我们的评估还揭示了原始Circom项目中的6个以前未知的漏洞。