Commit Graph

5502 Commits

Author SHA1 Message Date
Tobin C. Harding ec06028f63
hashes: Make hex dependency optional
The only reason we need `hex-conservative` is to parse strings and
format them as hex. For users that do not require this functionality we
can make the `hex-conservative` crate an optional dependency.

The `serde` feature requires `Display` so we enable `hex` from the
`serde` feature.

If `hex` feature is not enabled we still need to be able to debug so
provide `fmt::Debug` functionality by way of macros.

Close: #2654
2024-11-14 09:36:55 +11:00
Shing Him Ng 33b9d6904c Remove From and Into test impls
The removed impls have been replaced with test-specific functions for
converting between Rust primitives and U256
2024-11-13 15:49:50 -06:00
merge-script 3d17ec962f
Merge rust-bitcoin/rust-bitcoin#3576: transaction: Add plural field getters
be553217f1 transaction: Add plural field getters (Tobin C. Harding)

Pull request description:

  The `Transaction` type was created way back when, and the field names were named using singular (`input` and `output`). In hindsite plural probably should have been used since its more idiomatic Rust but the fields have been around so long now that re-naming them is going annoy a whole bunch of people.

  As a compromise add getters that use plural, immutable and mutable versions, for both the `input` and `output` fields.

  Close: #822

ACKs for top commit:
  apoelstra:
    ACK be553217f19069dd9ca28c3ba5953059df9caa1b; successfully ran local tests; though will let this sit a couple days before merging
  sanket1729:
    ACK be553217f1

Tree-SHA512: 4df9db179a69c9eea2940008c9eca9f9b9b9d9f27e2a174db39bfb3d5c32a9d06b26e5349e5baf5af78600ae128d1b534559baf7335aec6df1238de96a508764
2024-11-13 17:42:55 +00:00
merge-script 7315ca9a4e
Merge rust-bitcoin/rust-bitcoin#3608: Mark funtions const
4c94695942 Mark funtions const (yancy)

Pull request description:

  May as well mark these const as well.  Follow up to https://github.com/rust-bitcoin/rust-bitcoin/pull/3605

ACKs for top commit:
  apoelstra:
    ACK 4c94695942de41e5eca4ac120db2e069c0bb037d; successfully ran local tests; yeah, I think this are all worth consting
  tcharding:
    ACK 4c94695942
  sanket1729:
    ACK 4c94695942

Tree-SHA512: bf41e416cb8a2eb90e26d7bd640df5c2a5a868e3b721bde7cc8a3b97c687bab4d1cb4ab1c4b04ed625e8657e25c59e386720cb0f9d735ffc492e98f5b8b2ca3c
2024-11-13 14:47:40 +00:00
merge-script 3870121371
Merge rust-bitcoin/rust-bitcoin#3601: Fix bug in witness stack getters
1ed3fc9270 Add unit test for tapscript function (Tobin C. Harding)
195615c14d Fix bug in witness stack getters (Tobin C. Harding)

Pull request description:

  In #2646 we introduced a bug in the taproot witness stack getter functions, of which we have three:

  - `tapscript`
  - `taproot_control_block`
  - `taproot_annex`

  Each returns `Some` if a possible bytes slice is found (with no other guarantees).

  Use `taproot_annex` combined with getters from `primitives` to implement the other two getters. This simplifies the code and fixes the bug.

  Add an additional getter to `primitives` `Witness::third_from_last`.

  Fix: #3598

ACKs for top commit:
  sanket1729:
    ACK 1ed3fc9270
  apoelstra:
    ACK 1ed3fc9270c6e46f42f447bf1c63cfa64dafa5e8; successfully ran local tests

Tree-SHA512: fdaa254a05e58a5a8800ac3316ee1dd2e6da83910fa4860156683ba27c594be19549f22cdf7f170142767733240eba2b31f3a31c10626a1ba5c21409e62b9ec5
2024-11-13 14:11:55 +00:00
Tobin C. Harding 9dce0b4b8c
Remove hex string trait bounds from GeneralHash
For the `hashes` crate we would like to make `hex` an optional
dependency. In preparation for doing so do the following:

- Remove the trait bounds from `GeneralHash`
- Split the hex/string stuff out of `impl_bytelike_traits` into a
  separate macro.
2024-11-13 14:01:13 +11:00
merge-script a9bc1c7db5
Merge rust-bitcoin/rust-bitcoin#3605: Mark function as const
1db4b723dc Mark function as const (yancy)

Pull request description:

  We discussed marking from_vb as const here: https://github.com/rust-bitcoin/rust-bitcoin/issues/3602

  However, from what I can tell, map() isn't const and I don't see a tracking issue for changing it.  Also, the question mark operator isn't available in const context either, although there is a tracking issue for that: https://github.com/rust-lang/rust/issues/74935.  It will be a long while before that makes it into this projects MSRV if/when it lands.

  There are some other functions in this module that could use the same re-write to make them const as well it looks like.

