-
Notifications
You must be signed in to change notification settings - Fork 136
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
Implement to/fromBits in TS, and set max length to 254 bits #1461
Merged
Merged
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5dccfb9
Implement to/fromBits in TS, and set max length to 254 bits
jackryanservia fcf1613
Forgot to change name of fromBits
jackryanservia 157edbf
Fixed mask
jackryanservia 6e4ab72
Swtich import from core.js to prevent dependency cycle
jackryanservia d4c642f
Fix Field.toBits error message
jackryanservia c3df5ec
Change field unit test to use 254bit values
jackryanservia e63f421
Handle constant case manually like before
jackryanservia c14178a
Add extra 0 to end of Bool.toBits so that Scalar.fromBits is happy
jackryanservia e706b55
Fix typo
jackryanservia 74fb4f3
Remove unreachable lines
jackryanservia f9acdbb
Dump vks
jackryanservia 720a9fc
Add explanation for why only 254 bits are allowed in typedoc of fromBits
jackryanservia d291e18
Better comment in Field unit test
jackryanservia 8509bdc
Refactor Scalar.fromBits method to handle input of less than 255 bits
jackryanservia bcf9029
Revert "Add extra 0 to end of Bool.toBits so that Scalar.fromBits is …
jackryanservia da1a7a6
Seal Field.fromBits() return value to avoid proving AST each time ret…
jackryanservia 266b9d1
Add CHANGELOG entry
jackryanservia 08a224b
Merge branch 'main' into fix/field-to-from-254bits
jackryanservia 24aa290
Merge branch 'main' into fix/field-to-from-254bits
jackryanservia 19a3e99
Fix Field import
jackryanservia e1daa57
Dump vks
jackryanservia e5cd926
Move CHANGELOG entry to unreleased section
jackryanservia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
My understanding is that there isn't a clever way to make this secure (other than just limiting it to 254 bits) because any other method would necessarily involve checking if the value overflowed or not. Does that reasoning check out?
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 could provide a secure, 255-bits version by treating the bits as a
ForeignField
element and asserting that it's less than the field size. That would add some overhead so it's better to not do it by default. It could be a separate methodtoFullBits()
or similar. But not urgent IMOThere 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.
This makes sense. I will implement tomorrow if there is time.