Commit Graph

6702 Commits

Author SHA1 Message Date
Jose Storopoli f01f071751
api: document the need of cargo nightly 2024-12-15 11:42:52 -03:00
Jose Storopoli ff67eadc7f
contributing: clarify API changes 2024-12-15 11:42:52 -03:00
Jose Storopoli 04852958b9
contrib: check if the user has cargo-public-api 2024-12-15 11:42:51 -03:00
merge-script 7e8d4615db
Merge rust-bitcoin/rust-bitcoin#3758: api: Run just check-api
f412f2b149 api: Run just check-api (Tobin C. Harding)

Pull request description:

  Some wombat queued 100 PRs up and is constantly breaking the api text files.

ACKs for top commit:
  apoelstra:
    ACK f412f2b149b73f6030fdd5565b3d5f920512f477; successfully ran local tests

Tree-SHA512: e283b92f4c9571b3c3d9caeccada54f556663c80c491dc966c1ffe68bb5e1d6cfccc9eedcedbdc8f9f5eb03686562d4cbfc115af3a0e8868ae5328dea9b37bfb
2024-12-15 14:00:19 +00:00
merge-script b1b025febf
Merge rust-bitcoin/rust-bitcoin#3756: units::Amount Make rustdocs conform to the API guidelines
01b58d668c Add rustdoc examples (Jamil Lambert, PhD)
b881f1b54e Add `# Errors` to rustdocs (Jamil Lambert, PhD)
66f36b3048 Correct doc errors and add links in `unsigned` (Jamil Lambert, PhD)

Pull request description:

  Update rustdocs in `units::Amount` to conform to the API guidelines.

  `# Examples` API guideline quote:
  > "is not always to show how to use the item. ... Rather, an example is often intended to show why someone would want to use the item."

  This guideline is subjective, and in the cases in `Amount` the why is often trivial.  Where the example is trivial it has been included once, and for similar functions left off e.g. included for `from_sat` but not `from_btc`, etc.

ACKs for top commit:
  tcharding:
    ACK 01b58d668c
  apoelstra:
    ACK 01b58d668cf03dda6aeff7c556e359436ccc4132; successfully ran local tests

Tree-SHA512: 5dde89949e0091f166b9903d28ca44275ca3d283de4ef1b6142dba88f0c45e9ba0a8f7cefa0c36a0f1e3e9e2b61d4992f0d3324d30c09b9877b481e9f343002a
2024-12-15 02:50:11 +00:00
Fmt Bot 18d904d647 2024-12-15 automated rustfmt nightly 2024-12-15 01:35:28 +00:00
Tobin C. Harding f85456a726
Improve rustdocs on addresses module
These docs are stale, update them.

- Mention segwit and legacy
- Improve example code to show feature gating
- Fix headings to be as typical
2024-12-15 09:29:48 +11:00
Tobin C. Harding f412f2b149
api: Run just check-api 2024-12-15 09:17:05 +11:00
merge-script 1c4d66ab39
Merge rust-bitcoin/rust-bitcoin#3749: Remove unnecessary type
3ac9b2ded2 Remove unnecessary type (Tobin C. Harding)

Pull request description:

  `hex_psbt` returns `Psbt`, no need for the explicit type.

  Internal change only.

ACKs for top commit:
  shinghim:
    ACK 3ac9b2ded2
  apoelstra:
    ACK 3ac9b2ded24d5428945538c0a674301f6094df96; successfully ran local tests

Tree-SHA512: 2be1bfa56729bf97e60d721a184d3d21bfb27115fab1dd1b9103428658b5faca012d8f01e0458be7f17dadcd8cc495b327f2b472d825d46aa5cb71d0906ecb21
2024-12-14 17:48:02 +00:00
merge-script 25236ce697
Merge rust-bitcoin/rust-bitcoin#3746: bitcoin: Improve rustdocs on extern crates
a5993426fd bitcoin: Improve rustdocs on extern crates (Tobin C. Harding)

