1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
Return-Path: <roconnor@blockstream.io>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id BFFB8C8B
for <bitcoin-dev@lists.linuxfoundation.org>;
Fri, 28 Jun 2019 11:16:58 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-io1-f54.google.com (mail-io1-f54.google.com
[209.85.166.54])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 53CC487D
for <bitcoin-dev@lists.linuxfoundation.org>;
Fri, 28 Jun 2019 11:16:58 +0000 (UTC)
Received: by mail-io1-f54.google.com with SMTP id r185so11684427iod.6
for <bitcoin-dev@lists.linuxfoundation.org>;
Fri, 28 Jun 2019 04:16:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=blockstream.io; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=muNmRrptca/GQuV3lWFDB/STF5KkCRPWDh0lhfFmgcI=;
b=lVXBlM97yfGI/Cl6VYPlsGkBCqV8Jd3pZMI7INw5VovpqeYRVlC5WULFo0fx09jmfq
uL3N5CDcy7CiQfTz4sixju2LiFGP+k+BkphOgBS6hSqRI4NSwjbWtSf3aXyWZIHZ6nan
oE8kdthBghrDBzdQ3rXL3ZQYdLafWoII4T26g=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=muNmRrptca/GQuV3lWFDB/STF5KkCRPWDh0lhfFmgcI=;
b=FVj8IuUNLgLuODjQPIQ4XGzk4mcYIn5kxtGPHW+Fb8MiHJyvNO+dPiuex6A1omguRq
2MEghw17/8IsDIkcTS8Cqyx7ltFw7US+M7iJUi8C6fPiL5YGDYYDKD1dO85LVpT9nI3k
6tC6KAuYHFjXBGZiXczaj4yLVLI0T5a9Y6P06oe2wgsdibLbfM/3aqGzT2M5hUnxxWl5
LmN+lZdvV9L42Am5g7UedCVGnpGi0AEJ7lnloye91k5sH5As9YUS1oE3VEjnLDKDJV7W
eZOR6K2DGJ28lTLRP+mXU1t4Nc0Iz9tVBHvmCt4YApCaZgFZn41J9iYJnL9DhUCSVHrx
5CCg==
X-Gm-Message-State: APjAAAW3JTYgdqLVMHZW1Jv7WrZpkFj3BjtGiqjFfpgEhDsYpxAJXr8O
Ev/upsFYd4O5/K1WRxW2Jj6k0VXy71p9+2y5uUPYMD0XGtQ=
X-Google-Smtp-Source: APXvYqwiTrJCt+YeJ+DRNz3ktYLtiDo/mBOvVWE0R0S5+sauYz5LH6AV3883XKoCwFocSTUH83mcyDdtDztd7BKL4hg=
X-Received: by 2002:a5e:aa15:: with SMTP id s21mr9668171ioe.221.1561720617528;
Fri, 28 Jun 2019 04:16:57 -0700 (PDT)
MIME-Version: 1.0
References: <CAPg+sBg6Gg8b7hPogC==fehY3ZTHHpQReqym2fb4XXWFpMM-pQ@mail.gmail.com>
<CAMZUoKnniSEy4RM2DWCRxzVyYsGJ3Rbw4sbFv0zxuPi9gwoXYA@mail.gmail.com>
<20190628094937.u5zisdhdyfc6g5ts@erisian.com.au>
In-Reply-To: <20190628094937.u5zisdhdyfc6g5ts@erisian.com.au>
From: "Russell O'Connor" <roconnor@blockstream.io>
Date: Fri, 28 Jun 2019 07:16:46 -0400
Message-ID: <CAMZUoK==mXiJQjcJO+KgxtCSf9qBan4tgsGzfPKLjP4CHcZ_iA@mail.gmail.com>
To: Anthony Towns <aj@erisian.com.au>
Content-Type: multipart/alternative; boundary="000000000000a5a0c7058c606a42"
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
X-Mailman-Approved-At: Fri, 28 Jun 2019 14:40:14 +0000
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Taproot proposal
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Fri, 28 Jun 2019 11:16:58 -0000
--000000000000a5a0c7058c606a42
Content-Type: text/plain; charset="UTF-8"
Hmm? If I'm following what you mean, that's not the P2P rules, it's the
> Unserialize code, in particular:
>
> compat/assumptions.h:52:static_assert(sizeof(int) == 4, "32-bit int
> assumed");
>
> serialize.h:289:uint64_t ReadCompactSize(Stream& is)
>
> serialize.h-679-template<typename Stream, unsigned int N, typename T,
> typename V>
> serialize.h-680-void Unserialize_impl(Stream& is, prevector<N, T>& v,
> const V&)
> serialize.h-681-{
> serialize.h-682- v.clear();
> serialize.h:683: unsigned int nSize = ReadCompactSize(is);
>
> (and other Unserialize_impl implementations)
>
> However, ReadCompactSize throws "size too large" if the return value is
> greater than MAX_SIZE == 0x02000000 =~ 33.5M, which prior to the implicit
> cast to 32 bits in Unserialize_impl. And it looks like that check's been
> there since Satoshi...
>
> So as far as I can see, that encoding's just unsupported/invalid, rather
> than equivalent/non-canonical?
>
Thanks for this correction! I totally missed that MAX_SIZE == 0x02000000.
I think I mistook it for SIZE_MAX when reviewing this, or just didn't
notice it at all.
Cheers,
> aj
>
>
--000000000000a5a0c7058c606a42
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
Hmm? If I'm following what you mean, that's not the P2P rules, it&#=
39;s the<br>
Unserialize code, in particular:<br>
<br>
=C2=A0 compat/assumptions.h:52:static_assert(sizeof(int) =3D=3D 4, "32=
-bit int assumed");<br>
<br>
=C2=A0 serialize.h:289:uint64_t ReadCompactSize(Stream& is)<br>
<br>
=C2=A0 serialize.h-679-template<typename Stream, unsigned int N, typenam=
e T, typename V><br>
=C2=A0 serialize.h-680-void Unserialize_impl(Stream& is, prevector<N=
, T>& v, const V&)<br>
=C2=A0 serialize.h-681-{<br>
=C2=A0 serialize.h-682-=C2=A0 =C2=A0 v.clear();<br>
=C2=A0 serialize.h:683:=C2=A0 =C2=A0 unsigned int nSize =3D ReadCompactSize=
(is);<br>
<br>
=C2=A0 (and other Unserialize_impl implementations)<br>
<br>
However, ReadCompactSize throws "size too large" if the return va=
lue is<br>
greater than MAX_SIZE =3D=3D 0x02000000 =3D~ 33.5M, which prior to the impl=
icit<br>
cast to 32 bits in Unserialize_impl. And it looks like that check's bee=
n<br>
there since Satoshi...<br>
<br>
So as far as I can see, that encoding's just unsupported/invalid, rathe=
r<br>
than equivalent/non-canonical?<br></blockquote><br></div><div class=3D"gmai=
l_quote">Thanks for this correction!=C2=A0 I totally missed that MAX_SIZE =
=3D=3D 0x02000000.=C2=A0 I think I mistook it for SIZE_MAX when reviewing t=
his, or just didn't notice it at all.</div><div class=3D"gmail_quote"><=
br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers,<br>
aj<br>
<br>
</blockquote></div></div>
--000000000000a5a0c7058c606a42--
|