summaryrefslogtreecommitdiff
path: root/9d/c5b12366c76a6493c7fc1880502e19be42d814
blob: 3fb131cb4055bcc3ab0e0b241a653771a200d4b1 (plain)
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
Return-Path: <bram@bittorrent.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id CE1E4941
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 31 Mar 2017 20:38:18 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-io0-f171.google.com (mail-io0-f171.google.com
	[209.85.223.171])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 26625140
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 31 Mar 2017 20:38:18 +0000 (UTC)
Received: by mail-io0-f171.google.com with SMTP id l7so46789073ioe.3
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 31 Mar 2017 13:38:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=bittorrent-com.20150623.gappssmtp.com; s=20150623;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=iDmiQjbbs+ncOaSPZQyrQa9MO3yFcmcOHTqsF/1P1Eo=;
	b=SjW1v0/r4ZzN+1U3/OOiSiniMlSpTuPeO3vVoDCb+fUe6+W6ij5CaEjVQb5DMLwwMV
	yX8Hb7VYfwYanwU+07tZC88Ir5mvRiiuQ8KDhCZbfKublWWUc7CzJzXRQYoLeUQbu3mt
	ieVpfg3ElDmLCQihrjCW1dHUO6lXGifU34IHKXxACwytWVwCLEH/AEXffzrVBwqkEzfJ
	C1VcRYcrwRXT2yMBWTuWNBVrIoChkzyunOLJEYcuaHO14HmPDoSis+zwks9YAJe7KS9+
	Cm01+7LhG+4UY3256RWGmCDHBCc0bKIOyPfkF0hukZ5HqWs3VBjw7yqAi6eJeFgusqxK
	hfhQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=iDmiQjbbs+ncOaSPZQyrQa9MO3yFcmcOHTqsF/1P1Eo=;
	b=GFszk1/z+NgAwhZKyfI4QXF2mJJBnizGZHdV7xYACl6kK/qtZiut5yW99urQHaFIcS
	qj46lalbP4FQsAt80mnLHvomc9dT8dNyOakwE5gg9sTCgVq9jSrZ9aXuX+DbsiEH6+t9
	tGW5dE1DhDbpzOTVDJvxGLNkrUKcH9Dg6D/MN6c/WYmpQYxfKiqzIfgy7cppQz16YSTI
	Scda8IkTBcBUgyrwWxbKiIpiQMmQyGlNYqO3n8/bN1ab1ZrhpQ3LRB3O+Kd4YUrhYZHY
	hhmA2WAR1mS3fN8UfxsgJpQYqOYETq0O31R1NEjynoRnO3oOzVHDAPqQShVaQxHxHaZd
	xfUQ==
X-Gm-Message-State: AFeK/H25evbducxtrUYhf5u4EItH+LjzcbkXMB+bYaRI8a+h9Jf6pJmqZ0BdczXNms5TGOA0xLjyJ1TqkhbMqv3r
X-Received: by 10.107.50.206 with SMTP id y197mr5603384ioy.214.1490992697451; 
	Fri, 31 Mar 2017 13:38:17 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.36.184.70 with HTTP; Fri, 31 Mar 2017 13:38:16 -0700 (PDT)
In-Reply-To: <20170301223101.GA17022@savin.petertodd.org>
References: <20170224010943.GA29218@savin.petertodd.org>
	<CA+KqGkrOK76S3ffPJmpqYcBwtSeKESqN16yZsrwzDR6JZZmwFA@mail.gmail.com>
	<20170224025811.GA31911@savin.petertodd.org>
	<CA+KqGkq7gavAnAk-tcA+gxL2sWpv3ENhEmHrQHaPdyAsKrLjGg@mail.gmail.com>
	<20170224031531.GA32118@savin.petertodd.org>
	<CA+KqGkrfhg3GnbWwvKXHQ2NWuCnfzYyTPUxRhzYMuDBiNQR4eA@mail.gmail.com>
	<20170224043613.GA32502@savin.petertodd.org>
	<CA+KqGkpi4GvgU-K6vt-U5ZN4AkpjZ0rruzddoJS4-V0TcnyqUQ@mail.gmail.com>
	<20170225041202.GA11152@savin.petertodd.org>
	<CA+KqGkqs8F1hK6y-JnLFRpqhQ5i8i+MXVmtGUQBYmE5d1OCAAg@mail.gmail.com>
	<20170301223101.GA17022@savin.petertodd.org>
From: Bram Cohen <bram@bittorrent.com>
Date: Fri, 31 Mar 2017 13:38:16 -0700
Message-ID: <CA+KqGkoKy4spzi4mHBEfqXV8e9xwf8GA8oWN-Nqv7kNH_yPqpg@mail.gmail.com>
To: Peter Todd <pete@petertodd.org>
Content-Type: multipart/alternative; boundary=001a1144795418427b054c0ccada
X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE,
	RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] A Better MMR Definition
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, 31 Mar 2017 20:38:18 -0000

--001a1144795418427b054c0ccada
Content-Type: text/plain; charset=UTF-8

On Wed, Mar 1, 2017 at 2:31 PM, Peter Todd <pete@petertodd.org> wrote:

>
> A better way to present your work would have been to at least explain that
> at
> the top of the file, and perhaps even better, split the reference
> implementation and optimized implementation into two separate files. If
> you did
> this, you'd be more likely to get others to review your work.
>

I've now added explanation to the README, reorganized the files, and added
some comments:

https://github.com/bramcohen/MerkleSet

In fact, I'd suggest that for things like edge cases, you test edge cases in
> separate unit tests that explain what edge cases you're trying to catch.
>

The tests work by doing a lot of exercising on pseudorandom data, an
approach which does a good job of hitting all the lines of code and edge
cases and requiring very little updating as the implementation changes, at
the expense of it taking a while for tests to run. The advantage of very
custom unit tests is that they run almost instantly, at the cost of
requiring painstaking maintenance and missing more stuff. I've come to
favor this approach in my old age.

The proportion of code devoted to tests is more than it looks like at first
blush, because all the audit methods are just for testing.

--001a1144795418427b054c0ccada
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On W=
ed, Mar 1, 2017 at 2:31 PM, Peter Todd <span dir=3D"ltr">&lt;<a href=3D"mai=
lto:pete@petertodd.org" target=3D"_blank">pete@petertodd.org</a>&gt;</span>=
 wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>A better w=
ay to present your work would have been to at least explain that at<br>
the top of the file, and perhaps even better, split the reference<br>
implementation and optimized implementation into two separate files. If you=
 did<br>
this, you&#39;d be more likely to get others to review your work.<br></bloc=
kquote><div><br></div><div>I&#39;ve now added explanation to the README, re=
organized the files, and added some comments:</div><div><br></div><div><a h=
ref=3D"https://github.com/bramcohen/MerkleSet">https://github.com/bramcohen=
/MerkleSet</a><br></div><div><br></div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">In fact, I&#39;d suggest that for things like edge cases, you=
 test edge cases in<br>
separate unit tests that explain what edge cases you&#39;re trying to catch=
.<br></blockquote><div><br></div><div>The tests work by doing a lot of exer=
cising on pseudorandom data, an approach which does a good job of hitting a=
ll the lines of code and edge cases and requiring very little updating as t=
he implementation changes, at the expense of it taking a while for tests to=
 run. The advantage of very custom unit tests is that they run almost insta=
ntly, at the cost of requiring painstaking maintenance and missing more stu=
ff. I&#39;ve come to favor this approach in my old age.</div><div><br></div=
><div>The proportion of code devoted to tests is more than it looks like at=
 first blush, because all the audit methods are just for testing.</div><div=
><br></div></div></div></div>

--001a1144795418427b054c0ccada--