Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions barretenberg/cpp/src/barretenberg/bbapi/bbapi_ecc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ GrumpkinMul::Response GrumpkinMul::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 };
}

GrumpkinAdd::Response GrumpkinAdd::execute(BBApiRequest& request) &&
Expand All @@ -26,11 +22,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) &&
Expand All @@ -41,11 +33,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) };
Copy link
Contributor

Choose a reason for hiding this comment

The 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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

}

Expand All @@ -67,11 +54,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) &&
Expand Down
Loading