Skip to content

Remove fuzztaget and cleanup psbt finalizer #290

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

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

sanket1729
Copy link
Member

No description provided.

})?;
if target != flag {
if target != ecdsa_sig.hash_ty {
// hash_ty is guaranteed to follow standardness rules
Copy link
Member

Choose a reason for hiding this comment

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

In 7f4adf5:

I think this comment can be dropped -- standardness isn't actually relevant to this check, which is just that the signature hashtype matches the one required by the PSBT.

Also, I don't think that standardness is actually guaranteed here. See this code: rust-bitcoin/rust-bitcoin#669 (comment)

Copy link
Member Author

@sanket1729 sanket1729 Jan 13, 2022

Choose a reason for hiding this comment

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

I think that is probably a bug upstream because we will risk generating wrong signatures. Anything that is consensus valid sighashtype byte (0x01, 0x02, x03, 0x81, 0x82, and 0x83) is mapped to sighash all. Consider a case with 0x05 sighash byte, while signing, we sighash_u32 as 0x05u32, but while serializing it, we check it as 0x01 because the information that sighash_all from 0x05 is lost.

Copy link
Member

Choose a reason for hiding this comment

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

oo good catch!

I think the bug is actually that we're losing information, rather than that we allow non-standard sighash types in PSBT. I can see how this happened, since this recent PSBT thing is the first time that we've ever deliberately supported non-standard sighash types..

Copy link
Member

Choose a reason for hiding this comment

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

I opened rust-bitcoin/rust-bitcoin#777 about this.

For now I still think we should remove this comment, because standardness is irrelevant, although you could add a comment linking to that rust-bitcoin issue.

apoelstra
apoelstra previously approved these changes Jan 14, 2022
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK bb9f2a0

@sanket1729
Copy link
Member Author

The sighash issue was taken upstream to rust-bitcoin and resolved cleanly there. The current code only parses PsbtSigHashType using the new method ecdsa_sighash_ty correctly and was merged in #301 while updating to bitcoin 0.28-rc1. The scope of this PR is now only removing the fuzztarget

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK a142ab4

@JeremyRubin
Copy link
Contributor

ack

@sanket1729 sanket1729 merged commit a881b47 into rust-bitcoin:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants