-
Notifications
You must be signed in to change notification settings - Fork 630
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
Witness presence check not tested #2183
Comments
Another missing test: check that decoding an otherwise-valid transaction encoded with non-minimal VarInt fails. |
it looks like this needs to be re-factored also. L1090 means the empty test in the condition you mentioned won't ever be empty here. |
You're confusing it with witness flag, that one is correct. (I meant the code is, didn't verify the tests.) |
L1088 and L1095 do the same thing. I'm not saying it's incorrect, just that it looks like it decodes twice which is not needed? I read over BIP-141 that is mentioned in the comments, but it doesn't look like this BIP describes the TX serialization, or am I missing it? Is there a different BIP that describes the serialization/de-serialization of a general transaction? |
They don't, the cursor is already moved in the second call. Note that From quick look it looks like the BIP doesn't explicitly say that wtxid serialization is the same as P2P serialization but nevertheless it is. |
I would like to solve this issue, But I couldn't find any test for |
You should dig into the call chain starting an |
I think you shouldn't worry about that. Just add a test that passes in an invalid transaction with the mentioned errors. Somewhere in the tests modules you'll find a list of valid and invalid hexes. |
I'm facing an issue. I've attempted to identify hexes that might cause failures, but none of them triggered the required error. Then let mut tx_without_witness = realtx;
tx_without_witness.input.iter_mut().for_each(|input| input.witness.clear()); After this modification, I serialized If anyone has insights or suggestions on how to properly serialize the transaction for testing purposes, your help would be greatly appreciated. |
It's because the library serializes correctly. You have to produce invalid serialization manually. |
You might also be able to modify one of the fuzztests to trigger on a specific error, and then it'll find a test case for you. |
I managed to find it by chance (failing the roundtrip test) when working on #2184
So in fact it is tested by the fuzzer. However, an explicit test would still be great because it's faster to run and much easier to understand what went wrong. |
This condition appears untested. I've been doing some experiments which didn't perform the check and the tests did not fail.
The text was updated successfully, but these errors were encountered: