727c519efa Re-export amount from primitives (Tobin C. Harding)
84ede349b0 Run the formatter (Tobin C. Harding)
4865d60258 bitcoin: Improve the re-exports ... again (Tobin C. Harding)
Pull request description:
When we messed with the re-exports recently we failed to notice that the formatter would move the `pub use` blocks around because I only put `rustfmt::skip` on one block, I thought that had the effect of stopping all exports below that block being changed, turns out I was wrong.
Run the formatter then make some minor changes to the re-exports in `bitcoin`, including changing comments that do not make sense with the new layout.
ACKs for top commit:
apoelstra:
ACK 727c519efa771d3ec6a21350e4638b9f1536bfe1; successfully ran local tests
Tree-SHA512: fa9fbadf7efa0a76db6a0a2915fcabeda348c561e4047f9517ca7fba1a2008d5624072b7a9ce6069d71c229a794b4d27c3d96195768e87b3c2c412d611ecbfcf
2ae6a9abc1 Prep the chacha20-poly1305 crate for release (Nick Johnson)
Pull request description:
Bump the patch version to `v0.1.1` to include the no_std support.
Could see this requiring `v0.2.0`, but went with the patch bump.
ACKs for top commit:
apoelstra:
ACK 2ae6a9abc1cb6b0f3edb358ebe5e9a0781051abe; successfully ran local tests; let's do it
tcharding:
ACK 2ae6a9abc1
Tree-SHA512: 880e8390447c238bfd0e9493682622213b91f7f41c8c320fea6af763e00d73fb30bfc545f420b79614a8b33249abbd08bc9dcb7ace9522a68862194240b7258a
We are trying to make it so that what ever crate a user uses they see
the same module/type tree (if the module or type exists).
E.g., one can do either of these.
If they use `bitcoin`:
```
use bitcoin::{
amount, block, fee_rate, weight, merkle_tree, opcodes,
pow, script, sequence, transaction, witness,
};
```
Or if they use `primitives`:
```
use bitcoin_primitives::{amount, block, fee_rate, weight};
```
The above imports were tested and `amount` was found to be missing.
These re-exports are hard to get right. We (I) recently made an attempt
to make our stack of crates easier to navigate using the idea that
exporting a type from the crate it is defined in adds some additional
information without any loss of clarity. Note however that the module
must be re-exported from the "highest" place possible because we at
times add additional functionality as we move up the stack e.g.,
`bitcoin::merkle_tree` has logic in it that `primitives::merkle_tree`
does not. In order to future proof the codebase default to always using
the highest module up the stack even when that module adds no additional
code e.g., re-export `blockdata::fee_rate` as opposed to
`units::fee_rate` in the event that we later add logic to
`bitcoin::blockdata::fee_rate`.
This patch adds an additional re-export: `sequence` (previously missing).
eb0a7b40ec Add callouts to the chacha20-poly1305 public docs (Nick Johnson)
Pull request description:
Making it clear in the chacha20-poly1305 documentation that this implementation is maintained by bitcoin developers and targeted specifically for bitcoin ecosystem use cases.
ACKs for top commit:
apoelstra:
ACK eb0a7b40ec8c54807cf316b050f131197aaf3852; successfully ran local tests; will merge this before the 0.1.1 release
tcharding:
ACK eb0a7b40ec
Tree-SHA512: a70e8f79298b63bc7584d0f833ee48162e703518900851dd8b97d353e6e2f0c104810f86337485bcf84709253c9cd8ee3fd5def23959d1510f3d27a909efa181
Making it clear in the chacha20-poly1305 documentation that this
implementation is maintained by bitcoin developers and targeted
specifically for bitcoin ecosystem use cases.
8b928a1515 Split checked_div_by_weight into floor and ceiling version (yancy)
Pull request description:
closes https://github.com/rust-bitcoin/rust-bitcoin/issues/3563
ACKs for top commit:
tcharding:
ACK 8b928a1515
apoelstra:
ACK 8b928a151515b00d44e0c13a866eda874c73dbf6; successfully ran local tests
Tree-SHA512: 1f5a669b24dd5896cf5b13ecdb299fc1e4d449e379e5ae811a66a2efaf2565b7c7edc3e70275cde3b5e0aa5e29c1bbf180be6514a0de78ffd00ac929dbabbb87
8098d5ee05 Reword `Address` constructor docs (Jamil Lambert, PhD)
Pull request description:
Change the wording of the Address constructor function docs to be a standard format. Following up on [#3584 comment](https://github.com/rust-bitcoin/rust-bitcoin/pull/3584#issuecomment-2457197066)
ACKs for top commit:
apoelstra:
ACK 8098d5ee055d672fc8f6e4eef3971b66478a61b0; successfully ran local tests
tcharding:
ACK 8098d5ee05
Tree-SHA512: 1027f334d69182465b2ecafd6fcf9f5deb2b299a64d12dea7f09f25379bd98b1e11be52a04fea83c2194164fd428931f6416eee52603f4bc043717b4e4d1b193
3523b8e117 Rename generic parameter and variable (yancy)
Pull request description:
Use W for Write
closes https://github.com/rust-bitcoin/rust-bitcoin/issues/3590
ACKs for top commit:
tcharding:
ACK 3523b8e117
apoelstra:
ACK 3523b8e1171663fc93ab25765271a1070a2d649f; successfully ran local tests
Tree-SHA512: 8dd9f38ee07e7652ebd291eb121a2630ebb09ea9ea70873f87e57241f51e5114106517511d1fe07774ec4f42920e9d0619031a1545787631a30422de12421a67
c61df05916 Fix bip34 number parsing for Block (junderw)
Pull request description:
Fixes#3583
ACKs for top commit:
apoelstra:
ACK c61df059160d3aeef73046de28cb5d5afcb962d2; successfully ran local tests
tcharding:
ACK c61df05916
Tree-SHA512: 3fade122f98c7c9e3b2888c33479d3a9426fb35f212ccee6b89b7cd5c92d2b58c93e165d5c59eda183c0943809d7e633d929000be92b197988a3ceb0ea37514f
186b9557b6 Automated update to Github CI to rustc nightly-2024-11-06 (Update Nightly Rustc Bot)
Pull request description:
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
ACKs for top commit:
tcharding:
ACK 186b9557b6
Tree-SHA512: e601e5204bc3e312f8e1f9ec0a5ca316a428473a049065597d7c2d342ac7c1582083be93dcced844b991c7faad0675f555409a3325d5996b5bb65b0b32f93082
1649b68589 Standardize wording to `constructs a new` (Jamil Lambert, PhD)
27f94d5540 Replace `creates` with `constructs` (Jamil Lambert, PhD)
Pull request description:
As discussed in issue #3575 there are various ways of saying a new object is created.
These have all be standardized to the agreed version.
Close#3575
ACKs for top commit:
apoelstra:
ACK 1649b68589834dfe9d5b63812da3e9f0e5930107; successfully ran local tests
tcharding:
ACK 1649b68589
Tree-SHA512: 0ed9b56819c95f1fc14da1e0fdbbe03c4af2d97a95ea6b56125f72913e8d832db5d2882d713ae139d00614e651f3834a4d72528bdf776231cceb6772bf2f9963
fe8ca21ec2 hashes: Duplicate impl_from_infallible (Tobin C. Harding)
7652d0ddfc hashes: Hide innards of FromSliceError (Tobin C. Harding)
5232bba62b hashes: Move FromSliceError to submodule (Tobin C. Harding)
Pull request description:
Hide the internals of the `hashes::FromSliceError`.
ACKs for top commit:
apoelstra:
ACK fe8ca21ec282cfe50e3f39b7f86c619d30d7f542; successfully ran local tests
Tree-SHA512: dac33777353dd81c8c86de331b2ab30d0a5268f2be7685f85405d29809ec36eeab31b0e71c9f09e820e06a93c3f05b7d675e5e729b780e8600b960cad4a02c77
ba124757c4 hashes: Default to no_std (Tobin C. Harding)
6a4e219c55 hashes: embedded: Remove unused import (Tobin C. Harding)
915c9627f6 Put feature gate attribute under test attribute (Tobin C. Harding)
Pull request description:
`hashes` is `no_std` ready, lets default to `no_std`.
Done as part of #2413
ACKs for top commit:
apoelstra:
ACK ba124757c419aef38019ee7825c32af540b9dcd0; successfully ran local tests
Tree-SHA512: 14a69d32c7e1fe8303d53944fa274acfe6a509407b8d69312d693102588a1f59a56a815370d6d4dfe15fa68678ef67faa1c313967a7caaba01db97065e634b7b
There is a range of different wordings used in the docs of constructor
type functions.
Change all to start with `Constructs a new` or `Constructs an empty`.
In functions that act like constructors there is a mixture of the usage
of `creates` and `constructs`.
Replace all occurrences of `creates` with `constructs` in the first line
of docs of constructor like functions.
We don't want a dependency on `internals` for `hashes` unless its really
needed.
Duplicated the `impl_from_infallible` macro into `hashes::error` and
use it to implement from infallible for `FromSliceError`.
Add a public `error` module and move the one error for the `hashes`
crate into it.
Re-export at the crate root.
Done in preparation for adding an additional error type.
81d8699b55 units: Put no_std up top (Tobin C. Harding)
3e332c3839 amount: Fix docs on FromStr (Tobin C. Harding)
5bec76aa51 amount: Fix rustdocs (Tobin C. Harding)
41c80cc476 amount: Improve docs on div by weight (Tobin C. Harding)
2b4a61739a Add type to debug output for Amount (Tobin C. Harding)
42e5043b33 Add from_int_btc group of functions (Tobin C. Harding)
Pull request description:
Improve the `amount` module by doing:
- Patch 1: Add/update `from_int_btc` and `from_int_btc_const` functions
- Patch 2: Add type to debug output for `Amount`
- Patch 3: Fix incorrect docs
- Patch 4: Make docs use correct style and be uniform across the two amount types
- Patch 5: Fix docs on `FromStr`
ACKs for top commit:
apoelstra:
ACK 81d8699b55dad570247cb14d2b3eea64270a83cf; successfully ran local tests
jamillambert:
ACK 81d8699b55
Tree-SHA512: ddd6e02b4cd9a9aa8cbdd2d2f7ae289a6bcca9eb002ef0c6d83a6eca950b2cd08f5918286bb33e814f321e3bfe83fdf75ae051cf8f91ee45d3e4abe76c1c2a4c
312718cd6e Update rust-bitcoin-maintainer-tools (Tobin C. Harding)
Pull request description:
Update to the latest commit hash of tip of master.
ACKs for top commit:
apoelstra:
ACK 312718cd6eae8ce71a331c2957381b71240888d7; successfully ran local tests
Tree-SHA512: 94fbe5fb7c8f0ead1f46435e3b0c13f61d907f1e06aaa3160d6e7dc9f86339eb5efcf5a00322be42ab236396ff8245dc5e526ceaaa6642588e0bcd82252538d7
The `no_std` attribute has significant ramifications, as opposed to the
clippy attributes etc.
Put the `no_std` attribute up top so it catches the eye. This is also
uniform with other crates in this repo.
The docs on `FromStr` say "string slice is zero" but actually mean to
document the behaviour when the value represented is zero.
Also the fact that `FromStr` returns an error if parsing fails is self
evident.
Fix the rustdocs on `Amount` and `SignedAmount` by doing:
- Make them uniform
- Use correct style (looks like `SignedAmount` got left behind when we
improved `Amount`)
6555143478 bitcoin: Re-format crate level re-exports (Tobin C. Harding)
Pull request description:
Is there any advantage trying to lay out the re-exports to give users an idea of the crate structure?
We have the explicit aim that users who depend on `bitcoin` do not ever need to reach directly into `primitives` (or `units`) however it is kind of nice to know where things come from, saves jumping to multiple files looking for them (for those of us that jump to files manually).
I do not know how all the re-exports interact with other folks IDEs, I personally open files manually and just remember where stuff is.
ACKs for top commit:
jamillambert:
ACK 6555143478
apoelstra:
ACK 6555143478dbd2306d0506a29b7d83433e7b33f5; successfully ran local tests; If Jamil and Tobin are happy then I am happy
Tree-SHA512: 15fc9bec6ba34114b59f9eeb8b5377f8bc2957f10b37e8b41772b26f3240fa2b41bb67dc33575f54e1a42d4c3cc44f148630e328674bc1c9e0e3a29c9e6efa06
9f60e1ae26 Copy crate level attributes to chacha20_poly1305 (Tobin C. Harding)
Pull request description:
No obvious reason not to; copy the crate level attributes that we have in all our other crates.
ACKs for top commit:
apoelstra:
ACK 9f60e1ae26d2ff29a53e90bccd5a580d7a0f2c84; successfully ran local tests
Tree-SHA512: 5b861fc3a7f05cb4bd24f714a47266616d462ffa67253249f214339d341f39d5f42e35d7e23269bdf40182041b6138e9b304f7883c644f9e522ec2a90be5cb99
f3aedf5335 Automated update to Github CI to rustc nightly-2024-11-03 (Update Nightly Rustc Bot)
Pull request description:
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
ACKs for top commit:
tcharding:
ACK f3aedf5335
Tree-SHA512: 49d27faea980f7aaacd9d0c15c4687f1157962a25e29849bd5916f134333dd85a967a23c804a0753c3551eef618bc782127cf5ed37d977385c90305e510798e6
Is there any advantage trying to lay out the re-exports to give users an
idea of the crate structure?
We have the explicit aim that users who depend on `bitcoin` do not ever
need to reach directly into `primitives` (or `units`) however it is kind
of nice to know where things come from, saves jumping to multiple files
looking for them (for those of us that jump to files manually).
I do not know how all the re-exports interact with other folks IDEs, I
personally open files manually and just remember where stuff is.
85942c355d Re-export block::Header as BlockHeader (Tobin C. Harding)
Pull request description:
For users who want to just grab stuff from the crate root it makes total sense for there to be a `BlockHeader`.
Another nice thing, in the HMTL docs it makes BlockHeader be in the struct list right along with `Block`, `BlockHash`, and `BlockHeight`.
Close: #3548
ACKs for top commit:
apoelstra:
ACK 85942c355dfdcf9ddf9a46202f4db56794dcc85d; successfully ran local tests
jamillambert:
ACK 85942c355d
Tree-SHA512: 6fbaf7936062323d31940179ffcbc62951b21f53955a42dca2e28476bda0cebeb041db0e1b4f1ceeac32e43d94fe5476ef055595ae88dc6cfc266d32082bdf4d
4431df18fe script: remove `unsafe` marker from slice-to-script conversions (Andrew Poelstra)
Pull request description:
The length of the slices is not a safety invariant.
Fixes#3531
ACKs for top commit:
tcharding:
ACK 4431df18fe
Tree-SHA512: 85f745058bc5bf68d312f75c53cef570ead986247ca3cb3fc54b5381dd0214e7df55c1fcb99f06e693b0b9478ec6a9785186cac56886f8007ab7b827d903bd01
90b2ac03e3 hashes: Introduce impl_bytelike_traits macro (Tobin C. Harding)
Pull request description:
We have a couple of problems:
1. There are two macros currently for fmt stuff that do similar things, `arr_newtype_fmt_impl` and `hex_fmt_impl` - the difference is not immediately obvious, its the way that the byte array is iterated.
2. Our hash types are missing `AsRef<[u8; len]>` and `Borrow<[u8; len]>`.
Introduce a new macro and remove a bunch of other macros. Include extensive docs but hide the macro from public docs because its not really for consumers of the library.
The macro requires `$crate::hex` to point to `hex-conservative`.
Note the macro is pretty generic (as in general purpose), `hashes` might not be the right home for it. Potentially a better place would be in `hex` itself?
ACKs for top commit:
apoelstra:
ACK 90b2ac03e3560b0e9f78f52b198c869773b5816e; successfully ran local tests
Tree-SHA512: 4d8778c572f29d965d353ab877631c24ce09c27c8f1269d2874fd9a97b3e8ba782d367aedcd501d9e7236ac653ed1f106ec9bf1759c5574f21a607856347f75d
32bc68d4dc primitives: Add rustdoc links back in (Tobin C. Harding)
Pull request description:
During move of code to `primitives` we removed a few links to types that were not yet moved, we can now put these back in.
Close: #2997
ACKs for top commit:
apoelstra:
ACK 32bc68d4dcbbb9a15694df56743ae550de0c805c; successfully ran local tests
jamillambert:
ACK 32bc68d4dc
Tree-SHA512: 952bd9c2e358aed4dc8b40f6f98d11ef2f52acb9366587a81033663a16745d2fb68003b043516b3ef3faf788742910cccb40ffa8b515bb3ad189131425f969bf
The length of the slices is not a safety invariant.
Fairly large diff because I had to remove a bunch of `unsafe` blocks
around calls to this function.
Fixes#3531
38b8c6f5ea units: Remove a bunch of feature gateing (Tobin C. Harding)
e347b50614 Use InputString in hex prefix error types (Tobin C. Harding)
ff20249bdc Remove unneeded feature gate (Tobin C. Harding)
88f6621e30 Split parse macros (Tobin C. Harding)
Pull request description:
Remove the feature gating from the modules in `units` - BOOM!
Close: #3213
ACKs for top commit:
apoelstra:
ACK 38b8c6f5ea2d997e08aae496ed333abeedab9406; successfully ran local tests; nice!
Tree-SHA512: 75c7e70e64c705fe0e32d92d9a0557cd77f5cd5d68a50f274be4a128331f5ae69259f6c6a9d483699478cbc2c40ebadcb83e1d419952287f74657906ca65caaf