-
Notifications
You must be signed in to change notification settings - Fork 150
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
Fix "alloc" feature for tests #808
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #808 +/- ##
=======================================
Coverage 85.71% 85.71%
=======================================
Files 57 57
Lines 4095 4095
=======================================
Hits 3510 3510
Misses 585 585
Continue to review full report in Codecov by Sentry.
|
4a98dd9
to
d9acefa
Compare
d9acefa
to
63f2e45
Compare
examples/circuit.rs
Outdated
let d = composer.append_witness(self.d); | ||
|
||
// 1) a < 2^6 | ||
const HALF_SIX: usize = 3; |
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 remember that you explained me the reason for that, but I can't remember it now. As such, maybe would be a good moment to fix this? Probably more people will have the same doubt...
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 range component can only operate with even numbers. This is why we give it half of the number we want to operate on, see here.
I was trying to convey this by introducing the constant and naming it HALF_*
where *
is the value that we are checking on. As much as I can see that this is far from ideal, I'm also not sure how to make this better.
Do you have a suggestion?
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.
How about this:
// 1) a < 2^6
composer.component_range::<3>(a); // 3 BIT_PAIRS = 6 bits
// 2) b < 2^4
composer.component_range::<2>(b); // 2 BIT_PAIRS = 4 bits
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.
is there a way to do a compile time check on the provided value? otherwise, we could also throw an error at runtime. e.g., if the provided number is not even, throw NotEvenError: provided constant not even.
EDIT: I saw that time ago, the function had this check:
Line 913 in 65db5f0
debug_assert_eq!(num_bits % 2, 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.
Actually we introduced BIT_PAIRS
to get rid of this debug_assert
(see the discussion in #764 ).
In any case, any change in the range or logic components is not in the scope of this PR.
If you want we can open another issue on this to have the discussion.
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.
LGTM, just consider the comment I added.
63f2e45
to
287b9c1
Compare
Also add an example for creating a circuit.
287b9c1
to
70447ac
Compare
Also add an example for creating a circuit.
Resolves #346