-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat: enable to_radix for any field element #1343
Conversation
Can we have a test for this? |
I added one |
Perfect! |
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.
Seems there is an issue with #1313 (comment) when they were testing your PR -- I can't dig into it right now, can you check to see if the issue is related to this PR or something else?
I checked and I don't think it is related, all the to_bits() in the example lead to the same result with my changes or with the noir version. |
A minimal example that isn't working for me:
fn main(x: Field) {
x.to_le_bits(254);
}
# The first 254 bit number
x = "0x2000000000000000000000000000000000000000000000000000000000000000"
# All inputs up to 253 bits seem to work
# x = "0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" nargo execute main |
@guipublic apologies for removing it from the queue, can you check the above message? |
Thank you for the example, a range check was incorrect and I fixed it. |
Does this require any changes to what is currently documented on this page? |
Nope, this shouldn't need any updates to the documentation as it already implies you can do it for all field elements. |
* master: (66 commits) feat(nargo)!: retire print-acir in favour of flag (#1328) chore(ssa): enable cse for assert (#1350) chore(ssa refactor): Add basic instruction simplification (#1329) chore(noir): Release 0.6.0 (#1279) feat: enable to_radix for any field element (#1343) chore(ssa refactor): Simplify inlining pass and fix inlining failure (#1337) chore!: Update to acvm 0.11.0 (#1322) feat: Add ECDSA secp256k1 builtin test (#1294) chore: add support for encoding/decoding inputs from JSON (#1325) feat: Issue an error when attempting to use a `return` expression (#1330) chore(ssa refactor): Fix inlining bug (#1335) fix: to-bits and to-radix for > 128 bits (#1312) chore(parser): Parser error optimisation (#1292) chore(ssa refactor): Implement function inlining (#1293) chore: fix installation link in readme (#1326) chore: fix installation link in readme (#1326) feat(stdlib): Add keccak (#1249) fix: Parsing nested generics (#1319) chore(ssa refactor): Document some SSA-gen functions (#1321) fix: Assigning to tuple fields (#1318) ...
* Enable to_radix for any field element * add integration test * use proper bound during modulo (and small optimisation) * update integration test
* feat: enable to_radix for any field element (#1343) * Enable to_radix for any field element * add integration test * use proper bound during modulo (and small optimisation) * update integration test * feat: Add ECDSA secp256k1 builtin test (#1294) * Copy ECDSA from commit 92ef9b4 * rework for new syntax * commit since github was down * [NOT MERGEABLE] - Skip all tests except ecdsa * change parameter order * update flake.lock * update test * update flake.lock * update flake.lock * modify test * add message + hashed_message to program * remove underscore * modify input to use low-S * commit s variant 1 * commit variant S2 * modify s value in signature to value that passes in acvm/pwg * update flake.lock * remove if statement to make tests go faster * cleanup test --------- Co-authored-by: guipublic <47281315+guipublic@users.noreply.github.com> Co-authored-by: kevaundray <kevtheappdev@gmail.com>
Related issue(s)
Related to #1129
Description
Summary of changes
Enable to_radix for any field element, a maximum bit size was requested before. Now we compute the first value manually in order to reduce the size by the radix have have it below the maximum.
Checklist
cargo fmt
with default settings.Additional context
This PR is related to #1313, where the same feature is done in noir.
BEGIN_COMMIT_OVERRIDE
feat: Enable
to_radix
for any field element (#1343)END_COMMIT_OVERRIDE