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

Update to secp256k1 0.21.2 #755

Merged
merged 2 commits into from
Jan 7, 2022
Merged

Conversation

sanket1729
Copy link
Member

No description provided.

@sanket1729 sanket1729 changed the title Update to secp256k1 0.21.2 [DO NOT MERGE]Update to secp256k1 0.21.2 Jan 6, 2022
@sanket1729 sanket1729 force-pushed the secp_update branch 2 times, most recently from 84c48f7 to 10883eb Compare January 6, 2022 18:35
apoelstra added a commit to rust-bitcoin/rust-secp256k1 that referenced this pull request Jan 6, 2022
1671dfc Release 0.21.2 (sanket1729)
837be22 Basic derives for Parity (sanket1729)
7059192 Wildcard export from key module (sanket1729)

Pull request description:

  Sorry for getting another point release. This time I have tested against this branch for rust-bitcoin rust-bitcoin/rust-bitcoin#755. Hopefully, this is the last release.

  Next release, we should have a Release Candidate for a couple of days before publishing a release.

ACKs for top commit:
  apoelstra:
    ACK 1671dfc

Tree-SHA512: 263ad027da3da764bd76f719200382c47ba21a976caefc23ebef45d1c4be35ddfc80ce619b57326310aaab22bbf75ca7f1db80b45e95ec076584805efb791f3f
@sanket1729 sanket1729 marked this pull request as ready for review January 6, 2022 23:00
@sanket1729 sanket1729 changed the title [DO NOT MERGE]Update to secp256k1 0.21.2 Update to secp256k1 0.21.2 Jan 6, 2022
We can check tweak add priv key with latest secp
@sanket1729
Copy link
Member Author

This is ready for review now and kind of a blocker for the rest of the PRs for the next release. @apoelstra, @dr-orlovsky , @Kixunil

@@ -700,8 +700,7 @@ impl ControlBlock {

/// Serialize to a writer. Returns the number of bytes written
pub fn encode<Write: io::Write>(&self, mut writer: Write) -> io::Result<usize> {
let first_byte: u8 =
(if self.output_key_parity { 1 } else { 0 }) | self.leaf_version.as_u8();
let first_byte: u8 = i32::from(self.output_key_parity) as u8 | self.leaf_version.as_u8();
Copy link
Member Author

Choose a reason for hiding this comment

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

Here, we rely on Parity being only one bit. But converting to u8 should be enough.

Copy link
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 91470f5

However, I'm highly surprised Parity is not an enum (Even, Odd) and even more strangely, impl From<i32> for Parity exists. I'd expect it to be TryFrom. I understand this is something from secp256k1, that's why I'm ACKing this even though I find it suspicious, maybe even wrong.

If someone could explain why it's not an enum, it'd be appreciated.

@sanket1729
Copy link
Member Author

If someone could explain why it's not an enum, it'd be appreciated.

This was a mistake in rust-secp and I the maintainers agree with it. I think we have to live with this now till the next release :(.

For what it's worth, rust-bitcoin only has states Parity(1)/Parity(0) and there is no function that takes input Parity from the user.

@Kixunil
Copy link
Collaborator

Kixunil commented Jan 7, 2022

As far as I can see, the consumer of rust-bitcoin could construct invalid ControlBlock. I personally wouldn't mind if fixing breaking release of secp256k1 was made (soonish) but if people feel it's not a good idea I can accept the sad reality.

@sanket1729 sanket1729 mentioned this pull request Jan 7, 2022
20 tasks
Copy link
Collaborator

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

utACK 91470f5 in order to unlock the rest of PRs required for Taproot, which depend on this.

However I feel that we need another major secp256k1 release fixing Parity (making it enum) before releasing new rust-bitcoin version.

@dr-orlovsky dr-orlovsky added the P-high High priority label Jan 7, 2022
@dr-orlovsky dr-orlovsky added this to the 0.28.0 milestone Jan 7, 2022
@dr-orlovsky
Copy link
Collaborator

One use of deprecated function:

warning: use of deprecated associated function `secp256k1::ecdsa::recovery::<impl secp256k1::Secp256k1<C>>::sign_recoverable`: Use sign_ecdsa_recoverable instead.
   --> src/util/misc.rs:323:29

Since this is a non-critical warning I will merge this anyway, but it may be nice to fix it in some other PR

@dr-orlovsky dr-orlovsky merged commit 7010672 into rust-bitcoin:master Jan 7, 2022
@dr-orlovsky dr-orlovsky added this to Done in Taproot Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants