ZK-Garage / plonk

A pure Rust PLONK implementation using arkworks as a backend.
https://discord.gg/XWJdhVf37F
Mozilla Public License 2.0
295 stars 76 forks source link

Error handling for InvalidEvalDomain improvement #86

Open CPerezz opened 2 years ago

CPerezz commented 2 years ago

We should do something like:

.ok_or(Error::InvalidEvalDomainSize {
                log_size_of_group: plonk_verifier_key.n.trailing_zeros(),
                adacity: <F as FftField>::FftParams::TWO_ADACITY,
            })?

instead of unwrap() but I'm having some issues implementing this. I could just remove the parameters from InvalidEvalDomainSize or something quick, or leave it as unwrap and open another issue/PR for this case (since it's rather independent)

_Originally posted by @joebebel in https://github.com/ZK-Garage/plonk/pull/61#discussion_r781776889_

ghost commented 2 years ago

I eventually added some workaround, but I think it could use some additional work. Maybe the GeneralEvaluationDomain can be constructed in one place instead of the several places it is now.

Also it might be better if GeneralEvaluationDomain::new returns a Result instead of an Option, not sure about that.