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 个以前未知的漏洞。