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

Move Field to JS #12

Merged
merged 19 commits into from
May 31, 2023
Merged

Move Field to JS #12

merged 19 commits into from
May 31, 2023

Conversation

mitschabaude
Copy link
Member

@mitschabaude mitschabaude commented May 8, 2023

This exposes snarky methods on field elements, in service of o1-labs/o1js#902

Base automatically changed from refactor/js-circuit to main May 10, 2023 20:09
@mitschabaude mitschabaude marked this pull request as ready for review May 24, 2023 11:14
does 16 bits per row (vs 1 bits per row that you can do with generic gates).
[length] has to be a multiple of 16
*)
let truncate_to_bits (length : int) x =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this parameter length_div_16 instead and multiply by 16 in the body of the function -- then the function is total and the caller can prove that it's a multiple of 16 by dividing it by 16 before passing it in.

Consider changing the name to truncate_to_bits16 also

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the input length is a plain integer, which will define the circuit statically, so the caller can't / doesn't have to prove anything about it.

do you still think we should change the signature?
I'm going to change it here but not in the user-facing SnarkyJS method for now (but will throw a quick error there)

@mitschabaude mitschabaude merged commit 0925b00 into main May 31, 2023
@mitschabaude mitschabaude deleted the refactor/field branch May 31, 2023 14:13
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.

None yet

3 participants