Commit Graph

3946 Commits

Author SHA1 Message Date
Fmt Bot 3417c576ed 2024-04-21 automated rustfmt nightly 2024-04-21 01:03:30 +00:00
Andrew Poelstra 76a5909029
Merge rust-bitcoin/rust-bitcoin#2685: Add backport section to contributing docs
b49e670772 Add backport section to contributing docs (Tobin C. Harding)

Pull request description:

  Add a section on how we do backports and what the merge policy is.

  Recently I backported a patch by pushing directly to the `0.32.x` release branch but this is not an optimal process because it leaves no history on github. Instead PR backports in like we do for patching `master` but allow one-ACK merging if the backport is a straight cherry pick of a patch from `master`.

ACKs for top commit:
  apoelstra:
    ACK b49e670772 looks much better!
  storopoli:
    ACK b49e670772
  sanket1729:
    ACK b49e670772

Tree-SHA512: f114cc015cd0c314567dc337c77ba9b021132f5bbd503f58fcac1c86acab3aae89d179af67cde89f2ac48d7391f7cc7fc23b4f7cfa63ad2b89d335a36cbe131b
2024-04-20 11:35:11 +00:00
Andrew Poelstra 2df6b013de
Merge rust-bitcoin/rust-bitcoin#2700: Fix kani test
e47e57c265 Fix kani test (Tobin C. Harding)

Pull request description:

  In a kani test we are checking if the result of `to_unsigned()` is an error but setting `is_signed` to `true`, this field represents the signed-ness of the return type of `to_unsigned` (`Amount`) so should be `false`.

  Fix kani daily job.

ACKs for top commit:
  apoelstra:
    ACK e47e57c265

Tree-SHA512: b0b4ace6d66dbbd30df3da1cbc233bfa994e7e003e049e949af4ab03b01c09d0cc29fd40d84a93a7d41e94751da91407e391c80d3de7064e9ac23485273309a6
2024-04-18 22:06:53 +00:00
Tobin C. Harding e47e57c265
Fix kani test
In a kani test we are checking if the result of `to_unsigned()` is an
error but setting `is_signed` to `true`, this field represents the
signed-ness of the return type of `to_unsigned` (`Amount`) so should be
`false`.

Fix kani daily job.
2024-04-19 06:15:49 +10:00
Tobin C. Harding b49e670772
Add backport section to contributing docs
Add a section on how we do backports and what the merge policy is.

Recently I backported a patch by pushing directly to the `0.32.x`
release branch but this is not an optimal process because it leaves no
history on github. Instead PR backports in like we do for patching
`master` but allow one-ACK merging if the backport is a straight cherry
pick of a patch from `master`.
2024-04-19 05:50:32 +10:00
Andrew Poelstra 3aecf94205
Merge rust-bitcoin/rust-bitcoin#2696: Fix example spend amount
3a2d86e0c6 Fix example spend amount (Tobin C. Harding)

Pull request description:

  In the segwit signing example we are using the incorrect value when creating the signature - we should be using the utxo amount (input amount) not the spend amount (output spend amount).

  Close: #2680

ACKs for top commit:
  storopoli:
    ACK 3a2d86e0c6
  apoelstra:
    ACK 3a2d86e0c6
  sanket1729:
    ACK 3a2d86e0c6

Tree-SHA512: dbd25c0adb2b0cd3ddd61893ce0c057edd7d62aad6a380b19b1e10ae1b8f0f22d81c15c3c7e2bb64a1740b1b6a7b096aaadab8040e507b73fef0bc2a1638d827
2024-04-18 19:44:36 +00:00
Tobin C. Harding 3a2d86e0c6
Fix example spend amount
In the segwit signing example we are using the incorrect value when
creating the signature - we should be using the utxo amount (input
amount) not the spend amount (output spend amount).

Close: #2680
2024-04-18 09:23:18 +10:00
Andrew Poelstra 7a8dafb748
Merge rust-bitcoin/rust-bitcoin#2692: Add docs for custom signets
30a09670e8 Add docs for custom signets (Tobin C. Harding)

