-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: catch panics from EC point creation (e.g. the point is at infini…
…ty) (#4790) # Description ## Problem\* Presently noir programs panic when trying to add points not in the curve. For example: ```rust #[test] fn test_addition_with_zero() { let a = pedersen_commitment([1]); let b = pedersen_commitment([0]); // returns the point at infinity let result = a + b; // panics let expected = pedersen_commitment([1]); assert(result == expected); } ``` ## Summary\* Ideally we would check if one of the operands to the ec addition is the point at infinity and return the other operand if so. This at least prevents it from panicking and returns a nicer error. ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
5b352d6
commit 645dba1
Showing
2 changed files
with
39 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ examples/**/target/ | |
examples/9 | ||
node_modules | ||
pkg/ | ||
.idea | ||
|
||
# Yarn | ||
.pnp.* | ||
|
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