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
base: release/0.29
Are you sure you want to change the base?
Bump MSRV 1.63.0 AND add deprecate TxBuilder::allow_shrinking() #1366
Conversation
Rather than try to figure out how to get this to build with MSRV 1.57 I'm bumping it to 1.63.0.
|
a24fd81
to
bf0845c
Compare
127b29c
to
3b09e26
Compare
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:
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 |
|
46a3c64
to
21f9d69
Compare
Fix related clippy errors
21f9d69
to
9ee2ce6
Compare
9ee2ce6
to
2e679e6
Compare
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 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. |
Yes it's a design bug IMO: #1374 |
2e679e6
to
be9e796
Compare
How about we just deprecate |
be9e796
to
376dcbc
Compare
…te it test(wallet): add test_bump_fee_allow_shrinking test
376dcbc
to
5bc00e4
Compare
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.
utACK 5bc00e4 - looks good to me, I only have one comment regarding the clippy ci
@@ -18,9 +18,9 @@ jobs: | |||
strategy: | |||
matrix: | |||
rust: | |||
- version: 1.65.0 # STABLE | |||
- version: stable |
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 means that if a new version of rust is released, with a new version of clippy with stricter rules, our ci would immediately fail the clippy check. Are we ok with this?
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 don't think so because of
Line 1 in 52f3955
msrv="1.63.0" |
Ref: https://doc.rust-lang.org/stable/clippy/configuration.html
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 think it means that clippy won't suggest any improvement that breaks msrv, not that clippy is pinned to version 1.63.0.
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.
From the Ref above:
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by specifying the minimum supported Rust version (MSRV) in the clippy configuration file.
So I think that you worry about
if a new version of rust is released, with a new version of clippy with stricter rules, our ci would immediately fail the clippy check
would not fail right?
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 think it would fail.
Let's say that rust 1.80 introduces the method pizza()
, and clippy 1.80 introduces two new rules:
pizza()
should always be used instead offormat()
- Every variable name should start with a
x
(this makes your code more beautiful)
If your msrv is 1.79, clippy wouldn't complain about rule 1: you can't use pizza()
, as it doesn't exist in rust 1.79! But I'm kind of sure that it would still warn you about rule 2, since it's doable in earlier versions of rust too.
Anyways, I don't know how often clippy adds rules that don't pertain to new rust features, so it might not be a big deal after all.
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.
Yes but first MSRV CI would fail because you cannot include pizza()
since it does not exist in MSRV.
And even if you don't include it the clippy.toml
MSRV config will make sure to not enable the pizza_instead of format
lint because of
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by specifying the minimum supported Rust version (MSRV) in the clippy configuration file.
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.
Yes but first MSRV CI would fail because you cannot include pizza() since it does not exist in MSRV.
I never said I included pizza in my code. I said that clippy had that rule, but wouldn't enforce it since my MSRV wouldn't permit it.
The point is not the rule1, it is rule2 that would make the CI fail.
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.
Rule 2 is a "newer feature" that I've mentioned above.
So CI with clippy.toml
would pass.
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.
No, rule 2 is a new clippy lint that can be applied to also older versions of rust, not a new feature.
Anyways, I don't have the time to try this out, I'd say it's ok to merge and if you ever notice that clippy breaks when a new version is released, and it's too annoying to fix, you can change the ci again.
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 don't think that this is how the clippy lints are versioned.
Because if you run clippy with Rust 1.X.0 it means that you are running a snapshot of the codebase of rust, cargo, clippy, and rustfmt from the time that 1.X.0 was released.
I see you scenario happening with some backport like 1.X.1 or 1.X.2 etc.
pub enum TapLeavesOptions { | ||
/// The signer will sign all the leaves it has a key for. | ||
#[default] |
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.
Ohh this is so cool!
Description
fixes #1342
Notes to the reviewers
This is a quick fix, long term we should try to make this safer to use.
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing