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
Fix typo in deprecated type #2693
Conversation
Pull Request Test Coverage Report for Build 8904697452Details
💛 - Coveralls |
@@ -31,11 +31,11 @@ const VERSION_BYTES_TESTNETS_PRIVATE: [u8; 4] = [0x04, 0x35, 0x83, 0x94]; | |||
|
|||
/// The old name for xpub, extended public key. | |||
#[deprecated(since = "0.31.0", note = "use xpub instead")] | |||
pub type ExtendendPubKey = Xpub; | |||
pub type ExtendedPubKey = Xpub; |
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.
Interesting, we should just delete this code. The type was named ExtendedPubKey
in 0.30 and we removed ExtendedPubKey
completely in 0.31 by accidentally mis-spelling 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.
Yes, I also agree. Note that with the CI testing, it took a long time for someone to find this typo.
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 :(. We messed up the deprecation cycle here. Frustrating that nobody noticed until now -- it would have made the 0.30 to 0.31 transition much easier.
Maybe this PR should instead be a backport to the 0.31 branch.
Also the deprecation method should say Xpub
instead of xpub, which will make it clear that there's an actual type called Xpub
.
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.
Note that with the CI testing, it took a long time for someone to find this typo.
I'm not sure that tests would have caught it. Tobin and I updated a bunch of crates from 0.30 to 0.31, and I recall seeing that ExtendedPubKey
no longer compiled and thinking "hmm don't I remember us doing a deprecation here?" and then deciding that there must've been some reason we didn't.
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.
@tcharding @apoelstra the deprecation warning does not show up unless you explicitly wrap the create a new type. Simply pub type A = B
does an alias and would not show warning when user uses type A.
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.
Perhaps we should do as you suggested once in the past @apoelstra and during RC testing I should do each upgrade as two separate patches, the first being required changes and the second fixing all the lints (deprecation). That way we may notice if something is in the first patch that shouldn't have been.
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, though if Sanket is correct, we won't actually get a deprecation warning in this case :(.
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 swapped Xpriv
for ExtendendPrivKey
on master
(with the spelling mistake) and got a warning
cargo run --example taproot-psbt --features=rand-std,bitcoinconsensus
warning: /home/tobin/build/github.com/tcharding/rust-bitcoin/master/bitcoin/Cargo.toml: version requirement `0.105.0+25.1` for dependency `bitcoinconsensus` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
Compiling bitcoin v0.32.0-rc1 (/home/tobin/build/github.com/tcharding/rust-bitcoin/master/bitcoin)
warning: use of deprecated type alias `bitcoin::bip32::ExtendendPrivKey`: use xpriv instead
--> bitcoin/examples/taproot-psbt.rs:81:77
|
81 | use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpriv, Xpub, ExtendendPrivKey};
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated type alias `bitcoin::bip32::ExtendendPrivKey`: use xpriv instead
--> bitcoin/examples/taproot-psbt.rs:117:9
|
117 | ExtendendPrivKey::from_str(BENEFACTOR_XPRIV_STR)?,
| ^^^^^^^^^^^^^^^^
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.
Thanks for checking. For some reason, I recall this not working.
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 sweat, there are various deprecation things that definitely do not work as they appear, I can not remember which ones work and which don't either.
Agreed, added label - I'll handle the backport. |
Hi @matthiasdebernardini, thanks for noticing our fail, and thanks for fixing it! This patch will need to be backported to the Thanks again! |
fda3690
to
d78afe1
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.
ACK 6f0c5c1
Can you squash down to a single commit please. |
6f0c5c1
to
1ce08ac
Compare
Let me know if there is anything else @tcharding ! |
Need to fix the commit message please. |
1ce08ac
to
adbbc9b
Compare
Got it! Should be good now. |
Still needs a brief message followed by the body. You can see this blog for how to write a commit message: https://chris.beams.io/posts/git-commit/ |
In PR rust-bitcoin#2258, deprecated BIP-32 types were re-added but contained a typo in the identifier: "Extendend" instead of "Extended". This commit fixes that typo. The incorrect patch was backported to the 0.31.x branch in December but only noticed recently.
adbbc9b
to
12411fc
Compare
Thank you for your guidance, I think this commit message is good now. Let me know otherwise. |
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 12411fc
Thanks for sticking with it! Grumpy old devs like me like commit messages to be limited to 72 characters wide ... but I let this one through :) Thanks for the contribution man! Sorry to be such a fussy reviewer. |
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 12411fc
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 12411fc
@tcharding I think that's a positive - I look forward to learning more and making better contributions in the future. Thanks again! |
Awesome, glad to have your contributions! We have a ton of work that needs doing, some easy so not so much :) |
In #2258 we attempted to add back in deprecated BIP-32 types - but we spelled the identifier incorrectly. The patch was then backported to the
0.31.x
branch in December but was only just noticed now.Fix typo in deprecated type from
Extendend
->Extended
.