7d2c57d345 Soften wording on MSRV (Tobin C. Harding)
Pull request description:
Currently we use the word "always" in the MSRV docs, we mean to say "there are no set of features that will break the build" but this usage of "always" may be interpreted as "always, for all time" which is definitely not what we mean.
Soften the wording on MSRV by removing the word always.
ACKs for top commit:
apoelstra:
ACK 7d2c57d345 successfully ran local tests; will one-ACK merge because it's trivially correct
Tree-SHA512: 8d85d748e90e8082861005e6787d1c6be95745ebb442c98f638c5efb9940fc5ac7860d786b47bff88ba59c17a2a8c115d2c740108772dd63dc24f3e911555473
cbfddb0394 hashes: Rename length field and use u64 (Tobin C. Harding)
Pull request description:
The hash engine types have a `length` field that is used to cache the number of bytes hashed so far, as such it is an arbitrary number and could use a `u64` instead of `usize`.
While we are at it rename `length` to `bytes_hashed` to remove any ambiguity of what this field is. Note this field is private, we already have the public getter `n_bytes_hashes` to get the value.
Introduce a private function `incomplete_block_size`, the purpose of this function is to put all the casts in one place so they can be well documented and easily understood.
Fix: #3016
ACKs for top commit:
apoelstra:
ACK cbfddb0394 successfully ran local tests
Tree-SHA512: a9d932938afcbd6dfb9db471a02fa7e3fff8f0659906627001ad241390b9af57088fd34afeae551c70c2c49783e6296f110b57ff9de6fed2609f4648ec8fd934
18110a51f2 Bump version of internals to 0.4.0 (Tobin C. Harding)
Pull request description:
In preparation for releasing `internals v0.4.0` bump the version number, add a changelog entry, update the lock files, and depend on the new version in all crates that depend on `internals`.
ACKs for top commit:
apoelstra:
ACK 18110a51f2 successfully ran local tests; lots of nice stuff here
Tree-SHA512: a4d3d5279b7d7fa993cbc3b7b34fc6dc4024dd54c0bfa1ecd0f0d5f09b984871f156c3695092a1f6c44b7571f8b2051699040f5f77636d44d4cae6c972ab597f
184dfbcdb6 primitives: Move optional dependency to correct place (Tobin C. Harding)
Pull request description:
We keep optional deps in a separate group to non-optional deps, move the new `arbitrary` dependency.
Internal change only.
ACKs for top commit:
shinghim:
ACK 184dfbcdb6
apoelstra:
ACK 184dfbcdb6 successfully ran local tests
Tree-SHA512: 8540ee9ce9663d60d1a8d08e94738c7a3e3341b640ec6cbc04c304cb12daa4c95ae6cd1e4ad9fde361065510b2e34c65f6f08db1ae305976fce4525aa98756a3
Currently we use the word "always" in the MSRV docs, we mean to say
"there are no set of features that will break the build" but this usage
of "always" may be interpreted as "always, for all time" which is
definitely not what we mean.
Soften the wording on MSRV by removing the word always.
bd32d1db78 Add stricter doc test to justfile (Jamil Lambert, PhD)
Pull request description:
In order to show warnings for unused imports etc. in doc examples as mentioned in #3362, an extra test has been added to the justfile for `just lint` and the doc test in `just sane` has been removed since it calls `just lint`.
ACKs for top commit:
apoelstra:
ACK bd32d1db78 successfully ran local tests
tcharding:
ACK bd32d1db78
Tree-SHA512: 088244aa9cd07e4aab197d1ad675c6ed778f10cec5304bfcecdd9a0526cd6395f14db69e71a464acd1e41ce54610a51257481602348f3ee65b0228550cc6e12c
In order to show warnings for unused imports etc. in doc examples an
extra test has been added to the justfile for `just lint` and the doc
test in `just sane` has been removed since it calls `just lint`.
46386337b0 Ignore doc compile error (Jamil Lambert, PhD)
Pull request description:
With the stricter doc tests required to pick up unused imports etc. the code under the `compile_fail` tag also creates an Error.
Changed `compile_fail` to `ignore` to remove the Error.
ACKs for top commit:
tcharding:
ACK 46386337b0
apoelstra:
ACK 46386337b0 successfully ran local tests
Tree-SHA512: 67513464dede8d4bd9f9fa4363ccb58e774b180f331edc4486290784f61e931195225765768030d2709f618ba4afe17d034d4bbc4d649a02e7a34b47b48bd297
f6abdcc001 Allow unused in `macros.rs` docs (Jamil Lambert, PhD)
fd89ddf401 Remove or fix unused variables and methods in docs (Jamil Lambert, PhD)
ff6b1d4f19 Remove unused variables and methods from docs (Jamil Lambert, PhD)
e58cda6f92 Remove `unused_imports` in docs (Jamil Lambert, PhD)
Pull request description:
As mentioned in #3362 examples in documentation are not linted in the same way as other code, but should still contain correctly written code.
#![doc(test(attr(warn(unused))))] has been added to all lib.rs files
In the docs throughout all crates:
- Unused imports have been removed.
- Unused variables, structs and enums have been used e.g. with an `assert_eq!` or prefixed with `_`
- Unused methods have been called in the example code.
ACKs for top commit:
tcharding:
ACK f6abdcc001
apoelstra:
ACK f6abdcc001 successfully ran local tests
Tree-SHA512: c3de1775ecde6971056e9fed2c9fa1621785787a6a6ccbf3a6dbd11e18d42d4956949f3f8adfc75d94fd25db998b04adb1c346cc2c2ba47f4dc37402e1388277
With the stricter doc tests required to pick up unused imports etc. the
`compile_fail` tag also creates an Error.
Changed `compile_fail` to `ignore` to remove the Error.
34c95ad729 Automated update to Github CI to rustc nightly-2024-09-18 (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 34c95ad729
Tree-SHA512: da84f2a273c2e26a1305935bd2e1abc35dea9b6dc45f54414339ede5b91346ab3b96188bcb4b6567bc13a53e630b3e0efa0584cd7714f10bc4ae0483e8fb4541
f5cae1cddd Comment from_str methods (yancy)
Pull request description:
Follow up from https://github.com/rust-bitcoin/rust-bitcoin/pull/3346
ACKs for top commit:
tcharding:
ACK f5cae1cddd
apoelstra:
ACK f5cae1cddd successfully ran local tests
Tree-SHA512: 2b95381e5281754e2b3a49aa8dfaac5742c244970fb54f68024dc23b61a74955ae95b9a0e7ae848095ac0686df5faf93faf7de3371b2f341b108cc10e5d4a9cd
8c29fe08f8 Revise doc comment (yancy)
Pull request description:
Update doc comment to make clear that the ceiling is computed instead of the default behavior for integer division.
ACKs for top commit:
tcharding:
ACK 8c29fe08f8
apoelstra:
ACK 8c29fe08f8 successfully ran local tests
Tree-SHA512: 3793dccab5b5a3e59b3949ecb54475c76263e1debcc18df42f3b0251189435ba87e537c4b5d80c91f4b916449618a75e6efac32b4ba2fc29c42563e1b0fb4a89
The example code in macros.rs is much clearer as it is than changing
it to remove the warnings created by adding the warn attribute to the
`lib.rs` file.
The example code was enclosed within a function block and
`#[allow(unused)]` added. And a warn attribute added to `lib.rs`.
Examples in documentation are not linted in the same way as other code,
but should still contain correctly written code.
Throughout all of the crates except internals (another commit) unused
variables have been prefixed with `_`, unused imports have been removed,
and a warn attribute added to all of the `lib.rs` files.
Examples in documentation are not linted in the same way as other code,
but should still contain correctly written code.
Throughout the bitcoin crate unused variables have either been prefixed
with _ or an assert used. And unused methods have been used in the
example code.
5b4e81b379 Implement Arbitrary for Transaction (Shing Him Ng)
Pull request description:
Implement `Arbitrary` for Transaction and its child types
ACKs for top commit:
apoelstra:
ACK 5b4e81b379 successfully ran local tests
tcharding:
ACK 5b4e81b379
Tree-SHA512: 411b97344e01e2bf38fff994902acda51f9a4fe748573e600fbdd643951a0a56b37395594349706b13c744304bd5396fd8ee31c27e5b1ff97e1a3cebd479e7c8
Examples in documentation are not linted in the same way as other code,
but should still contain correctly written code.
unused_imports in docs have been removed in bitcoin, and a warn
attribute added to lib.rs.
25d906d936 Use UFCS in macros (Liam Aharon)
Pull request description:
Closes#3304
ACKs for top commit:
apoelstra:
ACK 25d906d936 successfully ran local tests
tcharding:
ACK 25d906d936
Tree-SHA512: a02a8507bcec73dab1ec8d49e45eab327d989c276d931520e0fff312faf7d3165292c300fb9414314f9b94b1255ee49a0fb64303df6d971c9089226b6873c36a
In preparation for releasing `internals v0.4.0` bump the version number,
add a changelog entry, update the lock files, and depend on the new
version in all crates that depend on `internals`.
8ec3571d80 Implement GetKey for Vec<Xpriv> (Nadav Ivgi)
Pull request description:
It appears that the `BTreeSet<Xpriv>`/`HashSet<Xpriv>` sets currently implementing `GetKey` cannot actually be constructed, because `Xpriv` does not implement `Ord` nor `Hash`. (And that the rust-bitcoin code referencing these sets should not even compile? yet evidently it does 👀 )
This PR adds support for `Vec<Xpriv>` to enable signing with multiple `Xpriv`s, but does not address the issue with the existing sets.
The added test case demonstrates the issue:
```rust
error[E0277]: the trait bound `bip32::Xpriv: std:#️⃣:Hash` is not satisfied
--> bitcoin/src/psbt/mod.rs:2301:24
|
2301 | HashSet::new().insert(xpriv.clone());
| ^^^^^^ the trait `std:#️⃣:Hash` is not implemented for `bip32::Xpriv`
|
note: required by a bound in `std::collections::HashSet::<T, S>::insert`
--> /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/collections/hash/set.rs:888:5
error[E0277]: the trait bound `bip32::Xpriv: Ord` is not satisfied
--> bitcoin/src/psbt/mod.rs:2302:25
|
2302 | BTreeSet::new().insert(xpriv.clone());
| ^^^^^^ the trait `Ord` is not implemented for `bip32::Xpriv`
|
note: required by a bound in `std::collections::BTreeSet::<T, A>::insert`
--> /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/collections/btree/set.rs:899:5
```
ACKs for top commit:
apoelstra:
ACK 8ec3571d80 successfully ran local tests
tcharding:
ACK 8ec3571d80
Tree-SHA512: aceb95f8eaf11f91c6829e0b5e1c0264ebffbf587fd420145a22e924cb45678b2f4334f0b7de6ed99b57f0ce24c3d61f9e5c1e348e1b40975bc515e8fd16b75d
f7ff6582ad Automated update to Github CI to rustc nightly-2024-09-15 (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 f7ff6582ad
Tree-SHA512: d04e7a3ca475dc05e7289493b194c144fca244e901144b2ebfca686e206d99f85213d66b6be1be37c2aacd734e0da4b075c14149b6cdc84185bc5aaa59a3a196
d942882b36 Document the magic bytes for witness commitment (Peter Ryszkiewicz)
Pull request description:
ACKs for top commit:
apoelstra:
ACK d942882b36 successfully ran local tests; neat! I don't think I was aware of this
tcharding:
ACK d942882b36
Tree-SHA512: 89766e986574e49b6c5fd00844db679eb8894a591463029f7f88079fa9ca65bd56265a42dd8fa5aad20ef4744bca3259c06f8a461abd1c695fb89433ed5cc145
9459739457 Move feature flag inside impl_to_hex_from_lower_hex macro (Shing Him Ng)
Pull request description:
Moving the feature flag inside the macro definition. Since the feature flag is moved inside the macro def, we don't need to keep the definition of the one behind `#[cfg(not(feature = "alloc"))]`
Fixes#3348
ACKs for top commit:
apoelstra:
ACK 9459739457 successfully ran local tests
tcharding:
ACK 9459739457
Tree-SHA512: 47272d3e1def21ef372af04810834da072fc43069a5c0b8ba154910d07526e79693c86cb73de301ce3d0c6cdca92abb7d23ae8346e8ce8b29c961e42e821f0e0
b593c886e3 Support GetKey where the Xpriv is a direct child of the looked up KeySource (Nadav Ivgi)
055aa9d4dc Refactor GetKey to take the KeyRequest by reference (Nadav Ivgi)
d15c57bd1f Refactor GetKey for sets to internally use Xpriv::get_key() (Nadav Ivgi)
d25c62bf45 Fix GetKey for sets to properly compare the fingerprint (Nadav Ivgi)
Pull request description:
- The first commit is the simplest fix for a bug where the fingerprint wasn't compared correctly.
- The second & third commits are optional refactoring to reuse `Xpriv::get_key` for `$set<Xpriv>::get_key`, so the Xpriv matching logic only has to be maintained in one place.
- The forth commit adds support for signing with `Xpriv`s that are direct children of the `KeySource` -- possibly what the original (buggy) code author had in mind?
Of course, feel free to take just the first commit if the others seem unnecessary. The last one is kind of meh, not sure if really useful.
Note that multi-`Xpriv` signing does not actually work until #2850 is addressed too.
ACKs for top commit:
apoelstra:
ACK b593c886e3 successfully ran local tests
tcharding:
ACK b593c886e3
Tree-SHA512: a6f84fe12b68ddb71fc722649b1596d1561ab08a07d47f2345bd8932e155571f2b1e23c32a9c03d588fb697540340cb8ca38275dfe11f4910fd48265a993762a
70ccd6b629 signed_msg_hash takes impl AsRef<[u8]> (Liam Aharon)
Pull request description:
Closes#3249
Seems not required for Kixunil's immediate use case anymore, but figured I'd open a PR anyways.
ACKs for top commit:
apoelstra:
ACK 70ccd6b629 successfully ran local tests
Kixunil:
ACK 70ccd6b629
Tree-SHA512: b15bafd1af0749cbac36652a4e4c9ab3f91b3980bb6c3cbc1c977d339810fc15075af5d4bc6b210de364bedc496ce3759eaf4539e40d215ab66a122ba69dd56a
894f82e7cc Add a condition for parsing zero from string when not denominated. (yancy)
Pull request description:
closes https://github.com/rust-bitcoin/rust-bitcoin/issues/3307
ACKs for top commit:
Kixunil:
ACK 894f82e7cc
tcharding:
ACK 894f82e7cc
apoelstra:
ACK 894f82e7cc9eb459a297d43e82734621e0824610; successfully ran local tests.
Tree-SHA512: 6d32847c74ccedc3355d615838e2dd1e08add29cc47ff69d9ef22683eda93049d41131dd0c992c8d7be3a018f5438856c415a3d2f3cb9de9c986534b268ee386
8f2f4cbb3c Re-order optional dependencies (Tobin C. Harding)
95f2a8dab6 Do not access ScriptBuf inner from builder (Tobin C. Harding)
900af453ff Stop accessing inner ScriptBuf field when encoding (Tobin C. Harding)
8b82363d97 Use Script::as_bytes instead of inner when indexing (Tobin C. Harding)
b0675a4a4f Use Script::len instead of inner field (Tobin C. Harding)
374c6118dc Deprecate Script::fmt_asm and to_asm_str (Tobin C. Harding)
Pull request description:
Move the `Script` and `ScriptBuf` types to `primitives`. There were still a few preparations required, things we had missed while creating the extension traits.
Note also please, in the last patch, we enable `hex` from the `serder` feature. This is not the final state we want but like we did for `alloc` it is a step to reduce the size of the diff.
ACKs for top commit:
Kixunil:
ACK 8f2f4cbb3c
apoelstra:
ACK 8f2f4cbb3c successfully ran local tests
Tree-SHA512: 62a5f3c253ecb54d95c37fdc7eb955f3952909dc3bca20444b85c44665f54d5a0c48daf729bed0dd60ff3e9571b41deed039984c8b757b075ac6e136cacd17d7
6c0aaa0915 hashes: Put test function in a module (Tobin C. Harding)
Pull request description:
With a recent nightly toolchain `clippy` gives us an error:
error: missing documentation for a constant
I'm not sure why the error is emitted but wrapping the function in a `tests` module as is standard practice clears the error.
ACKs for top commit:
Kixunil:
ACK 6c0aaa0915
apoelstra:
ACK 6c0aaa0915 successfully ran local tests
Tree-SHA512: f6b72c439d3fb34944b58565afaaeeea9e9420d4031091d0215f8c514b64f4ea593f155363fd173f022739422b504e3b2215ce60b35d55b4fd8a3554c5a84f3c