Skip to content

Fixups for taproot improvements#778

Merged
sanket1729 merged 4 commits intorust-bitcoin:masterfrom
BP-WG:taproot/improvements-2
Jan 13, 2022
Merged

Fixups for taproot improvements#778
sanket1729 merged 4 commits intorust-bitcoin:masterfrom
BP-WG:taproot/improvements-2

Conversation

@dr-orlovsky
Copy link
Copy Markdown
Collaborator

@dr-orlovsky dr-orlovsky commented Jan 13, 2022

This addresses @Kixunil review comments in #696 post-merge

Update: also closes nits from issues #764 and #770

@dr-orlovsky dr-orlovsky added code quality Makes code easier to understand and less likely to lead to problems trivial Obvious, easy and quick to review (few lines or doc-only...) labels Jan 13, 2022
@dr-orlovsky dr-orlovsky added this to the 0.28.0 milestone Jan 13, 2022
@dr-orlovsky dr-orlovsky linked an issue Jan 13, 2022 that may be closed by this pull request
@dr-orlovsky dr-orlovsky mentioned this pull request Jan 13, 2022
20 tasks
Copy link
Copy Markdown
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 62a27a5

Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

Just a question to help me learn more.

let mut output_key = self.clone();
output_key.tweak_add_assign(&secp, &tweak_value).expect("Tap tweak failed");
TweakedKeyPair(output_key)
self.tweak_add_assign(&secp, &tweak_value).expect("Tap tweak failed");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't mean to de-reail your PR but why is it ok to panic here please? The docs of this function say that this can error if the resulting key would be invalid, is that not possible here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It will fail with negligible probability - multiple orders if magnitude less then probability of meteor hitting the server directly.

It can only fail if the tweak * G is the inverse of the original public key - which could not happen with hash computed out of key itself - or if the tweak is > than group order, which has that "several orders of magnitude of meteor hitting server" probability.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps the panic message should've been "Tap tweak broken" since that's a more likely cause for the error. (We had similar discussion not long ago.)

I wouldn't mind if the method itself just panicked without returning Result but that's another discussion.

Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

utACK 62a27a5

@sanket1729 sanket1729 merged commit b2de2bc into rust-bitcoin:master Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Makes code easier to understand and less likely to lead to problems trivial Obvious, easy and quick to review (few lines or doc-only...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-export Witness in lib.rs Document that serde impl of LeafVersion uses u8 in consensus encoding

4 participants