arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2106.04826cs.PLcs.CRcs.SE
收藏

使用F* 验证Merkle Patricia树库

Verification of a Merkle Patricia Tree Library Using F*

Sota Sato, Ryotaro Banno, Jun Furuse, Kohei Suenaga, Atsushi Igarashi

摘要:

Merkle树是用于将键值存储表示为树的数据结构。Merkle树的每个节点都配备了从其后代计算的哈希值。Merkle树通常用于表示区块链系统的状态,因为它可以用于以不信任的方式有效地审计状态。由于区块链的安全关键性,确保其实现的正确性至关重要。我们使用F* 展示了Plebeia核心部分的正式验证实现。Plebeia是一个操作Merkle树(称为Plebeia树)扩展的库。它是Tezos区块链系统存储系统的一部分。为此,我们逐渐将Plebeia移植到F*;从移植到F* 的模块中提取的OCaml代码与Plebeia的未验证部分相关联。通过这个渐进的移植过程,我们可以从我们部分验证的Plebeia实现中获得一个工作代码;我们确认二进制文件通过了Plebeia的所有单元测试。更具体地说,我们验证了Plebeia实现的以下性质:(1)每个树操作函数保留了Plebeia树的数据结构上的不变量,并满足嵌套键值存储的功能要求;(2)每个用于将Plebeia树序列化到低级存储/从低级存储序列化的函数都被正确地实现;以及(3)相对于blake 2b散列函数的密码安全性,用于Plebeia树的散列函数是相对抗冲突的。在将Plebeia移植到F* 的过程中,我们发现了旧版本Plebeia中的一个bug,这个bug在与原始实现捆绑的测试中被忽略了。据我们所知,这是F* 验证Merkle树库的生产级实现的第一项工作。

英文摘要:

A Merkle tree is a data structure for representing a key-value store as a tree. Each node of a Merkle tree is equipped with a hash value computed from those of their descendants. A Merkle tree is often used for representing a state of a blockchain system since it can be used for efficiently auditing the state in a trustless manner. Due to the safety-critical nature of blockchains, ensuring the correctness of their implementation is paramount. We show our formally verified implementation of the core part of Plebeia using F*. Plebeia is a library to manipulate an extension of Merkle trees (called Plebeia trees). It is being implemented as a part of the storage system of the Tezos blockchain system. To this end, we gradually ported Plebeia to F*; the OCaml code extracted from the modules ported to F* is linked with the unverified part of Plebeia. By this gradual porting process, we can obtain a working code from our partially verified implementation of Plebeia; we confirmed that the binary passes all the unit tests of Plebeia. More specifically, we verified the following properties on the implementation of Plebeia: (1) Each tree-manipulating function preserves the invariants on the data structure of a Plebeia tree and satisfies the functional requirements as a nested key-value store; (2) Each function for serializing/deserializing a Plebeia tree to/from the low-level storage is implemented correctly; and (3) The hash function for a Plebeia tree is relatively collision-resistant with respect to the cryptographic safety of the blake2b hash function. During porting Plebeia to F*, we found a bug in an old version of Plebeia, which was overlooked by the tests bundled with the original implementation. To the best of our knowledge, this is the first work that verifies a production-level implementation of a Merkle-tree library by F*.

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

↑