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

hashes: make hex optional #2711

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Apr 23, 2024

Draft because the first 3 patches are #2770, this PR is just the last 5.

The first 4 patches of this PR are all preparatory, and introduce no logic changes.

What this PR mainly shows is how easy it is to close #2654 after we did #2770 - WIN.

Close: #2654

@github-actions github-actions bot added ci C-bitcoin PRs modifying the bitcoin crate C-hashes PRs modifying the hashes crate doc labels Apr 23, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8797148222

Details

  • 140 of 161 (86.96%) changed or added relevant lines in 14 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 83.151%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bitcoin/src/internal_macros.rs 64 85 75.29%
Files with Coverage Reduction New Missed Lines %
bitcoin/src/internal_macros.rs 1 70.27%
Totals Coverage Status
Change from base Build 8793522744: 0.02%
Covered Lines: 19118
Relevant Lines: 22992

💛 - Coveralls

We have a private function that makes use of the `Hash` trait to
generically hash map entries. This usage makes patching the `hashes`
module difficult. We can achieve the same thing by using a macro and
passing in the concrete type.

This is an internal change, no effect on logic or public API.
Clean up the test imports in the `p2p` module:

- Use `use super::*` as is conventional.
- Use `sha256d::Hash` as is conventional.

Refactor, no logic changes.
In preparation for feature gating hex stuff pull the bytelike traits
that depend on `hex` (ie, stringly stuff) out into a separate macro and
call the new macro from the original.

Structural change only, no behavioural change.
In preparation for feature gating a bunch of the `hmac` unit tests move
the slicey (`AsRef`, `Borrow`, etc) tests so that all the display
related tests are together.

Code move only, no other changes.
This import is not needed, not sure why its not being flagged by
`clippy`.

No logic change.
In general smaller unit tests are better, and ones that have one assert
and the "best" - or so they say.

In this instance, done mainly in preparation for feature gating one of
the tests in upcoming work.

Refactor only, no test coverage change.
Make the `hex` dependency optional and feature gate code on "hex" as
required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-base58 C-bitcoin PRs modifying the bitcoin crate C-hashes PRs modifying the hashes crate test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make hex an optional dep for hashes
2 participants