ACKs for top commit:
  tcharding:
    ACK 1db4b723dc
  apoelstra:
    ACK 1db4b723dc59568c14c76598e7c63c58651ed1cd; successfully ran local tests

Tree-SHA512: 62b612791dd3ce2f6ebf27f586a1262633a46566b9fd3583984171f62209714ad979439345fe86d8ef87d2f78a2cee21d619e2eb3621689faf59d81640e9f77c
2024-11-13 02:01:09 +00:00
Tobin C. Harding 766f498b33
Pull serde stuff out of impl_bytelike_traits macro
The `impl_bytelike_traits` macro is public and it is used in the
`hash_newtype` macro, also public.

Currently if a user calls the `hash_newtype` macro in a crate that
depends on `hashes` without the `serde` feature enabled and with no
`serde` dependency everything works. However if the user then adds a
dependency that happens to enable the `serde` feature in `hashes` their
build will blow up because `serde` code will start getting called from
the original crate's call to `hash_newtype`.

Pull the serde stuff out of `hash_newtype` and provide a macro to
implement it `impl_serde_for_newtype`.
2024-11-13 12:28:47 +11:00
merge-script 708522394b
Merge rust-bitcoin/rust-bitcoin#3604: Add constructor to `FeeRate`
b96501981f feat(units): add kvb constructor to `FeeRate` (Rob N)

