fuzz: assert we accept any PSBT serialization we create#34725
fuzz: assert we accept any PSBT serialization we create#34725achow101 merged 1 commit intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsNo conflicts as of last run. |
|
Can you share the fuzz test case that this fixes? |
|
The input that triggers the crash is already present in qa-assets, and therefore should be run in CI. Here is the corresponding PSBT: Calling |
|
ACK fc2245e |
|
Actually, is this a duplicate of #34219? Seems like that got review, but just stalled? |
|
Oh i had missed it! I just pushed that as a separate PR while i was reviewing #21283. The fix is virtually the same (as per #34725 (comment) i don't think How about merging/backporting #34219 then i rebase this PR with only the fuzz harness commit, that does not necessarily need backporting? |
That seems fine. |
fc2245e to
c383c3c
Compare
|
Rebased after #34219 was merged, to only contain the patch to the fuzzing harness. |
|
crACK c383c3c Feel free to disregard as orthogonal or insignificant, but I think it would be valuable to also add a (programmatic) test for the particular case addressed in #34219 / in this PR prior to rebase either as a unit test (e.g. davidgumberg@a58ac09) or as a functional test case (e.g. davidgumberg@395ebfa). While redundant with the cases added in #34219 to |
c383c3c to
d76ec4d
Compare
This will prevent us from creating a serialization we do not accept going forward.
|
@davidgumberg that feels really redundant, so i'm not too keen. Especially as it would still be specific to this very instance of the roundtrip bug, and not be able to catch others. The fuzz harness modification in this PR is also another test for the bug fixed in #34219, which i hope is easier for a reader to review / comprehend than the raw PSBT added there. |
|
crACK d76ec4d Ran fuzzing for ~20 minutes with no issues.
That's what I intended, but I'm satisfied that checking roundtripping is very likely to catch any issue related to deserializing a key that fails |
|
ACK d76ec4d |
Invalid public keys were accepted in Musig2 partial signatures. Because we serialize invalid keys as the empty byte string, this would lead us to creating an invalid PSBT serializations.This can be checked by reverting the first commit with the fix and simply running the target against the existing qa-assets corpus for thepsbtharness.This patch found the issue fixed in #34219 with a single run against the existing qa-assets corpus. It is useful to make sure there are no similar bugs, and we don't introduce roundtrip regressions outside of the specifc instance of accepting invalid public keys in Musig2 fields.
(Edited on March 4 to only contain the fuzz harness patch)