Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-10 Thread Oleg Andreev via bitcoin-dev
OP_0 gives a zero length byte array because OP_0 == 0x00 which is equivalent to pushdata with zero length. OP_EQUAL compares byte strings as-is. So it will push "false" because empty string is not the same as a single-byte string with 0x00 byte in it. Value "false" in turn is encoded as empty s

Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread Oleg Andreev via bitcoin-dev
> One and zero should be defined as arrays of length one. Otherwise, it is > still possible to mutate the transaction by changing the length of the array. > > They should also be minimally encoded but that is covered by previous rules. These two lines contradict each other. Minimally-encoded "

Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread Nick ODell via bitcoin-dev
Your suggested modification seems sound. Though, a script author could do something similar right now by prefacing his IF with this: OP_DUP OP_DUP OP_0 OP_EQUAL OP_SWAP OP_1 OP_EQUAL OP_BOOLOR OP_NOTIF OP_RETURN OP_ENDIF [actual OP_IF goes here] That checks whether the input is 0 or 1, and r

Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread jl2012 via bitcoin-dev
I assume this proposal is implemented at the same time as BIP62. As long as OP_IF/OP_NOTIF interprets the argument as a number, zero-padded number and negative zero are already prohibited in BIP62 Tier Nolan via bitcoin-dev 於 2015-11-06 04:37 寫到: I meant not to use the OP_PUSH opcodes to do th

Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread Tier Nolan via bitcoin-dev
I meant not to use the OP_PUSH opcodes to do the push. Does OP_0 give a zero length byte array? Would this script return true? OP_0 OP_PUSHDATA1 (length = 1, data = 0) OP_EQUAL The easiest definition is that OP_0 and OP_1 must be used to push the data and not any other push opcodes. On Fri, N

Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread Tier Nolan via bitcoin-dev
One and zero should be defined as arrays of length one. Otherwise, it is still possible to mutate the transaction by changing the length of the array. They should also be minimally encoded but that is covered by previous rules. On Fri, Nov 6, 2015 at 8:13 AM, jl2012 via bitcoin-dev < bitcoin-dev

[bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability

2015-11-06 Thread jl2012 via bitcoin-dev
I have a new BIP draft for fixing OP_IF and OP_NOTIF malleability. Please comment: https://github.com/jl2012/bips/blob/master/opifmalleability.mediawiki Copied below: BIP: x Title: Dealing with OP_IF and OP_NOTIF malleability Author: jl2012 Status: Draft Type: Standards Track Create