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.
2e3006a729 Add max standard tx weight constant to transaction (yancy)
Pull request description:
Add a constant for the max transaction weight. Similar to [max block weight](1b009b809b/bitcoin/src/blockdata/weight.rs (L35)). This value is pulled from core [here](44b05bf3fe/src/policy/policy.h (L27))
ACKs for top commit:
apoelstra:
ACK 2e3006a729
sanket1729:
ACK 2e3006a729
Tree-SHA512: 1583695f43387538f948be85ded7ff9a4bf9778169acb958debcbe1572a6dc8bfcd26ddfb8dbe0c030c98ab1f8a66d239a5bc663bf65ec3376a46d5f71e90894
9eff2f2f5e fee_rate: Add public absolute weight convenience functions (Tobin C. Harding)
f00e93bdcd Fix typos in rustdoc (Tobin C. Harding)
f3412325ea weight: Make docs uniform and terse (Tobin C. Harding)
Pull request description:
- Patch 1 is docs cleanup
- Patch 2 adds two functions to `FeeRate`
From the commit log of patch 2:
Calculating the absolute fee from a fee rate can currently be achieved
by creating a `Weight` object and using
`FeeRate::checked_mul_by_weight`. This is kind of hard to discover, we
can add two public convenience functions that make discovery of the
functionality easier.
Add two functions for calculating the absolute fee by multiplying by
weight units (`Weight`) and virtual bytes (by first converting to weight
units).
This seems like an obvious thing so I'm inclined to think that Kixunil left it out for a reason. (Mentioning you here Kix so even if this merges you'll see it in notifications later on.)
ACKs for top commit:
sanket1729:
utACK 9eff2f2f5e
apoelstra:
ACK 9eff2f2f5e
Tree-SHA512: 5b3997b721b7d7225bcf0e8a4a3efb6f207393541dbbcef533135af06a4d9c95210d450bb2322fd65a727e4560b29f0b20fb96c154d019fd4e745506213abc1c
154552e334 docs: Do not link to std::option::Option (Tobin C. Harding)
24843468c3 Remove rustdocs links to serde (Tobin C. Harding)
Pull request description:
Two minor patches to fix up docs links. These were originally done as part of #1880 but are unrelated so pushing them up separately.
ACKs for top commit:
apoelstra:
ACK 154552e334
RCasatta:
utACK 154552e334
Tree-SHA512: e45e1538c66b59d63a66898896927bb6c1336fb4c8515bb9e2204c8035870ef8e4a6fd32dfc83db2938afda67feb27c48989e382410f9e7ea7a967132941c720
27b3c1e0e6 Improve the ScriptHash and WScriptHash types (Tobin C. Harding)
2197f1377f Improve PubkeyHash and WPubkeyHash (Tobin C. Harding)
Pull request description:
Total re-write since review. Now this PR moves the hash type definitions out of `hash_types`. Please see https://github.com/rust-bitcoin/rust-bitcoin/issues/1909#issuecomment-1603634440 for more.
No longer adds unit tests.
Fix: #1909
ACKs for top commit:
apoelstra:
ACK 27b3c1e0e6
Tree-SHA512: 216b9bed05d1a4a4fc493262664ceb5d60f9c30685b63d6f6675d21a7bf811053320a002165487b29599c52f345057d9c92babb0fc1ccd4628671ec468c804f9
50ada8298f Move EncodeSigningDataResult to sighash module (Tobin C. Harding)
1b7dc51ccb Remove deprecated code (Tobin C. Harding)
Pull request description:
We only keep deprecated code around for one release so we can now remove code deprecated in v0.30.0
Done in preparation as we gear up for v0.31.0 release.
ACKs for top commit:
apoelstra:
ACK 50ada8298f
sanket1729:
ACK 50ada8298f
Tree-SHA512: 40769258605563e2e12a6118306655fc9a012ae1f86509fca757ca411f0cef74480b7bb7b0db147f30a7d362b8494a077d5ec04f719351661ceb5a0697a5369d
3c0bb63423 Do trivial rustdoc improvements (Tobin C. Harding)
3225aa9556 Use defensive documentation (Tobin C. Harding)
80d5d6665a crypto: key: Move error code to the bottom of the file (Tobin C. Harding)
fe3b1e1140 Move From for Error impl (Tobin C. Harding)
5f8e0ad67e Fix docs on error type (Tobin C. Harding)
f23155aa16 Do not capitalize error messages (Tobin C. Harding)
ae07786c27 Add InvalidSighashTypeError (Tobin C. Harding)
baba0fde57 Put NonStandardSighashTypeError inside ecdsa::Error variant (Tobin C. Harding)
6c9d9d9c36 Improve error display imlps (Tobin C. Harding)
22c7aa8808 Rename non standard sighash error type (Tobin C. Harding)
Pull request description:
EDIT: The commit hashes below are stale but the text is valid still.
In an effort to "perfect" our error handling, overhaul the error handling in the `crypto` module.
The aim is to do a small chunk so we can bikeshed on it then I can apply the learnings to the rest of the codebase.
Its all pretty trivial except:
- commit `4c180277 Put NonStandardSighashTypeError inside ecdsa::Error variant`
- comimt `5a196535 Add InvalidSighashTypeError`
- commit `05772ade Use defensive documentation`
Particularly the last one might be incorrect/controversial.
Also, please take the time to check the overall state of error code in the `crypto` module on this branch in case there is anything else we want to do.
Thanks
ACKs for top commit:
apoelstra:
ACK 3c0bb63423
Tree-SHA512: 7e5f8590aec5826098d4d8d33351a41b10c42b6379ff86e5b889e73271b71921fc3ca9525baa5da53e07fa2e961e710393694e04658a8243799950b4604caf43
Improve the script hash types by doing:
- Define the types in the `crypto::script` module
- Put the From impls directly below the type definitions
Keep the current crate level re-export so this does not impact the
public API _if_ people are using the re-export but is still a breaking
change.
Improve the pubkey hash types by doing:
- Define the types in the `crypto::key` module
- Add From<&PublicKey> impl for `PubkeyHash`
Keep the current crate level re-export so this does not impact the
public API _if_ people are using the re-export but is still a breaking
change.
Calculating the absolute fee from a fee rate can currently be achieved
by creating a `Weight` object and using
`FeeRate::checked_mul_by_weight`. This is kind of hard to discover, we
can add two public convenience functions that make discovery of the
functionality easier.
Add two functions for calculating the absolute fee by multiplying by
weight units (`Weight`) and virtual bytes (by first converting to weight
units).
d4e8f49fc3 Move p2p::constants::Network to crate root (Tobin C. Harding)
0f78943ef0 Move p2p::constants::Magic to p2p module (Tobin C. Harding)
d9d5a4ed4f Move p2p::constants::ServiceFlags to p2p module (Tobin C. Harding)
99d8ae1173 Improve rustdocs on PROTOCOL_VERSION (Tobin C. Harding)
4330722d62 Move p2p::constants::PROTOCOL_VERSION to p2p module (Tobin C. Harding)
1bac1fd518 Rename the network module to p2p (Tobin C. Harding)
dac97072a5 Add BorrowMut to prelude (Tobin C. Harding)
Pull request description:
This PR has grown.
- Rename the `network` module to `p2p` (fix: #1855)
- add `BorrowMut` to prelude
- Move the `Network`, `ChainHash`, and `Magic` structs to a newly create `p2p::network` module
- Do a few cleanups
ACKs for top commit:
apoelstra:
ACK d4e8f49fc3
Tree-SHA512: 7cee93d36363b8acbece6c92c6afc34bb3abe6d5801373d291db1323c934e7c384f3b5881cefb8b0d102dea53da6ed8da1bf60c324bf60d5dab3af598e0310da
55be538dac policy: Add refactor carve out (Tobin C. Harding)
Pull request description:
I have managed to burn out or bore our reviewers/maintainers. Getting two acks is becoming increasingly difficult. I've pestered everyone to the limit that I feel socially comfortable doing so, and as such, am requesting a carve out to the 2-ACK before merge rule.
The primary justification is that I feel we should have a bit more of BDFL and a bit less total consensus if we are to push forwards.
### Example PRs where this change would apply
- https://github.com/rust-bitcoin/rust-bitcoin/pull/1925
- https://github.com/rust-bitcoin/rust-bitcoin/pull/1854
- https://github.com/rust-bitcoin/rust-bitcoin/pull/1862
ACKs for top commit:
elichai:
I agree this makes sense for refactors ACK 55be538dac
apoelstra:
ACK 55be538dac
sanket1729:
ACK 55be538dac. Same reasons as apoelstra. And this is only for re-factors that are not adding any new features.
RCasatta:
ACK 55be538dac
Tree-SHA512: a5e206252015f49245ed282a3be7a35760d16f94dc6e60f31edf589a41ef642eba52a3bd7d1375b6033f3cf0128f47beee4f03e59cad151c64eedd71ac98baac
The `ServiceFlags` type is used by the p2p layer. It can live in the
`mod.rs` file of the `p2p` module. Done in preparation for removing the
`p2p::constants` module.
This is a straight code move, the `ServiceFlags` replaces the
current re-export.
The `PROTOCOL_VERSION` const is a p2p layer constant. It can live in the
`mod.rs` file of the `p2p` module.
This is a straight code move, the `PROTOCOL_VERSION` replaces the
current re-export.
The `network` module deals with data types and logic related to
internetworking bitcoind nodes, this is commonly referred to as the p2p
layer.
Rename the `network` module to `p2p` and fix all the paths.
Only commit in the docs and error messages to what we _really_ know.
In an attempt to reduce the likelyhood of the code going stale only
commit to what is guaranteed - that we have an error from a module.
This does arguably reduce the amount of context around the error.
As we do for `NonStandardSighashErrorType` add an error struct for
invalid sighash type, used by the `taproot` module instead of returning
a generic error enum with loads of unused variants.
Error types conventionally include `Error` as a suffix.
Rename `NonStandardSighashType` to `NonStandardSighashTypeError`.
While we are at it make the inner type private to the crate, there is no
need to leak the inner values type.
07041d584d Apply rustfmt (The rustfmt Tyranny)
dada6d65b7 script: Move some inspector methods from ScriptBuf to Script (Steven Roose)
Pull request description:
Noticed that these methods belong in Script.
ACKs for top commit:
tcharding:
ACK 07041d584d
sanket1729:
ACK 07041d584d.
apoelstra:
ACK 07041d584d
Tree-SHA512: cdcbdf22f0457123205621ec2834164c4598be1e5b221cf859d60e88110b19f8c1e484e86f60653af237e9c2acbcdbe5d2b4c98ccf239924386639c4ba6222f7
a70b1b9c6c Use standard set of derives on all error types (Tobin C. Harding)
2867acfffa Add non_exhaustive to SignError (Tobin C. Harding)
Pull request description:
This is a redo of #1961 without changing `io::Error` to `io::ErrorKind` and just leaving errors with an IO error in them with only `#[derive(Debug)]`.
ACKs for top commit:
apoelstra:
ACK a70b1b9c6c
sanket1729:
utACK a70b1b9c6c.
Tree-SHA512: 4a716077ed7e852d40b649d03239dea80039b5f32d30b8c572a5c3cd8e0ffbfe2593f8e5b18855fb4e659d08eefb515a6508e138fd0b14e82ab225876653d056
As part of an ongoing effort to make our error types stable and useful
add a stand set of derives to all error types in the library.
`#[derive(Debug, Clone, PartialEq, Eq)]`
Add `Copy` if possible and the error type does not include
`#[non_exhaustive]`.
If an error type includes `io::Error` it only gets `#[derive(Debug)]`.
bb8bd16302 internals: Remove hex module (Tobin C. Harding)
2268b44911 Depend on hex-conservative (Tobin C. Harding)
db50509cd3 Add usage docs to the "core2" feature (Tobin C. Harding)
Pull request description:
Use the newly released `hex-conservative` crate, by doing the following:
- Depend on `hex-conservative` in `bitcoin` and `hashes`
- Re-export `hex-conservative` as `hex` from both crate roots.
- Remove all the old hex code from `hashes`
- Remove all the old hex code from `internals`
- Remove the now unused `internals::prelude`
- Fix all the import statements (makes up the bulk of the lines changes in this patch)
ACKs for top commit:
apoelstra:
ACK bb8bd16302
sanket1729:
utACK bb8bd16302
Tree-SHA512: ec83b3941cae6f32272471779f28461bb04959a3f6a126a68bbf2c748d83ff9518ff8932d9e937a6f389c10028bf3eb58c6b6d71ea066924dd7a34faaec7a087
1edc5f4098 Fill in deprecated since NEXT-RELEASE placeholder (Tobin C. Harding)
Pull request description:
As we gear up for the v0.31.0 release we can fill in the NEXT-RELEASE placeholders.
ACKs for top commit:
sanket1729:
utACK 1edc5f4098
apoelstra:
ACK 1edc5f4098
Tree-SHA512: 61a78e9df0d563a1ebefef3d6c3447b767c5d878f05b45e9a20aecdcef897cc9d8c40d499882a7b8d74d5e99b25a256946c39edf2f05abab370cc0223346f66b