1cb24c1f15 hashes:: Polish crate level rustdocs (Tobin C. Harding)
98691186dc hashes: Move engine functions (Tobin C. Harding)
12f261c009 hashes: Re-order from_byte_array (Tobin C. Harding)
c11587d60d hashes: Rename hash_type macro (Tobin C. Harding)
62617cf9ac hashes: Move from_engine function to other macro (Tobin C. Harding)
bb7dd2c479 hashes: Move DISPLAY_BACKWARD to top of impl block (Tobin C. Harding)
71013afe07 hashes: Put attribute under doc (Tobin C. Harding)
Pull request description:
`hashes 1.0.0` can't be far away, here is a quick polish (done while I waited for my car to get fixed).
Everything here is internal except stuff to docs. Note please I claim "internal change only" in a bunch of patches that do code moves but these effect the docs build because order is preserved in some instances.
ACKs for top commit:
apoelstra:
ACK 1cb24c1f150bc2d65d0be439f2005f41d95ad23c; successfully ran local tests
Tree-SHA512: 430c451afab8fc92fb4596bf2d4b36c086333fe72b3fe5858925b75597641b8c4f5e49f7643888fa19b675d3070ce9a3606623cd56bdba6cfc59e459fbdda440
e7d326f071 Seal extension traits (Tobin C. Harding)
Pull request description:
The extension traits are temporary just while we try to stabalize `primitives`, they are not intended to be implemented by downstream.
Seal the extension traits so that downstream crates cannot implement them.
Fix: #3231
ACKs for top commit:
apoelstra:
ACK e7d326f071a368389f087ddb10ee9bbf3552c33a; successfully ran local tests; thanks! I know this is tedious and annoying
Tree-SHA512: 365979aeabb7941b9c8fa526f71aaadae3ab1cdd6a39e992c5eea2c1057b4b7c2b3a846ffd96a7eab47b9ad4e3e4de4fb141c24c62747e5cee45c74f52f9a172
4a8e2c3704 Add tests for sequence (Shing Him Ng)
Pull request description:
Add a few unit tests for Sequence
ACKs for top commit:
apoelstra:
ACK 4a8e2c3704 successfully ran local tests; sure
tcharding:
ACK 4a8e2c3704
Tree-SHA512: fb793a6a94a9d3f1522357f98a73a87618ba70776875b3ce051631970ca6c15998401dece47e426f7040770b8d24ee1b72f206d3164b7ca76492e12e86116677
1d2cfb036c Make `Amount::to_sat` and `SignedAmount::to_sat` const (Casey Rodarmor)
Pull request description:
Fixes#3491.
ACKs for top commit:
tcharding:
ACK 1d2cfb036c
apoelstra:
ACK 1d2cfb036cff1088420e42a817b4a672e65e5d4b; successfully ran local tests
Tree-SHA512: fc88202176afefb7ff75ad362cb9f139523db0a3d57821e5078af9fead9276b36fa7c915f197c45d4097c73e6bac6a1e72c012007ba9789d92a5514ab1d30f32
The extension traits are temporary just while we try to stabalize
`primitives`, they are not intended to be implemented by downstream.
Seal the extension traits so that downstream crates cannot implement
them.
Fix: #3231
8fffdc8a52 Automated update to Github CI to cargo-semver-checks version-0.36.0 (Update cargo-semver-checks 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 8fffdc8a52
Tree-SHA512: 9f9056c0efdd68a58fc5a2e96628e9327820868a880a2126c98a17ece9858064dc176b565325cfc4daa29f11dc1911c929eb92ebd2768115706be278c0d4540a
c1eccfde25 Move Witness to primitives (Tobin C. Harding)
6ce76cd7c8 Add unstable constructor to Witness (Tobin C. Harding)
Pull request description:
Patch 1 introduces a new policy to the codebase, we use `foo__unstable` for public unstable functions and there are zero semver guarantees if you call these functions.
Patch 2 does the move.
Close#3406
ACKs for top commit:
apoelstra:
ACK c1eccfde25fd4c2b19e7ec6759352b46ac246113; successfully ran local tests
Tree-SHA512: 2388066be2b6bb2cf3d6757c8f6334beeda6115ef1ce7c537955d32aa5e466add5162d0d2adee27f416fe622fc93c4e94bd848326463ee55e08d1c0f4e03719c
9d9a2d53e1 refactor: compute recid in a single line (ChrisCho-H)
Pull request description:
Just miscellaneous change that doesn't affect any but simpler and cleaner code.
ACKs for top commit:
apoelstra:
ACK 9d9a2d53e13d5de08440349e97b2eb393e7833dc; successfully ran local tests; will one-ACK merge; this seems like a clear improvement
Tree-SHA512: e90ccaad8878fdc0eeeced687f8734ad13d228a235d09be30021f7e967769ca11a4418f75e0d04b4a78aef19b37b658408f32ca6c11105252070af3a0f63709d
Move the `Witness` over to `primitives` leaving behind any method that
takes or returns a `Script` or a signature.
Includes addition of a feature gate to unit test.
In preparation for moving the `Witness` to `primitives` we need a way to
construct the `Witness` when decoding. In order to maintain the current
performance and not introduce additional allocations we need to be able
to construct a `Witness` from the content buffer, this leaks the
implementation details of `Witness`.
Add a clearly marked unstable constructor to create a `Witness` from
parts. This introduces the concept of `foo__unstable` function names;
add a section to the README describing unstable functions and semver
guarantees.
f37b573290 bitcoin: Set version to 0.33.0-alpha (Tobin C. Harding)
Pull request description:
We would like to create branches in other repos/crates that track master in this repo for testing purposes. In order to do so we need a non-0.32 version otherwise `cargo` pulls from crates.io.
Set the version to `0.33.0-alpha` - try not to get too excited, this release is a looong way away.
ACKs for top commit:
apoelstra:
ACK f37b5732901133eff0b8b11744f743c71533c240; successfully ran local tests; though I think if you try you can make cargo behave better
Tree-SHA512: 08d9f6e658ac575e4d42681ffe3fff2116ee35e31c1150b0f21228cb5ef9fc326ea604a9cfc56378a7da60815c2e6e9add4dd4d96969fea2dda2005d1c9af34f
ff64fa3c46 Move block::Header to primitives (Tobin C. Harding)
65925117a0 Manually implement block::Header::block_hash (Tobin C. Harding)
b02ab25342 Add regression test for block_hash function (Tobin C. Harding)
5614694b69 block: Remove wildcard re-export (Tobin C. Harding)
Pull request description:
- Patch 1: Trivial preparation.
- Patch 2 and 3: Reduce the API surface in a disappointing way due to the orphan rule.
- Patch 4: Do the move.
ACKs for top commit:
apoelstra:
ACK ff64fa3c46 successfully ran local tests; nice!
Tree-SHA512: 8d93de4a12c9f71f9dfbdc023fd8defb78f7d3da995490af8f83a927c2ca6338dd236bc08691311dc7345183fb6d0be61eedce3e4424d4060be2de934facd60a
88a35c8918 test: add test for new sign fn (Chris Hyunhum Cho)
Pull request description:
Follow up https://github.com/rust-bitcoin/rust-bitcoin/pull/3456.
add test to verify the signature generated from newly added `sign` fn.
ACKs for top commit:
apoelstra:
ACK 88a35c8918f48e72f032b73a233a016a1a0056b6; successfully ran local tests; sorry, testing local CI changes..
tcharding:
ACK 88a35c8918
Tree-SHA512: 8c457fbabf1ff86a9369934564874e78660f706714465731c185da16eff5c88a5e680c4373effbcc273394a5653edde9f559558917fee6e438b79bfee6f63b22
a5f5c795f5 Add the ChaCha20Poly1305 AEAD crate (Nick Johnson)
Pull request description:
Hopefully this isn't a little too (or grossly) ambitious, but figured I'd open a PR for feedback and guidance.
BIP324 depends on the ChaCha20 stream cipher and the Poly1305 authenticator. We coded these up for our [BIP324 library](https://github.com/rust-bitcoin/bip324/tree/main/protocol/src/chacha20poly1305) (this is mostly copy/paste from there), but I believe we want these lower-level protocols to live in rust-bitcoin. This follows with how Core has its implementation and also lets others in the ecosystem depend on it. For example, the Payjoin project is looking to specifically use this AEAD algorithm.
While I don't believe this is a case of "rolling your own crypto" since the intention was to match the RFCs, and all test vectors are coded up and passing, I'll admit to being a bit naive on next steps. I tossed this into `hashes` just going with the momentum following the HKDF code that went in first.
## SIMD
This patch was originally just a copy/pasta from our BIP324 library, but modifications have been made to give compilers the best shot at leveraging SIMD instructions. This includes the new `U32x4` type and updates to the cipher's `chacha_block` and `quarter_round` functions to make them easier on the compiler to vector-ize.
Analyzing the assembly produced with the `opt-level=3` and `target-cpu=native` flags shows that the code is about as good as the LDK version, but extensive benchmarks have not been run. With a recent `rustc` version the quarter_round function is fully vector-ized. The project's MSRV `1.63.0` version is also able to vector-ize some parts of the cipher, but not as well as the tested `1.80.1` version.
More of the digging and raw asm output can be found in this [report](https://hackmd.io/@yonson/B1Ot7P0j0).
ACKs for top commit:
apoelstra:
ACK a5f5c795f5e7861d584fc325dcb01dd7d6966494; successfully ran local tests
Tree-SHA512: 692ce27d93f19fccea5a6d322a3eef5f12ed014a80e06738734a5e19fd354044f846718209ca1ed283aab8102f72d1da909315db335e5cf0d6bf58a4a0ba9c78
We would like to create branches in other repos/crates that track master
in this repo for testing purposes. In order to do so we need a non-0.32
version otherwise `cargo` pulls from crates.io.
Set the version to `0.33.0-alpha` - try not to get too excited, this
release is a looong way away.
10148adc31 contributing: Add section about release versions and deprecation (Steven Roose)
Pull request description:
Picked up Steven's PR #2137 and corrected `NEXT_RELEASE` to `TBD`.
ACKs for top commit:
tcharding:
ACK 10148adc31
apoelstra:
ACK 10148adc31 successfully ran local tests
storopoli:
ACK 10148adc31
Tree-SHA512: 891d2ac4accf0667570c90d528b11a16d6d8e77068a1260b0974b0eeec142b6a2d21973278d7a280fa2efbc137f458584d7e0e02ccb357cc33352afa660a6307
f2564b86d0 Make changelogs more discoverable (Steven Roose)
Pull request description:
Add links to the README and also add a workspace root dummy CHANGELOG file with the same links.
This is Steven's patch from #3169 shepherded in by me.
ACKs for top commit:
apoelstra:
ACK f2564b86d0 successfully ran local tests; will one-ACK merge
storopoli:
ACK f2564b86d0
Tree-SHA512: c4210903cd2b98152424beee2c730acd58cc1297c7a2df9369c087d3466fdd1f90ba1a176a88cc8c896bb3760221dfbea0d27dfe2258c066debdb31941d3f9cb
49914c50f4 Remove `allow_unused` flag in serde (Jamil Lambert, PhD)
Pull request description:
In serde `#[allow(unused_variables)]` has been dropped and the unused variables have been "used" when `debug_assertions` is off.
Close#3332
ACKs for top commit:
tcharding:
ACK 49914c50f4
apoelstra:
ACK 49914c50f4 successfully ran local tests
Tree-SHA512: c83703f91abb5ce513f6403375ce3b2cb24d5200272c98f0a5e532fe41dda1aae8a5334ee8868751e156457f1cfe6b4fe08849fb5329bfbb1c12ed18364e0b1c
88b53a471e Unify deprecated note field format (Jamil Lambert, PhD)
Pull request description:
Following the suggestion in Issue #3306 all the deprecated note fields have been changed to be lower case and in the format "use `abc` instead".
ACKs for top commit:
tcharding:
ACK 88b53a471e
apoelstra:
ACK 88b53a471e successfully ran local tests
Tree-SHA512: 5c20eda7140f37ce78eb58dfdf03ecc11a67fcb10f294d860e81eaaee696e3a4209516017a9885cef9bfff1aa69b845534d139578b674933770fa24d59e4275f
The `sha256t` module is unique in that it implements its methods
manually (as call throughs) instead of using the macros. To make it more
clear what is implemented re-order the engine constructor and getter to
better mirror the layout in the macros.
Internal change only.
The `hashes` crate has a bunch of similar types defined by a bunch of
similar macros and impl blocks, all of which makes it difficult to tell
exactly what is implemented where. In an effort to make the code easier
to read order the `from_byte_array` constructor in the same place across
the crate. Note also we typically put constructors up the top, also
`from_byte_array` is the likely most used constructor so put it first.
FWIW I discovered this while polishing the HTML docs.
Internal change only.
Conceptually (and using traits) we split the hashes into "general"
hash types and more restricted hash types (`Hash`). Also we observe that
the `hash_type` macro defines all the inherent functions name
identically to the `GeneralHash` trait methods.
Rename the trait to describe better what it does.
Internal change only.
The `from_engine` function is associated with a general hash type but we
are defining it in the `hash_type` macro which holds nothing but
functions associated with the `Hash` trait. By "associated" I mean
methods on the type as opposed to trait methods.
In preparation for re-naming the `hash_type` macro move the
`from_engine` function there. Requires duplicating the code in the
`siphash` impl block, this is as expected because the `siphash` requires
a custom implementation of the general hashing functionality.
Internal change only.
8696cb4b07 Fix unused import warning (Jamil Lambert, PhD)
fbc7aa7fd5 Remove unnecessary lifetimes (Jamil Lambert, PhD)
Pull request description:
New lint warnings from a recent nightly toolchain show some explicit lifetimes that can be omitted.
The unnecessary lifetimes have been removed.
An unused import warning has also been fixed by placing the use statement behind the relevant feature gate.
ACKs for top commit:
tcharding:
ACK 8696cb4b07
apoelstra:
ACK 8696cb4b07 successfully ran local tests
Tree-SHA512: 37e14ca9be2e8cfa64498084a7363783c2cca92dfce40a0a3ed9bda98f081c1fa9119e5d49d81684b6968329945c7004b86534412fd2fcd4898b862c859d42c6
2f656f77ba psbt: Use u64 for key type (Tobin C. Harding)
Pull request description:
Currently we use `u8` for key type but it was pointed out that we should be using a `u64` and encoding it as a compact type. The reason our code works now is because the compact type encoding for a `u8` (less than
This breaks the `serde` impl, as shown by changes to the regression tests,
Fix: #2891
ACKs for top commit:
apoelstra:
ACK 2f656f77ba successfully ran local tests
Tree-SHA512: ce5fe46b54cb724a0b0f9f874c037e5b5d344e5d3c380f9cdb3fdb5cbc5e31e4e32c229f5f2f72547823238934f6b0c3640c2c2ce79d98aa57bac509d130cb82
adf2fa3113 Update lock files and downgrade minimum arbitrary (Tobin C. Harding)
Pull request description:
Recently we added a use of `Arbitrary` for `[u8; 64]` (schnorr sig). I hit a build failure locally and discovered that
- `arbitrary 1.0.0` does not implement `Arbitrary` for 64 byte array
- We use `arbitrary = 1` in the `bitcoin` manifest
- We have `arbitrary 1.3.2` in the `Cargo-minimal.lock` file
Fix this all up by doing:
- Use `1.0.1` in the `bitcoin` manifest because that is a hard minimum version required to build
- Downgrade the `Cargo-minimal.lock` file to use `arbitrary v1.0.1`
- Upgrade the `Cargo-recent.lock` file while we are at it for good measure.
ACKs for top commit:
shinghim:
ACK adf2fa3113
apoelstra:
ACK adf2fa3113 successfully ran local tests
Tree-SHA512: 7be48d2086523322ca4b5f83a344d5096c46cfaff6bd2deb829d30b439feb045ba86b51e9ab2eac4ad5693b0f54a56ca4b86aadafc17a7e4a15cda4a349d0b18
4d18624435 Update CHANGELOG files (Tobin C. Harding)
Pull request description:
When we create point releases we merge the release tracking PR directly into the version branch, including the changelog entries. This means the changes never end up on `master`. We need to make a mental note to patch `master` anytime we merge a point release PR.
Audit all crates with a non-zero current point release and check we have the changelog entries on `master`.
ACKs for top commit:
apoelstra:
ACK 4d18624435 successfully ran local tests
Tree-SHA512: 826a5e5a565237d4f499dd56471b01ee7970b04125931f5a49355099507e24ae4452108004276939884e338201dd3ae7b66fd68439523b6bb1b07b83d3759ae4
Add links to the README and also add a workspace root dummy CHANGELOG
file with the same links.
This is Steven's patch from #3169 shepherded in by me.
Co-developed-by: Steven Roose <steven@stevenroose.org>
e68da281ff Warn on future deprecations (Tobin C. Harding)
2cc944578d Fully deprecate Hash::from_slice (Tobin C. Harding)
8bc3b2e2c4 Stop using deprecated to_vec (Tobin C. Harding)
Pull request description:
This is a bit curly because of current `serde` logic, fixed in patch 4. All the other patches are trivial.
ACKs for top commit:
apoelstra:
ACK e68da281ff successfully ran local tests
Tree-SHA512: f78b3f91923e3278bdec09c321c57f2c25fc92a6e2a3daa8acd60dc1f454dfc5f092424fee113e4e03ac01d80d27a959f346068ecad7bc7894ebb15d98228a40
We want to move the `block_hash` function to `primitives` but it uses
`Encodable` which currently lives in `bitcoin`. Just implement it
manually.
We added a regression test already in a previous commit to check that
this is correct.