Skip to content
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 MSRV 1.63.0 AND add deprecate TxBuilder::allow_shrinking() #1366

Merged

Conversation

notmandatory
Copy link
Member

@notmandatory notmandatory commented Mar 4, 2024

Description

fixes #1342

  • bumps MSRV to 1.63
  • fixed clippy errors for new MSRV
  • add warning to docs for TxBuilder::allow_shrinking().
  • add wallet test to confirm behavior of TxBuilder::allow_shrinking() when not also using drain_wallet().

Notes to the reviewers

This is a quick fix, long term we should try to make this safer to use.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@notmandatory notmandatory added this to the 0.29.1 milestone Mar 4, 2024
@notmandatory notmandatory self-assigned this Mar 4, 2024
@notmandatory notmandatory added the documentation Improvements or additions to documentation label Mar 4, 2024
@notmandatory notmandatory added the ci label Mar 4, 2024
@notmandatory notmandatory marked this pull request as draft March 4, 2024 02:36
@notmandatory
Copy link
Member Author

notmandatory commented Mar 4, 2024

Rather than try to figure out how to get this to build with MSRV 1.57 I'm bumping it to 1.63.0.

For some reason CI isn't running at all so I still working on that.

@notmandatory notmandatory marked this pull request as ready for review March 4, 2024 04:23
@notmandatory notmandatory force-pushed the docs/allow_shrinking branch 7 times, most recently from 127b29c to 3b09e26 Compare March 4, 2024 07:19
@thunderbiscuit
Copy link
Member

thunderbiscuit commented Mar 12, 2024

I think the docs now correctly describe what the method is doing, but it feels like a bug to me, and the docs now simply describe the bug.

The intended behaviour (as I imagine it at least) is what is described in the first line of the doc:

Explicitly tells the wallet that it is allowed to reduce the amount of the output matching this script_pubkey in order to bump the transaction fee.

In other words, if you're bumping the fee on a transaction, you can tell the wallet to not apply default behaviour (use the change output to pay for the extra fees), but instead use one of your payees' output. If the extra fee required is 1000 sat, the output should simply shrink by 1000 sat, those sats go to the transaction fee, and nothing else about the transaction change. If the method ends up triggering a switcharoo of where change goes and now throws all change into that payees' output, it's so far off what I'd expect would happen from the name of the method that I'd consider it a bug.

If the current behaviour is useful in some way (I can't think of a use case but maybe there are?) we could rename the method to better describe what it does. Otherwise I think it would be better to fix the method to match what users might expect from an allow_shrinking() method, or disable it entirely if there is no bandwidth to fix at the moment.

@notmandatory
Copy link
Member Author

notmandatory commented Mar 12, 2024

@thunderbiscuit I think you are right now that I'm looking at the code again it looks like coin selection WILL add more inputs to pay the fee so will drain the whole wallet to the allow_shrinking() address if enabled.. so either we need to remove allow_shrinking() or always turn on manually_selected_only() for RBF or for RBF when using allow_shrinking(). I'll update my test to confirm. Update, I was wrong about this, see below.

@notmandatory notmandatory force-pushed the docs/allow_shrinking branch 3 times, most recently from 21f9d69 to 9ee2ce6 Compare March 15, 2024 02:21
@notmandatory notmandatory changed the title docs(wallet): add warning on TxBuilder::allow_shrinking() docs(wallet): add warning on TxBuilder::allow_shrinking() AND bump MSRV 1.63.0 Mar 15, 2024
@notmandatory notmandatory changed the title docs(wallet): add warning on TxBuilder::allow_shrinking() AND bump MSRV 1.63.0 bump MSRV 1.63.0 AND add warning to docs for TxBuilder::allow_shrinking() Mar 15, 2024
@notmandatory notmandatory changed the title bump MSRV 1.63.0 AND add warning to docs for TxBuilder::allow_shrinking() Bump MSRV 1.63.0 AND add warning to docs for TxBuilder::allow_shrinking() Mar 15, 2024
@notmandatory
Copy link
Member Author

notmandatory commented Mar 15, 2024

I updated the test to confirm that given a wallet with 2 UTXOs, if the original TX only uses one UTXO then the new fee bumped TX with allow_shrinking() will also only use that one UTXO and NOT bring in the other available in the wallet.

I think this function is doing what it says which is allow shrinking one output to pay for a new larger TX fee. The only scenario I can think of where this behavior would be unexpected is if you also manually add new inputs with your fee bump tx builder. Should I explicitly warn against this scenario? I'd hope that the warning would cover that scenario, I'd rather not change the function name for the 0.xx branch, I'd rather have that discussion for the 1.0 bdk wallet api.

@LLFourn
Copy link
Contributor

LLFourn commented Mar 15, 2024

I think the docs now correctly describe what the method is doing, but it feels like a bug to me, and the docs now simply describe the bug.

Yes it's a design bug IMO: #1374

@notmandatory notmandatory added module-wallet api A breaking API change and removed documentation Improvements or additions to documentation labels Mar 16, 2024
Copy link
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

utACK 5bc00e4 - looks good to me, I only have one comment regarding the clippy ci

.github/workflows/cont_integration.yml Show resolved Hide resolved
src/wallet/signer.rs Show resolved Hide resolved
@notmandatory notmandatory force-pushed the docs/allow_shrinking branch 11 times, most recently from 1334d09 to b03dca1 Compare October 21, 2024 17:23
Fix related clippy errors
…te it

test(wallet): add test_bump_fee_allow_shrinking test
@notmandatory notmandatory force-pushed the docs/allow_shrinking branch 3 times, most recently from ddbce5d to a70dcee Compare October 21, 2024 18:23
@notmandatory notmandatory force-pushed the docs/allow_shrinking branch 3 times, most recently from 8837654 to bb83bae Compare October 21, 2024 22:29
@notmandatory
Copy link
Member Author

notmandatory commented Oct 22, 2024

I had to disable the code coverage and blockchain integration tests. They used to work but not are failing even though there haven't been any code changes since they last run successfully. I think time is better spent on 1.0 than trouble shooting these old flaky tests.

@notmandatory notmandatory merged commit f13335e into bitcoindevkit:release/0.29 Oct 22, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change ci module-wallet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants