Closed survived closed 1 year ago
I noticed that we have InvalidProof
error as a public enum. Practically it means that adding a new error path is a breaking change. Client code doesn't need to know why it failed, they're only interested to know whether proof is valid or not. Do you mind if I wrap it into public struct InvalidProof
and private enum InvalidProofReason
like I did with Error
and ErrorReason
in this PR?
Hmm, I think I already noted there that the enum is only public for debugging. We might as well hide the enum and only show it through Debug/Display isntances, so go ahead if you want
Also there're two InvalidProof errors, should we merge them?
If it makes the implementation of the new InvalidProof easier - sure. They are only used for potential debug anyway, in cggmp we only check is_err currently, right
I'm more thinking at API level, it doesn't make much sense to have two InvalidProof
types. I'll merge them.
it doesn't make much sense to have two InvalidProof
Well, they have completely different variants, so it makes sense to me.
they have completely different variants
All of them are private now, so at API level they're no different
This PR takes into account that result of
BigNumber::modpow
might not be defined if exponent is negative. It's done by addingpowmod
method (that returnsOption<BigNumber>
) and prohibiting usage ofBigNumber::modpow
.It also heavily affects API, as any prove/commit now may return error if modpow is not defined.