You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Filecoin Proving Subsystem (FPS)
2
2
3
-
The **Filecoin Proving Subsystem** 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. This decomposition into distinct crates/modules is relatively recent, and in some cases current code has not been fully refactored to reflect the intended eventual organization.
3
+
The **Filecoin Proving Subsystem** 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. This decomposition into distinct crates/modules is relatively recent, and in some cases current code has not been fully refactored to reflect the intended eventual organization.
4
4
5
5
There are currently four different crates:
6
6
@@ -23,23 +23,23 @@ There are currently four different crates:
23
23
A sector database abstracting away underlying storage considerations. This abstraction will allow for alternate implementations mapping logical sectors to physical storage – facilitating both support for miner specialization, and configurable adaptation to a given miner’s physical hardware and preferences.
The `storage-backend` crate is intended to contain abstractions and implementations of non-filecoin-specific storage mechanisms require by `storage-proofs`. However, for the sake of simplicity, it is currently an empty placeholder.
26
+
The `storage-backend` crate is intended to contain abstractions and implementations of non-Filecoin-specific storage mechanisms require by `storage-proofs`. However, for the sake of simplicity, it is currently an empty placeholder.
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 code base, 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.
32
+
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.
33
33
34
-
We also considered whether the **FPS** should be implemented as a standalone binary accessed from [**`go-filecoin`**](https://github.com/filecoin-project/go-filecoin) either as a single-invocation CLI or as a long-running daemon process. We chose to bundle the **FPS** as an FFI dependency for both the simplicity of having a Filecoin node be deliverable as a single monolithic binary, and for the (perceived) relative development simplicity of the API implementation.
34
+
We also considered whether the **FPS** should be implemented as a standalone binary accessed from [**`go-filecoin`**](https://github.com/filecoin-project/go-filecoin) 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.
35
35
36
-
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, we have now already solved the majority of technical problems associated with calling from Go into Rust even while allowing for a high degree of runtime configurability. Therefore, it seems most likely that we continue down the path in which we have already invested and begin to reap reward.
36
+
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.
37
37
38
38
## Install and configure Rust
39
39
40
-
**NOTE:** If you have installed `rust-proofs` incidentally, as a submodule of `go-filecoin`, then you may already have installed Rust.
40
+
**NOTE:** If you have installed `rust-fil-proofs` incidentally, as a submodule of `go-filecoin`, then you may already have installed Rust.
41
41
42
-
The instructions below assume you have independently installed `rust-proofs` in order to test, develop, or experiment with it.
42
+
The instructions below assume you have independently installed `rust-fil-proofs` in order to test, develop, or experiment with it.
@@ -93,13 +93,13 @@ To benchmark the examples you can [bencher](src/bin/bencher.rs).
93
93
94
94
The results are written into the `.bencher` directory, as JSON files. The benchmarks are controlled through the [bench.config.toml](bench.config.toml) file.
95
95
96
-
Note: on macOS you need `gtime` (`brew install gnu-time`), as the built in `time` command is not enough.
96
+
Note: On macOS you need `gtime` (`brew install gnu-time`), as the built in `time` command is not enough.
97
97
98
98
## Logging
99
99
100
100
For better logging with backtraces on errors, developers should use `expects` rather than `expect` on `Result<T, E>` and `Option<T>`.
101
101
102
-
Developers can control `rust-proofs` logging through environment variables:
102
+
Developers can control `rust-fil-proofs` logging through environment variables:
103
103
104
104
-
105
105
`RUST_PROOFS_LOG_JSON`
@@ -138,7 +138,7 @@ can run the following command:
- If you installed `rust-proofs` automatically as a submodule of `go-filecoin`:
159
+
First, navigate to the `rust-fil-proofs` directory.
160
+
- If you installed `rust-fil-proofs` automatically as a submodule of `go-filecoin`:
161
161
```
162
-
> cd <go-filecoin-install-path>/go-filecoin/proofs/rust-proofs
162
+
> cd <go-filecoin-install-path>/go-filecoin/proofs/rust-fil-proofs
163
163
```
164
164
165
-
- If you cloned `rust-proofs` manually, it will be wherever you cloned it:
165
+
- If you cloned `rust-fil-proofs` manually, it will be wherever you cloned it:
166
166
```
167
-
> cd <install-path>/rust-proofs
167
+
> cd <install-path>/rust-fil-proofs
168
168
```
169
169
170
-
[Note that the version of `rust-proofs` included in `go-filecoin` as a submodule is not always the current head of `rust-proofs/master`. For documentation corresponding to the latest source, you should clone `rust-proofs` yourself.]
170
+
[Note that the version of `rust-fil-proofs` included in `go-filecoin` as a submodule is not always the current head of `rust-fil-proofs/master`. For documentation corresponding to the latest source, you should clone `rust-fil-proofs` yourself.]
171
171
172
172
Now, generate the documentation:
173
173
```
174
174
> cargo doc --all --no-deps
175
175
```
176
176
177
-
View the docs by pointing your browser at: `…/rust-proofs/target/doc/proofs/index.html`.
177
+
View the docs by pointing your browser at: `…/rust-fil-proofs/target/doc/proofs/index.html`.
178
178
179
179
---
180
180
@@ -184,20 +184,24 @@ The **FPS** is accessed from [**go-filecoin**](https://github.com/filecoin-proje
184
184
185
185
The Rust source code serves as the source of truth defining the **FPS** APIs. View the source directly:
-[Go implementation of filecoin-proofs API](https://github.com/filecoin-project/go-filecoin/blob/master/proofs/rustprover.go) and [associated interface structures](https://github.com/filecoin-project/go-filecoin/blob/master/proofs/interface.go).
196
196
-[Go implementation of sector-base API](https://github.com/filecoin-project/go-filecoin/blob/master/proofs/disk_backed_sector_store.go).
197
197
198
+
## Contributing
199
+
200
+
See [Contributing](CONTRIBUTING.md)
201
+
198
202
## License
199
203
200
204
The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms:
201
205
202
-
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/filecoin-project/rust-proofs/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
203
-
- MIT license ([LICENSE-MIT](https://github.com/filecoin-project/rust-proofs/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)
206
+
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
207
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
0 commit comments