a09c3c5225 Check API: remove false positives on rustdoc (Jose Storopoli)
Pull request description:
Fixes the rustdocs build warnings.
This PR is composed by two commits:
- Updates `contrib/check-for-api-changes.sh` to ignore
`rustdoc::broken_intra_doc_links` due to the features being turned on and off
(see rationale below); and
- Adds a `just doc` quick check that will check for all missing rustdoc broken links
to counterbalance the allow flag above.
As jyap808 has pointed out in #2800,
we might not have a simple fix for these rustdoc build warnings inside the `just check-api`.
This can be mitigated by adding a simple allow flag to `RUSTDOCFLAGS` in `contrib/check-for-api-changes.sh`.
> Took a quick look at this. Not sure if there's anything obvious to fix.
>
> A few warnings mentioning [`ordered::ArbitraryOrd`] which is only enabled when the "--features ordered" flag is used. No warning when the flag is enabled. Generated docs look OK.
>
> jyap808 in #2800Closes#2800.
I don't know if this is the intended solution, or if we want to add more CI checks for the docs.
Note that these docs checks are already covered in `rust-bitcoin/rust-bitcoin-maintainer-tools`: 3494ceec52/ci/run_task.sh (L275-L278)
Any feedback will be appreciated.
ACKs for top commit:
apoelstra:
ACK a09c3c5225
tcharding:
ACK a09c3c5225
Tree-SHA512: d8a4a14a220d907a072fb283075c168e8264d01e73bf6b600f9c562337836ff6ea47cd0ab326bebd997522d5fdf32ae5a9b82c6951741595ec41c13ad49bc2ce
5e7a638b4d fix crypto rustdocs (Jamil Lambert, PhD)
bac30d3e6e fix rustdocs in bip152 (Jamil Lambert, PhD)
4a9f74b55c fix missing fullstops in bitcoin rustdoc (Jamil Lambert, PhD)
Pull request description:
Updated some of the rustdocs to make the style consistent. There is still more to do which I can work on if it is useful?
ACKs for top commit:
tcharding:
ACK 5e7a638b4d
apoelstra:
ACK 5e7a638b4d
Tree-SHA512: 3813900d4f15e95a290286a4d9efd8010625150a09dd4f601ab6279e3e0bd5cfa8b2f1628543d7279b4b26f1e7e85d10338d3401a7b6e9794684d02fa0e8fda1
55cbae9c2f fuzz: add more coverage for `deserialize_psbt` (Bruno Garcia)
Pull request description:
This PR adds more coverage for `deserialize_psbt` harness. It uses the `data` to create more than one psbt and then combine them.
ACKs for top commit:
apoelstra:
ACK 55cbae9c2f yeah, I like this
Tree-SHA512: 568899be8a82595c07e7b47c3011c093ce4ce49962e14781ea0c2eb9608fbba9920bbc81a296ec49d6ca124b813715bc0b8eb0cf887d44bbf8190f9a10c18845
3298c0c4b5 pow: Unit test from_hex_internal (Tobin C. Harding)
47e4bff0ee pow: Fix off-by-one error (Tobin C. Harding)
Pull request description:
Patch 1 adds the fix, patch 2 is a unit test that fails if move to the front.
ACKs for top commit:
apoelstra:
ACK 3298c0c4b5 nice find! and lucky this just returns an error rather than panicking. may be worth backporting nonetheless
brunoerg:
ACK 3298c0c4b5
Tree-SHA512: 15bbd5aa4ac62c91492f5394444d179d95770bae822422bf00bb62896dcaf6c92d32f7d2e3380c352ff7242422ec6af6ff637ff78d14406cd047ef4ad5f22649
Add a unit test that fails if put before the "pow: Fix off-by-one error"
patch. Tests that we can correctly parse a 32 character long hex string
into a `U256`.
ee30eaa81b fuzz: add more coverage for `deserialize_block` (Bruno Garcia)
Pull request description:
This PR adds more coverage for the `deserialize_block` target. First, it serializes the block and compares with the data provided and then call some block functions to ensure they run without any issue.
ACKs for top commit:
apoelstra:
ACK ee30eaa81b Thanks!
Tree-SHA512: db6c7befa7b429267e9b28fb7910d2b9e8d462e22c791b544b1aa528c7ba4f8e1cd32e1276c67d3da1f97ce484e7ed19ec20b10d2030f2977fd8f855cf510ffe
5cff6b4765 Automated update to Github CI to rustc nightly-2024-06-02 (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 5cff6b4765
Tree-SHA512: 02513ed90221b2a31a3cc839dde89eb0239d3537ce19bd32bbc4541f58469a9d88de57e921fea3d653b0f52405b94677ea4470d469ae5f7ace463611be7cd9cd
d6ef16af30 update api (Divyansh Gupta)
a336ec0dda refactor(script): move `read_scriptint` to `PushBytes` & create `read_int` function (Divyansh Gupta)
Pull request description:
* Moved `read_scriptint` method to `Push_Bytes` struct
* Created `Instruction::read_int` method which acts as a wrappper around this function.
Done as part of #1547
ACKs for top commit:
apoelstra:
ACK d6ef16af30
tcharding:
ACK d6ef16af30
Tree-SHA512: e33df8adcb1c23351da303f6bad1ea4a8eae30e65943d230ae886183a01f970aecd0c8c8fd3a6c337cfe6dde1b7590778d88c308415e393f137065ef7da4b29c
0ae5be3e42 docs: Add more info to the update api files section (Tobin C. Harding)
Pull request description:
Done to try to further help new contributors and save maintainer time.
Add an example of using `just check-api` and an example `git` command for devs to create the api patch now required for all changes to the public API.
ACKs for top commit:
apoelstra:
ACK 0ae5be3e42
Tree-SHA512: 042dad94c1887fcfad535b1eb51cb38a450f3928742d0887c8470888ba53cf79687b65cf7040bdcbe4ce4d49a843f66f198139c22d4f3c4d2689b94b946e6929
c9d1ff7037 Update hashes API changes (Nick Johnson)
878ab924d1 Add HMAC Extract-and-Expand Key Derivation Function (Nick Johnson)
Pull request description:
rustaceanrob and I have been working on a Rust-based BIP324 implementation over at https://github.com/rustaceanrob/bip324. We have been attempting to keep the code pretty clean in hopes of a future "soft landing" in rust-bitcoin. I figured the HKDF implementation is a small, self-contained chunk that might allow us to learn the ropes here first.
There was a mention in the [discussion thread on BIP324](https://github.com/rust-bitcoin/rust-bitcoin/discussions/1691) that the hashes interface may be changing in the near future. I am not sure the effect that would have on this implementation, but happy to work through any issues.
Closes#2551
ACKs for top commit:
tcharding:
ACK c9d1ff7037
apoelstra:
ACK c9d1ff7037
Tree-SHA512: 404d51ca055db4366ec57f1503fcf350aebcd181f36a20a17763ea8c47ade851213fc882acd2785313953a3e768d588c230f737ff93f88121b97c34b37c65127
Done to try to further help new contributors and save maintainer time.
Add an example of using `just check-api` and an example `git` command
for devs to create the api patch now required for all changes to the
public API.
60ab3d26e5 CI: Remove shebang from non-executable scripts (Tobin C. Harding)
Pull request description:
Some of our CI shell scripts are meant only to be sourced and not run directly however they include an initial shebang line, implying that they should be run.
Remove the shebang line from `crates.sh` and the various `test_vars.sh` scripts. Add a `shellcheck` directive to inhibit the no-shebang warning.
Please note, the issue mentions the following in the discussion thread and it is _not_ implemented here.
> It would be good also to find a way to detect whether the script is being run directly, and to print an error message. I'm sure this is a common thing and we can find a stackexchange post telling us how to do it.
I don't see an immediate way to do this because CI is run using `run_task.sh` which is not in this repo. And since one can still run a script without the shebang (by doing eg, `bash script.sh`) the lack of shebang is only an indicator of how we are using the script.
Fix: #2764
ACKs for top commit:
apoelstra:
ACK 60ab3d26e5
Tree-SHA512: fe829226fb50e88bb84a2bbe324fbf977b7d5abc3637e9b7f8148e74a45a995b526bbe8c7263d903fd03f4563cdf95887433daa76f81faa7cd88d830bf6e0205
Some of our CI shell scripts are meant only to be sourced and not
run directly however they include an initial shebang line, implying that
they should be run.
Remove the shebang line from `crates.sh` and the various `test_vars.sh`
scripts. Add a `shellcheck` directive to inhibit the no-shebang warning.
Fix: #2764
BIP324's peer to peer encryption protocol requires an HMAC-based extract
and expand key derivation function (HKDF). HKDFs were not part of many
bitcoin protocols before BIP324, but the hope is that the encrypted
protocol becomes the dominant standard justifying this implementation.
4137c5c7a2 Automated update to Github CI to rustc nightly-2024-05-29 (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 4137c5c7a2
Tree-SHA512: 022339e41f69f1d8518cd8902fbe3fab329df8564366d2ea8d4fe47337693ca7a344d1d799aa8db1235bc45e87c6f70f172efbd75b80a7a3ad79293b8e0fe4e5
eb723740f1 api: Run just check-api (Tobin C. Harding)
853026071f bitcoin: Use new BlockHeight and BlockInterval types (Tobin C. Harding)
1173f3fbff units: Add BlockHeight and BlockInterval types (Tobin C. Harding)
Pull request description:
Add two simple integer wrapper types for abstracting over block height (from genesis block) and block interval.
This does not include hex because block height is typically written in decimal.
These types are very thin wrappers, their usecase is to assist in code readability instead of enforcing any logic.
Based on discussion in #2533Close: #2532
ACKs for top commit:
apoelstra:
ACK eb723740f1
Tree-SHA512: e6ae637461a813022e5236622143c658ac731730cb568c14c90cb358ed40452609d0e815ea99619ad7a2ea36f8dd053094b55f09b267e9a7cf5bab73cd3f81c8
We just added to now types that are thin wrappers around `u32`s for
block heights and intervals.
Add `Encodable` and `Decodable` impls and use the new types. While we
are at it re-export the types from the crate root so users don't have to
dig into the `units` crate.
Add two simple integer wrapper types for abstracting over block
height (from genesis block) and block interval.
This does not include hex because block height is typically written in
decimal.
These types are very thin wrappers, their usecase is to assist in code
readability instead of enforcing any logic.
18d298ab4f api: Run just check-api (Tobin C. Harding)
Pull request description:
During a bunch of merges the api/ files have gotten out of sync.
Run just check-api, no other changes.
ACKs for top commit:
apoelstra:
ACK 18d298ab4f
Tree-SHA512: 44d8f691e0ef919b851c43e19ffa28c48598163be056ef95498b5b868a57f83a274e6b69b5172417ac8ef61d56b4d16ed99a91b4e9b5bb9261750afeda301cfa
9e4b092fce psbt: Use macro instead of function (Tobin C. Harding)
Pull request description:
We have a private function that makes use of the `Hash` trait to generically hash map entries. This usage makes patching the `hashes` module difficult. We can achieve the same thing by using a macro and passing in the concrete type.
This is an internal change, no effect on logic or public API.
ACKs for top commit:
apoelstra:
ACK 9e4b092fce
Tree-SHA512: 8b788fa91d21bbae556c746c2e55e6e9395e022bedf13193555ef7482109b6ef5032b233c5f37543a31ebda49d9b4761c161ca0db501472047eb661a48e944b7
6ba7758b30 Improve array macros (Tobin C. Harding)
Pull request description:
Currently we have two macros used when creating array wrapper types, one is in `internals` and the other in `bitcoin::internal_macros`. It is not immediately obvious what is what and why there are two.
Improve the macros by:
- Move the inherent functions to `impl_array_newtype`
- Use `*_byte_array` for the names instead of `*_bytes`
- Re-name the other macro to match what it now does
ACKs for top commit:
apoelstra:
ACK 6ba7758b30
Tree-SHA512: 36ed0fae0d28f24d29287062eb05bbc1e9e8b565f4ff41fd893503a25404ed8e185a34d75e398a8a660923ffda3b832b6157011598d5a75a5c4aafdffc74af2a
d2a597c90d unit: Group re-exports (Tobin C. Harding)
d242125ae4 units: Fix error re-exports (Tobin C. Harding)
Pull request description:
First patch is the meat and potatoes, second one is just a trivial refactor to the same code, done separately so as to make the changes in the first patch more clear.
From patch 1
```
units: Fix error re-exports
Currently we re-export two error types at the crate root, this is
surprising because:
- Why not none or all the rest?
- Why these two?
Observe that the `ParseIntError` is special in that it is used by
other modules so its good to have at the crate root (other errors are
expected to be used with a module prefix eg, `amount::ParseError`).
There is no obvious reason why `ParseAmountError` is re-exported.
Comment and doc inline the `ParesIntError`, remove the re-export of
the `ParseAmountError`.
```
ACKs for top commit:
apoelstra:
ACK d2a597c90d
Tree-SHA512: 38d3f590357e66d07cbd7fedff134c39e0920e076ea99cb34ba276749a14695d428345d7b0f9ec8222f7899cb57e7c97068d3b6e7b2a9be25a0278e0a1abf762
eda61ddfef Deprecate to_vec in favour of to_bytes (Tobin C. Harding)
Pull request description:
Currently we have to method names for the same thing "copy this object into a vector". The library is easier to use if we are uniform and just use one.
Elect to use `to_bytes`, for context see discussion in PR #2585.
ACKs for top commit:
apoelstra:
ACK eda61ddfef Nice. IMO we should start deprecating stuff for two releases rather than one, so that people have a year to update.
Tree-SHA512: 0aadd1258a07bfa53806f19a3c41af8d3b1132aa42e7a2015a59c58c4309d7a9b50b86d076c181ce5870ba5acd989feec32669352ecf857ae6fd982873482c34
1282b7f34b examples: drop a couple allocations (Andrew Poelstra)
45e0241267 doc: fix "lazy line continuations" in markdown (Andrew Poelstra)
Pull request description:
Rust nightly as of 2024-05-27 has a new lint which detects list items which are continued by a non-indented line. Markdown treats these as single list items, which they sometimes are, but sometimes we intended them to be on a separate line.
Also changes the docs for `UntweakedKeypair::tap_tweak` because the existing ones were overly technical and out-of-date.
Also fixes a minor "no need to create a vec then dereference it" lint in the examples.
ACKs for top commit:
storopoli:
ACK 1282b7f34b
tcharding:
ACK 1282b7f34b
Tree-SHA512: 989c83b6bbbfbf8ddd2ade63b5f590f76810f4ec56fab432b580a40e3cc1468a0ea657dcc7ad0d4a31d49eb1390219616fec5a76b5680d5fddc3a06d81db30d7
b5ef7db3c0 api: Run just check-api (Tobin C. Harding)
1b40550ce8 Add an AddressData type (Tobin C. Harding)
Pull request description:
In the 0.32.0 release we removed the `address::Payload` struct because it was deemed an implementation detail. As a byproduct of doing so we made it impossible for users to match on an enum and get the address payload (or data).
- Add a public `AddressData` enum that holds an address' encoded data.
- Add a conversion function to `Address` that returns the data enum.
This patch is additive and is expected to be backported and release as a `0.32` point release.
ACKs for top commit:
apoelstra:
ACK b5ef7db3c0 I still feel a little partial to calling the struct "DecodedAddress" and the method "decode"...but this is good, and I do not want to bikeshed
Tree-SHA512: d97836bb2d7fc0f6e9fbba2afb30eeefefc88e7105d4765a146dd444c8397dd4d1ef4fd3e3eb925589294d46bfc8a66d33797a05dbc2131923534364424c135c
Rust nightly as of 2024-05-27 has a new lint which detects list items
which are continued by a non-indented line. Markdown treats these as
single list items, which they sometimes are, but sometimes we intended
them to be on a separate line.
Also changes the docs for `UntweakedKeypair::tap_tweak` because the
existing ones were overly technical and out-of-date.