Skip to content

Commit

Permalink
refactor: clearer Synthetic PoRep separation (#1720)
Browse files Browse the repository at this point in the history
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 likely has
some problems, so it's better to error early.

`prove_layers_generate()` now operates on a single partition. This makes it
clearer that Synthetic PoReps always operate on a single partition only.

With the challenge generation moved outside of this function, it's also a
clearer separation of concerns, as it now operates directly on the challenges
given, without know anything about how they were generated. This also useful
for the work of having small, special case binaries for certain operations.
  • Loading branch information
vmx committed Dec 1, 2023
1 parent cfa79dd commit 4ffa4a8
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 220 deletions.
6 changes: 3 additions & 3 deletions storage-proofs-porep/src/stacked/vanilla/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ pub struct PublicInputs<T: Domain, S: Domain> {

impl<T: Domain, S: Domain> PublicInputs<T, S> {
/// If the porep challenge randomness `self.seed` is set, this method returns the porep
/// challenges for partition `k`; otherwise if `self.seed` is `None`, returns the entire
/// synthetic challenge set. Note synthetic challenges are generated in a single partition
/// `k = 0`.
/// challenges for partition `k` (for synth and non-synth poreps); otherwise if `self.seed` is
/// `None`, returns the entire synthetic challenge set. Note synthetic challenges are generated
/// in a single partition `k = 0`.
pub fn challenges(
&self,
layer_challenges: &LayerChallenges,
Expand Down
Loading

0 comments on commit 4ffa4a8

Please sign in to comment.