Skip to content

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

Merged
tarcieri merged 1 commit into
masterfrom
k256/expose-field
Sep 4, 2020
Merged

k256: add expose-field feature; fix/CI benches#161
tarcieri merged 1 commit into
masterfrom
k256/expose-field

Conversation

@tarcieri

@tarcieri tarcieri commented Sep 4, 2020

Copy link
Copy Markdown
Member

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

codecov-commenter commented Sep 4, 2020

Copy link
Copy Markdown

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