-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bump(deps): upgrade rust bitcoin
to 0.32.0
, miniscript
to 0.12.0
and others
#1448
bump(deps): upgrade rust bitcoin
to 0.32.0
, miniscript
to 0.12.0
and others
#1448
Conversation
49e2290
to
9d6c6ee
Compare
bitcoin
to 0.32.0
, miniscript
to 0.12.0
and others
4cf2e53
to
e6a93de
Compare
NOTE: related to the mentioned todo's on the description, I'll open a new PR to add more scope/context to this one with all the changes required due to the new |
@@ -37,7 +37,7 @@ pub enum Error { | |||
/// Error during base58 decoding | |||
Base58(bitcoin::base58::Error), | |||
/// Key-related error | |||
Pk(bitcoin::key::Error), | |||
Pk(bitcoin::key::ParsePublicKeyError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm undecided if we need this Pk
variant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik it's not being used anywhere
crates/wallet/src/wallet/signer.rs
Outdated
/// Error while computing the hash to sign a Taproot input. | ||
SighashTaproot(sighash::TaprootError), | ||
/// Error while computing the hash, out of bounds access on the transaction inputs. | ||
InputsIndexError(transaction::InputsIndexError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📌 Considering we already have a InputIndexOutOfRange
error, I recommend consolidating these into one variant if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ValuedMammal Oh, thanks! Yes, that's much better, I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ValuedMammal I did a deep-dive in rust-bitcoin, and now I'm wondering if we should have two variants, one for Psbt and another one for Transaction, as they have two in rust-bitcoin crate:
- bitcoin::psbt::IndexOutOfBoundsError
- bitcoin::transaction::InputsIndexError & bitcoin::transaction::OutputsIndexError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it to be TxInputsIndexError
instead, I also think for the current InputIndexOutOfRange
it should be PsbtInputIndexOutOfRange(psbt::IndexOutOfBoundsError)
instead, let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple solution would be to make SignerError::InputIndexOutOfRange
into a struct with fields for index
and length
(essentially reimplementing IndexOutOfBoundsError
) and then we have
impl From<transaction::InputsIndexError> for SignerError {}
similar to what you have here, but it shouldn't be a blocker to this PR. Accessing the outputs of a tx or psbt doesn't appear to be a concern in this module.
@tcharding Do the changes related to the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple small suggestions but otherwise this looks almost ready. Great work!
I also created #1469 to remove tmp_plan
, should it be done with this PR?
@@ -31,7 +31,7 @@ impl DescriptorExt for Descriptor<DescriptorPublicKey> { | |||
self.at_derivation_index(0) | |||
.expect("descriptor can't have hardened derivation") | |||
.script_pubkey() | |||
.dust_value() | |||
.minimal_non_dust() | |||
.to_sat() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📌 since this is a public API should we change the DescriptorExt
trait to make this an Amount
instead of u64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@notmandatory Yes, I do agree. I'll update it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@notmandatory I'll address it in another PR, it ends up breaking and requiring changes on the CoinSelectorOpt
, and probably will also raise some discussions, which is outside the scope of this PR.
crates/wallet/src/types.rs
Outdated
@@ -72,7 +72,7 @@ pub struct WeightedUtxo { | |||
/// properly maintain the feerate when adding this input to a transaction during coin selection. | |||
/// | |||
/// [weight units]: https://en.bitcoin.it/wiki/Weight_units | |||
pub satisfaction_weight: usize, | |||
pub satisfaction_weight: usize, // FIXME: (@leonardo) I think it should expect the new bitcoin-units `Weight` type instead of usize. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 agreed, now that there's a Weight
type we should use it. If you think it's too big a change to add to this PR feel free to make an issue to fix it in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@notmandatory I wasn't so sure about, but I think it adds unrelated scope/context, I'm addressing this one in #1468
950c166
to
e048247
Compare
crates/esplora/Cargo.toml
Outdated
# use these dependencies if you need to enable their /no-std features | ||
bitcoin = { version = "0.31.0", optional = true, default-features = false } | ||
miniscript = { version = "11.0.0", optional = true, default-features = false } | ||
# The `no-std` feature it's implied when the `std` feature is disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not really correct, there is no no-std
feature anymore in rust-bitcoin
. Its in another place also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I think it's best to just remove the comments altogether then.
fyi @notmandatory
Handwavey response, if it builds ship it. Take everything I saw with a pinch of salt, I'm not that good with I'm not sure, I don't exactly know what you are aiming for:
I didn't grok the Sorry I can't be much more help than that. |
e048247
to
29e65e3
Compare
98f67ad
to
fe5cd18
Compare
The summary of changes in the description certainly helps, thanks for that. In terms of review, the individual commits are less useful since realistically this should be a single commit - the one that finally builds with tests passing. |
Mostly number 2 for now, ha. All good, appreciate you @tcharding ! |
fe5cd18
to
cecb349
Compare
Nice, thanks for the feedback! I'll squash the commits into a single one. |
cecb349
to
acee6b5
Compare
deps(chain): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0` fix(chain): use `minimal_non_dust()` instead of `dust_value()` fix(chain): use `compute_txid()` instead of `txid` deps(testenv): bump `electrsd` to `0.28.0` deps(electrum): bump `electrum-client` to `0.20.0` fix(electrum): use `compute_txid()` instead of `txid` deps(esplora): bump `esplora-client` to `0.8.0` deps(bitcoind_rpc): bump `bitcoin` to `0.32.0`, `bitcoincore-rpc` to `0.19.0` fix(bitcoind_rpc): use `compute_txid()` instead of `txid` fix(nursery/tmp_plan): use proper `sighash` errors, and fix the expected `Signature` fields fix(sqlite): use `compute_txid()` instead of `txid` deps(hwi): bump `hwi` to `0.9.0` deps(wallet): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0` fix(wallet): use `compute_txid()` and `minimal_non_dust()` - update to use `compute_txid()` instead of deprecated `txid()` - update to use `minimal_non_dust()` instead of `dust_value()` - remove unused `bitcoin::hex::FromHex`. fix(wallet): uses `.into` conversion on `Network` for `NetworkKind` - uses `.into()` when appropriate, otherwise use the explicit `NetworkKind`, and it's `.is_mainnet()` method. fix(wallet): add P2wpkh, Taproot, InputsIndex errors to `SignerError` fix(wallet): fields on taproot, and ecdsa `Signature` structure fix(wallet/wallet): convert `Weight` to `usize` for now - converts the `bitcoin-units::Weight` type to `usize` with help of `to_wu()` method. - it should be updated/refactored in the future to handle the `Weight` type throughout the code instead of current `usize`, only converting it for now. - allows the usage of deprecated `is_provably_unspendable()`, needs further discussion if suggested `is_op_return` is suitable. - update the expect field to `signature`, as it was renamed from `sig`. fix(wallet/wallet): use `is_op_return` instead of `is_provably_unspendable` fix(wallet/wallet): use `relative::Locktime` instead of `Sequence` fix(wallet/descriptor): use `ParsePublicKeyError` fix(wallet/descriptor): use `.into()` to convert from `AbsLockTime` and `RelLockTime` to `absolute::LockTime` and `relative::LockTime` fix(wallet/wallet): use `Message::from_digest()` instead of relying on deprecated `ThirtyTwoByteHash` trait. fix(wallet/descriptor+wallet): expect `Threshold` type, and handle it internally fix(wallet/wallet): remove `0x` prefix from expected `TxId` display fix(examples): use `compute_txid()` instead of `txid` fix(ci): remove usage of `bitcoin/no-std` feature - remove comment: `# The `no-std` feature it's implied when the `std` feature is disabled.`
acee6b5
to
2a45640
Compare
ACK 2a45640 |
Methods `make_multi` and `make_multi_a` were essentially the same thing except for a different const generic param on `Threshold`. So we rm `make_multi_a` and put a const generic param on `make_multi`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1120081
438cd46 refactor(wallet)!: change WeightedUtxo to use Weight type (Leonardo Lima) Pull request description: fixes #1466 depends on #1448 <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description This PR is a follow-up on top of #1448, and should be rebased and merged after it, it uses the rust-bitcoin `Weight` type instead of the current `usize` usage. NOTE: ~~It also adds a new `MiniscriptError` variant, and remove the `.unwrap()` usage.~~ As suggested I'll address this on another issue #1485, trying to reproduce the error first. <!-- Describe the purpose of this PR, what's being adding and/or fixed --> ### Notes to the reviewers It should be ready to review after #1448 gets merged. <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ### Changelog notice - Change `WeightedUtxo` `satisfaction_weight` has been changed to use `Weight` type. - Change `TxBuilder` methods `add_foreign_utxo` and `add_foreign_utxo_with_sequence` to expect `Weight` as `satisfaction_weight` type. <!-- Notice the release manager should include in the release tag message changelog --> <!-- See https://keepachangelog.com/en/1.0.0/ for examples --> ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: storopoli: Anyways, ACK 438cd46 notmandatory: ACK 438cd46 Tree-SHA512: 1998fe659833da890ce07aa746572ae24d035e636732c1a11b7828ffed48e753adb4108f42d00b7cd05e6f45831a7a9840faa26f94058fc13760497837af002f
fixes #1422
Description
This PR focuses on upgrading the
rust-bitcoin
andminiscript
versions, to0.32.0
and0.12.0
, respectively. It also bumps the versions of other BDK ecosystem crates that also rely on bothrust-bitcoin
andminiscript
, being:rust-bitcoin
to0.32.0
rust-electrum-client#133rust-bitcoin
to0.32.0
rust-esplora-client#85rust-bitcoin
to0.32.0
rust-hwi#99I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (that should be squashed before merging), but I think it'll make it easier during review phase.
In summary I can already mention some of the main changes:
compute_txid()
instead of deprecatedtxid()
minimal_non_dust()
instead ofdust_value()
signature
andsighash_type
fieldssighash::P2wpkhError
,sighash::TaprootError
instead of oldersighash::Error
Network
to new expectedNetworkKind
feat: use newNetworkKind
throughout the BDK codebase #1465Weight
type to current expectedusize
feat: use newWeight
type throughout the BDK codebase, instead ofusize
for weight units #1466.into()
to convert from AbsLockTime andRelLockTime
toabsolute::LockTime
andrelative::LockTime
ThirtyTwoByteHash
trait.Threshold
type, instead of the previous two parameters.Notes to the reviewers
Again, I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (that should be squashed before merging), but I think it'll make it easier during review phase.
It should definitely be carefully reviewed, especially the last commits for the wallet crate scope, the ones with the semantic
fix(wallet)
.I would also appreciate if @tcharding reviewed it, as he gave a try in the past (#1400 ), and I relied on some of it for the policy part of it, other rust-bitcoin maintainers reviews are a definitely welcome 😁
Changelog notice
compute_txid()
instead of deprecatedtxid()
minimal_non_dust()
instead ofdust_value()
signature
andsighash_type
fields, instead of previoussig
andhash_type
sighash::P2wpkhError
, andsighash::TaprootError
instead of oldersighash::Error
Network
toNetworkKind
, where expectedWeight
type to current usedusize
.into()
to convert fromAbsLockTime
andRelLockTime
toabsolute::LockTime
andrelative::LockTime
ThirtyTwoByteHash
trait, useMessage::from_digest()
Threshold
type, instead of the previous two parameters.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: