a68c42e113 Remove test from Transaction test names (yancy)
f796d6fef9 Use Weight type for scaled_size (yancy)
e746341f33 Add tests for scaled_size (yancy)
97b7a2dee9 Use Weight type for block base_size (yancy)
9536a9947c Add base_size test (yancy)
Pull request description:
Use Weight type for `base_size` in Transaction. Also a small re-factor to remove `test_` and `_tests` from the testname for transaction tests.
ACKs for top commit:
apoelstra:
ACK a68c42e113
tcharding:
ACK a68c42e113
Tree-SHA512: f4ab54143cbd9b1439912390f1e0857069a32b715477a4bc08692c5e32860a7090c95a92f78b118b17c1295c45a3bbdd209ba1d68c3a934341269235040e6911
de95bf52cb Use checked_sub (Tobin C. Harding)
Pull request description:
Recently we "if" guarded subtraction manually using `> 0`, we can better convey the meaning by using `checked_sub` and pattern match on the option.
Refactor only, no logic changes.
ACKs for top commit:
RCasatta:
utACK de95bf52cb
apoelstra:
ACK de95bf52cb
Tree-SHA512: 2514cc2d8af89158e5e5e5a866f3fadb4927ba07dfb4e077fd16a98acf638588bee5ce03e2dc73fbda0b5064c30d8773d3be583c03c2a5336b8738c212a9776f
In an effort to reduce review burden add so strict rules defining 3
times where we think it is acceptable for code to be merged with a
single ACK. Feels a bit like we only just added the refactor carve out
and now we are adding more carve outs, so whats next? We should take
these rules seriously, if we are to be taken seriously.
As we have recently been doing, move the declaration of the hash type to
where it is used.
Move the `XpubIdentifier` hash declaration to the `bip32` module.
This is an API breaking change.
eccd3fe57b Introduce a basic justfile (Tobin C. Harding)
Pull request description:
Introduce usage of `just` by adding a basic `justfile`.
If this goes in we can add various script invocations to it plus other useful things that often get red CI runs (eg, checking no-std).
ACKs for top commit:
RCasatta:
ACK eccd3fe57b
apoelstra:
ACK eccd3fe57b
Tree-SHA512: c10514e0ee623f366904c9103bc961a1316b199c09083180767fb9b5864e94df122c9db1a3ea084c8790f0b849e89c68b304f87247b70763fb93c28a33642d28
18e2854a42 Update base64 usage to 0.21.3 (junderw)
Pull request description:
Closes#2031
The imports are a bit bike-sheddy... but I think this is fine.
ACKs for top commit:
tcharding:
ACK 18e2854a42
apoelstra:
ACK 18e2854a42
Tree-SHA512: 5707adc2066ef33a30e81eb74ddcb938350e5853438152278767c824a45909a0b4761d036e4e5f21fccd61102c4734936b5fd570dbd87140cd3b679dc9c7eec4
A P2TR output does not need to be clarified with version 1, it is
implicit. As with p2wpkh/p2wsh and version 0.
Remove redundant version identifiers from function names, deprecating
the originals.
`T` is a generic that implements`AsRef<PushBytes>`, it should not be a
reference. This is inline with other usages of `AsRef<PushBytes>` for
example in `Builder::push_slice`.
One encodes to a writer and decodes from a reader, most of the time in
the consensus `Encodable`/`Decodable` traits we use generic `R`/`W` and
variable `r`/`w` but there are other places that use other characters.
While touching these lines note also that there are a bunch of unneeded
`mut`s, I'm not sure why since usually between the compiler and the
linter `mut` is handled correctly.
Make implementations of `Encodable` and `Decodable` uniform by:
- Use R/W and r/w for trait and variable name
- Remove unneeded mut
Done as part of the push to have small specific errors instead of large
general ones.
Split the `witness_version::Error` up into small specific errors.
Recently we "if" guarded subtraction manually using `> 0`, we can better
convey the meaning by using `checked_sub` and pattern match on the
option.
Refactor only, no logic changes.
Recently we deprecated the `segwit_signature_hash` function but during
development the deprecation notice got stale.
Fix deprecation notice to use the actual function names.
adcc01c0bd CI: Fix pinning (Tobin C. Harding)
Pull request description:
More crates broke our MSRV by using edition 2021 without doing a major release, pin them in the CI script.
Other open PRs need this to get past CI.
ACKs for top commit:
sanket1729:
ACK adcc01c0bd
Tree-SHA512: 3fbaaf2677791c4761fb0543a09f855441a977aec8d277c01c12c3389ce64158833b6a5ea89a3cf4f2182b51f480849deaf8e33127a14f818024a1af95346baa
84614d9997 Unit test debug print of witness with empty instruction (Tobin C. Harding)
e96be5ee6e Fix Witness debug display bug (Tobin C. Harding)
Pull request description:
When we introduce a custom `Debug` implementation for the `Witness` we introduced a bug that causes code to panic if the witness contains an empty instruction.
The bug can be verified by putting patch 2 first or by running `cargo run --example sighash` on master.
ACKs for top commit:
apoelstra:
ACK 84614d9997
RCasatta:
ACK 84614d9997
Tree-SHA512: d51891206ab15f74dda07eb29ff3f6c69dc3f983a5a5abb55685688548481a19f7c1d33aa1183a89c553ff2bc86cf41057c2bae33d75e8a7f3b801056775bf9e
55e94b5dea Remove test from test names for Weight type (yancy)
142dde64c3 Use Weight type for stripped_size (yancy)
cb76f3ec43 Add scale_by_witness_factor to Weight type (yancy)
38c9e9947e Add witness scale factor to the Weight type (yancy)
77552987ab Add from_wu_usize to Weight type (yancy)
1a88c887f5 Rename strippedsize to stripped_size (yancy)
3369257c75 Fix grammar (yancy)
Pull request description:
Return Weight type for the strippedize function.
ACKs for top commit:
apoelstra:
ACK 55e94b5dea
tcharding:
ACK 55e94b5dea
Tree-SHA512: ad3e4bc29380f22e20a6302c1b24c201c772be759c655c62ba4717840a01fcaa36f0f8442c9a3ba71c6400d6af47a9a815e6d90877b5f14c6883fb950b9669fd
29a4f9b114 Wrap the bitcoinconsensus error (Tobin C. Harding)
Pull request description:
Currently the `bitcoinconsensus` error is part of the public API. This hinders maintainability because changes to the verison of `bitcoinconsensus` force a re-release in `rust-bitcoin`. This is an unnecessary maintenance burden, we can wrap the error instead.
ACKs for top commit:
apoelstra:
ACK 29a4f9b114
sanket1729:
utACK 29a4f9b114
Tree-SHA512: 36bc1b0ad5f5675d79eea2409844a839d862997c256e301c53c5f1af547edc9a0b83e586bd70e1b8853722cd7ef279e7515e09fbe942660f8049090d1be39d3a
f18f684ad2 Add version bytes consts (Tobin C. Harding)
Pull request description:
BIP-32 defines 4 4-byte consts used as version bytes; currently we are hardcoding the version bytes in multiple places.
Add BIP-32 version bytes consts and use them throughout the module.
ACKs for top commit:
apoelstra:
ACK f18f684ad2
RCasatta:
utACK f18f684ad2
Tree-SHA512: 50bf2d26f0f8e3528642ffcc621c03b82f536994deb808a6c84225676b4b8849db8e0d16e46f3819e0810296a422b31cf90d0595739910afdb92fb768ef7696e
66d5800ac0 psbt: Add IndexOutOfBounds error (Tobin C. Harding)
Pull request description:
We currently have a bunch of functions that are infallible if the `index` argument is within-bounds however we return a `SignError`, this obfuscates the code.
Add an `IndexOutOfBoundsError`. While we are at it make it an enum so users can differentiate between which vector the out of bounds access was attempted against.
ACKs for top commit:
sanket1729:
utACK 66d5800ac0. This is a clean improvement over existing code.
apoelstra:
ACK 66d5800ac0
Tree-SHA512: fa8a24990d1dcdab0c9b019fb2387b5a518b02d0a65715f0ab62519894b19c0c74750d3dcdc928626fa68b146038b907d79de3ba9712c9287db8fa64693ebc11
be05f9d852 Rename xpub and xpriv types (Tobin C. Harding)
Pull request description:
The BIP-32 extended public key and extended private key exist in the Bitcoin vernacular as xpub and xpriv. We can use these terms with no loss of clarity.
Rename our current BIP-32 types
- `ExtendedPubKey` to `Xpub`
- `ExtendedPrivKey` to `Xpriv`
This patch is a mechanical search-and-replace, followed by running the formatter, no other manual changes.
ACKs for top commit:
apoelstra:
ACK be05f9d852
sanket1729:
ACK be05f9d852
Tree-SHA512: 49925688783c3f37a9b92a9767a0df095323a3fa51f3d672a0b5dd1d8bca86f7facbcc33921274bc147b369de09042c4850b08c31e63f71110903435daa6c00c
724be17394 Remove useless usage of vec! macro (Tobin C. Harding)
e84ca292d9 Clear incorrect implementation of clone warning (Tobin C. Harding)
Pull request description:
A new version `clippy 0.1.72 (5680fa1 2023-08-23)` just came out and we get a two new warnings. Fix them up.
ACKs for top commit:
apoelstra:
ACK 724be17394
Tree-SHA512: f82f026773f8738d8d89710b36b979850e0e33c4d1afb4f78d2d4e957b37dd850ef9e83c9e25197dac981c7b49c448e49078777261749567303f1aac282b3d33
7bbdd9b2af Export all hash types (Tobin C. Harding)
Pull request description:
During the 0.30.0 release we removed the re-exports of hash types. This upset some folk and since the aim of our re-exports is not exactly clean as well as the fact that the public API surface is not yet fixed just re-export all the hash types at the crate root again.
This is #1792 but does not use a wildcard and also grabs the other hashes that we recently moved.
ACKs for top commit:
apoelstra:
ACK 7bbdd9b2af
sanket1729:
ACK 7bbdd9b2af
Tree-SHA512: addfb617fae2fce12eb9d198ffeb1b0c99792dfd757222c21c62bd4b408432de5dc93c42da7d886b43c29b2c34bd318573e813f567a29080fc264ee7beba0f70
53f68383b7 hashes: Bump version to 0.13.0 (Tobin C. Harding)
Pull request description:
In preparation for `hashes` release, bump the version. Depend on new version in `rust-bitcoin`.
Note the `bitcoin-private` addition to the lock files is because we temporarily have two `bitcoin_hashes` dependencies and the secp one (v.0.12.0) depends on `bitcoin-private`.
ACKs for top commit:
sanket1729:
utACK 53f68383b7 . I am not sure about the exact nature of release dance between various crates in rust-bitcoin. This code and changelog entries looks good.
apoelstra:
ACK 53f68383b7
Tree-SHA512: a1933bcda1fa9a06c96a4c7079ff49f531e4f366373e98700446cecdf1eed5a104d4d4aa737202ec426cb1f1edf88eff5eee80df9f0cc3a9779c051a55f847b5
8b84227aec Add a script for updating lock files (Tobin C. Harding)
Pull request description:
Every time one of the dependencies is explicitly changed we have to update the minimal/recent lock files. Add a script to do so.
ACKs for top commit:
apoelstra:
ACK 8b84227aec
sanket1729:
ACK 8b84227aec
Tree-SHA512: f165308131077c55712d9ae5b85a4dc5f0f24c660dd4c196c48a53f64411b25714b2f32d3a6538f040b3d8ef5240df7d16b7b66561e0d8bb49245b44eb8f522c
0419fa278b Add VarInt from implementations by way of macro (Tobin C. Harding)
Pull request description:
Throughout the codebase we cast values to `u64` when constructing a `VarInt`. We can make the code marginally cleaner by adding `From<T>` impls for all unsigned integer types less than or equal to 64 bits. Also allows us to (possibly unnecessarily) comment the cast in a single place.
ACKs for top commit:
sanket1729:
utACK 0419fa278b
apoelstra:
ACK 0419fa278b
Tree-SHA512: 0cbcc7e9ec6a1a102693cb13685c348672fb13b098cbecd0a36bed0331165adb008f149f87f7b0c64f131974cfe513adbc12f508bc4853906adb2a65c0c647ee
We currently have a bunch of functions that are infallible if the
`index` argument is within-bounds however we return a `SignError`, this
obfuscates the code.
Add an `IndexOutOfBoundsErorr`. While we are at it make it an enum so
users can differentiate between which vector the out of bounds access
was attempted against.
Throughout the codebase we cast values to `u64` when constructing a
`VarInt`. We can make the code marginally cleaner by adding `From<T>`
impls for all unsigned integer types less than or equal to 64 bits.
Also allows us to (possibly unnecessarily) comment the cast in a single
place.