Commit Graph

6689 Commits

Author SHA1 Message Date
Andrew Poelstra a000230301
Merge rust-bitcoin/rust-bitcoin#4647: fix: typo in error message
c642bebeb7 fix typo in error message (Afounso Souza)

Pull request description:

  The error message contains "do you have an hardened child number" but should be "do you have a hardened child number"


ACKs for top commit:
  tcharding:
    ACK c642bebeb7
  apoelstra:
    ACK c642bebeb7c452cdb81977f4fb9e36f2b1872be7; successfully ran local tests


Tree-SHA512: f8922d00a7bb687284387f880a1beeba6b1037d1885ea24c8162361880b250e6b44767c076ab40c6cd3cb9c667d28147413cc8257c46cd1383cc999c06735321
2025-07-03 03:40:08 +00:00
Andrew Poelstra af47c728ea
Merge rust-bitcoin/rust-bitcoin#4645: Automated nightly rustfmt (2025-06-29)
4e869b7415 2025-06-29 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:
  tcharding:
    ACK 4e869b7415
  apoelstra:
    ACK 4e869b7415afb4d86883c7b02c64f8bf1a546039; successfully ran local tests


Tree-SHA512: 7b41949d5a15df2532935f8b38156912e704dd0ba5100b6eff6bc6f7b646f11ce863a7fcca79317967a4e9ad745aa3a264c328b2bf93d80a8e978c3815dbbea6
2025-07-02 15:02:20 +00:00
Andrew Poelstra 6df0c82afa
Merge rust-bitcoin/rust-bitcoin#4648: units: Test generic `Add` and `Sub`
a520a8ab08 units: Test generic Add and Sub (Tobin C. Harding)

Pull request description:

  We have `Add` and `Sub` implemented for `NumOpResult<T>` but because the impls are generic they are not grouped in the file with the other add/sub impls. This makes it hard to see if they are supported.
  
  Add to the `add` and `sub` unit tests to verify support is implemented.


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


Tree-SHA512: 01a10e03f759942910c80d33e0150633415bc678c0ed5a7a403265226418a3594a658dff37ec770de3409a785e4d80213352075f6cca9ccbe3baf827e63b35ad
2025-07-02 14:24:57 +00:00
Tobin C. Harding a520a8ab08
units: Test generic Add and Sub
We have `Add` and `Sub` implemented for `NumOpResult<T>` but because the
impls are generic they are not grouped in the file with the other
add/sub impls. This makes it hard to see if they are supported.

Add to the `add` and `sub` unit tests to verify support is implemented.
2025-06-30 08:33:09 +10:00
Afounso Souza c642bebeb7
fix typo in error message 2025-06-29 21:23:29 +02:00
Fmt Bot 4e869b7415 2025-06-29 automated rustfmt nightly 2025-06-29 01:48:11 +00:00
Andrew Poelstra ad40e69a85
Merge rust-bitcoin/rust-bitcoin#4626: Saturate iwp constructors to u32 max
3355400d67 docs: document IWP function return limit and panic case (yancy)
8559a49e03 Do not bound Arbitrary parameters passed to InputWeightPrediction (yancy)
e4c3d1e7a6 Use saturating add in IWP constructors (yancy)
8552534b61 Use u32 for struct and member variables in IWP, saturating to u32::MAX (yancy)

Pull request description:

  Use u32 for struct and member variables in InputWeightPrediction (saturating to u32::MAX).  To avoid panics during construction and while using auxiliary methods such as `total_size()`, support saturating operations.
  
  closes: https://github.com/rust-bitcoin/rust-bitcoin/issues/4547


ACKs for top commit:
  apoelstra:
    ACK 3355400d6706ce8fee3daa258e9dbbd648a87dca; successfully ran local tests; looks great!
  tcharding:
    ACK 3355400d67


