Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YHs1O-0000Ej-Ue for bitcoin-development@lists.sourceforge.net; Sun, 01 Feb 2015 10:44:54 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.43 as permitted sender) client-ip=74.125.82.43; envelope-from=laanwj@gmail.com; helo=mail-wg0-f43.google.com; Received: from mail-wg0-f43.google.com ([74.125.82.43]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YHs1O-0001zD-3S for bitcoin-development@lists.sourceforge.net; Sun, 01 Feb 2015 10:44:54 +0000 Received: by mail-wg0-f43.google.com with SMTP id y19so33970393wgg.2 for ; Sun, 01 Feb 2015 02:44:48 -0800 (PST) X-Received: by 10.180.82.137 with SMTP id i9mr13574470wiy.38.1422787488067; Sun, 01 Feb 2015 02:44:48 -0800 (PST) Received: from amethyst.lan (e107003.upc-e.chello.nl. [213.93.107.3]) by mx.google.com with ESMTPSA id vq9sm22829544wjc.6.2015.02.01.02.44.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Feb 2015 02:44:47 -0800 (PST) Date: Sun, 1 Feb 2015 11:44:46 +0100 (CET) From: Wladimir To: Tamas Blummer In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Score: 1.2 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (laanwj[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 2.8 MALFORMED_FREEMAIL Bad headers on message from free email service 0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1YHs1O-0001zD-3S Cc: Bitcoin Dev Subject: Re: [Bitcoin-development] var_int ambiguous serialization consequences X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2015 10:44:55 -0000 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