public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Oleg Andreev <oleganza@gmail.com>
To: Tier Nolan <tier.nolan@gmail.com>
Cc: Bitcoin Dev <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability
Date: Tue, 10 Nov 2015 11:52:46 +0100	[thread overview]
Message-ID: <B3EDCC26-F2CF-44AD-B373-0FD60DA3E30B@gmail.com> (raw)
In-Reply-To: <CAE-z3OX6bMY+RjphyDS-zAO=aXLs-B41G4m6ssUjFC03ByQkWA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]

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 string, just like result of OP_0.

> On 06 Nov 2015, at 10:37, Tier Nolan via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
> 
> 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, Nov 6, 2015 at 9:32 AM, Oleg Andreev <oleganza@gmail.com <mailto:oleganza@gmail.com>> wrote:
> 
> > 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 "zero" is an array of length zero, not one. I'd suggest defining this explicitly here as "IF/NOTIF argument must be either zero-length array or a single byte 0x01".
> 
> 
> 
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


[-- Attachment #2: Type: text/html, Size: 2848 bytes --]

      parent reply	other threads:[~2015-11-10 10:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  8:13 [bitcoin-dev] Dealing with OP_IF and OP_NOTIF malleability jl2012
2015-11-06  9:22 ` Nick ODell
2015-11-06  9:27 ` Tier Nolan
2015-11-06  9:32   ` Oleg Andreev
2015-11-06  9:37     ` Tier Nolan
2015-11-06 10:16       ` jl2012
2015-11-10 10:52       ` Oleg Andreev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B3EDCC26-F2CF-44AD-B373-0FD60DA3E30B@gmail.com \
    --to=oleganza@gmail.com \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    --cc=tier.nolan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox