From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 10AE9273 for ; Thu, 25 Jun 2015 21:02:28 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com [209.85.192.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D731111F for ; Thu, 25 Jun 2015 21:02:26 +0000 (UTC) Received: by qgal13 with SMTP id l13so29197491qga.3 for ; Thu, 25 Jun 2015 14:02:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=C8tjAW1UfwLK78subLBwDqnaaSYH3BvaaTc0e/Q97hw=; b=LOyESBNGe4PcknzmrDhWIHj7kvYI92s56dHB3wp+ORdfBevUg9TaHPwt1MLg5IuKp2 AJZAKR+iZ1gn1d+SzKDuFHjm6CRaz/TMB8T+SgAfZwXQoh/pOozGDWJYVmS3iPwjebCH fUIcl+Lx/zdVoIQhAPcRPl2Fol+yaLxH+kmuQT/UiCIjQoz8EDfEfKj++bPQnVNlVICc TDHkL9oo/zsUvsKR805D1JaiE1QMyGkIyvUJIKxgtdJDoRdbYENEP6/18FTLSDI8PumK HnnRv9hFO9M27xovSmORfYHjNpM+bugh7qXofvXlLnfosPqJ+IoMUGWGugxHPI5VOJHM U/4w== X-Gm-Message-State: ALoCoQmfSfbgoUaleMGO1hyMVAHRxg107HcOBDDEaCYOUls2bTHf6wQ5tQmOKZGa/aEWnG6TwBC8 MIME-Version: 1.0 X-Received: by 10.55.18.14 with SMTP id c14mr73840599qkh.51.1435266146020; Thu, 25 Jun 2015 14:02:26 -0700 (PDT) Received: by 10.96.127.227 with HTTP; Thu, 25 Jun 2015 14:02:25 -0700 (PDT) In-Reply-To: <871th3t1go.fsf@rustcorp.com.au> References: <871th3t1go.fsf@rustcorp.com.au> Date: Thu, 25 Jun 2015 23:02:25 +0200 Message-ID: From: Kalle Rosenbaum To: Rusty Russell Content-Type: multipart/alternative; boundary=001a11471190cac5b205195df07d X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: bitcoin-dev@lists.linuxfoundation.org Subject: Re: [bitcoin-dev] [RFC] IBLT block testing implementation 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: Thu, 25 Jun 2015 21:02:28 -0000 --001a11471190cac5b205195df07d Content-Type: text/plain; charset=UTF-8 2015-06-23 7:53 GMT+02:00 Rusty Russell : > Hi all, > > I've come up with a model for using IBLT to communicate blocks > between peers. The gory details can be found on github: it's a > standalone C++ app for testing not integrated with bitcoin. > > https://github.com/rustyrussell/bitcoin-iblt Good to see that you're working on this. Really exciting! I want to take the opportunity to link to my previous work on IBLTs, for those that haven't seen it, where I investigate the behaviour of the IBLT when changing different parameters, like cell count, hashFunctionCount etc: https://github.com/kallerosenbaum/bitcoin-iblt/wiki >From glancing over your implementation, I see that you don't use a keyHashSum, in fact you don't use a key at all, but only a concatenatenation of (txid48, fragid, tx-chunk) as value. Here the txid48+fragid functions as a kind of keyHashSum. I think this might be a very good idea, If you have a false positive with count == 1, then you would probably detect it if fragid is outside reasonable limit from from base_fragid. Did you implement your idea to remove all the count==1 fagments in ascending order of (fragid-base_fragid)? Anyhow, I think we should make some more comparable tests, just as you proposed last year when I didn't reply, sorry... My code is a more straight forward implementation of the IBLT paper (http://arxiv.org/pdf/1101.2245.pdf) and encoding blocks is done pretty much as Gavin proposed in his gist. That should function as a baseline so that we can validate that your optimizations actually work. Please contact me directly if you are interested in that, and we'll figure something out. More comments/questions inline: > > Assumptions and details: > > 1. The base idea comes from Gavin's Block Propagation gist: > https://gist.github.com/gavinandresen/e20c3b5a1d4b97f79ac2 > > 2. It relies on similarity in mempools, with some selection hints. This > is designed to be as flexible as possible to make fewest assumptions > on tx selection policy. > > 3. The selection hints are: minimum fee-per-byte (fixed point) and > bitmaps of included-despite-that and rejected-despite-that. The > former covers things like child-pays-for-parent and the priority > area. The latter covers other cases like Eligius censoring "spam", > bitcoin version differences, etc. > There is a chance that the bit prefix of the added or removed tx is not unique within the receiver's mempool. In that case the receiver can probably just use the earliest matching transaction and hope for the best. If not -> bad luck. Is that how you do it? > 4. Cost to represent these exceptional added or excluded transactions is > (on average) log2(transactions in mempool) bits. These exceptional tx *could* instead be encoded in the IBLT, just as if they were unknown differences. Your bitmaps is probably a more compact representation, but it's also more complex. > > 5. At Peiter Wuille's suggestion, it is designed to be reencoded between > nodes. It seems fast enough for that, and neighboring nodes should > have most similar mempools. > What is the purpose of reencoding when relaying? Is that to improve the failure probability as new tx may have arrived in the mempool of the intermediary node? > 6. It performs reasonably well on my 100 block sample in bitcoin-corpus > (chosen to include a mempool spike): > > Average block range (bytes): 7988-999829 > Block size mean (bytes): 401926 > > Minimal decodable BLT size range (bytes): 314-386361 > Minimal decodable BLT size mean (bytes): 13265 > > 7. Actual results will have to be worse than these minima, as peers will > have to oversize the IBLT to have reasonable chance of success. > Yes, I have made some analysis on this here: https://github.com/kallerosenbaum/bitcoin-iblt/wiki/FailureProbability. We use quite different data structures for encoding blocks in IBLT, but it might apply to your implementation as well. An interesting result is that the space saving percentage actually increases as blocks grow. > 8. There is more work to do, and more investigation to be done, but I > don't expect more than a 25% reduction in this "ideal minimum" > result. > > Special thanks to Kalle Rosenbaum for helping investigate IBLTs with me > last year. Thank you too! Regards, Kalle > > Cheers, > Rusty. > PS. I work for Blockstream. And I'm supposed to be working on > Lightning, not this. --001a11471190cac5b205195df07d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
From glancing ove= r your implementation, I see that you don't use a keyHashSum, in fact y= ou don't use a key at all, but only a concatenatenation of (txid48, fra= gid, tx-chunk) as value. Here the txid48+fragid functions as a kind of keyH= ashSum. I think this might be a very good idea,

If you have a false = positive with count =3D=3D 1, then you would probably detect it if fragid i= s outside reasonable limit from from base_fragid. Did you implement your id= ea to remove all the count=3D=3D1 fagments in ascending order of (fragid-ba= se_fragid)?

Anyhow, I think we should make some more comp= arable tests, just as you proposed last year when I didn't reply, sorry= ... My code is a more straight forward implementation of the IBLT paper (http://arxiv.org/pdf/1101.2245= .pdf) and encoding blocks is done pretty much as Gavin proposed in his = gist. That should function as a baseline so that we can validate that your = optimizations actually work. Please contact me directly if you are interest= ed in that, and we'll figure something out.

More comments/questions inline:

>
> Assumption= s and details:
>
> 1. The base idea comes from Gavin's Bloc= k Propagation gist:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 https= ://gist.github.com/gavinandresen/e20c3b5a1d4b97f79ac2
>
> 2= . It relies on similarity in mempools, with some selection hints.=C2=A0 Thi= s
> =C2=A0 =C2=A0is designed to be as flexible as possible to make fe= west assumptions
> =C2=A0 =C2=A0on tx selection policy.
>
&g= t; 3. The selection hints are: minimum fee-per-byte (fixed point) and
&g= t; =C2=A0 =C2=A0bitmaps of included-despite-that and rejected-despite-that.= =C2=A0 The
> =C2=A0 =C2=A0former covers things like child-pays-for-pa= rent and the priority
> =C2=A0 =C2=A0area.=C2=A0 The latter covers ot= her cases like Eligius censoring "spam",
> =C2=A0 =C2=A0bit= coin version differences, etc.
>

There is a chance that the bi= t prefix of the added or removed tx is not unique within the receiver's= mempool. In that case the receiver can probably just use the earliest matc= hing transaction and hope for the best. If not -> bad luck. Is that how = you do it?

> 4. Cost to represent these exceptional added or excl= uded transactions is
> =C2=A0 =C2=A0(on average) log2(transactions in= mempool) bits.

These exceptional tx *could* instead be encoded in t= he IBLT, just as if they were unknown differences. Your bitmaps is probably= a more compact representation, but it's also more complex.

>=
> 5. At Peiter Wuille's suggestion, it is designed to be reencod= ed between
> =C2=A0 =C2=A0nodes.=C2=A0 It seems fast enough for that,= and neighboring nodes should
> =C2=A0 =C2=A0have most similar mempoo= ls.
>

What is the purpose of reencoding when relaying? Is that= to improve the failure probability as new tx may have arrived in the mempo= ol of the intermediary node?

> 6. It performs reasonably well on = my 100 block sample in bitcoin-corpus
> =C2=A0 =C2=A0(chosen to inclu= de a mempool spike):
>
> =C2=A0 =C2=A0Average block range (byte= s): =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 7988-999829
> =C2=A0 =C2=A0Block size mean (bytes): =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 401926
>
> =C2=A0 =C2=A0Minimal decodable = BLT size range (bytes): =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0314-386361=
> =C2=A0 =C2=A0Minimal decodable BLT size mean (bytes): =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 13265
>
> 7. Actual results wil= l have to be worse than these minima, as peers will
> =C2=A0 =C2=A0ha= ve to oversize the IBLT to have reasonable chance of success.
>
Yes, I have made some analysis on this here: ht= tps://github.com/kallerosenbaum/bitcoin-iblt/wiki/FailureProbability. W= e use quite different data structures for encoding blocks in IBLT, but it m= ight apply to your implementation as well. An interesting result is that th= e space saving percentage actually increases as blocks grow.
=
> 8. There is more work to do, and more investigation to be done, bu= t I
> =C2=A0 =C2=A0don't expect more than a 25% reduction in this= "ideal minimum"
> =C2=A0 =C2=A0result.
>
> Spe= cial thanks to Kalle Rosenbaum for helping investigate IBLTs with me
>= ; last year.

Thank you too!

Regards,
Kalle

>
> Cheers,
>= Rusty.
> PS. I work for Blockstream.=C2=A0 And I'm supposed to b= e working on
> =C2=A0 =C2=A0 Lightning, not this.
--001a11471190cac5b205195df07d--