public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Wladimir <laanwj@gmail.com>
To: Tamas Blummer <tamas@bitsofproof.com>
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] var_int ambiguous serialization consequences
Date: Sun, 1 Feb 2015 11:44:46 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.10.1502011133510.21504@nzrgulfg.ivfhpber.pbz> (raw)
In-Reply-To: <D89EBAA3-ED78-4D9C-B693-FBBF27501938@bitsofproof.com>


On Sun, 1 Feb 2015, Tamas Blummer wrote:

> I wonder of consequences if var_int is used in its longer than necessary forms (e.g encoding 1 as 0xfd0100 instead of 0x01)

In serialize.h lingo you are talking about CompactSize, not VarInt.

CompactSizes indeed have redundancy in their representation, i.e. the same 
number can be represented as up to four different byte sequences.

VARINTs have a different format that (AFAIK) isn't used anywhere in 
the block chain. See WriteVarInt / ReadVarInt. These were designed to 
not have any redundancy in their representation.

> This is already of interest if applying size limit to a block, since transaction count is var_int but is not part of the hashed header or the
> merkle tree.

Are you sure that this is a current concern? Non-canonical CompactSizes 
are forbidden - in serialize.h this is flagged in ReadCompactSize.

Wladimir




  reply	other threads:[~2015-02-01 10:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01  9:33 [Bitcoin-development] var_int ambiguous serialization consequences Tamas Blummer
2015-02-01 10:44 ` Wladimir [this message]
2015-02-01 11:42   ` Tamas Blummer
2015-02-01 15:00 ` Pieter Wuille

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=alpine.DEB.2.10.1502011133510.21504@nzrgulfg.ivfhpber.pbz \
    --to=laanwj@gmail.com \
    --cc=bitcoin-development@lists.sourceforge.net \
    --cc=tamas@bitsofproof.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