rust-fil-proofs

  • P0_946989
    了解作者
  • 965.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-26 04:28
    上传日期
Filecoin证明子系统 Filecoin证明子系统(或FPS)提供Filecoin协议所需的存储证明。 它作为一系列部分相互依赖的板条箱完全在Rust中实现-其中一些将C绑定导出到受支持的API。 当前有几种不同的板条箱: 用于构造存储证明的库-包括非电路证明,相应的SNARK电路及其组合方法。 在其他所有存储证明子等级中使用的一组通用原语,包括加密,merkle树,哈希和小工具接口。 storage-proofs-porep旨在用作复制证明( PoRep )的参考实现,同时还对文件filecoin-proofs进行了繁重的工作。 主要组成部分: PoR (可检索性证明:Merkle包含证明) DrgPoRep (深度鲁棒图复制证明) StackedDrgPoRep storage-proofs-post是为了充当验证的时空(POST)的参考实现,为filecoi
rust-fil-proofs-master.zip
内容介绍
# Filecoin Proving Subsystem The **Filecoin Proving Subsystem** (or FPS) provides the storage proofs required by the Filecoin protocol. It is implemented entirely in Rust, as a series of partially inter-dependent crates – some of which export C bindings to the supported API. There are currently several different crates: - [**Storage Proofs (`storage-proofs`)**](./storage-proofs) A library for constructing storage proofs – including non-circuit proofs, corresponding SNARK circuits, and a method of combining them. - [**Storage Proofs Core (`storage-proofs-core`)**](./storage-proofs/core) A set of common primitives used throughout the other storage-proofs sub-crates, including crypto, merkle tree, hashing and gadget interfaces. - [**Storage Proofs PoRep (`storage-proofs-porep`)**](./storage-proofs/porep) `storage-proofs-porep` is intended to serve as a reference implementation for _**Proof-of-Replication**_ (**PoRep**), while also performing the heavy lifting for `filecoin-proofs`. Primary Components: - **PoR** (**_Proof-of-Retrievability_**: Merkle inclusion proof) - **DrgPoRep** (_Depth Robust Graph_ **_Proof-of-Replication_**) - **StackedDrgPoRep** - [**Storage Proofs PoSt (`storage-proofs-post`)**](./storage-proofs/post) `storage-proofs-post` is intended to serve as a reference implementation for _**Proof-of-Space-time**_ (**PoSt**), for `filecoin-proofs`. Primary Components: - **PoSt** (Proof-of-Spacetime) - [**Filecoin Proofs (`filecoin-proofs`)**](./filecoin-proofs) A wrapper around `storage-proofs`, providing an FFI-exported API callable from C (and in practice called by [lotus](https://github.com/filecoin-project/lotus) via cgo). Filecoin-specific values of setup parameters are included here. ## Security Audits The `rust-fil-proofs` proofs code and the [Filecoin Spec](https://bafybeidxw5vxjdwsun2zc2illagf43v6w5r5w63vg455h7vjesbyqssg64.ipfs.dweb.link/algorithms/sdr/) has undergone a [proofs security audit](audits/Sigma-Prime-Protocol-Labs-Filecoin-Proofs-Security-Review-v2.1.pdf) performed by [Sigma Prime](https://sigmaprime.io/) and been deemed free of *critical* or *major* security issues. In addition to the security review, the document provides the summary of findings, vulnerability classifications, and recommended resolutions. All known issues have been resolved to date in both the code and the specification. `rust-fil-proofs` has also undergone a [SNARK proofs security audit performed by Dr. Jean-Philippe Aumasson and Antony Vennard](audits/protocolai-audit-20200728.pdf) and been deemed free of *critical* or *major* security issues. In addition to the security analysis, the document provides the audit goals, methodology, functionality descriptions and finally observations on what could be improved. All known issues have been resolved to date. ## Design Notes Earlier in the design process, we considered implementing what has become the **FPS** in Go – as a wrapper around potentially multiple SNARK circuit libraries. We eventually decided to use [bellman](https://github.com/zkcrypto/bellman) – a library developed by Zcash, which supports efficient pedersen hashing inside of SNARKs. Having made that decision, it was natural and efficient to implement the entire subsystem in Rust. We considered the benefits (self-contained codebase, ability to rely on static typing across layers) and costs (developer ramp-up, sometimes unwieldiness of borrow-checker) as part of that larger decision and determined that the overall project benefits (in particular ability to build on Zcash’s work) outweighed the costs. We also considered whether the **FPS** should be implemented as a standalone binary accessed from Filecoin nodes either as a single-invocation CLI or as a long-running daemon process. Bundling the **FPS** as an FFI dependency was chosen for both the simplicity of having a Filecoin node deliverable as a single monolithic binary, and for the (perceived) relative development simplicity of the API implementation. If at any point it were to become clear that the FFI approach is irredeemably problematic, the option of moving to a standalone **FPS** remains. However, the majority of technical problems associated with calling from Go into Rust are now solved, even while allowing for a high degree of runtime configurability. Therefore, continuing down the same path we have already invested in, and have begun to reap rewards from, seems likely. ## Install and configure Rust **NOTE:** If you have installed `rust-fil-proofs` incidentally, as a submodule of `lotus`, then you may already have installed Rust. The instructions below assume you have independently installed `rust-fil-proofs` in order to test, develop, or experiment with it. [Install Rust using rustup.](https://www.rust-lang.org/en-US/install.html) ## Build **NOTE:** `rust-fil-proofs` can only be built for and run on 64-bit platforms; building will panic if the target architecture is not 64-bits. Before building you will need OpenCL to be installed. On Ubuntu, this can be achieved with `apt install ocl-icd-opencl-dev`. Other system dependencies such as 'gcc/clang', 'wall' and 'cmake' are also required. You will also need to install the hwloc library. On Ubuntu, this can be achieved with `apt install hwloc libhwloc-dev`. For other platforms, please see the [hwloc-rs Prerequisites section](https://github.com/daschl/hwloc-rs). ``` > cargo build --release --all ``` ## Test ``` > cargo test --all ``` ## Benchmarks The main benchmarking tool is called `benchy`. `benchy` has several subcommands, including `merkleproofs`, `prodbench`, `winning_post` and `window_post`. You can run them with various configuration options, but some examples are below: ``` > cargo run --release --bin benchy -- merkleproofs --size 2 > cargo run --release --bin benchy -- winning-post --size 2 > cargo run --release --bin benchy -- window-post --size 2 > cargo run --release --bin benchy -- prodbench ``` ### Window PoSt Bench usages The Window PoSt bench can be used a number of ways, some of which are detailed here. First, you can run the benchmark and preserve the working directory like this: ``` cargo run --release --bin benchy -- window-post --size 2KiB --cache window-post-2KiB-dir --preserve-cache ``` Then if you want to run the benchmark again to test commit-phase2, you can quickly run it like this: ``` cargo run --release --bin benchy -- window-post --size 2KiB --skip-precommit-phase1 --skip-precommit-phase2 --skip-commit-phase1 --cache window-post-2KiB-dir ``` Alternatively, if you want to test just GPU tree building, you can run it like this: ``` cargo run --release --bin benchy -- window-post --size 2KiB --skip-precommit-phase1 --skip-commit-phase1 --skip-commit-phase2 --cache window-post-2KiB-dir ``` Note that some combinations of arguments will cause destructive changes to your cached directory. For larger benchmark sector sizes, it is recommended that once you create an initial cache, that it be saved to an alternate location in the case that it is corrupted by a test run. For example, the following run sequence will be guaranteed to corrupt your cache: ``` # Do NOT run this sequence. For illustrative purposes only: # Generate clean cache cargo run --release --bin benchy -- window-post --size 2KiB --cache window-post-2KiB-dir --preserve-cache # Skip all stages except the first cargo run --release --bin benchy -- window-post --size 2KiB --skip-precommit-phase2 --skip-commit-phase1 --skip-commit-phase2 --cache broken-cache-dir ``` The reason this fails is because new random piece data is generated (rather than loaded from disk from a previous run) in the first step, and then we attempt to use it in later sealing steps using data from previously preserved run. This cannot work. There is also a bench called `gpu-cpu-test`: ``` > cargo run --release --bin gpu-cpu-test ``` Some results are displayed at the comm
评论
    相关推荐
    • rust_repo:锈代码存储
      rust_repo:锈代码存储
    • rust-projects
      防锈项目 都是名字。 该存储库仅供我用于任何rust项目。 上次更新时间:2021-04-10
    • rust-emitter
      发射器 用于事件代码的同步事件发射器。...使用 crates.io 存储库; 将其与其余依赖Cargo.toml一起添加到Cargo.toml : [ dependencies ] emitter = " * " 作者 是的主要作者和维护者。 执照 麻省理工学院
    • Rust_Examples:该存储库包含Rust教程的示例文件
      Rust_Examples 该存储库包含Rust教程的示例文件
    • ProjectEuler_Rust
      Rust中完成的Euler项目演习概述。 要运行其中的任何一个,请将cd放入存储库,然后在您选择的终端中运行cargo run 。 笔记 欧拉计划旨在成为学习如何通过问题进行编码的地方。 仅从此处复制粘贴代码将破坏您的学习...
    • rust-compiler
      Rust编译器 描述 用C ++编写的Rust编译器 作者Vladislav Kalinin,B8118-01.03.02sistpro组的学生(1)(2018年) 执照 该存储库已获得许可证的许可。
    • exercism-rust
      运动锈 Rust执行轨道的存储库。
    • Rust_tutorial
      Rust_tutorial 教程1为什么要坚持? ??类型安全C和C ++有什么区别? ?? →编译器具有能力,可以保证存储器的安全性。 教程2锈之旅。网页和函数编写。#[测试],选项类型 作者 正弘
    • rust-downcast
      沮丧 一个扩展 trait,提供对 trait 对象...使用 crates.io 存储库; 将其与其余依赖Cargo.toml一起添加到Cargo.toml : [ dependencies ] downcast = " * " 作者 是 downcast 的主要作者和维护者。 执照 麻省理工学院
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档