Title: script_invalid.json and MINIMALDATA test vectors Post by: piotr_n on November 07, 2015, 05:23:04 PM It's probably something I'm missing, but I haven't been able to figure out why certain test vectors with MINIMALDATA flag are expected to return FAIL, in the test suite.
I mean, I assume that all the script inside script_invalid.json (https://github.com/bitcoin/bitcoin/blob/master/src/test/data/script_invalid.json) are a failing ones - aren't they? Because if so, can someone please explain me why e.g. these ones are supposed to fail: Code: ["0x01 0x81", "DROP 1", "MINIMALDATA", "-1 minimally represented by OP_1NEGATE"], Code: ["0x4c 0x48 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", "DROP 1", "MINIMALDATA", Which specific code triggers these failures? Title: Re: script_invalid.json and MINIMALDATA test vectors Post by: hhanh00 on November 07, 2015, 08:09:14 PM You can represent these numbers with single op_codes
Code: ["0x01 0x81"] = ["0x4f"] You don't need PUSH_DATA1 for data <= 75 bytes Code: "0x4c 0x48 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", They only fail if you pass the "MINIMALDATA" flag to the verification routine. I believe they are in to enforce BIP 62 (not yet in effect) https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki#push-operators Implemented at: https://github.com/bitcoin/bitcoin/blob/923c5e93a90a6eddde3ab8589fc393da95bbc489/src/script/interpreter.cpp#L215 Title: Re: script_invalid.json and MINIMALDATA test vectors Post by: piotr_n on November 08, 2015, 08:25:39 AM Thank you.
So, as for the code on the master branch, these tests are not supposed to pass? Are they being run for the release cycle? Is there any way to find out which of the vectors are not supposed to pass with the code from the current head? Reason I ask is because I am trying to keep my script parsing implementation in sync with the core's head. Figured that passing the core's test vectors should be a good measure of the compatibility, but apparently it isn't. Title: Re: script_invalid.json and MINIMALDATA test vectors Post by: hhanh00 on November 09, 2015, 01:39:49 AM They pass because the test driver sends the minimaldata flag. It's the last field of the test data.
Your implementation could do the same thing. Title: Re: script_invalid.json and MINIMALDATA test vectors Post by: piotr_n on November 09, 2015, 11:06:14 AM All right, seems that I'm good now :)
Thanks mate, it helped me a lot! |