Pull request description:

  We have started using `AsRef<Params>` in a few places as a function parameter. If a user of the library wishes to use these functions they need to create a type that can implement this trait. Because we use `non_exhaustive` on the `Params` struct it is not possible to just construct a `Params` type. This may be surprising for some folk.

  Add module level docs to the `consensus::params` module with an example of how to create a type that can be used to describe a custom signet network. Use fields inspired by Mutiny Wallet's described usage.

  Close: #2690

ACKs for top commit:
  sanket1729:
    ACK 30a09670e8.
  apoelstra:
    ACK 30a09670e8 this is great; would like to see more `const` but for example code no big deal

Tree-SHA512: 50881763aea99641e24871b0eae60650174c48f620742944e7d5617fcf1edff73a20b2a8f043433f6f114ff5f3f4691703fc37b28880c305bb052c2d75d1eeeb
2024-04-17 17:31:03 +00:00
Andrew Poelstra 4a73987888
Merge rust-bitcoin/rust-bitcoin#2687: Allow deprecated Params field
6e84548b1f Allow deprecated Params field (Tobin C. Harding)

Pull request description:

  I'm not sure why I haven't see this before during the whole test cycle but while running `cargo kani --only-codegen` we get a bunch of warnings of form:

    warning: use of deprecated field `consensus::params::Params::pow_limit`

  We deprecated the `pow_limit` field but still set it (obviously) in const structs - just shoosh the warning.

  Found while investigating the current kani CI failures.

ACKs for top commit:
  sanket1729:
    utACK 6e84548b1f

Tree-SHA512: b3fe9108e6098bdca824785caf1b5ce5f89c415e014c6380302f3de16421083fd9b0f01f1559466e2a3a57da93cd7e14a2c3e59ef5c8fdd45762ebeeeeffeea0
2024-04-17 12:22:06 +00:00
Tobin C. Harding 30a09670e8
Add docs for custom signets
We have started using `AsRef<Params>` in a few places as a function
parameter. If a user of the library wishes to use these functions they
need to create a type that can implement this trait. Because we use
`non_exhaustive` on the `Params` struct it is not possible to just
construct a `Params` type. This may be surprising for some folk.

Add module level docs to the `consensus::params` module with an example
of how to create a type that can be used to describe a custom signet
network. Use fields inspired by Mutiny Wallet's described usage.

Close: #2690
2024-04-17 10:35:32 +10:00
Tobin C. Harding 6e84548b1f
Allow deprecated Params field
I'm not sure why I haven't see this before during the whole test cycle
but while running `cargo kani --only-codegen` we get a bunch of warnings
of form:

  warning: use of deprecated field `consensus::params::Params::pow_limit`

We deprecated the `pow_limit` field but still set it (obviously) in
const structs - just shoosh the warning.
2024-04-17 06:31:41 +10:00
Andrew Poelstra 87b674be45
Merge rust-bitcoin/rust-bitcoin#2686: Fix kani codegen CI job
0f0bd91929 kani: Pin version to 0.48.0 (Tobin C. Harding)
5981b15902 kani: Rename tests (Tobin C. Harding)
17bacc6fb6 kani: Remove redundant import (Tobin C. Harding)

