-
Notifications
You must be signed in to change notification settings - Fork 613
chore(bb): remove some is_curve checks #18037
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,6 @@ GrumpkinMul::Response GrumpkinMul::execute(BBApiRequest& request) && | |
| BBAPI_ERROR(request, "Input point must be on the curve"); | ||
| } | ||
| auto result = point * scalar; | ||
| if (!result.on_curve()) { | ||
| BBAPI_ERROR(request, "Output point must be on the curve"); | ||
| } | ||
| return { result }; | ||
| } | ||
|
|
||
|
|
@@ -26,11 +23,7 @@ GrumpkinAdd::Response GrumpkinAdd::execute(BBApiRequest& request) && | |
| if (!point_b.on_curve()) { | ||
| BBAPI_ERROR(request, "Input point_b must be on the curve"); | ||
| } | ||
| auto result = point_a + point_b; | ||
| if (!result.on_curve()) { | ||
| BBAPI_ERROR(request, "Output point must be on the curve"); | ||
| } | ||
| return { result }; | ||
| return { point_a + point_b }; | ||
| } | ||
|
|
||
| GrumpkinBatchMul::Response GrumpkinBatchMul::execute(BBApiRequest& request) && | ||
|
|
@@ -41,11 +34,6 @@ GrumpkinBatchMul::Response GrumpkinBatchMul::execute(BBApiRequest& request) && | |
| } | ||
| } | ||
| auto output = grumpkin::g1::element::batch_mul_with_endomorphism(points, scalar); | ||
| for (const auto& p : output) { | ||
| if (!p.on_curve()) { | ||
| BBAPI_ERROR(request, "Output point must be on the curve"); | ||
| } | ||
| } | ||
| return { std::move(output) }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this kind of move generally to be avoided? (or at least not necessary)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easiest way is to try and move something and see if linter complains. but std::move is needed here! only literally return a; doesn't need to be return std::move(a) but using the param as a parameter in any way the C++ compiler does not automatically move it |
||
| } | ||
|
|
||
|
|
@@ -67,11 +55,7 @@ Secp256k1Mul::Response Secp256k1Mul::execute(BBApiRequest& request) && | |
| if (!point.on_curve()) { | ||
| BBAPI_ERROR(request, "Input point must be on the curve"); | ||
| } | ||
| auto result = point * scalar; | ||
| if (!result.on_curve()) { | ||
| BBAPI_ERROR(request, "Output point must be on the curve"); | ||
| } | ||
| return { result }; | ||
| return { point * scalar }; | ||
| } | ||
|
|
||
| Secp256k1GetRandomFr::Response Secp256k1GetRandomFr::execute(BB_UNUSED BBApiRequest& request) && | ||
|
|
||
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.
micro nit: inconsistent return syntax vs other methods