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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
helo=mx.sourceforge.net)
by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
(envelope-from <mh.in.england@gmail.com>) id 1X9Y18-0000Lb-3p
for bitcoin-development@lists.sourceforge.net;
Tue, 22 Jul 2014 11:13:58 +0000
Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of gmail.com
designates 209.85.219.45 as permitted sender)
client-ip=209.85.219.45; envelope-from=mh.in.england@gmail.com;
helo=mail-oa0-f45.google.com;
Received: from mail-oa0-f45.google.com ([209.85.219.45])
by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
(Exim 4.76) id 1X9Y16-0007aA-Dt
for bitcoin-development@lists.sourceforge.net;
Tue, 22 Jul 2014 11:13:58 +0000
Received: by mail-oa0-f45.google.com with SMTP id i7so9399493oag.4
for <bitcoin-development@lists.sourceforge.net>;
Tue, 22 Jul 2014 04:13:51 -0700 (PDT)
MIME-Version: 1.0
X-Received: by 10.60.70.205 with SMTP id o13mr46997343oeu.38.1406027630888;
Tue, 22 Jul 2014 04:13:50 -0700 (PDT)
Sender: mh.in.england@gmail.com
Received: by 10.76.35.234 with HTTP; Tue, 22 Jul 2014 04:13:50 -0700 (PDT)
In-Reply-To: <53CD4E3A.1000605@certimix.com>
References: <53CD4E3A.1000605@certimix.com>
Date: Tue, 22 Jul 2014 13:13:50 +0200
X-Google-Sender-Auth: WMcWBRzAHgs-Gm3oZvS-dwtx-AM
Message-ID: <CANEZrP3q6QdVH1P0_FyOkE6SzG338pAGJ6NzDCEj52bXwnW-Sg@mail.gmail.com>
From: Mike Hearn <mike@plan99.net>
To: Sergio Lerner <sergiolerner@certimix.com>
Content-Type: multipart/alternative; boundary=001a11333df67bcdc504fec65122
X-Spam-Score: -0.5 (/)
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
(mh.in.england[at]gmail.com)
-0.0 SPF_PASS SPF: sender matches SPF record
1.0 HTML_MESSAGE BODY: HTML included in message
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
X-Headers-End: 1X9Y16-0007aA-Dt
Cc: bitcoin-development <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] Question on creating test cases for
block.CheckBlock()
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Tue, 22 Jul 2014 11:13:58 -0000
--001a11333df67bcdc504fec65122
Content-Type: text/plain; charset=UTF-8
There is no infrastructure for writing block chain unit tests
unfortunately. Last time I tried to fix this I ended up going down a rabbit
hole - Bitcoin wasn't written to be a testable codebase and as a result
reinitialising it from scratch is rather difficult (there are lots of
global variables that have to be reset to particular states and no real
list of where they are).
Instead what I ended up doing is extending the pull tester. This is a
bitcoinj based app (BitcoindComparisonTool in the codebase) which builds a
regtest chain and submits it to a local regtest node. It tests things like
reorgs and various rules. It speaks to the node only via P2P so how easy it
is to verify your BIP works will depend on that. Also the code needs
cleaning up, there's a lot of copy/paste coding going on in there.
On Mon, Jul 21, 2014 at 7:30 PM, Sergio Lerner <sergiolerner@certimix.com>
wrote:
> I'm working on a BIP which needs to modify the block acceptance rules. I
> have two ways of testing:
>
> - Mining blocks on the testnet
> - Creating test cases for Bitcoin Core.
>
> I want to create those test cases for block.CheckBlock(), which involves
> verifying 100 dynamically generated blocks.
> What is the state of the blockchain when a test case is executed ? Is is
> configured for the regtest, testnet3 or mainnet? What blocks are in the
> blockchain? Only the genesis block?
>
> checkblock_tests.cpp seems to be the only test case for CheckBlock() and
> it assumes the mainnet is configured.
> I need to use the regtest so I can create blocks of difficulty 1.
>
> Best regards and thank you in advance,
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
--001a11333df67bcdc504fec65122
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">There is no infrastructure for writing block chain unit te=
sts unfortunately. Last time I tried to fix this I ended up going down a ra=
bbit hole - Bitcoin wasn't written to be a testable codebase and as a r=
esult reinitialising it from scratch is rather difficult (there are lots of=
global variables that have to be reset to particular states and no real li=
st of where they are).<div>
<br></div><div>Instead what I ended up doing is extending the pull tester. =
This is a bitcoinj based app (BitcoindComparisonTool in the codebase) which=
builds a regtest chain and submits it to a local regtest node. It tests th=
ings like reorgs and various rules. It speaks to the node only via P2P so h=
ow easy it is to verify your BIP works will depend on that. Also the code n=
eeds cleaning up, there's a lot of copy/paste coding going on in there.=
</div>
<div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><br><div=
class=3D"gmail_quote">On Mon, Jul 21, 2014 at 7:30 PM, Sergio Lerner <span=
dir=3D"ltr"><<a href=3D"mailto:sergiolerner@certimix.com" target=3D"_bl=
ank">sergiolerner@certimix.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">I'm working on a BIP which needs to modi=
fy the block acceptance rules. I<br>
have two ways of testing:<br>
<br>
- Mining blocks on the testnet<br>
- Creating test cases for Bitcoin Core.<br>
<br>
I want to create those test cases for block.CheckBlock(), which involves<br=
>
verifying 100 dynamically generated blocks.<br>
What is the state of the blockchain when a test case is executed ? Is is<br=
>
configured for the regtest, testnet3 or mainnet? What blocks are in the<br>
blockchain? Only the genesis block?<br>
<br>
checkblock_tests.cpp seems to be the only test case for CheckBlock() and<br=
>
it assumes the mainnet is configured.<br>
I need to use the regtest so I can create blocks of difficulty 1.<br>
<br>
Best regards and thank you in advance,<br>
<br>
<br>
---------------------------------------------------------------------------=
---<br>
Want fast and easy access to all the code in your enterprise? Index and<br>
search up to 200,000 lines of code with a free copy of Black Duck<br>
Code Sight - the same software that powers the world's largest code<br>
search on Ohloh, the Black Duck Open Hub! Try it now.<br>
<a href=3D"http://p.sf.net/sfu/bds" target=3D"_blank">http://p.sf.net/sfu/b=
ds</a><br>
_______________________________________________<br>
Bitcoin-development mailing list<br>
<a href=3D"mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-develo=
pment@lists.sourceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/bitcoin-development=
" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/bitcoin-de=
velopment</a><br>
</blockquote></div><br></div>
--001a11333df67bcdc504fec65122--
|