Tree-SHA512: 8e4af86914152b4c159749ba71f1a2a45682b7c16ba7b35a0c4fd4e8c7c162d3999f4280dffd71b231c7e24f0b4a18907465bd99d8ef958fb7bc81f519059f63
2025-06-28 20:55:14 +00:00
Andrew Poelstra f0ec103eba
Merge rust-bitcoin/rust-bitcoin#4643: minor correction bridge.rs
ba29dac6ad minor correction bridge.rs (strmfos)

Pull request description:

  Hey team, fix correction io/src/bridge.rs
  
  `No ide why` - `No idea why`


ACKs for top commit:
  apoelstra:
    ACK ba29dac6ad6b52752f411b266f11111355ada7b8; successfully ran local tests; thanks!


Tree-SHA512: e27aec05dcff1d60d34bd001c65dfaf89208f72ae8a961b5504275f6cb5c45c9a3b087fc5b589e3e1a313622715bd3e46c8bcb53c8d456d74648507c456cf47e
2025-06-28 19:21:11 +00:00
Andrew Poelstra 32a898b735
Merge rust-bitcoin/rust-bitcoin#4641: Automated weekly update to rustc stable (to 1.88.0)
b6d8d2a4ab Automated update to Github CI to rustc stable-1.88.0 (Update Stable Rustc Bot)

