Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Challenges enum #1739

Merged
merged 3 commits into from
Dec 5, 2023
Merged

refactor: Challenges enum #1739

merged 3 commits into from
Dec 5, 2023

Conversation

vmx
Copy link
Contributor

@vmx vmx commented Dec 4, 2023

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
Copy link
Contributor Author

vmx commented Dec 4, 2023

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).

Reducing the public API where it's not needed. Currently is `SynthChallenges`
not used outside this crate, hence make it non-public.

This enables later refactors, where the struct can be renamed.
Renaming the `SynthChallenges` struct int `SynthChallengeGenerator` in order
to make clear that those are not the actual challenges, but that it's an object
to generate challenges.
The `Challenges` enum introduces a bit more type safety.
@vmx vmx merged commit 97f39b6 into master Dec 5, 2023
32 checks passed
@vmx vmx deleted the challenges-enum branch December 5, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants