71c0043127 Remove docsrs attributes (Tobin C. Harding)
Pull request description:
Somehow when we started using `doc_auto_cfg` we forgot to remove a bunch of docsrs attributes.
ACKs for top commit:
apoelstra:
ACK 71c0043127
sanket1729:
utACK 71c0043127
Tree-SHA512: 16ff8eec0f6cd392d496f8f07cc0773bbda28f7c71022ae6b5e2c47a98d40c94a9169c60c0d8fa5a819f07910593d65a47b69bdc748d64cda0aac3323e9599a6
81a42536f9 Use hex_lit::hex in benches (Tobin C. Harding)
Pull request description:
Currently the test `hex` macro is only available when the `test` compiler configuration option is set but we are using it in benches code, this works for use because `cargo bench` sets `test` for the current crate, however it breaks downstream crates.
Fix: #1830
ACKs for top commit:
RCasatta:
ACK 81a42536f9
apoelstra:
ACK 81a42536f9
Tree-SHA512: 429d38093cf42c50464ce5389313fde7c7d2644423ef11ed8f0a3eed1d55f2d2e4b66b7c2dc6e59e4c2cb96128b09d45a1b48369b404ac5eaecf845d2098f467
Currently the test `hex` macro is only available when the `test`
compiler configuration option is set but we are using it in benches
code, this works for use because `cargo bench` sets `test` for the
current crate, however it breaks downstream crates.
Fix: #1830
d45dbef3e7 Manually implement Debug on Witness (Tobin C. Harding)
Pull request description:
The current derived debug implementation on `Witness` prints the content field as an array of integers. We can do better than this by manually implementing `Debug`.
With this applied `Witness` is printed as follows: (first line is `{:?}` and the next is `{:#?}`):
Using `{:?}`:
```
Witness: { indices: 3, indices_start: 8, witnesses: [[0x00], [0x02, 0x03], [0x04, 0x05]] }
```
Using `{:#?}`:
```
Witness: {
indices: 3,
indices_start: 8,
witnesses: [
[0x00],
[0x02, 0x03],
[0x04, 0x05],
],
}
```
ACKs for top commit:
sanket1729:
tested ACK d45dbef3e7. This would be helpful for debugging downstream.
apoelstra:
ACK d45dbef3e7
Tree-SHA512: eacf4fa8e3f38c4e9ddc45de78afb8eab5b5b196b77a6612f61860e0e4e7ba96de2e7f434b92816e0b00532e73c05378cafc046ec9c34108e9d9216fb36c524a
552f19abe3 Add more rustdocs to WitnessProgram (Tobin C. Harding)
89303c1464 Move witness types to the script module (Tobin C. Harding)
Pull request description:
This is done as part of an ongoing effort to improve the `address` module and `Address` type.
- Patch 1: Move `WitnessVersion` and `WitnessProgram` to their own modules within `script` - this is code move only except for the variant changes to the `address::Error` enum (see note below on `rustfmt` acting up).
- Patch 2: Improves documentation on the `WitnessProgram`
-
### Note on `rustfmt`
There are a bunch of formatting changes that shouldn't be in here, I stashed and re-ran the formatter a bunch of times but for some reason `rustfmt` wouldn't change `address` as it is but after I patched it `rustfmt` made a bunch of changes.
ACKs for top commit:
sanket1729:
ACK 552f19abe3
apoelstra:
ACK 552f19abe3
Tree-SHA512: 6c33124e1fd4fd7dcc51af4df0584579da8ed8451f4243dc3392babe3e3385d68a7beab9d052cd3f08342032dce7add4c892c6d0187133d64622115bef9fa872
Add rustdocs to `WitnessProgram` commenting on why we carry the witness
version number around with the witness program. This is mainly a dev
comment but it helps document the invariants so make it a rustdoc
comment.
From BIP 141:
> A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that
> consists of a 1-byte push opcode (for 0 to 16) followed by a data push
> between 2 and 40 bytes gets a new special meaning. The value of the
> first push is called the "version byte". The following byte vector
> pushed is called the "witness program".
`WitnessVersion` and `WitnessProgram` are scriptPubkey concerns and
scriptPubkey is basically synonymous with address so in one way it makes
sense that these types are in `address` however we are in the process of
overhauling the `Address` (and `AddressInner`) types so lets move the
witness stuff to `script` and put it in individual sub-modules.
This move helps simplify the address error type also.
Note please, there are a bunch of formatting changes in here in the
error type that I cannot explain and could not remove.
c3a99c62ad CI: Pin serde_json for MSRV build (Tobin C. Harding)
Pull request description:
Recent release of `serde_json` depends on `serde` 1.0.66 but we pin to 1.0.56
Pin `serde_json` for MSRV build to v1.0.99
ACKs for top commit:
apoelstra:
ACK c3a99c62ad
sanket1729:
ACK c3a99c62ad
Tree-SHA512: f9c4e679c9b7f827132f4172056d48fd7428330d8acdb390b022825cfcf20d96610dd7a5cd77c2e833efb8ad52f0d0a5895a7657758a0af01da47db7a881a797
The current derived debug implementation on `Witness` prints the content
field as an array of integers. We can do better than this by manually
implementing `Debug`.
With this applied `Witness` is printed as follows: (first line is `{:?}`
and the next is `{:#?}`):
Using `{:?}`:
```
Witness: { indices: 3, indices_start: 8, witnesses: [[0x00], [0x02, 0x03], [0x04, 0x05]] }
```
Using `{:#?}`:
```
Witness: {
indices: 3,
indices_start: 8,
witnesses: [
[0x00],
[0x02, 0x03],
[0x04, 0x05],
],
}
```
c958112824 update proc-macro to 1.0.56 to 1.0.63 (Andrew Poelstra)
Pull request description:
1.0.56 does not compile on Rust nightly anymore.
ACKs for top commit:
yancyribbens:
ACK c958112824
tcharding:
But ACK c958112824
adoerr:
ACK c958112824
sanket1729:
ACK c958112824
Tree-SHA512: bdab34d9a7ba74e18489f0cacd9aa5c65cd1f09d269fdba92dfa2ad16e19bd2de346e7378be23e79a893a10b71db1fb465edd74fb73f6e28e476415826226ea8
fc167097aa Added examples for sighash computations (Alec Matusis)
Pull request description:
So far computed sighashes and verified signatures for:
- P2WPKH
- P2MS 2of3
- P2SH 2of2 multisig
- P2SH 2of3 multisig
- P2WSH 2of2 multisig.
TODOs:
- Add P2TR script-path multisig and key-path examples
- Are there mutisig transactions where flags are different for diff signatures within an input?
- Maybe switch to segwit_signature_hash()?
- Consider also verifying script hash if we go for full P2(W)SH transactions verifications?
ACKs for top commit:
tcharding:
ACK fc167097aa
apoelstra:
ACK fc167097aa
Tree-SHA512: 67750b614592391d8252fc270be8676f8aef61eb842c49816386396e7afaa472921c21df40d13291ee80e653f3a0ec367f7b941920f1777f086815bf222e8e62
96784b9cfa Make sha512::HashEngine fields private (Tobin C. Harding)
Pull request description:
Recently we made the hash engine fields pub crate so that `sha512_256` could construct a hash engine with different constants. We can make the code slightly cleaner by adding a pub crate constructor and making the fields private again.
Idea from Kixunil:
https://github.com/rust-bitcoin/rust-bitcoin/pull/1413#pullrequestreview-1197207593
This is a follow up to #1413, cc kcalvinalvin as the author of that one.
ACKs for top commit:
apoelstra:
ACK 96784b9cfa
Kixunil:
ACK 96784b9cfa
Tree-SHA512: 40faa969b2227e46ea66a4ce887f17d9a48a0bc18846fb6bb1a51dd117a4e49cc031196846e913e03c39597cacd30a61a55bd1ccde600be72583965d2faf090a
6881080f8e Fix incorrect comment in ci script (Tobin C. Harding)
Pull request description:
MSRV build breaks because of edition _2021_ not 2018.
ACKs for top commit:
yancyribbens:
I feel like this comment isn't very helpful and worth maintaining. However ACK 6881080f8e to correct it.
Kixunil:
ACK 6881080f8e
apoelstra:
ACK 6881080f8e
Tree-SHA512: c909e986fa96e68211177fa4eed4e9645fb4c918c062d3be40df8f3615f877b0a89932fd39bf95475c2ee4a1557174c09c3a5b4e9853680ed74d9116a48703c9
Recently we made the hash engine fields pub crate so that `sha512_256`
could construct a hash engine with different constants. We can make the
code slightly cleaner by adding a pub crate constructor and making the
fields private again.
Idea from Kixunil:
https://github.com/rust-bitcoin/rust-bitcoin/pull/1413#pullrequestreview-1197207593
Expose signature verification functionality for ECDSA signatures on the
`PublicKey` type.
We should have an identical function on `XOnlyPublicKey` but this will
have to be done in `secp2561`.
aa7b3a7d0c ci: Remove stal DO_ALLOC_TESTS variable (Tobin C. Harding)
Pull request description:
We never enable the `DO_ALLOC_TESTS` variable, and hence never test the "alloc" feature in `hashes`.
Remove the `DO_ALLOC_TESTS` variable and add "alloc" to the `FEATURES` array.
ACKs for top commit:
yancyribbens:
ACK aa7b3a7d0c
apoelstra:
ACK aa7b3a7d0c
sanket1729:
utACK aa7b3a7d0c
Tree-SHA512: 461735242ec94786624a3653c3ea108d1a8712d5a77943f2ce54b44298624f6d4a43c98a0079782211e9a4b61ac87fbadd9c98608ca0ad82574c4a63b921776f
7cdc90565f Mutate mul_u64 with mutagen (Tobin C. Harding)
Pull request description:
Add the `mutate` attribute to mutate `mul_u64`. Add non-doc comments listing the two false positives. These are identical but we list them twice so when devs grep for `mutagen false pos` the same number of lines for each function is displayed as is displayed by the `mutagen` run. This coding false positives thing is also introduced in PR #1655.
ACKs for top commit:
apoelstra:
ACK 7cdc90565f
sanket1729:
utACK 7cdc90565f
Tree-SHA512: d066beb2f9ba198f5af36258ba15cfbd2c7c9ce7596f6340ed1fe2f62a2b0b5296eeb2cb4be30146d019671f1858521c29db917936895b5b3fd36bdb0bd07e57
4dfaec952c hashes: Remove stale status badge (Tobin C. Harding)
Pull request description:
We do not use travis in our CI pipeline anymore, remove the stale badge.
ACKs for top commit:
yancyribbens:
ACK 4dfaec952c
apoelstra:
ACK 4dfaec952c
sanket1729:
utACK 4dfaec952c
Tree-SHA512: 6865c8cc51f90161ea643922df3bbf890811777e3dcbff9e464d6092f0d79a6ae2798d593f6a27e7f18b05ba66a765c871d4d01086e18b8480916573288afc0e
9f7449b572 Use from_int_btc function for const context (yancy)
f93e67977a Add from_int_btc function to Amount (yancy)
Pull request description:
Followup PR from https://github.com/rust-bitcoin/rust-bitcoin/pull/1811
Added a `const` associated function `from_int_btc()` for Amount. `panic()` in const context is only available after 1.57+ so a work around is provided.
ACKs for top commit:
tcharding:
ACK 9f7449b572
apoelstra:
ACK 9f7449b572
Tree-SHA512: 7755234f2e573577d754f0224083cb7acc059e58833790fe344b0d9bad0acd89b0f74054d9efcba2133576222c7e9ab8dc3d81ddc10fbdcd4f83638d697118c4
654f58da17 This library is not solely dependent on Rust (roy9495)
Pull request description:
Fix: #1867
Docs claim this library is pure rust but it depends on libsecp256k1 (and optionally libbitcoinconsensus)
So, I changed the lib.rs file accordingly.
ACKs for top commit:
Kixunil:
ACK 654f58da17
apoelstra:
ACK 654f58da17
Tree-SHA512: 139a921ead8e96472adb8019a0b43bcde728578699092c69322459d865be0de69ca48d073cc4c16739257627f2b6dea4e77332f2d32894812ae5b91935257782
2b6bcf085c Implement support for `alloc`-free parse errors (Martin Habovstiak)
783e1e81dc Move `impl_std_error` to `bitcoin-internals` (Martin Habovstiak)
Pull request description:
This implements various helpers for parse errors that will not require `alloc`. This PR is useless while all of the crates require `alloc` and is thus a draft so that you can look at the design.
ACKs for top commit:
tcharding:
ACK 2b6bcf085c
apoelstra:
ACK 2b6bcf085c
Tree-SHA512: 776838a754b2c17263cf167c8cf8a3e69e51d8de45eb08d072ef930cbd1149360da2cb5fc430ce58f31c2b07dbf06c9f8384c567358873a3440e85632fcc2af8
6a18997e3c Removed only available in 1.46.0 line (TATHAGATA ROY)
Pull request description:
Fix: #1850
Removed "*Important: only available in Rust 1.46+*" on the file transaction.rs from lines 1288 and 1407 respectively.
ACKs for top commit:
Kixunil:
ACK 6a18997e3c
apoelstra:
ACK 6a18997e3c
tcharding:
ACK 6a18997e3c
sanket1729:
ACK 6a18997e3c
Tree-SHA512: 1395384ffe301b628687cc6d154e191b6a4415acd33eb4209065c5bf94115c3210ea1d28f7d7186e41665b39b5bebae849c3fa5394786ce24bdcd57b765cdbd3
4c18ba779c network: Implement Default on ServiceFlags (Steven Roose)
Pull request description:
I think the NONE/empty service flags are a reasonable default value, no?
ACKs for top commit:
apoelstra:
ACK 4c18ba779c
tcharding:
ACK 4c18ba779c
Tree-SHA512: 14433f695edcbc19eb58f03b6b1b9dfe0cf0825df5521a7d15667733bf0a4b07a921ba9bc780acbf16cbee232177ecd4638a474a1ab046c9371ce4df16292569
d961b9c4ee Fix minor comments on count_sigops PR (junderw)
Pull request description:
Fixing some comments that were left on #1890
ACKs for top commit:
yancyribbens:
ACK d961b9c4ee
apoelstra:
ACK d961b9c4ee
tcharding:
ACK d961b9c4ee
Tree-SHA512: caa04428eb7c09915964e4a7bae2d1fca2426317f3620d16e73e992269a99d7adb3d360affb954a173835661a9960cf760d29ae9861816b1a898c01428b0f2d6
202d1cd581 Rename taproot::Error to SigFromSliceError (Tobin C. Harding)
29678cb82b Correctly document InvalidSighashType variant (Tobin C. Harding)
13d5c0536b Remove explicit error conversion (Tobin C. Harding)
d86517ae4f taproot: Use error variants locally (Tobin C. Harding)
Pull request description:
First three patches are preparatory cleanup, last patch renames `crypto::taproot::Error` to `SigFromSliceError`. See commit log for justification of the `Sig` prefix.
Done as part of the great error cleanup.
ACKs for top commit:
apoelstra:
ACK 202d1cd581
Kixunil:
ACK 202d1cd581
Tree-SHA512: 87aef07d2a3518c68c070e348d2331a9fbf1dc5cd36fd4d966607ddb0531eca9dc6be08f1923f941d33973f173b915490de9ef0cad724cce7bf108cdc8a82af0
638445f8a9 Feature: Add opcodes::All::decode_pushnum and Script::count_sigops (junderw)
Pull request description:
Planning to also add methods for the various parts of Transaction etc. to eventually allow for easier sigops calculation.
Bare multisig is making a comeback, which is causing a large amount of transactions' effective vSizes (for fee calculation) to be dependent on the sigop count.
This is a first step at making those transactions easier to estimate fees for / template blocks for etc.
ACKs for top commit:
Kixunil:
ACK 638445f8a9
tcharding:
ACK 638445f8a9
Tree-SHA512: 5e87d0f5ab58ed22ed50e43eac392b9b84ebccab5086553a6234d825766842057ab89bd0753f3c9de50d9ab17536182b8f64a57e8d5632a55494180f2cc26bbd
This implements basic facilities to conditionally carry string inputs in
parse errors. This includes:
* `InputString` type that may carry the input and format it
* `parse_error_type!` macro creating a special type for parse errors
* `impl_parse` implementing parsing for various types as well as its
`serde`-supporting alternative
ccb6e3eeba Rename TaprootSpendInfo::as_script_map to script_map (Tobin C. Harding)
Pull request description:
The `as_script_map` is a getter not a conversion function (to/into/as), as such it should not include the prefix `as_`.
Deprecate `as_script_map` in favour of `script_map`.
ACKs for top commit:
yancyribbens:
ACK ccb6e3eeba
Kixunil:
ACK ccb6e3eeba
apoelstra:
ACK ccb6e3eeba
Tree-SHA512: 4e14fbfff413ee1d1a396597be6c0d65d1294406291e09c06ad69836c495e6556f2c4ca1bbeca869607f1757b01de85321a8857c9e5157ae25c57f709e572178
The `as_script_map` is a getter not a conversion function (to/into/as),
as such it should not include the prefix `as_`.
Deprecate `as_script_map` in favour of `script_map`.
This error type is only used in the `from_slice` function. Use prefix
`Sig` because `taproot::FromSliceError` does not fully express how the
error came about.
Use specific identifier for the error, this aids usage but also prevents
us later adding "random" other variants into this error and using it in
other functions.