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.
042dcaa4b7 Remove doc(hidden) from error conversion functions (Tobin C. Harding)
Pull request description:
Give people access to the error type conversion docs, its no harm and it may be useful when the compiler does not give enough information.
Done based on discussion here: https://github.com/rust-bitcoin/rust-bitcoin/pull/1846#discussion_r1209583520
ACKs for top commit:
Kixunil:
ACK 042dcaa4b7
apoelstra:
ACK 042dcaa4b7
Tree-SHA512: 9d975845ba84213b203062282b68f06f6790d03dbc88d66dce82e9bedff4696fc01da6216920de9e9e4130f6469b32ff9c168d0800d057ec0bae51702d4a139e
06afd52a12 Improve hashes::Error (Tobin C. Harding)
Pull request description:
We are trying to make error types stable on the way to v1.0
The current `hashes::Error` is a "general" enum error type with a single variant, better to use a struct and make the error usecase specific.
Improve the `hashes::Error` by doing:
- Make it a struct
- Rename to `FromSliceError`
- Move it to the crate root (remove `error` module)
Includes usage in `bitcoin`.
ACKs for top commit:
apoelstra:
ACK 06afd52a12
Kixunil:
ACK 06afd52a12
Tree-SHA512: 20a517daaf3e9e09744e2a65cde6e238c8f2d1224899a6c04142a3a4e635d54112b0a2e846d25256071bb27cb70f7482380f98e9a535a5498aa4c7dc0d52cc54
3717a549f9 hashes: Fix stale repository name (Tobin C. Harding)
Pull request description:
The repository name is stale since we moved the `hashes` crate into the `rust-bitcoin` repo a while ago.
ACKs for top commit:
apoelstra:
ACK 3717a549f9
Kixunil:
ACK 3717a549f9
Tree-SHA512: ac4553547f1912c8242e3b87d3cc8951598999b5512ad1b49494b3c504449939e0e60905d96464b22c71b67ca975d18814a92af6e0aa66ff4f46effb97ac0733
0f74eb6876 Remove the unused crate::Error (Tobin C. Harding)
74154c2294 Add block::ValidationError (Tobin C. Harding)
3a9b5526b3 Move BlockHash From impls (Tobin C. Harding)
Pull request description:
Remove the `crate::Error` and replace its usage with `block::ValidationError`.
ACKs for top commit:
apoelstra:
ACK 0f74eb6876
Kixunil:
ACK 0f74eb6876
Tree-SHA512: 80b2c98d3d8f7c3f060c8ea2d94e1ebe118c07d0dcf91f6d13aed00df2cb0b15bf5e295ec0976d88d81e029cf7d3e8e4a1fe70120db57e49bbd8dd229291836b
0046bb8ad8 Fix usage of cfg(rust_1_53) (Tobin C. Harding)
c3450f3913 Remove stale usage of doc(cfg) (Tobin C. Harding)
Pull request description:
These build cfg options are not features, fix broken usage. And remove stale docsrs attribute while we are at it. Bad rust-bitcoin devs.
Found while reviewing #1870
ACKs for top commit:
apoelstra:
ACK 0046bb8ad8
Kixunil:
ACK 0046bb8ad8
Tree-SHA512: 7053affef6654ff203c93590bf081e165f019feb040aa8c55259ffe4e15eaf0e7522f6e5a4f6f62e8f578420b0313f4b7b17c46b741b7fcfd05750e5c5976589
3af9258025 embedded: Document how to clean up linker flags (Tobin C. Harding)
Pull request description:
Our embedded crate includes instructions to source a shell script that sets the `RUSTFLAGS` env var. Having the env var set like this in ones environment breaks linkage when trying to do "regular" builds.
Document how to clean up.
ACKs for top commit:
apoelstra:
ACK 3af9258025
Kixunil:
ACK 3af9258025
Tree-SHA512: 72758fba4dede873da299f01d75fd64b549fe21f954c2720ba3b7fc3c29fd4ed28fd0a749bbe987a7de1551aa32192253dd0033a18c877e877c9960343a5b07c
ca06d64455 rename bitcoin-private to bitcoin-internals (Andrew Poelstra)
Pull request description:
Since we now have control over the name on crates.io.
ACKs for top commit:
tcharding:
ACK ca06d64455
Kixunil:
ACK ca06d64455
Tree-SHA512: 8b3285b5ce9e3f1788ab9a3efa29b3e96f1f21dcfc0bb13f5940caf22cd43f74463b28bd85309e0200956dc11fe0102fd041b79bcd5f45fb8edb8449893bd287
Our embedded crate includes instructions to source a shell script that
sets the `RUSTFLAGS` env var. Having the env var set like this in ones
environment breaks linkage when trying to do "regular" builds.
Document how to clean up.
Add a `ValidationError` to the `block` module and remove the two
variants out of `crate::Error`.
This error is only used by the `validate_pow` function, a specific error
better serves our purposes.
We are trying to make error types stable on the way to v1.0
The current `hashes::Error` is a "general" enum error type with a single
variant, better to use a struct and make the error usecase specific.
Improve the `hashes::Error` by doing:
- Make it a struct
- Rename to `FromSliceError`
- Move it to the crate root (remove `error` module)
Includes usage in `bitcoin`.
No idea why this re-export is here, the `Prevouts` type is not even used
in the `psbt` module.
Remove the re-export of `crate::sighash::Prevouts` from `pstb`.
013dffa65d tests: Use script hash methods (Tobin C. Harding)
Pull request description:
The `ScriptBuf` type can be serialized using it's `to_bytes` function. Do not use the `psbt::Serialize` trait to do so in test code.
No logic changes, since the impl of `psbt::Serialize` for `ScriptBuf` just calls `to_bytes`.
ACKs for top commit:
Kixunil:
ACK 013dffa65d
apoelstra:
ACK 013dffa65d
Tree-SHA512: 08959e065f1528f2ca69c12d5e34bceea3ddd17eefcee45094f071b3fa7357dbf289f6fe54d18fea02eecd1d0a7cd04598bbf014a5f10676387dbe27bb490395
b03c24db8c Add a checked version of weight mul fee_rate (yancy)
Pull request description:
Add a checked version of fee_rate * weight. While I like the trait version of just being able to multiply `feerate * weight`, it's not really very useful imo since a large input feerate could cause an overflow. Instead of changing the trait in https://github.com/rust-bitcoin/rust-bitcoin/pull/1849 (not idiomatic enough I guess) I added a `checked_weight_mul` method to `FeeRate`.
ACKs for top commit:
apoelstra:
ACK b03c24db8c
Kixunil:
ACK b03c24db8c
Tree-SHA512: 231ade94291becadcea9ea2a40a5daf96b77f01a29cca2494d7bbe4f7de5b412fa8fc816ea249268569f5378410185d9349fd687533bf3a422a752997e107a2b
c2f33f60b8 Add changelo entry for removal of FromHex (Tobin C. Harding)
Pull request description:
During the last round of releases (bitcoin 0.30, hashes 0.12) we removed the `FromHex` implementation from all types except vecs and arrays. We added `FromStr` impls for types that roundtrip with `Display`.
We never added a changelog mention to either `bitcoin` or `hashes`, lets retroactively add an entry.
Fix: #1747
ACKs for top commit:
Kixunil:
ACK c2f33f60b8
apoelstra:
ACK c2f33f60b8
Tree-SHA512: 7affc492104be2be17861c55511407e66d8c821f35b18eeb62f6852a669253d23af67cbd44323ff568d2f143af57e37212455c7af3ed0b1d58313135b0783ea6
We have methods to convert a script to a `WScritpHash` and `ScriptHash`,
no need to do this manually, let alone use the `psbt::Serialize` trait
to do so.
During the last round of releases (bitcoin 0.30, hashes 0.12) we removed
the `FromHex` implementation from all types except vecs and arrays. We
added `FromStr` impls for types that roundtrip with `Display`.
We never added a changelog mention to either `bitcoin` or `hashes`, lets
retroactively add an entry.
Fix: #1747
6cec19f6d3 Update documentation of `InputWeightPrediction` (Martin Habovstiak)
6fec1789b9 Fix associated constants of `InputWeightPrediction` (Martin Habovstiak)
Pull request description:
These constants had an error that they had `script_size` set to 0 which
was incorrect because it's not length of the script but serialized size.
Rather than just bumping the value this uses the `from_slice` method
which is less error-prone.
Closes https://github.com/rust-bitcoin/rust-bitcoin/issues/1834
ACKs for top commit:
apoelstra:
ACK 6cec19f6d3
tcharding:
ACK 6cec19f6d3
Tree-SHA512: 4e05be2c05795e8c4f9c67374491be71d2bde8233446f22bf458cfeb542d81043f03f90f65e59e769fce8275925dff28fc3dfce48fd62bd20be7fca22b71ca3c
These constants had an error that they had `script_size` set to 0 which
was incorrect because it's not length of the script but serialized size.
Rather than just bumping the value this uses the `from_slice` method
which is less error-prone.
This also deletes a useless test of the constants.
Closes#1834
0555695757 Fix formatting (Martin Habovstiak)
Pull request description:
This slipped in and is breaking builds.
ACKs for top commit:
RCasatta:
ACK 0555695757
apoelstra:
ACK 0555695757
Tree-SHA512: de93667f10fa99c51f1119353e3d59c587b7eb737a9bb92355e1f57bf2beadd1515133431bd510e6dd9b81a0d08fdd263e663117cae288eec92d207a9dabc0b3