Pull request description:

  Make slight improvement to the extern crates we re-export from `bitcoin`.

ACKs for top commit:
  apoelstra:
    ACK a5993426fddea85c29ac6cd5a0e3096988d72b03; successfully ran local tests

Tree-SHA512: bb857316fc2606aa553f15e1c9fcf8dd87374e170121fe30cf9e44ae190f873f94c113af49b096cb49a65fd68d1bf24732e3f1aba04861e2ae934414f30473c6
2024-12-14 17:03:56 +00:00
merge-script 834010d681
Merge rust-bitcoin/rust-bitcoin#3724: units: Seal the `Integer` trait
4cccbfdf76 units: Seal the Integer trait (Tobin C. Harding)

Pull request description:

  This trait is an internal thing, users should never implement it.

ACKs for top commit:
  sanket1729:
    utACK 4cccbfdf76
  apoelstra:
    ACK 4cccbfdf7628442cc198f6399846ad4e98938494; successfully ran local tests

Tree-SHA512: f48e8ef96d15135990976c77e933ddc735dda577464548478526e37fff49bf453aaacf966967d98a0d5598588b531199627af8e353f845d4c7781f1e1d8de6db
2024-12-14 14:33:27 +00:00
merge-script fcbe970ddb
Merge rust-bitcoin/rust-bitcoin#3734: Move script hash types to `primitives`
6e01383f16 api: Run just check-api (Tobin C. Harding)
3855d3cc83 Move script hashes to primitives (Tobin C. Harding)
d1dd63d6d4 Remove wildcard in script re-exports (Tobin C. Harding)

Pull request description:

  Woops, this should have been done before v0.101.0 was released.

  Move the `ScriptHash` and `WScriptHash` types to `primitives`.

  Requires moving constants and error types as well. We re-export the errors because they are in the `mod.rs` file so they should appear in both `primitives::script::FooError` and `bitcoin::script::FooError`.

ACKs for top commit:
  apoelstra:
    ACK 6e01383f162307a573c3454733ccae0596d3eaf6; successfully ran local tests

Tree-SHA512: 4ef838ee9c4cb3eb308ffa855ea5d6f5ad46f81c17b9413faa493a46a262afc18b47f28a0fdd5fc675eea31b895d0eb0e2505a523e820504ec88d9334d6874b4
2024-12-14 06:14:39 +00:00
merge-script 3c25a8acbc
Merge rust-bitcoin/rust-bitcoin#3753: Update to arbitrary v1.4
463fbd16f1 Update to arbitrary v1.4 (Tobin C. Harding)

