Skip to content
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

k256: add expose-field feature; fix/CI benches #161

Merged
merged 1 commit into from
Sep 4, 2020
Merged

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Sep 4, 2020

The benchmarks want direct access to FieldElement for benchmarking purposes. This is a legitimate use case, but breaks encapsulation in that we'd like to generally prevent exposure of FieldElement except for "hazmat"-style use cases.

This is a well-recognized problem with Rust in general: rust-lang/cargo#2911

This commit adds a semi-hidden expose-field feature in order to fix the benchmark. Perhaps it will be abused, but the alternative is not having a benchmark, which seems bad too.

It also adds a CI build step to ensure the benchmarks compile to prevent this sort of regression in the future.

@tarcieri tarcieri requested a review from fjarri September 4, 2020 03:34
@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2020

Codecov Report

Merging #161 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #161   +/-   ##
=======================================
  Coverage   60.25%   60.25%           
=======================================
  Files          25       25           
  Lines        3555     3555           
=======================================
  Hits         2142     2142           
  Misses       1413     1413           
Impacted Files Coverage Δ
k256/src/arithmetic.rs 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3384dc...9621c1f. Read the comment docs.

The benchmarks want direct access to `FieldElement` for benchmarking
purposes. This is a legitimate use case, but breaks encapsulation in
that we'd like to generally prevent exposure of `FieldElement` except
for "hazmat"-style use cases.

This is a well-recognized problem with Rust in general:
rust-lang/cargo#2911

This commit adds a semi-hidden `expose-field` feature in order to fix
the benchmark. Perhaps it will be abused, but the alternative is not
having a benchmark, which seems bad too.

It also adds a CI build step to ensure the benchmarks compile to prevent
this sort of regression in the future.
@tarcieri tarcieri merged commit 089aab4 into master Sep 4, 2020
@tarcieri tarcieri deleted the k256/expose-field branch September 4, 2020 03:44
@tarcieri tarcieri mentioned this pull request Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants