filecoin-project / rust-fil-proofs

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

refactor: Challenges enum #1739

Closed vmx closed 9 months ago

vmx commented 9 months ago

This PR is a preparation for the non-interactive PoRep, where a new type of challenges will be introduced.

Though it also makes sense outside of this. A new Challenges enum is introduced, which add a bit more type safety. This way you cannot accidentally use e.g. the interactive PoRep challenges with the synthetic PoRep.

For more consistency the SynthChallenges struct renamed to SynthChallengeGenerator, so that we can have a SynthChallenges struct which corresponds to the InteractiveChallenges and upcoming NiChallenges struct.

For testing purpose it's now possible to add any feature (not just the Synthetic PoRep one). This is something that is needed for the NonInteractive PoRep, as well as the Resnaps work.

I've keep the individual commits for easier reviewing, the major change is the introduce Challenges enum commit.

vmx commented 9 months ago

I've pushed a new version without the testing code changes, which shows again that splitting PRs into small independent pieces is the way to go (which I also should've done here).