public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Tamas Blummer <tamas@bitsofproof•com>
To: Wladimir <laanwj@gmail•com>
Cc: Bitcoin Dev <bitcoin-development@lists•sourceforge.net>
Subject: Re: [Bitcoin-development] var_int ambiguous serialization consequences
Date: Sun, 1 Feb 2015 12:42:05 +0100	[thread overview]
Message-ID: <B2C9D852-1C58-4F33-B17E-2E6A377E3B70@bitsofproof.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1502011133510.21504@nzrgulfg.ivfhpber.pbz>


[-- Attachment #1.1: Type: text/plain, Size: 1366 bytes --]

Thanks for the clarification. Yes, I referred to CompactSize using the lingo of https://en.bitcoin.it/wiki/Protocol_documentation

I am not sure if it is current concern. Apparently an exception is thrown if non-canonical CompactSize in a transaction s parsed.
Is it ensured that transactions are always parsed before computing their hash?

Tamas Blummer

On Feb 1, 2015, at 11:44 AM, Wladimir <laanwj@gmail•com> wrote:

> 
> 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
> 
> 


[-- Attachment #1.2: Type: text/html, Size: 2636 bytes --]

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 496 bytes --]

  reply	other threads:[~2015-02-01 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01  9:33 Tamas Blummer
2015-02-01 10:44 ` Wladimir
2015-02-01 11:42   ` Tamas Blummer [this message]
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=B2C9D852-1C58-4F33-B17E-2E6A377E3B70@bitsofproof.com \
    --to=tamas@bitsofproof$(echo .)com \
    --cc=bitcoin-development@lists$(echo .)sourceforge.net \
    --cc=laanwj@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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