Pull request description:

  This is partially to check my understanding. I did poorly in physics class as part of my misunderstanding of unit conversions.

  The `feefilter` message expresses the fee as satoshis per 1,000 vbyte, see the [p2p handling](1dda1892b6/src/net_processing.cpp (L5331)) which calls [this function](https://github.com/bitcoin/bitcoin/blob/master/src/policy/feerate.h#L63) on the mempool. I presume all that needs to happen to express this in `kwu` is to divide by 4, but ideally a `FeeRate` may be constructed directly from a `feefilter` message using a constructor.

  My conversion is (sat / kvb * kvb / 4 kwu)

ACKs for top commit:
  sanket1729:
    ACK b96501981f.
  apoelstra:
    ACK b96501981ffef1d32c839cd44861736ce3683964; successfully ran local tests
  tcharding:
    ACK b96501981f

Tree-SHA512: 5aec75d253a0955bfe0bdec42d2e13b69602da057ec7769126399473799455f8df1691f98f6e8dc1d6338958e05702a846d0a5f00bce6aa9079c2ceb0c54df0f
2024-11-13 00:19:50 +00:00
yancy 4c94695942 Mark funtions const 2024-11-12 18:16:12 -06:00
Tobin C. Harding 1ed3fc9270
Add unit test for tapscript function
Add a unit test that verifies we correctly remove the annex when getting
the tapscript from the witness stack.

Unit test written by Casey, pulled out of #3599.

Co-developed-by: Casey Rodarmor <casey@rodarmor.com>
2024-11-13 10:55:51 +11:00
Tobin C. Harding 195615c14d
Fix bug in witness stack getters
In #2646 we introduced a bug in the taproot witness stack getter
functions, of which we have three:

- `tapscript`
- `taproot_control_block`
- `taproot_annex`

Each returns `Some` if a possible bytes slice is found (with no other
guarantees).

Use `taproot_annex` combined with getters from `primitives` to implement
the other two getters. This simplifies the code and fixes the bug.

Add an additional getter to `primitives` `Witness::third_from_last`.

Fix: #3598
2024-11-13 10:55:51 +11:00
yancy 1db4b723dc Mark function as const 2024-11-12 16:10:38 -06:00
Rob N b96501981f
feat(units): add kvb constructor to `FeeRate`
Namely, the feefilter expresses the fee as sat per 1000 vbyte
2024-11-12 08:13:53 -10:00
merge-script 73e33e5808
Merge rust-bitcoin/rust-bitcoin#3581: Fix re-exports and (manually) format the codebase
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
2024-11-11 20:15:14 +00:00
merge-script c3a4ba2c5a
Merge rust-bitcoin/rust-bitcoin#3593: Release tracking PR: chacha20-poly1305 v0.1.1
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
2024-11-11 16:43:11 +00:00
Tobin C. Harding 727c519efa
Re-export amount from primitives
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.
2024-11-11 14:21:47 +11:00
Tobin C. Harding 84ede349b0
Run the formatter
Run `just fmt`, no manual changes.
2024-11-11 14:19:17 +11:00
Tobin C. Harding 4865d60258
bitcoin: Improve the re-exports ... again
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).
2024-11-11 14:18:58 +11:00
merge-script 0ee38cf7e0
Merge rust-bitcoin/rust-bitcoin#3594: Add callouts to the chacha20-poly1305 public docs
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
2024-11-10 18:28:28 +00:00
Nick Johnson 2ae6a9abc1 Prep the chacha20-poly1305 crate for release
Bump the patch version to 0.1.1 to include the no_std support.
2024-11-09 07:23:45 -08:00
Nick Johnson eb0a7b40ec Add callouts to the chacha20-poly1305 public docs
Making it clear in the chacha20-poly1305 documentation that this
implementation is maintained by bitcoin developers and targeted
specifically for bitcoin ecosystem use cases.
2024-11-08 10:56:36 -08:00
merge-script 7df5e7c1bc
Merge rust-bitcoin/rust-bitcoin#3587: Split checked_div_by_weight into floor and ceiling version
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
2024-11-08 15:58:36 +00:00
merge-script 9d9f1d84e4
Merge rust-bitcoin/rust-bitcoin#3588: Reword `Address` constructor docs
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
2024-11-08 15:25:27 +00:00
merge-script 0667a67b7c
Merge rust-bitcoin/rust-bitcoin#3592: Update generic param
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
2024-11-08 14:19:00 +00:00
yancy 3523b8e117 Rename generic parameter and variable
Use W for Write
2024-11-07 16:38:13 -06:00
yancy 8b928a1515 Split checked_div_by_weight into floor and ceiling version 2024-11-07 16:28:44 -06:00
merge-script f963bf38b1
Merge rust-bitcoin/rust-bitcoin#3585: Fix bip34 number parsing for Block
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
2024-11-07 21:16:25 +00:00
merge-script e3b8508603
Merge rust-bitcoin/rust-bitcoin#3591: Automated daily update to rustc (to nightly-2024-11-06)
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
2024-11-08 06:55:56 +11:00
Update Nightly Rustc Bot 186b9557b6 Automated update to Github CI to rustc nightly-2024-11-06 2024-11-07 01:45:57 +00:00
Jamil Lambert, PhD 8098d5ee05
Reword `Address` constructor docs
Change the wording of the Address constructor function docs to be a
standard format.
2024-11-06 19:05:29 +00:00
merge-script 4797a75586
Merge rust-bitcoin/rust-bitcoin#3584: Standardize constructor type function docs
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
2024-11-06 16:05:24 +00:00
merge-script b09ce778f8
Merge rust-bitcoin/rust-bitcoin#3579: hashes: Hide error internals
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
2024-11-06 15:33:27 +00:00
junderw c61df05916
Fix bip34 number parsing for Block 2024-11-06 14:06:18 +09:00
merge-script 401327d8fd
Merge rust-bitcoin/rust-bitcoin#2543: hashes: Default to `no_std`
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
2024-11-05 13:27:51 +00:00
Jamil Lambert, PhD 1649b68589
Standardize wording to `constructs a new`
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`.
2024-11-05 13:02:26 +00:00
Jamil Lambert, PhD 27f94d5540
Replace `creates` with `constructs`
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.
2024-11-05 12:47:28 +00:00
Tobin C. Harding fe8ca21ec2
hashes: Duplicate impl_from_infallible
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`.
2024-11-05 11:19:19 +11:00
Tobin C. Harding 7652d0ddfc
hashes: Hide innards of FromSliceError
In preparation for releasing 1.0 we want to hide all error internals. Do
so for the single error type in the `hashes` crate.
2024-11-05 11:17:29 +11:00
Tobin C. Harding 5232bba62b
hashes: Move FromSliceError to submodule
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.
2024-11-05 11:17:29 +11:00
Tobin C. Harding ba124757c4
hashes: Default to no_std
`hashes` is `no_std` ready, lets default to `no_std`.
2024-11-05 11:16:24 +11:00
Tobin C. Harding 6a4e219c55
hashes: embedded: Remove unused import
Clear clippy warning by removing unused import statement.
2024-11-05 11:16:23 +11:00
Tobin C. Harding 915c9627f6
Put feature gate attribute under test attribute
Either way is fine, just pick one and be uniform.
2024-11-05 11:16:23 +11:00
merge-script 3b0cb0e87d
Merge rust-bitcoin/rust-bitcoin#3539: Improve the `amount` module
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
2024-11-04 23:32:41 +00:00
merge-script 50abab8558
Merge rust-bitcoin/rust-bitcoin#3577: Update rust-bitcoin-maintainer-tools
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
2024-11-04 22:50:32 +00:00
Tobin C. Harding 312718cd6e
Update rust-bitcoin-maintainer-tools
Update to the latest commit hash of tip of master.
2024-11-05 07:52:13 +11:00
Tobin C. Harding 81d8699b55
units: Put no_std up top
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.
2024-11-05 07:49:35 +11:00
Tobin C. Harding 3e332c3839
amount: Fix docs on FromStr
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.
2024-11-05 07:49:35 +11:00
Tobin C. Harding 5bec76aa51
amount: Fix rustdocs
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`)
2024-11-05 07:49:35 +11:00
Tobin C. Harding 41c80cc476
amount: Improve docs on div by weight
Make an effort to improve the docs on `Amount::checked_div_by_weight`
and `ops::Div<weight> for Amount`.
2024-11-05 07:49:28 +11:00