Pull request description:

  Out with the old in with the new, update to the latest minor version of arbitrary.

  No real reason to do this except that I wanted to add the minor version instead of using just `1` so that we don't accidentally pull a new minor version in during a patch release (after we 1.0).

  (I'm unsure if this is necessary and did not test it against MSRV.)

ACKs for top commit:
  apoelstra:
    ACK 463fbd16f1431febe7e4fc50abd7415886542109; successfully ran local tests

Tree-SHA512: 88913f993b97abba224ba94ee9d5057894bb7142fef07e557de03a423da314a9f21632932fb64c4c27c676051bbb6e90d9b90bfa944af810e834bf42707d3cff
2024-12-14 01:39:38 +00:00
merge-script 7ab569388b
Merge rust-bitcoin/rust-bitcoin#3743: Refactor predict weight
0135cddc32 Refactor non_input_size (Tobin C. Harding)
f42f13cd8d Simplify closures in call to fold (Tobin C. Harding)

Pull request description:

  Two refactorings to make the code easier to read. No logic changes.

ACKs for top commit:
  apoelstra:
    ACK 0135cddc32462490528dea549fd8db4c0a30646e; successfully ran local tests

Tree-SHA512: 747cfe1212283a62545cb86a5af0be46592ab3b41f94ab0a2dad8f06b094c04eb9265520ece595d2aab303fddf55a652e7ef977911439602550c264bedd4385b
2024-12-13 23:58:31 +00:00
merge-script ee8430a527
Merge rust-bitcoin/rust-bitcoin#3738: Remove Weight::from_wu_usize function
3c8c956511 Remove Weight::from_wu_usize function (Tobin C. Harding)

Pull request description:

  This constructor is an anomaly in this repo. Also it is ugly to have the type parameter hard coded in the function name.

  The problem the constructor is trying to solve is that we don't like casts that don't obviously loose data. We have a solution for that already in `internals::ToU64`. This trait cannot be used in const contexts though so we do introduce a single cast in this patch.

ACKs for top commit:
  apoelstra:
    ACK 3c8c95651169fb9329ceb380162721c2d2f9b3aa; successfully ran local tests

Tree-SHA512: 168196edb7c151378d425b96ea3c9cdb0a4f6a879543e89facd02ed1fdf9bc69bde8ef862ffa0959b7c5ca21d6f4fe5ae38a933c379e7e88a946ca7cb68d61ec
2024-12-13 22:16:59 +00:00
merge-script c560a6e2cf
Merge rust-bitcoin/rust-bitcoin#3742: Test all the valid denomination forms
edfdd575d5 Test all the valid denomination forms (Tobin C. Harding)

Pull request description:

  Exhaustively ...

ACKs for top commit:
  apoelstra:
    ACK edfdd575d5af1c676c0640f1e38056d7da9168e0; successfully ran local tests

Tree-SHA512: 76d078988b68f68cf8d4f18439b94cfef6b8b222596aa0b64e5270797c1d7d0f15b6376fb81d1655638e2617c33747d8a5623d3f52db0c95061723a3e36ce7de
2024-12-13 20:53:33 +00:00
merge-script 7977231839
Merge rust-bitcoin/rust-bitcoin#3751: Remove unnecessary rustdocs
99e2a9f530 Remove unnecessary rustdocs (Tobin C. Harding)

Pull request description:

  The `deprecated` attribute already fully explains the status of a deprecated function and the replacement - no need to repeat this.

ACKs for top commit:
  apoelstra:
    ACK 99e2a9f530eced69e9df1441e15d24e626974385; successfully ran local tests

Tree-SHA512: 133d41573a3ba97abf85100649c1e8dfe131521a627e0b7f1ab803845caf1c183b99488cb5d9f7e858cab1b35f8907a79b320ec01901b15fdd63d08f0bc1f87e
2024-12-13 20:01:34 +00:00
merge-script 191e62fcff
Merge rust-bitcoin/rust-bitcoin#3750: readme: Fix the MSRV link
870bd49123 readme: Fix the MSRV link (Tobin C. Harding)

Pull request description:

  The link is broken, has the wrong date in it.

ACKs for top commit:
  apoelstra:
    ACK 870bd491238f7549700231eb777d6a31bca5beea; successfully ran local tests

Tree-SHA512: 16e05a863d95228c3d9610dc1f0b93475d0d3136c4f4bf261dfa9e8efed9b06f7c4ca358f492f8d46166e0a435f55fc8f4f849922753168f79c9eb379b4f8d8d
2024-12-13 19:09:39 +00:00
merge-script 66accdee08
Merge rust-bitcoin/rust-bitcoin#3748: Remove ToU64 from rustdocs
4ef06b4f2b Remove ToU64 from rustdocs (Tobin C. Harding)

Pull request description:

  The `ToU64` trait is not meant to be used publicly, remove the mention of it from rustdocs.

ACKs for top commit:
  shinghim:
    ACK 4ef06b4f2b
  apoelstra:
    ACK 4ef06b4f2b9945b46c190abd0cb3a6dfe234c7b5; successfully ran local tests

Tree-SHA512: e9acef9194cee380aa2aa44af9285d4f6e025bdf09f76e5066916c51215db15f1f920fd8ecf3cf079f0a2dddab0332b3a7df104f5bd61d12fc337b4ed163310c
2024-12-13 18:01:29 +00:00
merge-script 7b5f493a70
Merge rust-bitcoin/rust-bitcoin#3745: Use backticks on amount types
d066a863bf Use backticks on amount types (Tobin C. Harding)

Pull request description:

  rustdocs only.

ACKs for top commit:
  apoelstra:
    ACK d066a863bf3dc522da591cc1e0e27392f2e69dc9; successfully ran local tests

Tree-SHA512: 90039d11f17eeb13aafce6c53263b197baf77a91538534fc6fc2dfb374610474a7d2bfd9068e794153800ac73bbf1ee806eff532145fd1cc601cc33fa2d8212f
2024-12-13 17:25:13 +00:00
Jamil Lambert, PhD 01b58d668c
Add rustdoc examples 2024-12-13 09:43:56 +00:00
Jamil Lambert, PhD b881f1b54e
Add `# Errors` to rustdocs 2024-12-13 09:34:02 +00:00
Jamil Lambert, PhD 66f36b3048
Correct doc errors and add links in `unsigned` 2024-12-13 09:33:41 +00:00
merge-script 7dd004b59f
Merge rust-bitcoin/rust-bitcoin#3741: Clean up possibly confusing
60f2089dcd Clean up possibly confusing (Tobin C. Harding)

Pull request description:

  Put the list of possibly confusing forms in the same order as the enum and fix the rustdocs to show the actual error variants returned.

ACKs for top commit:
  apoelstra:
    ACK 60f2089dcdd697b8ab53c9f96b2192ca030237ac; successfully ran local tests

Tree-SHA512: 109fd3e9b72860c3e2a1268aeafab30d6b2b6fac5d5835db6c216a434b9e175911e6445c187f6b80ab2d8c54184df9338230985a4e030aa146cd9fa410971216
2024-12-13 00:45:56 +00:00
Tobin C. Harding edfdd575d5
Test all the valid denomination forms 2024-12-13 09:01:28 +11:00
Tobin C. Harding d066a863bf
Use backticks on amount types 2024-12-13 09:01:16 +11:00
Tobin C. Harding a5993426fd
bitcoin: Improve rustdocs on extern crates
Make slight improvement to the extern crates we re-export from
`bitcoin`.
2024-12-13 09:01:08 +11:00
Tobin C. Harding 4ef06b4f2b
Remove ToU64 from rustdocs
The `ToU64` trait is not meant to be used publicly, remove the mention
of it from rustdocs.
2024-12-13 09:00:53 +11:00
Tobin C. Harding 3ac9b2ded2
Remove unnecessary type
`hex_psbt` returns `Psbt`, no need for the explicit type.

Internal change only.
2024-12-13 09:00:41 +11:00
Tobin C. Harding 870bd49123
readme: Fix the MSRV link
The link is broken, has the wrong date in it.
2024-12-13 09:00:32 +11:00
Tobin C. Harding 99e2a9f530
Remove unnecessary rustdocs
The `deprecated` attribute already fully explains the status of a
deprecated function and the replacement - no need to repeat this.
2024-12-13 09:00:20 +11:00
Tobin C. Harding 55092aab47
Use Self in amount consts
Currently the consts in the `amount` modules repeat the type. For
`Amount` this isn't a big deal but for `SignedAmount` its quite noisy.

Use `Self` as the type in const declarations inside `Amount` and
`SignedAmount`.

Internal change, no logic changes.
2024-12-13 08:59:31 +11:00
merge-script ea6bf12a64
Merge rust-bitcoin/rust-bitcoin#3725: Rename private module to sealed
7725ca77c5 Rename private module to sealed (Tobin C. Harding)

Pull request description:

  There are two `private` modules in `amount` but they do slightly different things. One provides a private `Token` and one is for trait sealing. We have various other trait sealing modules in the codebase and they are all called `sealed` not `private`. Also the seal trait is called `Sealed`.

  Rename the `private` module and the trait to be uniform with the rest of the codebase.

ACKs for top commit:
  apoelstra:
    ACK 7725ca77c589a5215c50f1634f1b095d3e268540; successfully ran local tests; sure

Tree-SHA512: 5953686d7d22daaad8d2d59eff2338db3bb2a7765a37c08ed02ae1a4622509d628dbcb971781a6e85d750afa58609f5b058dfce6d5b4066f4f0d8ded45375b5b
2024-12-12 21:19:38 +00:00
merge-script 6865ced228
Merge rust-bitcoin/rust-bitcoin#3755: api: Run just check-api
8576d194af api: Run just check-api (Tobin C. Harding)

Pull request description:

  Bother, punished by the merge queue again.

ACKs for top commit:
  apoelstra:
    ACK 8576d194af25dc8ea0be0d576cfc318da6019482; successfully ran local tests; though obligatory reference to #3166 since this is the sort of API break that will be a paper cut

Tree-SHA512: bb1048fb74b1c4003df1af1e275e33befa92dcca662e955f0cef7afe502f211c91d53213b76731abffec0fefa0565e5b57eac0e5fad5b87f48f9160ab9f8c569
2024-12-12 19:52:08 +00:00
merge-script bfd35d49e3
Merge rust-bitcoin/rust-bitcoin#3726: units: Improve `Default`
a4a0f2921c units: Add regression tests for Default impls (Tobin C. Harding)
f5c2248a31 units: Derive Default for BlockInterval (Tobin C. Harding)

Pull request description:

  Done while looking into [C-TOR](https://rust-lang.github.io/api-guidelines/predictability.html#c-ctor)

  - Derive `Default` for `BlockInterval`
  - Add regression test for all types that implement `Default`

ACKs for top commit:
  apoelstra:
    ACK a4a0f2921cd2425fa46a8ade42f888d5268e6709; successfully ran local tests

Tree-SHA512: ce39c2bcb37fc0fa70bd2553dd7843d9ac8f9528631706056ba89fda9623defadf32974091832b7a087121290b3f883bc8a8dcca070f1d90670eeee6b541de01
2024-12-12 18:26:46 +00:00
merge-script 661524f53f
Merge rust-bitcoin/rust-bitcoin#3727: units: Add _export::_core
a2cab6f925 units: Add _export::_core (Tobin C. Harding)

Pull request description:

  As we do in `bitcoin` add a module for usage in macros to prevent naming clashes if a module called `core` exists.

  Overly paranoid yes but this is bitcoin after all.

ACKs for top commit:
  apoelstra:
    ACK a2cab6f925530b7e920362149ac4a472abf035c8; successfully ran local tests; lol sure

Tree-SHA512: f20d5b7aae55370891a2943cf3be6e04cb24a93f570093252eefee548f3e13931d03cfaef14613df2a75c477476c98f33173bd4a6da3a15beb7dc4e01648f574
2024-12-12 17:08:49 +00:00
merge-script e768faf2a3
Merge rust-bitcoin/rust-bitcoin#3733: Add additional catagories
38c329c1b7 Add additional catagories (Tobin C. Harding)

Pull request description:

  Add `no-std` category to the soon-to-be-released leaf crates. Also add `cryptography` to the `bitcoin_hashes` crate.

  Close: #3731

ACKs for top commit:
  apoelstra:
    ACK 38c329c1b7e393b040da02447c5edfe8946c50cf; successfully ran local tests

Tree-SHA512: e4481c61028b42876ac4ff62d7f1f97116c49a72f99aa0f75fe158c524d021518bf3334ea181fdc9979765bbe3ef2167a7999396898471e88299814e292a9949
2024-12-12 15:52:14 +00:00
merge-script 157d5bfc80
Merge rust-bitcoin/rust-bitcoin#3719: Change `SignedAmount` `MAX` and `MIN` to equal +/- `MAX_MONEY`
4b926e1908 Change`MAX and `MIN` to equal `MAX_MONEY` (Jamil Lambert, PhD)

Pull request description:

  To prevent rounding errors converting to and from f64 change `SignedAmount` `MAX` and `MIN` to +/- `MAX_MONEY` which are within the limit in f64 that has issues.

  Add checks to `from_str_in`, `checked_add`,  `checked_sub` and `checked_mul` that the result is within MIN and MAX.

  Modify tests to work with new `MIN` and `MAX`.

  Discussed in #3688 and #3691

ACKs for top commit:
  tcharding:
    ACK 4b926e1908
  apoelstra:
    ACK 4b926e1908f72af98d24cc64d7e1eef44d624e4e; successfully ran local tests

Tree-SHA512: 9053e761b3b74a7a9d826ae7271ced41cf7919752ac8ed8977a20b5b1a746ac8a6bfff68159f4a0dea733ea00f49cf41c0422de53c7aff39efd8482f8cba6069
2024-12-12 14:34:34 +00:00
Tobin C. Harding 8576d194af
api: Run just check-api 2024-12-12 16:30:47 +11:00
Tobin C. Harding 6e01383f16
api: Run just check-api 2024-12-12 16:28:49 +11:00
Tobin C. Harding 463fbd16f1
Update to arbitrary v1.4
Out with the old in with the new, update to the latest minor version of
arbitrary.

No real reason to do this except that I wanted to add the minor version
instead of using just `1` so that we don't accidentally pull a new minor
version in during a patch release (after we 1.0).
2024-12-12 15:44:45 +11:00
Tobin C. Harding 0135cddc32
Refactor non_input_size
Looks like the formatter has put code comments in the wrong place.

Refactor the `non_input_size` line so that the formatter does not mess
with it.
2024-12-12 15:34:22 +11:00
Tobin C. Harding f42f13cd8d
Simplify closures in call to fold
Remove unnecessary code comments and make the closure variable names more
terse with no loss of clarity.

Refactor only, no logic changes.
2024-12-12 15:34:12 +11:00
Tobin C. Harding 60f2089dcd
Clean up possibly confusing
Put the list of possibly confusing forms in the same order as the enum
and fix the rustdocs to show the actual error variants returned.
2024-12-12 15:31:25 +11:00
Tobin C. Harding 3c8c956511
Remove Weight::from_wu_usize function
This constructor is an anomaly in this repo. Also it is ugly to have the
type parameter hard coded in the function name.

The problem the constructor is trying to solve is that we don't like
casts that don't obviously loose data. We have a solution for that
already in `internals::ToU64`. This trait cannot be used in const
contexts though so we do introduce a single cast in this patch.
2024-12-12 15:21:29 +11:00
Tobin C. Harding 4cccbfdf76
units: Seal the Integer trait
This trait is an internal thing, users should never implement it.
2024-12-12 15:16:15 +11:00
Tobin C. Harding 7725ca77c5
Rename private module to sealed
There are two `private` modules in `amount` but they do slightly
different things. One provides a private `Token` and one is for trait
sealing. We have various other trait sealing modules in the codebase and
they are all called `sealed` not `private`. Also the seal trait is
called `Sealed`.

Rename the `private` module and the trait to be uniform with the rest of
the codebase.
2024-12-12 15:16:00 +11:00
Tobin C. Harding a4a0f2921c
units: Add regression tests for Default impls
Add a regression test to the `api` tests to check the value returned by
`Default` for all types that implement it.
2024-12-12 15:15:29 +11:00
Tobin C. Harding f5c2248a31
units: Derive Default for BlockInterval
A block interval is a relative thing so it makes sense to default to
zero. This is the same as how we derive `Debug` for `relative::Height`
but not `absolute::Height`.
2024-12-12 15:15:28 +11:00
Tobin C. Harding a2cab6f925
units: Add _export::_core
As we do in `bitcoin` add a module for usage in macros to prevent naming
clashes if a module called `core` exists.

Overly paranoid yes but this is bitcoin after all.
2024-12-12 15:15:13 +11:00