Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C4FD283D for ; Fri, 21 Aug 2015 20:07:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-ig0-f177.google.com (mail-ig0-f177.google.com [209.85.213.177]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CA21914C for ; Fri, 21 Aug 2015 20:07:26 +0000 (UTC) Received: by igui7 with SMTP id i7so25646493igu.1 for ; Fri, 21 Aug 2015 13:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=VP7AI/+n3Eln6NA6Z1B6Yr+EE9hAqfUHrDzhh716ElA=; b=qZQm4Lnh2HZnIQkEsM+x0BsXPyXRWuKzkbKdyBIt6Kt64Wi1VCWPBRcZ7QdWJRCvdq hP8/Xd395+TCu+XrkogbSUo3Td2gZt87tcUltuDIR72U7tTFCefFjJQeZW8hlVApB//F X5n+XQslNiInhjSDxobNC60fjnG4bScgI4A8/hV3Zq73iR5u2eWM0m7S7Y1jwOuAkFdB uKrOFTyWcz5JPdrxLt6JJ3WMt2xHnObe05UFzhjEApVPAZRv6u+QWUbtqfF0mq54U7yv YdjfKRZdzFfAEZ7BcUCMpVdaS4Q6TyP55s30XlVXafW4s7TShfQGeDx2mV/JcEehCTKL etyw== X-Received: by 10.50.73.168 with SMTP id m8mr4187799igv.25.1440187646244; Fri, 21 Aug 2015 13:07:26 -0700 (PDT) MIME-Version: 1.0 References: <55B723EA.7010700@voskuil.org> <55B939CF.1080903@voskuil.org> <3390F712-879A-46E9-ABCD-D35B51190304@bitsofproof.com> In-Reply-To: From: Eric Lombrozo Date: Fri, 21 Aug 2015 20:07:15 +0000 Message-ID: To: =?UTF-8?B?Sm9yZ2UgVGltw7Nu?= , Tamas Blummer Content-Type: multipart/alternative; boundary=089e013a239c107c38051dd7d1bc X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, URIBL_BLACK autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Bitcoin Dev , Libbitcoin Subject: Re: [bitcoin-dev] Libconsensus separated repository (was Bitcoin Core and hard forks) X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Development Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 20:07:27 -0000 --089e013a239c107c38051dd7d1bc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Unfortunately we have no way of rigorously proving functional equivalence other than code review and unit testing. The simpler the consensus code (and the more we can write it in a style that affords provability of correctness) the easier it will be in the future to compare implementations= . Prior to swapping out implementations, we should at the least run it through the gauntlet and perhaps run both implementations side-by-side. All I/O should be treated abstractly in the API. In C++ I really like using a nearly bare-bones signal template for most async message handling, i.e. https://github.com/ciphrex/mSIGNA/blob/master/deps/Signals/src/Signals.h This greatly facilitates support for async bidirectional I/O, etc...with minimal overhead. But others might have other stylistic preferences. - Eric On Fri, Aug 21, 2015, 12:46 PM Jorge Tim=C3=B3n < bitcoin-dev@lists.linuxfoundation.org> wrote: > On Thu, Aug 20, 2015 at 10:35 AM, Tamas Blummer > wrote: > > Every re-implementation, re-factoring even copy-paste introduces a risk > of disagreement, > > but also open the chance of doing the work better, in the sense of > software engineering. > > But you don't want something better, you want something functionally > identical. > You may want to watch sipa's explanation on why "the implementation is > the specification" and the reasons to separate libconsensus: > https://youtu.be/l3O4nh79CUU?t=3D764 > > >> On Aug 20, 2015, at 10:06, Jorge Tim=C3=B3n wrote: > >> > >> > >> But the goal is not reimplementing the consensus rules but rather > >> extract them from Bitcoin Core so that nobody needs to re-implement > >> them again. > > > > > > > > My goal is different. Compatibility with Bitcoin is important as I also > want to deal with Bitcoins, > > but it is also imperative to be able to create and serve other block > chains with other rules and for those > > I do not want to carry on the legacy of an antique tool set and a > spaghetti style. > > > > Bits of Proof uses scala (akka networking), java (api service), c++ > (leveledb and now libconsensus) > > and I am eager to integrate secp256k1 (c) as soon as part of consensus. > The choices were > > made because each piece appears best in what they do. > > Since you already depend on libconsensus for VerifyScript, wouldn't it > be nice that it also offered VerifyTx, VerifyHeader and VerifyBlock? > You would still have complete control over storage, concurrency, > networking, policy... > My plan is for the C API to interface with the external storage by > passing a function pointer to it. > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > --089e013a239c107c38051dd7d1bc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Unfortunately we have no way of rigorously proving functiona= l equivalence other than code review and unit testing. The simpler the cons= ensus code (and the more we can write it in a style that affords provabilit= y of correctness) the easier it will be in the future to compare implementa= tions.

Prior to swapping out implementations, we should at the leas= t run it through the gauntlet and perhaps run both implementations side-by-= side.

All I/O should be treated abstractly in the API.

In C++ I really like using a nearly bare-bones signal templa= te for most async message handling, i.e. https://github.com/ciphr= ex/mSIGNA/blob/master/deps/Signals/src/Signals.h

This greatly facilitates support for async bidirectional I/O= , etc...with minimal overhead.

But others might have other stylistic preferences.

- Eric


On Fri, Aug 21, 2015, 12:46= PM=C2=A0Jorge Tim=C3=B3n <bitcoin-dev@lists.linuxfoundation.org> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">On Thu, Aug 20, 2015 at 10:35 AM, Tamas Blumm= er <tamas@bit= sofproof.com> wrote:
> Every re-implementation, re-factoring even copy-paste introduces a ris= k of disagreement,
> but also open the chance of doing the work better, in the sense of sof= tware engineering.

But you don't want something better, you want something functionally id= entical.
You may want to watch sipa's explanation on why "the implementatio= n is
the specification" and the reasons to separate libconsensus:
https://youtu.be/l3O4nh79CUU?t=3D764

>> On Aug 20, 2015, at 10:06, Jorge Tim=C3=B3n <jtimon@jtimon.cc&g= t; wrote:
>>
>>
>> But the goal is not reimplementing the consensus rules but rather<= br> >> extract them from Bitcoin Core so that nobody needs to re-implemen= t
>> them again.
>
>
>
> My goal is different. Compatibility with Bitcoin is important as I als= o want to deal with Bitcoins,
> but it is also imperative to be able to create and serve other block c= hains with other rules and for those
> I do not want to carry on the legacy of an antique tool set and a spag= hetti style.
>
> Bits of Proof uses scala (akka networking), java (api service), c++ (l= eveledb and now libconsensus)
> and I am eager to integrate secp256k1 (c) as soon as part of consensus= . The choices were
> made because each piece appears best in what they do.

Since you already depend on libconsensus for VerifyScript, wouldn't it<= br> be nice that it also offered VerifyTx, VerifyHeader and VerifyBlock?
You would still have complete control over storage, concurrency,
networking, policy...
My plan is for the C API to interface with the external storage by
passing a function pointer to it.
_______________________________________________
bitcoin-dev mailing list
= bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mail= man/listinfo/bitcoin-dev
--089e013a239c107c38051dd7d1bc--