-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add rot function to bindings #184
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MartinMinkov
force-pushed
the
feat/ROT-gadget
branch
from
October 12, 2023 21:46
7c4ee93
to
0859254
Compare
MartinMinkov
force-pushed
the
feat/ROT-gadget
branch
from
October 12, 2023 21:53
0859254
to
1f7443d
Compare
… on 64-bit integers This function allows for the rotation of bits in a 64-bit integer, either to the left or right, by a specified number of bits. This is useful for cryptographic operations that require bit manipulation.
…lect its functionality, as it is not limited to 64 bits
MartinMinkov
changed the title
WIP: add rot function to bindings
add rot function to bindings
Oct 17, 2023
MartinMinkov
changed the title
add rot function to bindings
Add rot function to bindings
Oct 17, 2023
mitschabaude
approved these changes
Oct 23, 2023
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.
pre-approving with the comment above!
… string literal types 'left' | 'right' for better readability and understanding of the code
…er readability and understanding of its functionality
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR exposes the
ROT
constraint to our JS bindings and adds arot
function for finite fields in the case of constants.Context
In the context of bitwise operations, a rotation (often referred to as a "bitwise rotation") is an operation that shifts the bits of a binary number either to the left or to the right, but unlike a standard shift operation, the bits that "fall off" the end are not discarded. Instead, they "wrap around" to the other end.
There are two primary types of rotations:
Tested
This work is tested in the upper layers of
o1js
with unit and e2e tests that are built on top of the exposed gate constraint.🔗 o1js: o1-labs/o1js#1182