Skip to content

WIP: Upgrade rust-miniscript / rust-bitcoin to latest version #1228

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

Closed
wants to merge 1 commit into from

Conversation

darosior
Copy link
Member

@darosior darosior commented Aug 14, 2024

I need to go over the changes again, and this introduces a massive performance hit. From quick profiling i think it's from upstream changes in the miniscript policy compiler.

Running cargo test descriptors before:

real    0m5.166s
user    0m10.630s
sys     0m0.075s

After:

real    4m16.438s
user    7m14.968s
sys     0m0.099s

Fixes #1224.

_ => None,
}
.ok_or(LianaPolicyError::IncompatibleDesc)?;
SemanticPolicy::Thresh(thresh) if thresh.is_or() && thresh.n() > 1 => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we check thresh.k() == 1?

Suggested change
SemanticPolicy::Thresh(thresh) if thresh.is_or() && thresh.n() > 1 => {
SemanticPolicy::Thresh(thresh) if thresh.is_or() && thresh.n() > 1 && threshk() == 1 => {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is already checked by thresh.is_or().

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to keep this thresh.n() > 1 condition here, but perhaps this is not strictly necessary as the previous version didn't have subs.len() > 1 and we already ensure further below that the primary path and recovery paths are not empty.

@nondiremanuel nondiremanuel added this to the v8 - Liana milestone Aug 28, 2024
@darosior
Copy link
Member Author

Yes. In general i don't think the code here is correct. I need to go through the descriptor core logic one more time.

@pythcoiner
Copy link
Collaborator

also not from these PR, but here if assert fail we will panic shouldn'nt we error instead?

@@ -185,11 +187,14 @@ impl PathInfo {
) -> Result<PathInfo, LianaPolicyError> {
match policy {
SemanticPolicy::Key(key) => Ok(PathInfo::Single(key)),
SemanticPolicy::Threshold(k, subs) => {
let keys: Result<_, LianaPolicyError> = subs
SemanticPolicy::Thresh(thresh) if thresh.k() > 0 && thresh.n() >= thresh.k() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the if condition required here if these checks are already performed in the Threshold constructor?

SemanticPolicy::Threshold(k, subs) => {
let keys: Result<_, LianaPolicyError> = subs
SemanticPolicy::Thresh(thresh) if thresh.k() > 0 && thresh.n() >= thresh.k() => {
// FIXME
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this FIXME still required? The code seems OK 🤔

jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 23, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

The changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 23, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

The changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 23, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

The changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

The changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

The changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate is not upgraded to the most recent
version available due to a degradation in Electrum sync performance
in relation to the fetching and validation of Merkle proofs. Once
that issue has been resolved, we can further upgrade BDK
dependencies.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate is not upgraded to the most recent
version available due to a degradation in Electrum sync performance
in relation to the fetching and validation of Merkle proofs. Once
that issue has been resolved, we can further upgrade BDK
dependencies.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate is not upgraded to the most recent
version available due to a degradation in Electrum sync performance
in relation to the fetching and validation of Merkle proofs. Once
that issue has been resolved, we can further upgrade BDK
dependencies.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate has not been upgraded to the most
recent version available as the Electrum syncing there takes much
longer due to the fetching and validation of Merkle proofs. There
are ongoing BDK changes in relation to that and so we can further
upgrade this dependency once those changes have been completed.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 24, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate has not been upgraded to the most
recent version available as the Electrum syncing there takes much
longer due to the fetching and validation of Merkle proofs. There
are ongoing BDK changes in relation to that and so we can further
upgrade this dependency once those changes have been completed.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
jp1ac4 added a commit to jp1ac4/liana that referenced this pull request Jan 27, 2025
This upgrades bitcoin to 0.32 and related dependencies accordingly.

Note that the bdk_electrum crate has not been upgraded to the most
recent version available as the Electrum syncing there takes much
longer due to the fetching and validation of Merkle proofs. There
are ongoing BDK changes in relation to that and so we can further
upgrade this dependency once those changes have been completed.

Non-BDK changes to the liana and lianad crates are taken from
darosior's commit 20ee8b1 in
draft PR wizardsardine#1228.
edouardparis added a commit that referenced this pull request Jan 27, 2025
c5f5284 upgrade bitcoin to 0.32 and related (Michael Mallan)

Pull request description:

  This is to upgrade bitcoin to 0.32 and related dependencies accordingly.

  Note that the bdk_electrum crate has not been upgraded to the most recent version available as the Electrum syncing there takes much longer due to the fetching and validation of Merkle proofs. There are ongoing changes in relation to that (https://github.com/bitcoindevkit/bdk/issues/1699) and so we can further upgrade this dependency once those changes have been completed.

  Non-BDK changes to the liana and lianad crates are taken from commit 20ee8b1 in draft PR #1228, which this replaces.

  (Once this PR has been tested and approved, we can release a new version of the async_hwi crate and point to that.)

ACKs for top commit:
  edouardparis:
    ACK c5f5284

Tree-SHA512: 3cb1a2060ecc4c6b9631df0eadf5692ad35495b9303edbb80a437aca60ae062a7227f20ddeb5eb722cf57dd80bfa752372a14d26b8f306844237bfdb5f41e51a
@jp1ac4
Copy link
Collaborator

jp1ac4 commented Jan 27, 2025

Replaced by #1555.

@jp1ac4 jp1ac4 closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Upgrade bitcoin dependency to v0.32
4 participants