Rusty Russell [ARCHIVE] on Nostr: 📅 Original date posted:2016-05-10 📝 Original message:Gregory Maxwell <greg at ...
📅 Original date posted:2016-05-10
📝 Original message:Gregory Maxwell <greg at xiph.org> writes:
> On Tue, May 10, 2016 at 5:28 AM, Rusty Russell via bitcoin-dev
> <bitcoin-dev at lists.linuxfoundation.org> wrote:
>> I used variable-length bit encodings, and used the shortest encoding
>> which is unique to you (including mempool). It's a little more work,
>> but for an average node transmitting a block with 1300 txs and another
>> ~3000 in the mempool, you expect about 12 bits per transaction. IOW,
>> about 1/5 of your current size. Critically, we might be able to fit in
>> two or three TCP packets.
>
> Hm. 12 bits sounds very small even giving those figures. Why failure
> rate were you targeting?
That's a good question; I was assuming a best-case in which we have
mempool set reconciliation (handwave) thus know they are close. But
there's also an alterior motive: any later more sophisticated approach
will want variable-length IDs, and I'd like Matt to do the work :)
In particular, you can significantly narrow the possibilities for a
block by sending the min-fee-per-kb and a list of "txs in my mempool
which didn't get in" and "txs which did despite not making the
fee-per-kb". Those turn out to be tiny, and often make set
reconciliation trivial. That's best done with variable-length IDs.
> (*Not interesting because it mostly reduces exposure to loss and the
> gods of TCP, but since those are the long poles in the latency tent,
> it's best to escape them entirely, see Matt's udp_wip branch.)
I'm not convinced on UDP; it always looks impressive, but then ends up
reimplementing TCP in practice. We should be well within a TCP window
for these, so it's hard to see where we'd win.
>> I would also avoid the nonce to save recalculating for each node, and
>> instead define an id as:
>
> Doing this would greatly increase the cost of a collision though, as
> it would happen in many places in the network at once over the on the
> network at once, rather than just happening on a single link, thus
> hardly impacting overall propagation.
"Greatly increase"? I don't see that.
Let's assume an attacker grinds out 10,000 txs with 128 bits of the same
TXID, and gets them all in a block. They then win the lottery and get a
collision. Now we have to transmit ~48 bytes more than expected.
> Using the same nonce means you also would not get a recovery gain from
> jointly decoding using compact blocks sent from multiple peers (which
> you'll have anyways in high bandwidth mode).
Not quite true, since if their mempools differ they'll use different
encoding lengths, but yes, you'll get less of this.
> With a nonce a sender does have the option of reusing what they got--
> but the actual encoding cost is negligible, for a 2500 transaction
> block its 27 microseconds (once per block, shared across all peers)
> using Pieter's suggestion of siphash 1-3 instead of the cheaper
> construct in the current draft.
>
> Of course, if you're going to check your whole mempool to reroll the
> nonce, thats another matter-- but that seems wasteful compared to just
> using a table driven size with a known negligible failure rate.
I'm not worried about the sender: The recipient needs to encode all the
mempool.
>> As Peter R points out, we could later enhance receiver to brute force
>> collisions (you could speed that by sending a XOR of all the txids, but
>> really if there are more than a few collisions, give up).
>
> The band between "no collisions" and "infeasible many" is fairly
> narrow. You can add a small amount more space to the ids and
> immediately be in the no collision zone.
Indeed, I would be adding extra bits in the sender and not implementing
brute force in the receiver. But I welcome someone else to do so.
Cheers,
Rusty.
Published at
2023-06-07 17:50:21Event JSON
{
"id": "4dd68f863cb752aac20ce024d7a703eead5ddb9a52ed7b0c3c202b127d6b8135",
"pubkey": "13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425",
"created_at": 1686160221,
"kind": 1,
"tags": [
[
"e",
"37fe3d2b857e9599a14c87e34f77dee62e90bb6721200fbd7752c60823834c1e",
"",
"root"
],
[
"e",
"e97b55f429c98016d812846470e33422d6e0ca766b29d5e46c53924dee2e8a83",
"",
"reply"
],
[
"p",
"4aa6cf9aa5c8e98f401dac603c6a10207509b6a07317676e9d6615f3d7103d73"
]
],
"content": "📅 Original date posted:2016-05-10\n📝 Original message:Gregory Maxwell \u003cgreg at xiph.org\u003e writes:\n\u003e On Tue, May 10, 2016 at 5:28 AM, Rusty Russell via bitcoin-dev\n\u003e \u003cbitcoin-dev at lists.linuxfoundation.org\u003e wrote:\n\u003e\u003e I used variable-length bit encodings, and used the shortest encoding\n\u003e\u003e which is unique to you (including mempool). It's a little more work,\n\u003e\u003e but for an average node transmitting a block with 1300 txs and another\n\u003e\u003e ~3000 in the mempool, you expect about 12 bits per transaction. IOW,\n\u003e\u003e about 1/5 of your current size. Critically, we might be able to fit in\n\u003e\u003e two or three TCP packets.\n\u003e\n\u003e Hm. 12 bits sounds very small even giving those figures. Why failure\n\u003e rate were you targeting?\n\nThat's a good question; I was assuming a best-case in which we have\nmempool set reconciliation (handwave) thus know they are close. But\nthere's also an alterior motive: any later more sophisticated approach\nwill want variable-length IDs, and I'd like Matt to do the work :)\n\nIn particular, you can significantly narrow the possibilities for a\nblock by sending the min-fee-per-kb and a list of \"txs in my mempool\nwhich didn't get in\" and \"txs which did despite not making the\nfee-per-kb\". Those turn out to be tiny, and often make set\nreconciliation trivial. That's best done with variable-length IDs.\n\n\u003e (*Not interesting because it mostly reduces exposure to loss and the\n\u003e gods of TCP, but since those are the long poles in the latency tent,\n\u003e it's best to escape them entirely, see Matt's udp_wip branch.)\n\nI'm not convinced on UDP; it always looks impressive, but then ends up\nreimplementing TCP in practice. We should be well within a TCP window\nfor these, so it's hard to see where we'd win.\n\n\u003e\u003e I would also avoid the nonce to save recalculating for each node, and\n\u003e\u003e instead define an id as:\n\u003e\n\u003e Doing this would greatly increase the cost of a collision though, as\n\u003e it would happen in many places in the network at once over the on the\n\u003e network at once, rather than just happening on a single link, thus\n\u003e hardly impacting overall propagation.\n\n\"Greatly increase\"? I don't see that.\n\nLet's assume an attacker grinds out 10,000 txs with 128 bits of the same\nTXID, and gets them all in a block. They then win the lottery and get a\ncollision. Now we have to transmit ~48 bytes more than expected.\n\n\u003e Using the same nonce means you also would not get a recovery gain from\n\u003e jointly decoding using compact blocks sent from multiple peers (which\n\u003e you'll have anyways in high bandwidth mode).\n\nNot quite true, since if their mempools differ they'll use different\nencoding lengths, but yes, you'll get less of this.\n\n\u003e With a nonce a sender does have the option of reusing what they got--\n\u003e but the actual encoding cost is negligible, for a 2500 transaction\n\u003e block its 27 microseconds (once per block, shared across all peers)\n\u003e using Pieter's suggestion of siphash 1-3 instead of the cheaper\n\u003e construct in the current draft.\n\u003e\n\u003e Of course, if you're going to check your whole mempool to reroll the\n\u003e nonce, thats another matter-- but that seems wasteful compared to just\n\u003e using a table driven size with a known negligible failure rate.\n\nI'm not worried about the sender: The recipient needs to encode all the\nmempool.\n\n\u003e\u003e As Peter R points out, we could later enhance receiver to brute force\n\u003e\u003e collisions (you could speed that by sending a XOR of all the txids, but\n\u003e\u003e really if there are more than a few collisions, give up).\n\u003e\n\u003e The band between \"no collisions\" and \"infeasible many\" is fairly\n\u003e narrow. You can add a small amount more space to the ids and\n\u003e immediately be in the no collision zone.\n\nIndeed, I would be adding extra bits in the sender and not implementing\nbrute force in the receiver. But I welcome someone else to do so.\n\nCheers,\nRusty.",
"sig": "e7470a4f0d9c63f4a0e7ffcc8e5dea97f2d67018a4ec24df015b7fdf4074213f84a12f289cf9337131d2ece56568c50e4902f4f5d4a299a0548800279193d42d"
}