Pull request description:

  Fix the current failing Kani job on todays PRs.

  FTR our daily `kani` job has been red for ages, perhaps since we created the `units` crate? But today the `--codege-only` job broke (on all PRs). `kani` released a new version 10 days ago, pinning to the previous version seems to resolve the issue. I raised a bug report but did not investigate further.

  - Patch 1: Remove redundant import
  - Patch 2: Rename the tests
  - Patch 3: Pin kani version

  File bug report: https://github.com/model-checking/kani/issues/3142

  PR is CI only, can go in with one ack.

  (Patch 2 is the result of debugging the _real_ kani failure we have at the moment, I'll save the rant for the PR that fixes it.)

ACKs for top commit:
  apoelstra:
    ACK 0f0bd91929 though I wonder if we shoud comment out the test in rust.yml and file an issue
  sanket1729:
    utACK 0f0bd91929

Tree-SHA512: 1e510dd53f3474dd4891792e312444cec57239c865e4cd7d144932713b3ce2e66806a37b88d55ecaa514292ac936de569cc9126c773048a5a930c6c822faad29
2024-04-16 20:28:55 +00:00
Tobin C. Harding 0f0bd91929
kani: Pin version to 0.48.0
Kani version `0.49.0` came out 10 days ago, its odd that our CI just
broke today but in an attempt to see if its release related pin to the
version before the latest release.
2024-04-16 10:05:07 +10:00
Tobin C. Harding 5981b15902
kani: Rename tests
The tests currently include the word "add" but they test addition as
well as subtraction. Elect to keep the multiple assertions per test and
just make the names more general.
2024-04-16 10:05:07 +10:00
Tobin C. Harding 17bacc6fb6
kani: Remove redundant import
`cargo` is reporting a redundant import warning:

 warning: the item `TryInto` is imported redundantly

Remove the import statement from the `verification` module.
2024-04-16 06:18:06 +10:00
Andrew Poelstra f18bd22489
Merge rust-bitcoin/rust-bitcoin#2677: Allow m prefix in derivation paths
830c1e9cfe Allow m prefix in derivation paths (Tobin C. Harding)

Pull request description:

  Recently in #2451 we disallowed bip32 derivation paths with the leading 'm' variable.

  There is some confusion as to what exactly the bip specifies however Bitcoin Core RPC call `getaddressinfo` returns a derivation path with a leading "m/". This means we need to be able to parse it irrespective of what the bip says.

  Be more liberal in what we accept as a derivation path, including both with and without the leading 'm/'.

  Leave the full investigation of the bip to a later date.

  Change back some of the test strings as makes sense and include test strings to showcase the full current behaviour.

  This PR replaces #2674.

ACKs for top commit:
  apoelstra:
    ACK 830c1e9cfe
  sanket1729:
    ACK 830c1e9cfe
  junderw:
    ACK 830c1e9cfe

Tree-SHA512: 7a4fccd49cb8cd91a6c8db51d758ae116d9d2e98fead7b87520ca302022b37ddbcf3f85453941c5f336f8e934ad224beba99527dc29ce8368fbb1f25508c1615
2024-04-15 12:40:18 +00:00
Andrew Poelstra 4d9449e0f9
Merge rust-bitcoin/rust-bitcoin#2683: Automated nightly rustfmt (2024-04-14)
410fd892e9 2024-04-14 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 410fd892e9 one line, nice

Tree-SHA512: dadf7c46f26b42cd1376b83c307b1cca3c55e3c23f6281cc51f2445d8536638ba803a3b403490ddfdc5e1993139c5c14671c3b8ac3d087ba0d7bf2e141f47838
2024-04-14 13:10:17 +00:00
Fmt Bot 410fd892e9 2024-04-14 automated rustfmt nightly 2024-04-14 01:21:26 +00:00
Andrew Poelstra 52080a0853
Merge rust-bitcoin/rust-bitcoin#2676: Improve deprecation notice
33ebbac4c8 Improve deprecation notice (Tobin C. Harding)

Pull request description:

  The deprecation notice for `is_provably_unspendable` contains "is not very useful" which is a bit presumptuous to tell to users, it may very well be useful to them. Use the more helpful text that already exists in rustdoc on the function.

  Function was deprecated in #2294

ACKs for top commit:
  apoelstra:
    ACK 33ebbac4c8 I am fine with the existing text
  sanket1729:
    utACK 33ebbac4c8

Tree-SHA512: 0611b9c414a5b01d453145d645dbfe6ef0be4000a7133bc79211c0494741638fcc19f97d6503546813f426cbc492816daf708045a76e7d67e5bd975ad8f56d5f
2024-04-11 12:26:15 +00:00
Tobin C. Harding 830c1e9cfe
Allow m prefix in derivation paths
Recently in #2451 we disallowed bip32 derivation paths with the leading
'm' variable.

There is some confusion as to what exactly the bip specifies however
Bitcoin Core RPC call `getaddressinfo` returns a derivation path with a
leading "m/". This means we need to be able to parse it irrespective of
what the bip says.

Be more liberal in what we accept as a derivation path, including both
with and without the leading 'm/'.

Leave the full investigation of the bip to a later date.

Change back some of the test strings as makes sense and include test
strings to showcase the full current behaviour.
2024-04-11 07:23:30 +10:00
Andrew Poelstra 8a09f142a9
Merge rust-bitcoin/rust-bitcoin#2675: Automated daily update to rustc (to nightly-2024-04-09)
00572ae24b Automated update to Github CI to rustc nightly-2024-04-09 (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 00572ae24b

Tree-SHA512: 1a76e4777f760607507eee4769e0e30c5b681fb4b2c75ac0581753c2cf3d36e8dc2bb76da14977e2e7ee0f64fd2aad04474b7f56858adbdaa5a81d1b1f8ddf70
2024-04-10 10:31:59 +00:00
Tobin C. Harding 33ebbac4c8
Improve deprecation notice
The deprecation notice for `is_provably_unspendable` contains "is not
very useful" which is a bit presumptuous to tell to users, it may very
well be useful to them. Use the more helpful text that already exists in
rustdoc on the function.
2024-04-10 11:05:05 +10:00
Update Nightly Rustc Bot 00572ae24b Automated update to Github CI to rustc nightly-2024-04-09 2024-04-10 01:04:08 +00:00
Andrew Poelstra 163bf64fcc
Merge rust-bitcoin/rust-bitcoin#2668: Automated nightly rustfmt (2024-04-07)
747ca578dd 2024-04-07 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 747ca578dd
  tcharding:
    ACK 747ca578dd

Tree-SHA512: c4387388f2cfcb9b9aacf7023d024379cbf073166f04fcba4b4c0d66972ee109f4c9f66e0d8ed1d57c419266680a9e6953a5e38ecb0aa937e6c368d59aaba976
2024-04-08 22:28:08 +00:00
Andrew Poelstra 59a262e465
Merge rust-bitcoin/rust-bitcoin#2669: Minor fixes for latest rustc nightly
12be5c0d27 clippy: fix a couple of nits in `clippy --no-default-features` (Andrew Poelstra)
7d07fc3fb9 ci: update the new nightly_version file in cron (Andrew Poelstra)

Pull request description:

  Fixes an issue with #2658 which accidentally disabled our nightly rustc update cronjob, and also fixes a small clippy lint.

  After this, we should be able to get back onto the latest nightly :).

ACKs for top commit:
  tcharding:
    ACK  12be5c0d27

Tree-SHA512: 771fb2c278b0aaea04454a3c397d4ca1c201ff59891d4f7af69a295aa4c6475320383fa5f4dd2a20323e79d5fe68b2ff37c3f01717a12f98afb9db3c2939c95a
2024-04-08 13:03:37 +00:00
Andrew Poelstra 12be5c0d27
clippy: fix a couple of nits in `clippy --no-default-features`
We only check clippy in CI with --all-features, which usually is the
best way to get maximum coverage. But if you try a couple other feature
combos, especially those related to nostd, you can hit more code.
2024-04-07 15:16:09 +00:00
Andrew Poelstra 7d07fc3fb9
ci: update the new nightly_version file in cron 2024-04-07 15:16:09 +00:00
Andrew Poelstra 5c56b69eed
Merge rust-bitcoin/rust-bitcoin#2667: Remove deprecated legacy numeric methods
051c358bcb Remove deprecated legacy numeric methods (Divyansh Gupta)

Pull request description:

  As `rustc 1.79.0-nightly (9d79cd5f7 2024-04-05)` is released which solves the issue mentioned , but the release has deperacted legacy numeric methods.
  Thus replaced `u16::max_value()` etc with `u32::MAX` & `core::u16` to directly `u16`.

  fix #2639

ACKs for top commit:
  tcharding:
    ACK 051c358bcb
  apoelstra:
    ACK 051c358bcb thanks! I will remove an equivalent commit from my #2669

Tree-SHA512: c08c856f7f3b281417c29283351eac5e0f75cc1c8d23d9aae58d969219a327b2337fe57932053e53773ebb9dbec04254f90149266b6639a66c5c09f2ad1675ef
2024-04-07 15:15:47 +00:00
Fmt Bot 747ca578dd 2024-04-07 automated rustfmt nightly 2024-04-07 01:03:23 +00:00
Divyansh Gupta 051c358bcb Remove deprecated legacy numeric methods
As `rustc 1.79.0-nightly (9d79cd5f7 2024-04-05)` is released which solves the issue mentioned , but the release has deperacted legacy numeric methods.
Thus replace `u16::max_value()` etc with `u32::MAX` & `core::u16` to directly `u16`.

fix #2639
2024-04-07 01:51:14 +05:30
Andrew Poelstra bae2c75f69
Merge rust-bitcoin/rust-bitcoin#2657: bitcoin: Release tracking PR: `v0.32.0-rc1` - oh yeah!
0073a17e20 bitcoin: Bump version to 0.32.0-rc1 (Tobin C. Harding)

Pull request description:

  This PR is just the final patch, primarily the changelog. Pretty happy with my effort, check it out: https://github.com/tcharding/rust-bitcoin/blob/04-04-release-bitcoin-rc1/bitcoin/CHANGELOG.md

ACKs for top commit:
  sanket1729:
    utACK 0073a17e20.
  apoelstra:
    ACK 0073a17e20

Tree-SHA512: 9d2815c8739286350373eac3cd03d703082fb41b67cc83dcd694f41f2b97cc7d07b8942b62876552f490fddb588e30c346246ff0114b3b3adafb3482f76db242
2024-04-05 17:19:50 +00:00
Tobin C. Harding 0073a17e20
bitcoin: Bump version to 0.32.0-rc1
In preparation for dropping the first release candidate bump the version
and add a changelog.

Please not I went to much more effort that usual with the changelog,
open to review on the overall form - not promising I'll change it but
definitely would like to keep iterating and improving.

If this changelog is appreciated then FWIW I don't think we should
bother automating it, a machine does not have all the context required
to create it.
2024-04-05 08:10:08 +11:00
Andrew Poelstra a5eee3eadc
Merge rust-bitcoin/rust-bitcoin#2655: units: Release tracking PR: `0.1.1`
e06ebd69e7 units: Bump version number to 0.1.1 (Tobin C. Harding)
a2b019f823 Enable internals "alloc" feature (Tobin C. Harding)

Pull request description:

  Fix a minor internal bug in error code in `units` and bump the version number so we can do a point release.

  This can go in after the RC drops as part of the release candidate cycle if its easier - as long as its in and released before the finale `v0.32.0` release.

ACKs for top commit:
  apoelstra:
    ACK e06ebd69e7
  sanket1729:
    ACK e06ebd69e7

Tree-SHA512: b6523fae57ba3becf27c0a11fe0b1d75db9226d01bde527390e2cf1697520d5daabc5ef3909b2c464b14f38ba4f8ab87aa49d17a1d054767920963ef1c3ef3b9
2024-04-04 21:08:22 +00:00
Andrew Poelstra df9b31ddcf
Merge rust-bitcoin/rust-bitcoin#2652: psbt: Return internal key for key path spend
14040e2ff5 psbt: Return the internal key for key path spend (Tobin C. Harding)
ffd5664c08 Do not panic if input_index is out of bounds (Tobin C. Harding)
f79f20d4e6 Remove stale rustdoc (Tobin C. Harding)

Pull request description:

  When signing a Taproot input (in a PSBT) using a key path spend we currently return the pubkey associated with key that signs. However it is common to think of the internal key as being the one that signs even though this is not technically true. We also have the internal key in the PSBT so matching against it is less surprising.

  When using the `Psbt` type to sign a Taproot input using a key path spend return the internal key.

  - Patch 1: Fix stale docs
  - Patch 2: Remove unnecessary panic
  - Patch 3: Change the key returned when signing Taproot input as key path spend

  Done as part of #2557, this is the release blocking part.

ACKs for top commit:
  sanket1729:
    ACK 14040e2ff5
  apoelstra:
    ACK 14040e2ff5

Tree-SHA512: 0b38b9009fd5dab682461dcb79f46c7540ec79cfd9c856fc5036ad8ecda061781c58b6fd157db9f034ab07dda6fa747417318f613092ee2017b8f2f44898dcd7
2024-04-04 14:40:16 +00:00
Andrew Poelstra 400e9340a2
Merge rust-bitcoin/rust-bitcoin#2658: Use pinned nightly in all the tools
398fc6b73a Update pre-commit hook to use pinned nightly (Tobin C. Harding)
1a85eac01b Move nightly_version file to crate root (Tobin C. Harding)

Pull request description:

  Move the nightly pinning config file out of `.github/` and use it in the pre-commit hook.

ACKs for top commit:
  sanket1729:
    ACK 398fc6b73a
  apoelstra:
    ACK 398fc6b73a

Tree-SHA512: 9b30c7064a43b068399927518732c3f4fe033693a7ad09af33f49b18a31c8965e6d4bb887ee558dd2a8d50b165545eb3de3fa7c415bff27efee5ac97385d27ff
2024-04-04 14:04:32 +00:00
Tobin C. Harding 398fc6b73a
Update pre-commit hook to use pinned nightly
Use the pinned nightly toolchain from `./nightly-version` when running
git pre-commit hook.
2024-04-04 15:42:42 +11:00
Tobin C. Harding 1a85eac01b
Move nightly_version file to crate root
The nightly pinning is used by a bunch of different tools outside of
github actions, move the config file to the crate root.

Update the path in the justfile.

Done in preparation for fixing the git pre-commit hook.
2024-04-04 15:42:12 +11:00
Tobin C. Harding e06ebd69e7
units: Bump version number to 0.1.1
We just did a minor bug fix to error code in the `amounts` module. This
change did not effect the public API but improved the display of two
error types from that module.

In preparation for doing a point release bump the version number and add
a changelog entry.
2024-04-04 08:24:28 +11:00
Tobin C. Harding a2b019f823
Enable internals "alloc" feature
We have 2 crates that require an allocator, `bitcoin` and `base58ck` -
these crates should enable the "alloc" feature when depending on
`internals`.

For `units` we use the `internals::error::InputString` but do not enable
the "alloc" feature - this is a bug, it means that the parsed string is
being lost from the error types that use `InputString`.

Enable "alloc" for `bitcoin`, `base58ck`, and `units`.

- `bitcoin` and `base56ck` is just for good measure so we don't get
  bitten later on.
- `units` is a bug fix and requires a point release.
2024-04-04 08:18:51 +11:00
Tobin C. Harding 14040e2ff5
psbt: Return the internal key for key path spend
When signing a Taproot input (in a PSBT) using a key path spend we
currently return the pubkey associated with key that signs. However it
is common to think of the internal key as being the one that signs even
though this is not technically true. We also have the internal key in
the PSBT so matching against it is less surprising.

When using the `Psbt` type to sign a Taproot input using a key path
spend return the internal key.
2024-04-04 07:36:04 +11:00
Tobin C. Harding ffd5664c08
Do not panic if input_index is out of bounds
There is no need to panic if input index is out of bounds because we
have a function to check the validity of the `input_index` argument and
use it in other places already.
2024-04-04 07:27:55 +11:00
Tobin C. Harding f79f20d4e6
Remove stale rustdoc
We recently added support for signing taproot inputs but forgot to
update the docs to reflect this.

Remove stale rustdoc from `Psbt::sign` function.
2024-04-04 07:27:53 +11:00
Andrew Poelstra b5fbdcd68a
Merge rust-bitcoin/rust-bitcoin#2541: Reduce usage of `Network` in the public API
f6467ac98d Minimize usage of Network in public API (Tobin C. Harding)
3ec5eff56e Add Magic::from_params (Tobin C. Harding)

Pull request description:

  Minimize usage of the `Network` enum in the public API.

  See #2225 for context, and https://github.com/rust-bitcoin/rust-bitcoin/pull/1291#discussion_r1492993788 for an interpretation of that long discussion.

  Close: #2169

ACKs for top commit:
  sanket1729:
    reACK f6467ac98d.
  apoelstra:
    ACK f6467ac98d

Tree-SHA512: f12ecd9578371b3162382a9181f7f982e4d0661915af3cfdc21516192cc4abb745e1ff452649a0862445e91232f74287f98eb7e9fc68ed1581ff1a97b7216b6a
2024-04-03 13:50:47 +00:00
Andrew Poelstra aefc791dd7
Merge rust-bitcoin/rust-bitcoin#2651: units: Release tracking PR: `0.1.0` - BOOM!
a05da2294e units: Add an initial changelog (Tobin C. Harding)
36ef4a62cf units: Improve re-exports (Tobin C. Harding)

Pull request description:

  In preparation for release do two things:

  - Patch 1: Attempt to improve the re-exports and HTML docs
  - Patch 2: Add an initial changelog file

  Note the version number is set already and does not conflict with the current `v0.0.0` version: https://crates.io/crates/bitcoin-units

ACKs for top commit:
  sanket1729:
    utACK a05da2294e
  apoelstra:
    ACK a05da2294e

Tree-SHA512: ab78f89d2e29e58e840d64889f0b7e0e57335e610b8759490478511854f1a7606e8203e4201872eaeb16a96fc527ecdca35e13b39027218d8f71290591e68101
2024-04-03 13:18:39 +00:00
Tobin C. Harding a05da2294e
units: Add an initial changelog
In preparation for the initial release add a changelog. Note the version
number is already set to `v0.1.0` and this does not conflict with the
release currently on crates.io `v0.0.0`.
2024-04-03 14:39:57 +11:00
Andrew Poelstra 924104daec
Merge rust-bitcoin/rust-bitcoin#2650: Improve docs in pow module
1bb32febbd Use manual docs attributes (Tobin C. Harding)
19f70959e1 Document private from_hex_internal function (Tobin C. Harding)
81a704302c Improve rustdocs on U256 type (Tobin C. Harding)

Pull request description:

  Follow up to #2514, improve docs in the `pow` module. Done as separate patches because there are 3 distinct improvements. The first two are trivial the last can be verified by running:

      `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links`

ACKs for top commit:
  apoelstra:
    ACK 1bb32febbd
  sanket1729:
    ACK 1bb32febbd

Tree-SHA512: 13b9db4b184328fdea1f212b9d049c76b0b824bae822cd9f6cf9460a38f3ca3d2f7270d4c4ee2b9301a5a4049a30d82a706b8b5c8415573fa6724d5105093d97
2024-04-03 02:54:08 +00:00
Tobin C. Harding f6467ac98d
Minimize usage of Network in public API
A release or so ago we added `non_exhaustive` to the `Network` enum,
this turned out to make usage of the enum un-ergonomic for downstream
users. After much debate we decided that a way forward was to just
minimize the usage of the enum in the public API by instead use
`AsRef<Params>` so that downstream could define their own network enum
based on the networks they support.

Minimize usage of `Network` by using `AsRef<Params>` as a parameter type
instead. "minimize" because the `Network` still appears in some places.
2024-04-03 13:32:39 +11:00
Tobin C. Harding 36ef4a62cf
units: Improve re-exports
Make an attempt to improve the ergonomics and docs clarity of the
`units` crate.

- Don't inline error type re-exports, this keeps them up in the
"Re-exports" section and saves cluttering the other inlined docs.

- Re-export and inline the docs for `FeeRate` and `Weight` same as we do
for `Amount`. This makes the "Structs" section of the docs nice except
for the exclusion of the locktime types (which cannot be helped).
2024-04-03 11:39:56 +11:00
Tobin C. Harding 1bb32febbd
Use manual docs attributes
Currently we are using `Self` (in backticks) in the docs to functions
defined by the `do_iml` macro, this is a bit lazy, we can do better than
that.

Use `doc` attribute and the `$ty` macro variable to construct the docs
to use the type name.
2024-04-03 11:14:32 +11:00
Tobin C. Harding 19f70959e1
Document private from_hex_internal function
Use a code comment to document the calling restrictions of private
function `from_hex_internal`. (Code comment because comment is not well
formed as per convention in this codebase.)
2024-04-03 11:12:45 +11:00