Skip to content

Move hash types to where they live#2178

Merged
apoelstra merged 6 commits intorust-bitcoin:masterfrom
tcharding:11-07-mv-hash-types
Dec 10, 2023
Merged

Move hash types to where they live#2178
apoelstra merged 6 commits intorust-bitcoin:masterfrom
tcharding:11-07-mv-hash-types

Conversation

@tcharding
Copy link
Copy Markdown
Member

Move hash types out of hash_types and into the modules where they are primarily used. Adds deprecated re-export so this is not a breaking change.

Is an alternate solution to #2072

Resolves: #2072

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yeah! I wanted this a long time ago and getting rid of hash_types module.

@tcharding tcharding force-pushed the 11-07-mv-hash-types branch 2 times, most recently from 8eb07a6 to 755d71a Compare November 7, 2023 22:01
@tcharding
Copy link
Copy Markdown
Member Author

Hell yeah! I wanted this a long time ago and getting rid of hash_types module.

You inspired me. I rebased, and added a few additional patches fully gutting the hash_types module. I also added some docs fixes to the hash moves patches -BOOM!

apoelstra
apoelstra previously approved these changes Nov 9, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 755d71afcc9e27b847d74f85ed61d8f51403f3ae

@tcharding
Copy link
Copy Markdown
Member Author

Rebased, no other changes.

apoelstra
apoelstra previously approved these changes Nov 18, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 97f44d71591e62e4c7d9b960eada74a2f358a329

@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Nov 22, 2023

Gentle bump please crew.

@tcharding
Copy link
Copy Markdown
Member Author

Rebased, includes some fixes to things that either were broken or got borken during rebase. Note:

  • Public re-exports from lib.rs are now more complete, all hash types are re-exported.
  • Some moves of From impls were in the wrong patch when I first did this.

apoelstra
apoelstra previously approved these changes Nov 29, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1bc2e10e635391b9a543ccf174c932e76fe1929e

We would like all the various hash types to be defined where they
rightly live instead of in the `hash_types` module.

Move the block hash types to the `block` module. While moving, add full
stops to the rustdoc of each hash.

Re-export _all four_ types from lib.rs (previously `WitnessMerkleNode`
was not re-exported).
We would like all the various hash types to be defined where they
rightly live instead of in the `hash_types` module.

Move transaction hash types to the `transaction` module.
We would like all the various hash types to be defined where they
rightly live instead of in the `hash_types` module.

Move the BIP-158 filter hash types to the `bip158` module.
We are emptying the `hash_types` module. `impl_hashencode!` is an
internal macro, as such it can live in the `internal_macros` module.
We are emptying the `hash_types` module. `impl_asref_push_bytes!` is an
internal macro, as such it can live in the `internal_macros` module.

While we are at it import the macro and call it without any qualifying
path, this is typical for our usage of other internals/internal_macros
usage.
The `hash_types` module has been emptied, it now contains only
deprecated re-exports. Add a rustdoc comment stating as such.
@tcharding
Copy link
Copy Markdown
Member Author

Rebased and removed the trivial docs "fix", it wasn't really worth doing.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 801c72e

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 801c72e

@apoelstra apoelstra merged commit aeb220d into rust-bitcoin:master Dec 10, 2023
@tcharding tcharding deleted the 11-07-mv-hash-types branch December 10, 2023 22:00
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.

Consider re-exporting hash types from modules where they belong

3 participants