filecoin-project / rust-fil-proofs

Proofs for Filecoin in Rust
Other
489 stars 314 forks source link

refactor: clearer Synthetic PoRep separation #1720

Closed vmx closed 9 months ago

vmx commented 11 months ago

The Synthetic PoRep code is interleaved with the original PoRep code. This commit refactors the code, so that it's clearer what the differences between Synthetic and Non-Synthetic PoRep is, without the need to read through large parts of the code, looking for if-statements.

It also becomes more apparent in the code, that there are two "modes" of the prove_layers function in case of the Synthetic PoRep. One generation step in case there's no seed and one extracting step when there's a seed.

There no longer is a fallback in case from Synthetic PoRep to Non-Synthetic PoRep in case the Synthetic PoRep Proofs file cannot be read, but when the labels are set. I consider that a feature as if this case happens, your system likelt has some problems, so it's better to error early.

vmx commented 11 months ago

As this PR wasn't reviewed yet, I did dare to rebase it. I also pushed a new commit. It's easiest reviewed if you look at those two commits separately. The second one is again easiest with whitespace only changes hidden: https://github.com/filecoin-project/rust-fil-proofs/pull/1720/commits/4f4621681dc7188074956db78b5c20cf786e9c67?diff=split&w=1

DrPeterVanNostrand commented 11 months ago

This refactor looks good to me. I just have the one question regarding fallback behavior when synth proofs do not exist on disk.

vmx commented 10 months ago

The force push has just been a rebase, without any other code changes.