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
Bug on witness verification (witness flag but empty witnesses) #2681
Comments
Hmm, right. So, the difference in serialization is very deliberate on the transaction level (and in previous discussion with Bitcoin Core folks they seemed interested in changing their transaction deserializer to match ours at least for RPC, see #2238), but this really shouldn't carry over to blocks! Rather, we should explicitly reject any blocks that transactions that hit this case. |
@TheBlueMatt to be clear, this isn't about zero-input transactions (where we do deliberately deviate from Core) but transactions that have inputs but don't use segwit. I think in this case the correct behavior is to reject the marker, even for individual transactions. |
Exactly. |
Ah, sorry, my mistake. We should reject those as well. We should also reject zero-input transactions in blocks :) |
Would be good to add to https://github.com/bitcoin-core/qa-assets |
I'll check it. |
My understanding is that the corresponding error message in Bitcoin Core for the rejection of this type of block is So I think it could make sense to re-use the qa-assets fuzz inputs for differential fuzzing, because years of CPU have been spent on them. Though, if fuzz inputs with new coverage are found by bitcoinfuzz, it also makes sense to feed them back to qa-assets. |
I intentionally wrote this target to be compatible with the qa-assets fuzz inputs. Unfortunately, it will not be possible for all the targets. |
By applying differential fuzzing (bitcoinfuzz) with rust-bitcoin and Bitcoin Core for block deserialization, I found out a bug during the transaction verification step. Basically, it's illegal to have the witness flag present and all witness stacks empty. That is, it has inputs, they have empty witnesses, but the transaction is flagged as segwit. It seems this case is not being catched properly.
Base64 to reproduce (for block deserialization): //////////+puampqalJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJqampKak4ODg4ODg4qampqVdRqampAgICAgIB/QITAAICAgICAgICAAABAABRAgICAgH9AgICAgICAgICAgICAgICAgICAgICAACRAAIAAAAAAAAAAFECAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgAAApECAAIAAAAAAAAAUQICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAICRAAAAAAAAFv////8AAD0A/////y3/////////AP////8AAQAAAAD///8=
The text was updated successfully, but these errors were encountered: