021bea89bb ci: shellcheck checks (Jose Storopoli)
Pull request description:
Closes#2739.
I am proposing that we use this GitHub Shellcheck action:
[`ludeeus/action-shellcheck`](https://github.com/ludeeus/action-shellcheck)
since it has most stars (and eyes on it).
I also did all fixes that I could find with
```bash
shellcheck **/*.sh
```
If I've missed any please let me know.
ACKs for top commit:
apoelstra:
ACK 021bea89bb
tcharding:
ACK 021bea89bb
Tree-SHA512: 67e37da9ae3ea0c5551af57b928016a2d9e76761af5558b3057ac47e773189629dd20eea9e659b4323c8568fb48dcdbe9ebd5c730f2c6266fb0db52886c9835f
4646690521 fix clippy lint by using resize instead of push (Riccardo Casatta)
deeb160b86 remove SmallVec (Riccardo Casatta)
e4b707ba83 add bench for base58::encode_check (Riccardo Casatta)
Pull request description:
In a downstream app I've seen printing a descriptor is not a cheap operation, analyzing the flamegraph it seems base58 encoding of the xpub is the culprit

This PR adds benches for the `encode_check` function, and add the changes gaining more boost, which is also good cause it removes code.
Other attempts didn't provide enough benefit for inclusion but I report them here for knowledge.
```
## baseline
running 2 tests
test benches::bench_encode_check_50 ... bench: 8,760 ns/iter (+/- 113)
test benches::bench_encode_check_xpub ... bench: 19,982 ns/iter (+/- 109)
## remove smallvec
running 2 tests
test benches::bench_encode_check_50 ... bench: 7,935 ns/iter (+/- 129)
test benches::bench_encode_check_xpub ... bench: 18,076 ns/iter (+/- 184)
## increase smallvec to 128 (fits xpub)
test benches::bench_encode_check_50 ... bench: 8,786 ns/iter (+/- 738)
test benches::bench_encode_check_xpub ... bench: 20,006 ns/iter (+/- 2,611)
## avoid char-to-str by keeping str map
test benches::bench_encode_check_50 ... bench: 7,895 ns/iter (+/- 88)
test benches::bench_encode_check_xpub ... bench: 17,883 ns/iter (+/- 118)
```
Gains are good (~10%), but I don't think they explains the 3ms to print a descriptor in wasm env,
probably is the sha256 for the checksum is fast in cargo bench but slow in wasm env, but I didn't research on the topic.
ACKs for top commit:
apoelstra:
ACK 4646690521
tcharding:
ACK 4646690521
Tree-SHA512: 978bbe22c99bb455028d90532d59a076321e0c19105fc8335bd44cd84fbedda109083380df5c658b85121242c88d442994cfc58d141f3fc5daa66c27b1499329
6def5bc974 CI: Use run_task from maintainer tools (Tobin C. Harding)
c5af52847b CI: Add docs and document start (Tobin C. Harding)
62ba10503a CI: Use correct spacing (Tobin C. Harding)
0c0e88165e CI: Add README file (Tobin C. Harding)
44cb2255d3 CI: Add sanitizer script (Tobin C. Harding)
3407257936 CI: Add WASM script (Tobin C. Harding)
cc14edf63f CI: Run the schemars job directly using cargo (Tobin C. Harding)
1fb12e1917 CI: Remove recent from schemars job (Tobin C. Harding)
8d7117bb0e CI: Use original name (Tobin C. Harding)
Pull request description:
First we do some clean up, then we pull the stuff that is specific to this repo out into separate tests, then as the last patch we switch over to use the new script for `rust-bitcoin-maintainer-tools` that was introduced in https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools/pull/4.
ACKs for top commit:
apoelstra:
ACK 6def5bc974
Tree-SHA512: 70105d455294d49deb43461958435096d074d19ea8d9adc7036e15d74dfdab466f04b1d9e934574077ca0c32a6fe77d0e5aa11068d8c4d51acef634591227d33
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`.
Add a document start and comment to help try to stop the readme from
going stale.
This removes a `yamllint` warning.
While we are clearing lint warnings disable the one causing
warning truthy value should be one of [false, true] (truthy)
This is a know issue with GitHub actions yaml because `on` is a yaml
keyword, or something like that.
As we did for the wasm job.
In preparation for using the `run_task` script from maintainer tools we
want to have all the things that are particular to `rust-bitcoin` out of
the current `run_task` script.
The address/memory sanitizer test is specific to `hashes`. Add a script
in `hashes/contrib` and call it from the ASAN job.
No test coverage change.
In preparation for using the `run_task` script from maintainer tools we
want to have all the things that are particular to `rust-bitcoin` out of
the current `run_task` script.
The wasm test is specific to `hashes`. Add a script in `hashes/contrib`
and call it from the wasm job.
No test coverage change.
I've been a bit confused lately about pinning and the locks, at some
stage recently I changed 'Set dependencies' to 'Copy lock file'. Its no
biggy but the original that Kix wrote was correct and descriptive - it
was me who was confused. Revert it back to the original.
7685461e62 Document the sha256t_hash_newtype direction (Tobin C. Harding)
30e91cc766 Default to forward for tagged hashes (Tobin C. Harding)
5ecc69cd28 Add forward/backward unit test (Tobin C. Harding)
9aee65d1ba Refactor tagged hash tests (Tobin C. Harding)
216422dffc Remove schemars impl for test type (Tobin C. Harding)
Pull request description:
First three patches are preparation, improvements to the units tests in `sha256t`.
From the final patch:
Displaying backward is an anomaly of Bitcoin Core's early days and the
double SHA256 hash type. We should not let this unfortunate beast leak
out into other places.
Default to displaying forward when creating a new tagged hash and remove
all the explicit attributes from `bitcoin` that just clutter the code.
This is an API break and may quietly break some users downstream - eventually we should stop doing that sort of thing.
ACKs for top commit:
apoelstra:
ACK 7685461e62
Tree-SHA512: cb8a41b207aa68ecf63cb7af7f39f7d7c8a3a27f38595867949b288a81a20bff0c17aa4c17bb099e2ecf85194d83bad23c9c9792f511b6c4cd625ff27c1affaa
Since the default display direction is now forward, use
`#[hash_newtype(backward)]`
in the rustdocs on the macro. Also add an example usage to the changelog
in case someone downstream is relying on the old default behaviour of
displaying backwards (unlikely).
d094350230 hashes: Modify trait bounds (Tobin C. Harding)
Pull request description:
Currently we require indexing trait bounds as well as `Borrow` on the `Hash` trait. We also already implement `AsRef`.
It was observed that `Borrow<[u8]>` does not best describe what we want from the `Hash` trait implementor but rather `AsRef<[u8]>` does.
Remove all the inexing trait bounds. Remove the `borrow::Borrow<[u8]>` trait bound. Add a `convert::AsRef<[u8]>` trait bound.
This leaves the `Borrow<[u8]>` implementation for hashes created with `hash_newtype`, I'm not sure if this should be removed or not.
ACKs for top commit:
apoelstra:
ACK d094350230 thanks! FWIW I think we might want to return the indexing traits one day, at least `[..]`, but we can do that post-1.0 and we have not gotten any complaints after removing them from the non-HMAC hashes, so maybe people are good with it as is.
Tree-SHA512: 2704a7e850083e4eae5844c401c6ac6fe32e0939bbe6e0fb5e21faf4745f9c98634e210f522199ceacd663be60685d7f30df6c89a7787ca11ea8294d104d813e
cf19e37785 CI: Update nightly semi-weekly (Tobin C. Harding)
Pull request description:
Updating the nightly toolchain every day is overly arduous, lets just update it twice a week.
ACKs for top commit:
apoelstra:
ACK cf19e37785 CI-only, will one-ACK merge
Tree-SHA512: c827a1805efea43b945c254775cde7d3e064ccebbcca7cf0d9ca92447e54a43ec0f41d324b3e39d70ff060620ef005e867578461d1eb4b69996d2416f69f6a05
Currently we require indexing trait bounds as well as `Borrow` on the
`Hash` trait. We also already implement `AsRef`.
It was observed that `Borrow<[u8]>` does not best describe what we want
from the `Hash` trait implementor but rather `AsRef<[u8]>` does.
Remove all the inexing trait bounds. Remove the `borrow::Borrow<[u8]>`
trait bound. Add a `convert::AsRef<[u8]>` trait bound.
This leaves the `Borrow<[u8]>` implementation for hashes created with
`hash_newtype`, I'm not sure if this should be removed or not.
b705ac62e6 Automated update to Github CI to rustc nightly-2024-05-04 (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 b705ac62e6
Tree-SHA512: e43188c0ba5d5b38c7bdb192e5ade7f612e1867bb9825676412237200b54d4d4417c4f306339b745e1af08907d9f8a377bddabe52e6bce8af0925149506e6fa5
0a5d8b07a8 Automated update to Github CI to rustc nightly-2024-05-03 (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 0a5d8b07a8
Tree-SHA512: 98d9cfb0cffe94b78a5939e0967d73f3c5ab382527dd66bc4f4823d8327d1afe6bb2d779c467ed9e815bcf25d7ca7940d9799c189b355cc642db000e633ceb1f
71bb86232b hashes: Do not import str (Tobin C. Harding)
Pull request description:
Depending on things being in scope for macros to use is bad form, using the fully qualified path is the correct way.
Do not import `str` instead use the fully qualified path to the `core` re-export.
Use fully qualified path instead.
ACKs for top commit:
apoelstra:
ACK 71bb86232b trivial rebase
sanket1729:
ACK 71bb86232b
Tree-SHA512: 401520a5876b83ad4053bbe9b1e8cd9ff2e723cf86f95e47891a6411ad5e9af4f904e19ccaaab80d342dfe4745753c24af168dcbc8170fb6b39da08e577d30ae
e565e06b0c just: Add just fmt (Tobin C. Harding)
Pull request description:
We already have a `just` command to check the formatting, add one to run the formatter. Use the more terse `just fmt` although the difference from `just format` is not super obvious it is documented in the default output of `just`.
With this applied we have
```bash
$ just
Available recipes:
build # Cargo build everything.
check # Cargo check everything.
default
fmt # Run cargo fmt
format # Check the formatting
lint # Lint everything.
sane # Quick and dirty CI useful for pre-push checks.
update-lock-files # Update the recent and minimal lock files.
```
ACKs for top commit:
apoelstra:
ACK e565e06b0c
Tree-SHA512: 0e73bad93708f626bd00eabc4e2264f2f2fddb0d8cb80a4464889f14077b29ecabdf1865c9dbe3ca7b08354585e3579c515dedcd2b05f34ae863aab31382de33
69f799acc5 Automated update to Github CI to rustc nightly-2024-05-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 69f799acc5
Tree-SHA512: 0c2bedf09668db55e2dde1f5add6a53478c9479451b5d91cf95ebeaac9159840bd6d484af93af15f6035997831500c785abd227bfcbbd4cc0ff1ea292d163b96
During the recent release cycle we left `bitcoin` on the last rc
version.
Set the version number to `v0.33.0-unreleased` to make it obvious what
it is.
Close: #2724
c750be2352 fuzz: Update generate-files.sh (Tobin C. Harding)
Pull request description:
Recently we modified the fuzz job manually and forgot about the `generate-files.sh` file.
Update the script to match the current CI job, running it now produces the same file `cron-daily-fuzz.sh`.
ACKs for top commit:
storopoli:
ACK c750be2352
apoelstra:
ACK c750be2352
Tree-SHA512: 13ec222f760848d2089fd0e92460f18548c11b1dd2025ca804567eadd52e040c90c668126e63ce794023034e5606772cbe3293eae49327f0934c45cd1b7baf47
f0093c0f1c fix(typo): examples/ecdsa-psbt.rs (Jose Storopoli)
Pull request description:
"Creater" is a typo, it should be "Creator" role.
Ref: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki?plain=1#L660
ACKs for top commit:
tcharding:
ACK f0093c0f1c
apoelstra:
ACK f0093c0f1c
Tree-SHA512: ccdae4979da2044b4fdf3a0522e5cb6d64b394baadb6107d5e58096d2741458085c6ef349924bc0aa64eca69b89e394eb16fbf890c86716608ee06d287828ff2
Recently we modified the fuzz job manually and forgot about the
`generate-files.sh` file.
Update the script to match the current CI job, running it now produces
the same file `cron-daily-fuzz.sh`.
12411fc917 Fix typo in deprecated BIP-32 type (matthiasdebernardini)
Pull request description:
In #2258 we attempted to add back in deprecated BIP-32 types - but we spelled the identifier incorrectly. The patch was then backported to the `0.31.x` branch in December but was only just noticed now.
Fix typo in deprecated type from `Extendend` -> `Extended`.
ACKs for top commit:
tcharding:
ACK 12411fc917
storopoli:
ACK 12411fc917
apoelstra:
ACK 12411fc917
Tree-SHA512: f70e8fe741740f62b29932d8ee84cbe7803cb71dfb0491d251c3a982ede07ea7a32b5ecdf569d6012ee05509e8182a439b022c606a2f01742f4908089edc85a9
In PR #2258, deprecated BIP-32 types were re-added but contained a typo in the identifier: "Extendend" instead of "Extended". This commit fixes that typo.
The incorrect patch was backported to the 0.31.x branch in December but only noticed recently.
83b517fe70 Automated update to Github CI to rustc nightly-2024-04-30 (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 83b517fe70
Tree-SHA512: 093b177b391519d5fb5a1ad63984296cd3e7dc49e861735e8ce389eee23c568d981dd45196eb87973adf387deace2c670ac2c86208e92419512934b43e0a3b1b
a552e6bbb7 Automated update to Github CI to rustc nightly-2024-04-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 a552e6bbb7
Tree-SHA512: 12727e742ea59644f17bbb99e4a84196f0d25d2aa12a79e3a0d87da7fd452944d9073b5acde33e5e2c1445ea5035b757becb43241884497762464e814324078c