Pull request description:

  Automated update to Github CI workflow `semver-checks.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action


ACKs for top commit:
  tcharding:
    ACK b6d8d2a4ab


Tree-SHA512: 8e021a7c22c887eaa908fbf25247da5f296675f70addac5ce0667791e93735b68f8576626927945c477f3895e2d1c29a5c99839081054f1afcb5c9271fca14b7
2025-06-28 17:40:30 +00:00
strmfos ba29dac6ad
minor correction bridge.rs 2025-06-28 14:32:04 +02:00
merge-script 88faf3acad
Merge rust-bitcoin/rust-bitcoin#4598: Automated daily update to rustc (to nightly-2025-06-27)
24971a21d7 Automated update to Github CI to rustc nightly-2025-06-27 (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 24971a21d7

Tree-SHA512: 980497f649d2440f813924da62458c9ed67f4eeae72421ac19994a73aae103872b98c2908be37fd06e804efb55a5b60688f7f593006ae806f081e562c25f6deb
2025-06-28 14:33:08 +10:00
Update Nightly Rustc Bot 24971a21d7 Automated update to Github CI to rustc nightly-2025-06-27 2025-06-28 01:57:26 +00:00
Andrew Poelstra 2c18ec2c9f
Merge rust-bitcoin/rust-bitcoin#4637: psbt: check that non-witness UTXOs' txids match the input txid
53b93321c8 psbt: add test vector where non-witness UTXO TXID does not match input txid (Andrew Poelstra)
74f22a0a67 psbt: validate that non_witness_utxo txids match the input txids (Andrew Poelstra)
3337b7a030 psbt: introduce IncorrectNonWitnessUtxo error variant (Andrew Poelstra)

Pull request description:

  Fixes #4617


ACKs for top commit:
  tcharding:
    ACK 53b93321c8


Tree-SHA512: bf841708493fe38a37c7448cc02a26061ea66fd3c7acdbf9df4bbdfe07d8611075dceed20813de2b7cd63864ad80a9f66eaf8b869249c3a2028e1be25b48c5ae
2025-06-27 14:36:34 +00:00
Update Stable Rustc Bot b6d8d2a4ab Automated update to Github CI to rustc stable-1.88.0 2025-06-27 01:06:59 +00:00
Andrew Poelstra 8d3b69dc52
Merge rust-bitcoin/rust-bitcoin#4204: units: Bump version to `1.0.0-rc.0`
806b34aefc units: Bump version to 1.0.0-rc.0 (Tobin C. Harding)
1f9c48b5d3 units: Set explicit internals dependency version to v0.4.0 (Tobin C. Harding)

Pull request description:

  In preparation for doing the first 1.0 RC release set the version number, add a changelog entry, and update the lock files.
  
  Lets go!


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


Tree-SHA512: 4d87865990fc66d0150156cf9aaae53b80602b826e68bc7e0210bea7dc488b72beb90b64034a4debb455c3d902efe574ec15ed7a8e638bc6f670cdd16b7a4e20
2025-06-25 21:20:04 +00:00
Andrew Poelstra 53b93321c8
psbt: add test vector where non-witness UTXO TXID does not match input txid 2025-06-25 16:12:21 +00:00
Andrew Poelstra 74f22a0a67
psbt: validate that non_witness_utxo txids match the input txids
This requires updating a couple serde test vectors -- we are tightening
validation so that some existing serde-serialized PSBTs no longer
deserialize. I believe this is the correct thing to do.
2025-06-25 16:12:20 +00:00
Andrew Poelstra 3337b7a030
psbt: introduce IncorrectNonWitnessUtxo error variant
Putting this in its own commit so that the fix and the test can live in
separate commits which reviewers can swap.
2025-06-25 16:12:20 +00:00
Tobin C. Harding 806b34aefc
units: Bump version to 1.0.0-rc.0
In preparation for doing the first 1.0 RC release set the version
number, add a changelog entry, and update the lock files.
2025-06-25 11:06:33 +10:00
Tobin C. Harding 1f9c48b5d3
units: Set explicit internals dependency version to v0.4.0
`cargo publish` does not allow publishing a crate without all
dependencies having explicit version numbers. We discovered recently
that having patching the root manifest was annoying when downstream
testing so we removing the version numbers in #4284 in favor of `path`.
It turns out we can include both.

Props to nyonson for discovering that.

ref: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#multiple-locations

Use an explicit version number to the `internals` dep in `units`.
2025-06-25 11:06:29 +10:00
yancy 3355400d67 docs: document IWP function return limit and panic case
Document the newly added saturation point for internal arithmetic.
2025-06-24 15:04:35 -05:00
yancy 8559a49e03 Do not bound Arbitrary parameters passed to InputWeightPrediction
Now that InputWeightPrediction can no longer overflow due to extreme
values, there is no longer need to bound the Arbitrary parameters
passed.
2025-06-24 15:04:35 -05:00
yancy e4c3d1e7a6 Use saturating add in IWP constructors
In order to avoid panics during weight prediction replace addition
with `u32::saturating_add()`.
2025-06-24 15:04:29 -05:00
yancy 8552534b61 Use u32 for struct and member variables in IWP, saturating to u32::MAX
To prevent panics during addition if `usize` is `u64`, use `u32` member
variables internally.  TK use `u32::saturating_add` instead of basic
addition. However, to use `u32::saturating_add()`, the variables need
to be of type `u32`. Therefore, this commit transforms the internal
types to `u32`.

In so doing, add a `const` function `saturate_to_u32()` which saturates
a usize to `u32`.  Also, replace `compact_size::encoded_size()` with a new
function `encoded_size()` which returns a `u32`, avoiding needless casts.
2025-06-24 15:03:26 -05:00
Andrew Poelstra 8dc4b832c5
Merge rust-bitcoin/rust-bitcoin#4638: Manual daily update to rustc (to nightly-2025-06-20)
a5db001fc0 Update Github CI to rustc nightly-2025-06-20 (Jamil Lambert, PhD)
0624d96415 Use the anonymous lifetime for path (Jamil Lambert, PhD)
f22f10b5ca Simplify PartialOrd implementation (Jamil Lambert, PhD)

Pull request description:

  Automated daily update to rustc (to nightly-2025-06-20) failed CI due to new lint errors (#4598).
  
  Fix the lint errors.
  
  Update to nightly-2025-06-20.


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


Tree-SHA512: a396b7b696c2a6a904a832e3ffd14bc2a6f27936aa076641d3f03c6000be4962606b9398c1f82d9aa12ddf919023d87302b338a9779084ef521411f6f0151220
2025-06-24 17:16:19 +00:00
Jamil Lambert, PhD a5db001fc0
Update Github CI to rustc nightly-2025-06-20
Automated update failed CI due to new lint errors.

Now lint errors have been fixed update the nightly version.
2025-06-24 14:47:36 +01:00
Jamil Lambert, PhD 0624d96415
Use the anonymous lifetime for path
Lint error from new nightly "lifetime flowing from input to output with
different syntax can be confusing".

Add the anonymous lifetime to make it explicit.
2025-06-24 14:47:35 +01:00
Jamil Lambert, PhD f22f10b5ca
Simplify PartialOrd implementation
Lint error with new nightly version "non-canonical implementation of
`partial_cmp` on an `Ord` type".

Update to directly call instead of dereferencing first.
2025-06-24 14:47:23 +01:00
Andrew Poelstra d84745fd92
Merge rust-bitcoin/rust-bitcoin#4623: Improve `Xpriv::derive_xpriv` and `Xpub::derive_xpub` ergonomics slightly
352712257e psbt: Use new `derive_xpriv` flexibility in GetKey (Daniel Roberts)
bd3f4b6bf1 psbt: Add test for GetKey bip32 (Daniel Roberts)
c7bdec14fb Fix clippy lint and formatting for `Xpriv::derive_xpriv` and `Xpriv::derive_xpub` calls (Daniel Roberts)
9d4381c8fe Improve `Xpriv::derive_xpriv` and `Xpub::derive_xpub` ergonomics (Daniel Roberts)

Pull request description:

  This enables a couple more things to be passed to the bip32 derive methods, with (afaict) no downside (all existing call sites remain valid and work as before).
  
  Given
  
  ```
  let secp = Secp256k1::new();
  let path: DerivationPath = "42'/350'/0".parse().unwrap();
  let xpriv: Xpriv = "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi".parse().unwrap();
  ```
  
  The following *new* ways to call derive are enabled:
  
  ```
  /// Derive using only part of the path
  xpriv.derive_xpriv(&secp, &path[1..])
  ```
  
  ```
  /// Derive moving into the method
  xpriv.derive_xpriv(&secp, path)
  ```
  
  The second case is probably of questionable usefulness, but I've ended up writing something like
  ```
  let path: DerivationPath = path.into_iter().skip(n).cloned().collect()
  ```
  enough that the first case would be welcome, and can be done with a minimal change.
  
  I'm reasonably confident this doesn't break anything (and it indeed doesn't break any tests that I can see) but this is definitely on the edge of my comfort with the rust type system, which is why I've created this as a draft.


ACKs for top commit:
  tcharding:
    ACK 352712257e
  apoelstra:
    ACK 352712257e66c7959b80a9f6375961295a292306; successfully ran local tests; nice!


Tree-SHA512: 0babdd9589d3312d4df54d77202a71dbb021e216167514c1a87f1f992f254f2b298b874411f8c7a3d56d7f730b22d104c3a78f9145715ea8df6bedad35c1ffd5
2025-06-24 12:39:28 +00:00
Daniel Roberts 352712257e psbt: Use new `derive_xpriv` flexibility in GetKey 2025-06-23 18:15:13 -05:00
Daniel Roberts bd3f4b6bf1 psbt: Add test for GetKey bip32 2025-06-23 18:06:02 -05:00
Daniel Roberts c7bdec14fb Fix clippy lint and formatting for `Xpriv::derive_xpriv` and `Xpriv::derive_xpub` calls 2025-06-23 18:06:02 -05:00
Daniel Roberts 9d4381c8fe Improve `Xpriv::derive_xpriv` and `Xpub::derive_xpub` ergonomics
This change enables references to slices, arrays, and Vecs to be passed
to derive methods.
2025-06-23 18:06:02 -05:00
Andrew Poelstra 732a83c3a9
Merge rust-bitcoin/rust-bitcoin#4629: Improve locktime docs
70221ffa08 Fix link to use new name (Tobin C. Harding)
ebf92fcb01 Use ASCII in rusdocs (Tobin C. Harding)
64ece63f19 Add missing whitespace character to rustdoc (Tobin C. Harding)
64e10686de Improve rustdoc examples for absolute locktime (Tobin C. Harding)

Pull request description:

  In preparation for release go over the locktime rustdocs. 
  
  Close: #4463


ACKs for top commit:
  jamillambert:
    ACK 70221ffa08
  apoelstra:
    ACK 70221ffa085e3cd0a50683f788f5e78cdfae04ae; successfully ran local tests


Tree-SHA512: 67bc51400056e08018f92f8e7ff91c8f8db9e6b575e83f8937a382bde45541a31e75277e200694180fa5098b681e200858fb7b0c9330065af0019955ed126a61
2025-06-23 13:16:48 +00:00
Andrew Poelstra 7bbb9085c6
Merge rust-bitcoin/rust-bitcoin#4634: Automated nightly rustfmt (2025-06-22)
c060285851 2025-06-22 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:
  tcharding:
    ACK c060285851
  apoelstra:
    ACK c06028585189bfb0f76f0e34bf10ec20573d5d71; successfully ran local tests


Tree-SHA512: e0eed455b4641522fb1dbdcf57e51cc8328be9be63d01d21e4d4868ad8fe47f11ea449574e85986bbaa7d7dbed89c3d7bce66f84059440c0588c0bde58a36d92
2025-06-22 23:36:06 +00:00
Andrew Poelstra 7af15ab676
Merge rust-bitcoin/rust-bitcoin#4631: Add tests to kill mutants
ef56baa696 Improve fee_rate test to kill a mutant (Jamil Lambert, PhD)
5edcc5dad4 Remove repeated fee_rate test (Jamil Lambert, PhD)
bd50943234 Add a roundtrip test to kill a mutant (Jamil Lambert, PhD)
0b4b17307d Test SignedAmount edge case to kill mutant (Jamil Lambert, PhD)
f3338655f1 Test OutPoint edge case to kill mutant (Jamil Lambert, PhD)

Pull request description:

  Weekly mutation testing found new mutants in units and primitives.
  
  - Add tests or improve existing tests to kill all of the mutants. 
  - Remove a duplicate test in `fee_rate`
  
  Closes #4601, Closes #4622


ACKs for top commit:
  tcharding:
    ACK ef56baa696
  apoelstra:
    ACK ef56baa69670f9c2e453cb981d6f3488247d000c; successfully ran local tests


Tree-SHA512: b5301ae76e6b1d94831054d348d7eb544ab052178a1ce362cff2e6876fd4eb243c842d158e7d174b7ec4700083367ed0e3c6f6d8e1f6c0a4c888d5bb3205f72f
2025-06-22 15:51:05 +00:00
Fmt Bot c060285851 2025-06-22 automated rustfmt nightly 2025-06-22 01:46:07 +00:00
Andrew Poelstra 51f78bbb4c
Merge rust-bitcoin/rust-bitcoin#4630: units: Remove serde derive feature
d8377d90dd units: Remove serde derive feature (Tobin C. Harding)
1031851da4 units: Manually implement serde traits for block types (Tobin C. Harding)

Pull request description:

  Currently we only need the `derive` feature of `serde` in test code.
  
  Observe:
  
  - We do not need the error testing logic because `ParseAmountError` is already exhaustively tested.
  - The rest of the `serde` test logic in `amount` can be done using the public API so it can be moved to the integration test directory.
  
  Move the unit test code to `tests/` excluding the error testing logic. Remove the `derive` feature from the `serde` dependency. Add a `dev-dependency` on `serde` that enables the `derive` feature.


ACKs for top commit:
  apoelstra:
    ACK d8377d90dd8d6bd066f51f45c23ffdfe2d0ab694; successfully ran local tests; nice!


Tree-SHA512: 03eb24ae1917e838a2e20c3c62ef9381e2a1eaccdb6474f60a2db59af98d9533054227af4c404013ea8deb4cfe4d57075ae4890857f8af283ebb4338ddb4ed3f
2025-06-21 21:39:39 +00:00
Andrew Poelstra fbb0e4004f
Merge rust-bitcoin/rust-bitcoin#4628: Use new type names instead of deprecated aliases
f746aecb61 Use NumberOfBlocks in rustdoc (Tobin C. Harding)
dc5249aae6 Use new type names instead of deprecated aliases (Tobin C. Harding)

Pull request description:

  Recently we changed the names of some locktime types but kept aliases to the original names. To assist with ongoing maintenance lets use the new names already.
  
  ~Internal change only.~
  
  Added a patch that does the same in some rustdocs.


ACKs for top commit:
  jamillambert:
    ACK f746aecb61
  apoelstra:
    ACK f746aecb61456f1eb97280e1d091434250832e72; successfully ran local tests


Tree-SHA512: f3304fcc62069f72fa6c49b4aee5579e4ef6e81cb466b9c7e79ddd1a04b63f2f4d3f0ffdcb9303c3bee2501beead3fceb9be79cefe35d7615223738291535152
2025-06-21 18:03:55 +00:00
Andrew Poelstra ea731947b1
Merge rust-bitcoin/rust-bitcoin#4625: units: Fix up the api test
2b07f59545 units: Fix up the api test (Tobin C. Harding)
a6ab5c9fd0 Implement Arbitrary for result types (Tobin C. Harding)

Pull request description:

  A lot has changed over the last few months. Fix up the API integration test to match the current state of the crate.
  
  Includes a patch to implement `Arbitrary` for types from the new private `result` module.


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


Tree-SHA512: fa9bd5b67ea6217cfb11a985183d2d83ae126678fa9fbe5b540fcec31efc0fbafb3e6010c7e831c84c9161300ad5ccc771f848875fdcfe09e072bb0d2881a104
2025-06-20 23:01:29 +00:00
Tobin C. Harding 2b07f59545
units: Fix up the api test
A lot has changed over the last few months. Fix up the API integration
test to match the current state of the crate.
2025-06-20 09:00:29 +10:00
Tobin C. Harding a6ab5c9fd0
Implement Arbitrary for result types
Implement `Arbitrary` for the `NumOpResult` and `MathOp` types from the
`result` module.
2025-06-20 09:00:25 +10:00
Tobin C. Harding 70221ffa08
Fix link to use new name
Use `NumberOfBlocks` not the `Height` alias. Fixes link.
2025-06-20 08:41:59 +10:00
Tobin C. Harding ebf92fcb01
Use ASCII in rusdocs
Feels unnecessarily fancy, lets just use ASCII. Fix the column width to
be below the 100 character conventional width while we are at it.
2025-06-20 08:41:59 +10:00
Tobin C. Harding 64ece63f19
Add missing whitespace character to rustdoc
Fix trivial typo.
2025-06-20 08:41:58 +10:00
Tobin C. Harding 64e10686de
Improve rustdoc examples for absolute locktime
Improve the rustdoc examples and fleshing them out, using non-deprecated
functions, and returning an error if required (so we can use `?`).
2025-06-20 08:41:58 +10:00
Jamil Lambert, PhD ef56baa696
Improve fee_rate test to kill a mutant
There is a mutant found in `FeeRate` `to_sat_per_kvb_floor` and `ceil`.

Add to the existing test so that all 6 to_sat floor and ceil functions
are tested.
2025-06-19 21:48:06 +01:00
Jamil Lambert, PhD 5edcc5dad4
Remove repeated fee_rate test
One of the tests is a copy of the test two above it with a similar name.

Remove the copy of the test.
2025-06-19 20:35:32 +01:00
Jamil Lambert, PhD bd50943234
Add a roundtrip test to kill a mutant
There is a mutant found in relative locktime `to_512_second_intervals`.

Add a round trip test to kill the mutant.
2025-06-19 20:33:57 +01:00
Jamil Lambert, PhD 0b4b17307d
Test SignedAmount edge case to kill mutant
There is a mutant found in `SignedAmount::positive_sub`.

Add an edge case to the test to kill the mutant.
2025-06-19 20:33:39 +01:00