afd19ebd61 Use super for imports in script module (Tobin C. Harding)
Pull request description:
In the `script` module we currently import `script` types using the fully qualified path, as recently discussed code is easier to maintain if we use `super` when `super != crate`.
Internal change only, no external changes.
ACKs for top commit:
Kixunil:
ACK afd19ebd61
apoelstra:
ACK afd19ebd61
Tree-SHA512: 5d8546de3d8d9014054fb53020ec0d742eb9698d6d70cd0b2e722b5e43792f4d1ad480d1c61d67b10ddda6a5ef42839118f0de0332251bd64cf31f0a566fd40b
f8c91b067b ci: move semver-checks to its own job (Jose Storopoli)
Pull request description:
This is necessary because it needs to run only on pull_request, and not on push events.
Closes#2968.
ACKs for top commit:
apoelstra:
ACK f8c91b067b
tcharding:
ACK f8c91b067b
Kixunil:
ACK f8c91b067b
Tree-SHA512: 31b8817c2cc6aaf4902666140fba51ae1b2f54cc8843eacbe2782dbfca526023c536064351e08b58e5e1d999eb08937a39f619a36e3d9107fd688dea313638d2
6dd5af9678 Add missing links (Jamil Lambert, PhD)
47e367f011 Standardize error headings (Jamil Lambert, PhD)
75f317a689 Fix rustdoc grammar (Jamil Lambert, PhD)
573f8ce724 Add backticks to rustdoc links (Jamil Lambert, PhD)
Pull request description:
The rustdocs in the `units` crate has been reviewed and improved.
Some of the links were missing backticks, these have been added.
Some grammatical changes have been made to improve the documentation.
The use of links was inconsistent and has been changed to have links everywhere that seemed appropriate.
A couple of error headings were added and a description as to why a capital M is not accepted in the denomination for MegaSatoshi or MegaBitcoin.
ACKs for top commit:
apoelstra:
ACK 6dd5af9678
tcharding:
ACK 6dd5af9678
Tree-SHA512: f5481a7c3aa99d7882cda9ccda9df9e27f092ff91ef584f07dc887f38bfe12e5ea801cfa7f42bb4022301860489ee6be55557752a8cbe70932f258ea753495dc
Move the `opcodes` module to the new `primitives` crate. This is pretty
straight forward, some things to note:
- Are we ok with the public wildcard re-export from `blockdata`? I think
so because the whole `blockdata` module should, IMO, be deleted after
everything in it is moved to `primitives`.
- `decode_pushnum` becomes public.
Includes addition of a `patch` section for `primitives` in the
`bitcoin/embedded` crate.
In the `script` module we currently import `script` types using the
fully qualified path, as recently discussed code is easier to maintain
if we use `super` when `super != crate`.
Internal change only, no external changes.
f5dcbc1723 Automated update to Github CI to rustc nightly-2024-07-07 (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 f5dcbc1723
Tree-SHA512: 094407c926fa79fe22d26253296076c80b58240e62de5921f5ed4aee67177d3fb3711f0d40c2bd422b834a88df62ab4e9442165c2826ad1f787ad2d3fb23b2a4
Currently we are using a type alias for the `hash160::HashEngine`.
Type alias' allow for potential mixing of types, a `hash160::HashEngine`
struct can better serve our users with not much additional complexity or
maintenance burden.
As we did for the `sha256d::HashEngine`, add a new wrapper type
`hash160::HashEngine` that replaces the current type alias.
Currently we are using a type alias for the `sha256d::HashEngine`.
Type alias' allow for potential mixing of types, a `sha256d::HashEngine`
struct can better serve our users with not much additional complexity or
maintenance burden.
Add a new trait `TxIdentifier` that abstracts over the `Txid` and
`Wtxid` types. We make `AsRef` a super trait so that the new trait needs
no methods.
Seal the trait so consumers of the library cannot implement it.
Use the new trait in:
- the `bip152` module to tighten up the `with_siphash_keys` function
- as a trait bound on the `Leaf` associated type in the `MerkleNode` trait
837f466f72 bip152: check if indexes do not overflow (Bruno Garcia)
Pull request description:
When deserializing a `HeaderAndShortIds` we could check if the number of txs does not overflow 16 bits. If so, throw an error.
ACKs for top commit:
apoelstra:
ACK 837f466f72
Kixunil:
ACK 837f466f72
Tree-SHA512: 21797689758ae22666289cde123e3e9ae1bdb1ab2f85a1cd0f07ee8fa2a441e7b1b928f30b8fb1f65aef0c526c899eb96b83ed4fff074e70b31e0afad2c35930
During review of #2889 it was noted that we don't need to enable the
`derive` feature of `serde` in the `test-serde` feature.
Do not enable `derive` in the `test-serde` feature.
7fa53440dc Move serde_round_trip macro to internals (Tobin C. Harding)
Pull request description:
We currently duplicate the serde_round_trip macro in `units` and `bitcoin`, this is unnecessary since it is a private test macro we can just throw it in `internals`.
While we are at it lets improve the macro by testing a binary encoding also, elect to use the `bincode` crate because we already have it in our dependency graph.
Add `test-serde` feature to `internals` to feature gate the macro and its usage (preventing the transient dependency on `bincode` and `serde_json`).
ACKs for top commit:
Kixunil:
ACK 7fa53440dc
apoelstra:
ACK 7fa53440dc
Tree-SHA512: f40c78bf2539940b7836ed413d5fe96ce4e9ce59bad7b3f86d831971320d1c2effcd23d0da5c785d6c372a2c6962bf720080ec4351248fbbdc0f2cfb4ffd602c
58a43b309e Add missing ref keyword (Jamil Lambert, PhD)
Pull request description:
One item in the match statement was missing the `ref` keyword. This has been added.
ACKs for top commit:
apoelstra:
ACK 58a43b309e I think the noise is fine; this is an easy one-ack merge and should not cause rebasing pain for anybody
Tree-SHA512: 6ef383fba4a1836e0f904889086d8494a82bd01c407d738360d15cd31742ff6979e1aa406f20b27f47060f8d8e96015c20cce1834948d9ef786731ad7e7f8ce6
The use of links in the rustdocs was inconsistent.
Links have been added when missing.
[`locktime::absolute::Height`] and [`locktime::relative::Height`] did
not work and `(crate::locktime)` was appended to fix it.
Created headings for a couple of function error descriptions to be
consistent with the rest of the crate.
Added a description explaining why Mega is not allowed in a
denomination.
4bb9240992 bitcoin: Add comment to manifest (Tobin C. Harding)
c6c70a721e bitcoin: Update feature docs (Tobin C. Harding)
7712e5d891 bitcoin: Use 100 colum width in crate level docs (Tobin C. Harding)
Pull request description:
Update stale crate level docs in `bitcoin`. Done as two separate patches so the last one is trivial to review, whitespace only.
ACKs for top commit:
Kixunil:
ACK 4bb9240992
apoelstra:
ACK 4bb9240992
Tree-SHA512: b9d5474f7e7a0576f535df428ea20084acbcb74d0576e7f2934c547dd2c54f4a939d73ec547b3b254105a45c2372113c65ce136be1eabd63701259a3a6de3737
We currently duplicate the serde_round_trip macro in `units` and
`bitcoin`, this is unnecessary since it is a private test macro we can
just throw it in `internals`.
While we are at it lets improve the macro by testing a binary encoding
also, elect to use the `bincode` crate because we already have it in
our dependency graph.
Add `test-serde` feature to `internals` to feature gate the macro and
its usage (preventing the transient dependency on `bincode` and
`serde_json`).
830ebfe95e Automated update to Github CI to rustc nightly-2024-07-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 830ebfe95e
Tree-SHA512: b0458197d37697208ee856d774ba9f41da948545b334f64974383df832cc247f96287fdeef1e54f0f2091b8ef72b4e98f800900a10a5e254381c26e29c30d6cd
d07550d86d just: add just docsrs (Jose Storopoli)
Pull request description:
Adds `just docsrs` which takes [variadic arguments](https://just.systems/man/en/chapter_41.html?highlight=zero%20or#recipe-parameters) (zero or more after the command).
Kixunil this allows for `just docsrs` and `just docsrs --open`.
Closes#2965.
Using the command from `rust-bitcoin-maintainer-tools`: 3494ceec52/ci/run_task.sh (L277)
ACKs for top commit:
jamillambert:
ACK d07550d86d
Kixunil:
ACK d07550d86d
apoelstra:
ACK d07550d86d
Tree-SHA512: dfc8a91bf9d572cb0cb460102f051aabe026fde2852ef2c82e962f0c60d8532628aa15bb99590a6140871d5539cdd9e5c6f80d0684fc128031f1c930e66e99ff
dfce405007 Remove nonsense method (yancy)
Pull request description:
Weight type implicitly includes witness scale factor
closes https://github.com/rust-bitcoin/rust-bitcoin/issues/2963
ACKs for top commit:
Kixunil:
ACK dfce405007
apoelstra:
ACK dfce405007 agreed about CI, we are very close to removing it
Tree-SHA512: 1c30c61863dd9c2ce5b6524931a21f99825edfd7401b833581194792c622030a4aa6b9c0f9680f97a8ae901604314805efa77e6fe1e8c15b356ddfea99ffe90c
eeae225cfc ci: add cargo-semver-checks (Jose Storopoli)
d9567b097f ci: remove check-api (Jose Storopoli)
Pull request description:
- Removes `check-api` (`cargo-public-api`)
- Adds `cargo-semver-checks`
## Note to Reviewers
There is a new script `contrib/check-semver.sh` that checks for semver breaks against `master`.
If it detects a breaking change it will create the `.semver-break` file.
If this file exists then we will add an `API break` label and a big comment to the PR saying:
> 🚨 API BREAKING CHANGE DETECTED
It reproduces the current behavior of `cargo-public-api`:
- `bitcoin`:
- `all-features`
- `no-default-features`
- `base58ck`:
- `all-features`
- `no-default-features`
- `bitcoin_hashes`:
- `no-default-features`
- `features alloc`
- `bitcoin-units`:
- `no-default-features`
- `features alloc`
- `bitcoin-io`:
- `no-default-features`
- `features alloc`
Closes#1875.
Supersedes #2912.
## Context
Our current test to check API breaks using `cargo public-api` is not "automated" per se.
It needs contributors to keep tabs on text files with function signatures and other things and forces reviewers to be the _de facto_ API break detector tool.
The idea is to use the well-acclaimed and maintained `cargo semver-checks` that will do this automatically in CI.
ACKs for top commit:
Kixunil:
ACK eeae225cfc
tcharding:
ACK eeae225cfc
Tree-SHA512: a77d64b4ca6500b80e6f98f9735d17193f8eaa9998e38602f46418f4b9f3b391ffe9b06bfe8e0285fc4350e8214ebd203034693bac858bac31b7d722903933ae
The `bitcoin` crate documents its features in the crate level rustdocs,
currently they are stale.
Update and improve the feature docs section of crate level docs.
6d3137ed87 bip158: Hash data instead of copying first (Tobin C. Harding)
Pull request description:
Currently we copy data into a new buffer before passing it into the hasher, we can just hash the data directly.
Internal change only, no external change.
Fix: #2917
ACKs for top commit:
Kixunil:
ACK 6d3137ed87
apoelstra:
ACK 6d3137ed87
Tree-SHA512: ff5bd18feffe1e77494b0cd14713bc55f1111f026d05bfa58a679f609fdba70160ab9df7677f0790b5b269878226c2f16164be2c918e1ad8b77e2c23d72889dd
65e9ad2fea Introduce empty primitives crate (Tobin C. Harding)
Pull request description:
Introduce an empty `bitcoin-primitives` crate.
We were give the name on crates.io and previously a version `v0.1.16-alpha` was released so we use `v0.100.0`.
Does not include adding api files since that whole thing is in flux. This is an even smaller step than #2908 that does not include dependencies.
ACKs for top commit:
Kixunil:
ACK 65e9ad2fea
apoelstra:
ACK 65e9ad2fea
Tree-SHA512: e8664a5b697281b188345623783f3d92f625e7b42f497bd0c64e9117ac2eb42286071757b04ff92415fbb37ef53dbb7a395717785a941b69bee0f0e2a611c9c3
3196c271ac Deprecate `Amount::fmt_value_in` (Martin Habovstiak)
467546fc0c Round `Amount` when requested precision is too low (Martin Habovstiak)
7c95a777c1 Fix `Amount` decimals handling (Martin Habovstiak)
Pull request description:
Displaying with minimal number of zeros is the default in Rust and we want to follow it. This was originally implemented in #716 but #2604 reversed it claiming this is common, however it broke people who rely on minimal display (e.g. BIP21) without fixing the root cause of #2136.
This reverts commit d887423efc adds a test to prevent this change and also fixes the problem with `{:0.8}` not working.
Closes#2136Closes#2948
Can we backport this one too?
ACKs for top commit:
tcharding:
ACK 3196c271ac
apoelstra:
ACK 3196c271ac I also really like how this reduces the complexity of the module, basically passing everything through to `display_in`
Tree-SHA512: 3221f83086ac55af3d4caad03fe2b619be303533bba12096040419d119600c8597938809e171662f11b515d469156b083b2072b901d445e4fdfc7b1062cf7b6a
Currently we copy data into a new buffer before passing it into the
hasher, we can just hash the data directly.
Internal change only, no external change.
Fix: #2917
4576f4ba69 Remove fuzz rust version (yancy)
Pull request description:
Fuzz is not compatible with the workspace MSRV.
Closes https://github.com/rust-bitcoin/rust-bitcoin/issues/2923
ACKs for top commit:
tcharding:
ACK 4576f4ba69
apoelstra:
ACK 4576f4ba69
Kixunil:
ACK 4576f4ba69
Tree-SHA512: 3b350e1f22a585719eb272de41b6a2b7a83a8d7810df8d98c4ecc06cf391ec3c3582934abc05d53bbdbe4ae4165fead9df2abf6f5aa84a74c1c0a7a7569eac6c
60aa4acc5f Update README instructions for running MSRV (yancy)
Pull request description:
The file mentioned in the README for running MSRV no longer exists
closes https://github.com/rust-bitcoin/rust-bitcoin/issues/2934
ACKs for top commit:
tcharding:
ACK 60aa4acc5f
apoelstra:
ACK 60aa4acc5f Definite improvement. Unfortunately will not work for downstream users but currently we do not have a solution for them I think
Kixunil:
ACK 60aa4acc5f
Tree-SHA512: 554b1b4d6ea8a929fb168e48b8925e20e6ee717a603a4008793376393d1ae8ba18bc290fb69747be155cd75439499500056c54e845a6fa6dc097e523b76ea54f
`fmt_value_in` was added when `display_in` wasn't available. However
common usage patterns seem to favor `display_in`. It can be used within
format strings and supports formatting options.
Removing it will simplify the codebase, so this deprecates it.
Introduce an empty `bitcoin-primitives` crate.
We were give the name on crates.io and previously a version
`v0.1.16-alpha` was released so we use `v0.100.0`.