-
Notifications
You must be signed in to change notification settings - Fork 38
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
Change most assert_except into assert. #11
Conversation
@@ -187,7 +186,7 @@ inline void bigint<n>::div_qr(bigint<n-d+1>& quotient, bigint<d>& remainder, | |||
const bigint<n>& dividend, const bigint<d>& divisor) | |||
{ | |||
static_assert(n >= d, "dividend must not be smaller than divisor for bigint::div_qr"); | |||
assert_except(divisor.data[d-1] != 0); | |||
assert(divisor.data[d-1] != 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The divisor for our purposes is always the modulus.)
This looks good to me, I've previously tested a version of libsnark with all assert_except instances changed to assert, I'll track this change downstream once its merged |
LGTM, although I can only check that the
I'd personally prefer that this was split into a separate commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
@@ -257,7 +256,7 @@ alt_bn128_G1 alt_bn128_G1::add(const alt_bn128_G1 &other) const | |||
alt_bn128_G1 alt_bn128_G1::mixed_add(const alt_bn128_G1 &other) const | |||
{ | |||
#ifdef DEBUG | |||
assert_except(other.is_special()); | |||
assert(other.is_special()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't compile with DEBUG
, I think (based on cursory inspection of depends/packages/libsnark.mk.) But why is this in an #ifdef DEBUG
conditional anyway?
@@ -224,7 +223,7 @@ inline bool bigint<n>::operator>(const bigint<n>& other) const | |||
template<mp_size_t n> | |||
bigint<n>& bigint<n>::randomize() | |||
{ | |||
assert_except(GMP_NUMB_BITS == sizeof(mp_limb_t) * 8); | |||
assert(GMP_NUMB_BITS == sizeof(mp_limb_t) * 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a static assert. Does not block.
Oops, I didn't notice @str4d's #11 (comment) before merging. |
Update libsnark. This updates libsnark to adopt zcash/libsnark#11. Do not merge this until zcash/libsnark#11 is merged. Closes #2043
This PR changes most
assert_except
intoassert
in the interest of avoiding exceptions inside of OpenMP parallel regions.The remaining:
The one in the pairing is there because libsnark's pairing function doesn't appear to work properly for zero inputs (scipr-lab#62) and we don't want a remote DoS (zcash/zcash#437), and the two in fp/fp2 are for
sqrt
which is not used at all inside of parallel code.This PR also removes the evaluation domains that we don't use.