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

Fix "alloc" feature for tests #808

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Conversation

moCello
Copy link
Member

@moCello moCello commented Jan 2, 2024

Also add an example for creating a circuit.

Resolves #346

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (780bbf9) 85.71% compared to head (70447ac) 85.71%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #808   +/-   ##
=======================================
  Coverage   85.71%   85.71%           
=======================================
  Files          57       57           
  Lines        4095     4095           
=======================================
  Hits         3510     3510           
  Misses        585      585           
Files Coverage Δ
src/fft/domain.rs 71.42% <ø> (ø)
tests/common/mod.rs 81.81% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 780bbf9...70447ac. Read the comment docs.

@moCello moCello force-pushed the mocello/mocello/default-tests branch 2 times, most recently from 4a98dd9 to d9acefa Compare January 2, 2024 14:32
@moCello moCello changed the title Fix default feature for tests Fix "alloc" feature for tests Jan 2, 2024
@moCello moCello force-pushed the mocello/mocello/default-tests branch from d9acefa to 63f2e45 Compare January 2, 2024 14:34
let d = composer.append_witness(self.d);

// 1) a < 2^6
const HALF_SIX: usize = 3;
Copy link
Member

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

Copy link
Member Author

@moCello moCello Jan 2, 2024

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?

Copy link
Member Author

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

Copy link
Member

@xevisalle xevisalle Jan 2, 2024

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:

debug_assert_eq!(num_bits % 2, 0);

Copy link
Member Author

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.

Copy link
Member

@xevisalle xevisalle left a 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.

README.md Outdated Show resolved Hide resolved
@moCello moCello force-pushed the mocello/mocello/default-tests branch from 63f2e45 to 287b9c1 Compare January 2, 2024 15:18
Also add an example for creating a circuit.
@moCello moCello force-pushed the mocello/mocello/default-tests branch from 287b9c1 to 70447ac Compare January 3, 2024 09:52
@moCello moCello merged commit 77a9d25 into master Jan 3, 2024
11 checks passed
@moCello moCello deleted the mocello/mocello/default-tests branch January 3, 2024 09:57
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.

Add back examples folder for the crate
2 participants