summaryrefslogtreecommitdiff
path: root/5a/731d914d685fd5994d50b5f03a7cfe8df6e7df
blob: 37e2d47fc04156cdc7884f5c3c8a97b4334b5271 (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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
Return-Path: <gloriajzhao@gmail.com>
Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 5024BC002D
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 14 Jun 2022 09:59:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp2.osuosl.org (Postfix) with ESMTP id 2A0BA408F1
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 14 Jun 2022 09:59:39 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level: 
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: smtp2.osuosl.org (amavisd-new);
 dkim=pass (2048-bit key) header.d=gmail.com
Received: from smtp2.osuosl.org ([127.0.0.1])
 by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id sDwILfzog5Vg
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 14 Jun 2022 09:59:36 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.8.0
Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com
 [IPv6:2607:f8b0:4864:20::1132])
 by smtp2.osuosl.org (Postfix) with ESMTPS id 2E1504018F
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 14 Jun 2022 09:59:36 +0000 (UTC)
Received: by mail-yw1-x1132.google.com with SMTP id
 00721157ae682-31332df12a6so24120067b3.4
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Tue, 14 Jun 2022 02:59:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=uLLM66ZIxeN5M+dDlknuMG1d1TQymDfnkkSLQsx0n6U=;
 b=bqHf/co1YzXWjaDTchl5nEuRoJ4hys0AVU+0+wJpj+ezx6/R3x4pO3nv9fz27yQVVw
 ziALdFv1kzjOomj3VkPKPSuhEXP4jhj9deOIFHh8Nbj1F8FvWTFexHRLohCpEFwiY4dv
 xjp5b4Pv/d3ohYLKEsVSbW8vnfRbzHgeYfUVjUbcTxxCjPEt4tERuLAaUc717g8Z8Epp
 jhwZE2kEcS9mEB0Gtep5PQA9VTuziwR5zonIxiPaC3EXA8+yE7QsDKPixI6Y2tqv6dCz
 m+ivfvY5X12QdCG98FUoYr3ljQ7/I0UpkSGpkevAtOSIlQxex4HXs3/G85Gt7hxD7twt
 4vEQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=uLLM66ZIxeN5M+dDlknuMG1d1TQymDfnkkSLQsx0n6U=;
 b=Ky281IkOSkBJ9tNKjW/87WdllpjnoWS148nUORMEFelA+YepSW4zMiWlzVDtwUPu7e
 iTLmKIThIFkhRs+SEB4hN7wb7LR6xl9816hh9JLYOycbaZNqSWmoupF3mILZVM+vAh+M
 lPId31MTfg5IObBnOoX9aYvAAmM5Nvpp56LiOopzUmLvZgb2dtKDb4aZlqGBfC2rKMMw
 fJnCLGIEPoDd/a2DUMz9HxI4ziHqtGPTcCP9gRDefs+zE0GC8Y0wkEQ93UM4T05PozWP
 0XikQwBKmJj+DYmnYvjbTlPSS049mTCtSbQKjE6DQuoIQEq0CxVdjjH22lVOeteti9Y/
 KdGw==
X-Gm-Message-State: AJIora8ES0T5xdmGo5lOXh8jUPNZmQSmvCHe0lT5OxlFLMwh3D59LlBr
 t5yGABQlXA33fRbG6EVnb+RYfO9LyDjAZKjaYsV4PaVbpT7Qgg==
X-Google-Smtp-Source: AGRyM1uDFAMJHbP92L2UxGbuHnI6sJxHNDK6+ofhJKFcYnL6FeIIwcI8k1TtmhliWKLqZakG6hvwAIp+2spLm1SYlkg=
X-Received: by 2002:a81:3247:0:b0:30c:2aa1:7ef3 with SMTP id
 y68-20020a813247000000b0030c2aa17ef3mr4628093ywy.289.1655200774914; Tue, 14
 Jun 2022 02:59:34 -0700 (PDT)
MIME-Version: 1.0
References: <CAFXO6=JROe_9ih2h+_CCH-UbxehsM5RQ6YyNnPesEpveBEtdow@mail.gmail.com>
 <20220518003531.GA4402@erisian.com.au>
 <CAFXO6=LWM4eHM=zJhejw5981+8h7QHTbwpz0jEbWkrLOX0037Q@mail.gmail.com>
 <20220523213416.GA6151@erisian.com.au>
 <CAFXO6=KXToP2MFWQ1JVKX6jV++utw8E4Z13T4cH+mfgtyeUx_A@mail.gmail.com>
 <2B3D1901-901C-4000-A2B9-F6857FCE2847@erisian.com.au>
 <CAFXO6=K6FXNFwOZ3VyT6_RZY2F2BX+iTy+MyOshRBfNnn9Hqyg@mail.gmail.com>
 <8FFE048D-854F-4D34-85DA-CE523C16EEB0@erisian.com.au>
 <017501d87079$4c08f9c0$e41aed40$@voskuil.org>
 <001201d870ac$8d7a06a0$a86e13e0$@voskuil.org>
 <CAFXO6=LGX4zRN3rBPs89cgYKrM5H3kViR1QZRdMeyaS_HELPTQ@mail.gmail.com>
 <CAFp6fsE0ceXtwS=9wrzoKzuuay=n=66Ve9hcqcNPa09KfJCgcw@mail.gmail.com>
In-Reply-To: <CAFp6fsE0ceXtwS=9wrzoKzuuay=n=66Ve9hcqcNPa09KfJCgcw@mail.gmail.com>
From: Gloria Zhao <gloriajzhao@gmail.com>
Date: Tue, 14 Jun 2022 10:59:23 +0100
Message-ID: <CAFXO6=JJzuw8rxfLdomU0tyCwivr-fXNAgPnAH0ptJPWucSvFw@mail.gmail.com>
To: Suhas Daftuar <sdaftuar@gmail.com>, 
 Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Content-Type: multipart/alternative; boundary="00000000000038845905e1657654"
X-Mailman-Approved-At: Tue, 14 Jun 2022 10:07:47 +0000
Subject: Re: [bitcoin-dev] Package Relay Proposal
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
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: Tue, 14 Jun 2022 09:59:39 -0000

--00000000000038845905e1657654
Content-Type: text/plain; charset="UTF-8"

Hi Suhas,

Thanks for your attention and feedback!

> Transaction A is both low-fee and non-standard to some nodes on the
network...
> ...Whenever a transaction T that spends A is relayed, new nodes will send
INV(PKGINFO1, T) to all package-relay peers...
> ...because of transaction malleability, and to avoid being blinded to a
transaction unnecessarily, these nodes will likely still send
getdata(PKGINFO1, T) to every node that announces T...

Yes, we'd request pkginfo unless we already had the transaction in our
mempool. The pkginfo step is intended to prevent nodes from ever
downloading a transaction more than once; I was going for a benchmark of
"packages are announced once per p2p connection, transaction data
downloaded once per node".

In this scenario, both A and T's wtxids would be sent once per p2p
connection and transaction data downloaded once per node. If T has other
unconfirmed parents, the low-fee ones will only be announced once (in
pkginfo) per link. If it has high-fee parents, they will indeed be
announced more than once per link (once individually, then again in
pkginfo).

More precisely: if a package contains any transactions which are
non-standard to one peer and standard to another, the package transactions
(parents, not child) that pass the fee filter on their own will be
announced twice instead of once.

> I think a good design goal would be to not waste bandwidth in
non-adversarial situations. In this case, there would be bandwidth waste
from downloading duplicate data from all your peers, just because the
announcement doesn't commit to the set of parent wtxids that we'd get from
the peer (and so we are unable to determine that all our peers would be
telling us the same thing, just based on the announcement).

Each transaction is only downloaded once per node here, and each package
announced/pkginfo sent once per link. I definitely understand that this
doesn't pass a benchmark of "every transaction is announced at most once
per link," but it's still on the magnitude of 32-byte hashes. Adding a
commitment to parents in the announcements is an extra hash per link in all
cases - my question is whether it's worth it? We'd also need to write new
inv/getdata message types for package relay, though that's probably a
weaker argument.

> it won't always be the case that a v1 package relay node will be able to
validate that a set of package transactions is fully sorted topologically,
because there may be (non-parent) ancestors that are missing from the
package and the best a peer can validate is topology within the package --
this means that a peer can validly (under this BIP) relay transaction
packages out of the true topological sort (if all ancestors were included).

Good point. Since v1 packages don't necessarily include the full ancestor
set, we wouldn't be able to verify that two parents are in the right order
if they have an indirect dependency, e.g. parent 1 spends a tx
("grandparent") which spends parent 2. Note that the grandparent couldn't
possibly be in the mempool unless parent 2 is. We'd eventually get
everything submitted as long as we received the grandparent, and then know
whether the package was topologically sorted. But I think you're right that
this could be a "nice to have" instead of a protocol requirement.

> Could you explain again what the benefit of including the blockhash is?
It seems like it is just so that a node could prioritize transaction relay
from peers with the same chain tip to maximize the likelihood of
transaction acceptance, but in the common case this seems like a pretty
negligible concern...

The blockhash is necessary in order to disambiguate between a malformed
package and difference in chain tip. If a parent is missing from a package,
it's possible it was mined in a recent block that we haven't seen yet.
Validating using a UTXO set, all we see is "missing inputs" when we try to
validate the child; we wouldn't know if our peer had sent us a malformed
package or if we were behind.

I'm hoping some of these clarifications are helpful to post publicly, but I
know I haven't fully addressed all the concerns you've brought up. Will
continue to think about this.

Best,
Gloria

On Wed, Jun 8, 2022 at 4:59 PM Suhas Daftuar via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> Hi,
>
> Thanks again for your work on this!
>
> One question I have is about potential bandwidth waste in the case of
> nodes running with different policy rules.  Here's my understanding of a
> scenario I think could happen:
>
> 1) Transaction A is both low-fee and non-standard to some nodes on the
> network.
> 2) Whenever a transaction T that spends A is relayed, new nodes will send
> INV(PKGINFO1, T) to all package-relay peers.
> 3) Nodes on the network that have implemented package relay, but do not
> accept A, will send getdata(PKGINFO1, T) and learn all of T's unconfirmed
> parents (~32 bytes * number of parents(T)).
> 4) Such nodes will reject T.  But because of transaction malleability, and
> to avoid being blinded to a transaction unnecessarily, these nodes will
> likely still send getdata(PKGINFO1, T) to every node that announces T, in
> case someone has a transaction that includes an alternate set of parent
> transactions that would pass policy checks.
>
> Is that understanding correct?  I think a good design goal would be to not
> waste bandwidth in non-adversarial situations.  In this case, there would
> be bandwidth waste from downloading duplicate data from all your peers,
> just because the announcement doesn't commit to the set of parent wtxids
> that we'd get from the peer (and so we are unable to determine that all our
> peers would be telling us the same thing, just based on the announcement).
>
> Some ways to mitigate this might be to: (a) include a hash (maybe even
> just a 20-byte hash -- is that enough security?) of the package wtxids (in
> some canonical ordering) along with the wtxid of the child in the initial
> announcement; (b) limit the use of v1 packages to transactions with very
> few parents (I don't know if this is reasonable for the use cases we have
> in mind).
>
> Another point I wanted to bring up is about the rules around v1 package
> validation generally, and the use of a blockhash in transaction relay
> specifically.  My first observation is that it won't always be the case
> that a v1 package relay node will be able to validate that a set of package
> transactions is fully sorted topologically, because there may be
> (non-parent) ancestors that are missing from the package and the best a
> peer can validate is topology within the package -- this means that a peer
> can validly (under this BIP) relay transaction packages out of the true
> topological sort (if all ancestors were included).
>
> This makes me wonder how useful this topological rule is.  I suppose there
> is some value in preventing completely broken implementations from staying
> connected and so there is no harm in having the rule, but perhaps it would
> be helpful to add that nodes SHOULD order transactions based on topological
> sort in the complete transaction graph, so that if missing-from-package
> ancestors are already known by a peer (which is the expected case when
> using v1 package relay on transactions that have more than one generation
> of unconfirmed ancestor) then the remaining transactions are already
> properly ordered, and this is helpful even if unenforceable in general.
>
> The other observation I wanted to make was that having transaction relay
> gated on whether two nodes agree on chain tip seems like an overly
> restrictive criteria.  I think an important design principle is that we
> want to minimize disruption from network splits -- if there are competing
> blocks found in a small window of time, it's likely that the utxo set is
> not materially different on the two chains (assuming miners are selecting
> from roughly the same sets of transactions when this happens, which is
> typical).  Having transaction relay bifurcate on the two network halves
> would seem to exacerbate the difference between the two sides of the split
> -- users ought to be agnostic about how benign splits are resolved and
> would likely want their transactions to relay across the whole network.
>
> Additionally, use of a chain tip might impose a larger burden than is
> necessary on software that would seek to participate in transaction relay
> without implementing headers sync/validation.  I don't know what software
> exists on the network, but I imagine there are a lot of scripts out there
> for transaction submission to the public p2p network, and in thinking
> about modifying such a script to utilize package relay it seems like an
> unnecessary added burden to first learn a node's tip before trying to relay
> a transaction.
>
> Could you explain again what the benefit of including the blockhash is?
> It seems like it is just so that a node could prioritize transaction relay
> from peers with the same chain tip to maximize the likelihood of
> transaction acceptance, but in the common case this seems like a pretty
> negligible concern, and in the case of a chain fork that persists for many
> minutes it seems better to me that we not partition the network into
> package-relay regimes and just risk a little extra bandwidth in one
> direction or the other.  If we solve the problem I brought up at the
> beginning (of de-duplicating package data across peers with a
> package-wtxid-commitment in the announcement), I think this is just some
> wasted pkginfo bandwidth on a single-link, and not across links (as we
> could cache validation failure for a package-hash to avoid re-requesting
> duplicate pkginfo1 messages).
>
> Best,
> Suhas
>
>
> On Tue, Jun 7, 2022 at 1:57 PM Gloria Zhao via bitcoin-dev <
> bitcoin-dev@lists.linuxfoundation.org> wrote:
>
>> Hi Eric, aj, all,
>>
>> Sorry for the delayed response. @aj I'm including some paraphrased points
>> from our offline discussion (thanks).
>>
>> > Other idea: what if you encode the parent txs as a short hash of the
>> wtxid (something like bip152 short ids? perhaps seeded per peer so
>> collisions will be different per peer?) and include that in the inv
>> announcement? Would that work to avoid a round trip almost all of the time,
>> while still giving you enough info to save bw by deduping parents?
>>
>> > As I suggested earlier, a package is fundamentally a compact block (or
>> > block) announcement without the header. Compact block (BIP152)
>> announcement
>> > is already well-defined and widely implemented...
>>
>> > Let us not reinvent the wheel and/or introduce accidental complexity. I
>> see
>> > no reason why packaging is not simply BIP152 without the 'header'
>> field, an
>> > updated protocol version, and the following sort of changes to names
>>
>> Interestingly, "why not use BIP 152 shortids to save bandwidth?" is by
>> far the most common suggestion I hear (including offline feedback). Here's
>> a full explanation:
>>
>> BIP 152 shortens transaction hashes (32 bytes) to shortids (6 bytes) to
>> save a significant amount of network bandwidth, which is extremely
>> important in block relay. However, this comes at the expense of
>> computational complexity. There is no way to directly calculate a
>> transaction hash from a shortid; upon receipt of a compact block, a node is
>> expected to calculate the shortids of every unconfirmed transaction it
>> knows about to find the matches (BIP 152: [1], Bitcoin Core: [2]). This is
>> expensive but appropriate for block relay, since the block must have a
>> valid Proof of Work and new blocks only come every ~10 minutes. On the
>> other hand, if we require nodes to calculate shortids for every transaction
>> in their mempools every time they receive a package, we are creating a DoS
>> vector. Unconfirmed transactions don't need PoW and, to have a live
>> transaction relay network, we should expect nodes to handle transactions at
>> a high-ish rate (i.e. at least 1000s of times more transactions than
>> blocks). We can't pre-calculate or cache shortids for mempool transactions,
>> since the SipHash key depends on the block hash and a per-connection salt.
>>
>> Additionally, shortid calculation is not designed to prevent intentional
>> individual collisions. If we were to use these shortids to deduplicate
>> transactions we've supposedly already seen, we may have a censorship
>> vector. Again, these tradeoffs make sense for compact block relay (see
>> shortid section in BIP 152 [3]), but not package relay.
>>
>> TLDR: DoSy if we calculate shortids on every package and censorship
>> vector if we use shortids for deduplication.
>>
>> > Given this message there is no reason
>> > to send a (potentially bogus) fee rate with every package. It can only
>> be
>> > validated by obtaining the full set of txs, and the only recourse is
>> > dropping (etc.) the peer, as is the case with single txs.
>>
>> Yeah, I agree with this. Combined with the previous discussion with aj
>> (i.e. we can't accurately communicate the incentive compatibility of a
>> package without sending the full graph, and this whole dance is to avoid
>> downloading a few low-fee transactions in uncommon edge cases), I've
>> realized I should remove the fee + weight information from pkginfo. Yay for
>> less complexity!
>>
>> Also, this might be pedantic, but I said something incorrect earlier and
>> would like to correct myself:
>>
>> >> In theory, yes, but maybe it was announced earlier (while our node was
>> down?) or had dropped from our mempool or similar, either way we don't have
>> those txs yet.
>>
>> I said "It's fine if they have Erlay, since a sender would know in
>> advance that B is missing and announce it as a package." But this isn't
>> true since we're only using reconciliation in place of flooding to announce
>> transactions as they arrive, not for rebroadcast, and we're not doing full
>> mempool set reconciliation. In any case, making sure a node receives the
>> transactions announced when it was offline is not something we guarantee,
>> not an intended use case for package relay, and not worsened by this.
>>
>> Thanks for your feedback!
>>
>> Best,
>> Gloria
>>
>> [1]:
>> https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#cmpctblock
>> [2]:
>> https://github.com/bitcoin/bitcoin/blob/master/src/blockencodings.cpp#L49
>> [3]:
>> https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#short-transaction-id-calculation
>>
>> On Thu, May 26, 2022 at 3:59 AM <eric@voskuil.org> wrote:
>>
>>> Given that packages have no header, the package requires identity in a
>>> BIP152 scheme. For example 'header' and 'blockhash' fields can be
>>> replaced
>>> with a Merkle root (e.g. "identity" field) for the package, uniquely
>>> identifying the partially-ordered set of txs. And use of 'getdata' (to
>>> obtain a package by hash) can be eliminated (not a use case).
>>>
>>> e
>>>
>>> > -----Original Message-----
>>> > From: eric@voskuil.org <eric@voskuil.org>
>>> > Sent: Wednesday, May 25, 2022 1:52 PM
>>> > To: 'Anthony Towns' <aj@erisian.com.au>; 'Bitcoin Protocol Discussion'
>>> > <bitcoin-dev@lists.linuxfoundation.org>; 'Gloria Zhao'
>>> > <gloriajzhao@gmail.com>
>>> > Subject: RE: [bitcoin-dev] Package Relay Proposal
>>> >
>>> > > From: bitcoin-dev <bitcoin-dev-bounces@lists.linuxfoundation.org> On
>>> > Behalf
>>> > > Of Anthony Towns via bitcoin-dev
>>> > > Sent: Wednesday, May 25, 2022 11:56 AM
>>> >
>>> > > So the other thing is what happens if the peer announcing packages
>>> to us
>>> > is
>>> > > dishonest?
>>> > >
>>> > > They announce pkg X, say X has parents A B C and the fee rate is
>>> garbage.
>>> > But
>>> > > actually X has parent D and the fee rate is excellent. Do we request
>>> the
>>> > > package from another peer, or every peer, to double check? Otherwise
>>> > we're
>>> > > allowing the first peer we ask about a package to censor that tx from
>>> us?
>>> > >
>>> > > I think the fix for that is just to provide the fee and weight when
>>> > announcing
>>> > > the package rather than only being asked for its info? Then if one
>>> peer
>>> > makes
>>> > > it sound like a good deal you ask for the parent txids from them,
>>> dedupe,
>>> > > request, and verify they were honest about the parents.
>>> >
>>> > Single tx broadcasts do not carry an advertised fee rate, however the'
>>> > feefilter' message (BIP133) provides this distinction. This should be
>>> > interpreted as applicable to packages. Given this message there is no
>>> reason
>>> > to send a (potentially bogus) fee rate with every package. It can only
>>> be
>>> > validated by obtaining the full set of txs, and the only recourse is
>>> > dropping (etc.) the peer, as is the case with single txs. Relying on
>>> the
>>> > existing message is simpler, more consistent, and more efficient.
>>> >
>>> > > >> Is it plausible to add the graph in?
>>> > >
>>> > > Likewise, I think you'd have to have the graph info from many nodes
>>> if
>>> > you're
>>> > > going to make decisions based on it and don't want hostile peers to
>>> be
>>> > able to
>>> > > trick you into ignoring txs.
>>> > >
>>> > > Other idea: what if you encode the parent txs as a short hash of the
>>> wtxid
>>> > > (something like bip152 short ids? perhaps seeded per peer so
>>> collisions
>>> > will
>>> > > be different per peer?) and include that in the inv announcement?
>>> Would
>>> > > that work to avoid a round trip almost all of the time, while still
>>> giving
>>> > you
>>> > > enough info to save bw by deduping parents?
>>> >
>>> > As I suggested earlier, a package is fundamentally a compact block (or
>>> > block) announcement without the header. Compact block (BIP152)
>>> > announcement
>>> > is already well-defined and widely implemented. A node should never be
>>> > required to retain an orphan, and BIP152 ensures this is not required.
>>> >
>>> > Once a validated set of txs within the package has been obtained with
>>> > sufficient fee, a fee-optimal node would accept the largest subgraph of
>>> the
>>> > package that conforms to fee constraints and drop any peer that
>>> provides a
>>> > package for which the full graph does not.
>>> >
>>> > Let us not reinvent the wheel and/or introduce accidental complexity. I
>>> see
>>> > no reason why packaging is not simply BIP152 without the 'header'
>>> field,
>>> an
>>> > updated protocol version, and the following sort of changes to names:
>>> >
>>> > sendpkg
>>> > MSG_CMPCT_PKG
>>> > cmpctpkg
>>> > getpkgtxn
>>> > pkgtxn
>>> >
>>> > > > For a maximum 25 transactions,
>>> > > >23*24/2 = 276, seems like 36 bytes for a child-with-parents package.
>>> > >
>>> > > If you're doing short ids that's maybe 25*4B=100B already, then the
>>> above
>>> > is
>>> > > up to 36% overhead, I guess. Might be worth thinking more about, but
>>> > maybe
>>> > > more interesting with ancestors than just parents.
>>> > >
>>> > > >Also side note, since there are no size/count params,
>>> >
>>> > Size is restricted in the same manner as block and transaction
>>> broadcasts,
>>> > by consensus. If the fee rate is sufficient there would be no reason to
>>> > preclude any valid size up to what can be mined in one block (packaging
>>> > across blocks is not economically rational under the assumption that
>>> one
>>> > miner cannot expect to mine multiple blocks in a row). Count is
>>> incorporated
>>> > into BIP152 as 'shortids_length'.
>>> >
>>> > > > wondering if we
>>> > > >should just have "version" in "sendpackages" be a bit field instead
>>> of
>>> > > >sending a message for each version. 32 versions should be enough
>>> right?
>>> >
>>> > Adding versioning to individual protocols is just a reflection of the
>>> > insufficiency of the initial protocol versioning design, and that of
>>> the
>>> > various ad-hoc changes to it (including yet another approach in this
>>> > proposal) that have been introduced to compensate for it, though I'll
>>> > address this in an independent post at some point.
>>> >
>>> > Best,
>>> > e
>>> >
>>> > > Maybe but a couple of messages per connection doesn't really seem
>>> worth
>>> > > arguing about?
>>> > >
>>> > > Cheers,
>>> > > aj
>>> > >
>>> > >
>>> > > --
>>> > > Sent from my phone.
>>> > > _______________________________________________
>>> > > bitcoin-dev mailing list
>>> > > bitcoin-dev@lists.linuxfoundation.org
>>> > > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>>>
>>>
>>> _______________________________________________
>> bitcoin-dev mailing list
>> bitcoin-dev@lists.linuxfoundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>

--00000000000038845905e1657654
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Suhas,<br><br>Thanks for your attention and feedba=
ck!<br><br>&gt; Transaction A is both low-fee and non-standard to some node=
s on the network... <br></div><div>&gt; ...Whenever a transaction T that sp=
ends A is relayed, new nodes will send INV(PKGINFO1, T) to all package-rela=
y peers...<br>&gt; ...because of transaction malleability, and to avoid bei=
ng blinded to a transaction unnecessarily, these nodes will likely still se=
nd getdata(PKGINFO1, T) to every node that announces T...<br><br>Yes, we&#3=
9;d request pkginfo unless we already had the transaction in our mempool. T=
he pkginfo step is intended to prevent nodes from ever downloading a transa=
ction more than once; I was going for a benchmark of &quot;packages are ann=
ounced once per p2p connection, transaction data downloaded once per node&q=
uot;.<br><br>In this scenario, both A and T&#39;s wtxids would be sent once=
 per p2p connection and transaction data downloaded once per node. If T has=
 other unconfirmed parents, the low-fee ones will only be announced once (i=
n pkginfo) per link. If it has high-fee parents, they will indeed be announ=
ced more than once per link (once individually, then again in pkginfo).<br>=
<br>More precisely: if a package contains any transactions which are non-st=
andard to one peer and standard to another, the package transactions (paren=
ts, not child) that pass the fee filter on their own will be announced twic=
e instead of once.<br><br>&gt; I think a good design goal would be to not w=
aste bandwidth in non-adversarial situations. In this case, there would be =
bandwidth waste from downloading duplicate data from all your peers, just b=
ecause the announcement doesn&#39;t commit to the set of parent wtxids that=
 we&#39;d get from the peer (and so we are unable to determine that all our=
 peers would be telling us the same thing, just based on the announcement).=
<br><br>Each transaction is only downloaded once per node here, and each pa=
ckage announced/pkginfo sent once per link. I definitely understand that th=
is doesn&#39;t pass a benchmark of &quot;every transaction is announced at =
most once per link,&quot; but it&#39;s still on the magnitude of 32-byte ha=
shes. Adding a commitment to parents in the announcements is an extra hash =
per link in all cases - my question is whether it&#39;s worth it? We&#39;d =
also need to write new inv/getdata message types for package relay, though =
that&#39;s probably a weaker argument.<br><br>&gt; it won&#39;t always be t=
he case that a v1 package relay node will be able to validate that a set of=
 package transactions is fully sorted topologically, because there may be (=
non-parent) ancestors that are missing from the package and the best a peer=
 can validate is topology within the package -- this means that a peer can =
validly (under this BIP) relay transaction packages out of the true topolog=
ical sort (if all ancestors were included).<br><br>Good point. Since v1 pac=
kages don&#39;t necessarily include the full ancestor set, we wouldn&#39;t =
be able to verify that two parents are in the right order if they have an i=
ndirect dependency, e.g. parent 1 spends a tx (&quot;grandparent&quot;) whi=
ch spends parent 2. Note that the grandparent couldn&#39;t possibly be in t=
he mempool unless parent 2 is. We&#39;d eventually get everything submitted=
 as long as we received the grandparent, and then know whether the package =
was topologically sorted. But I think you&#39;re right that this could be a=
 &quot;nice to have&quot; instead of a protocol requirement.<br><br>&gt; Co=
uld you explain again what the benefit of including the blockhash is? It se=
ems like it is just so that a node could prioritize transaction relay from =
peers with the same chain tip to maximize the likelihood of transaction acc=
eptance, but in the common case this seems like a pretty negligible concern=
...<br><br>The blockhash is necessary in order to disambiguate between a ma=
lformed package and difference in chain tip. If a parent is missing from a =
package, it&#39;s possible it was mined in a recent block that we haven&#39=
;t seen yet. Validating using a UTXO set, all we see is &quot;missing input=
s&quot; when we try to validate the child; we wouldn&#39;t know if our peer=
 had sent us a malformed package or if we were behind.<br></div><div><br></=
div><div>I&#39;m hoping some of these clarifications are helpful to post pu=
blicly, but I know I haven&#39;t fully addressed all the concerns you&#39;v=
e brought up. Will continue to think about this.<br></div><div><br></div><d=
iv>Best,</div><div>Gloria<br></div></div><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Wed, Jun 8, 2022 at 4:59 PM Suhas Daf=
tuar via bitcoin-dev &lt;<a href=3D"mailto:bitcoin-dev@lists.linuxfoundatio=
n.org">bitcoin-dev@lists.linuxfoundation.org</a>&gt; wrote:<br></div><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1=
px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi,<div><br></=
div><div>Thanks again for your work on this!</div><div><br></div><div>One q=
uestion I have is about potential bandwidth waste in the case of nodes runn=
ing with different policy rules.=C2=A0 Here&#39;s my understanding of a sce=
nario I think could happen:</div><div><br></div><div>1) Transaction A is bo=
th low-fee and non-standard to some nodes on the network.</div><div>2) When=
ever a transaction T that spends A is relayed, new nodes will send INV(PKGI=
NFO1, T) to all package-relay peers.</div><div>3) Nodes on the network that=
 have implemented package relay, but do not accept A, will send getdata(PKG=
INFO1, T) and learn all of T&#39;s unconfirmed parents (~32 bytes * number =
of parents(T)).</div><div>4) Such nodes will reject T.=C2=A0 But because of=
 transaction malleability, and to avoid being blinded to a transaction unne=
cessarily, these nodes will likely still send getdata(PKGINFO1, T) to every=
 node that announces T, in case someone has a transaction that includes an =
alternate set of parent transactions that would pass policy checks.</div><d=
iv><br></div><div>Is that understanding correct?=C2=A0 I think a good desig=
n goal would be to not waste bandwidth in non-adversarial situations.=C2=A0=
 In this case, there would be bandwidth waste from downloading duplicate da=
ta from all your peers, just because the announcement doesn&#39;t commit to=
 the set of parent wtxids that we&#39;d get from the peer (and so we are un=
able to determine that all our peers would be telling us the same thing, ju=
st based on the announcement).</div><div><br></div><div>Some ways to mitiga=
te this might be to: (a) include a hash (maybe even just a 20-byte hash -- =
is that enough security?) of the package wtxids (in some canonical ordering=
) along with the wtxid of the child in the initial announcement; (b) limit =
the use of v1 packages to transactions with very few parents (I don&#39;t k=
now if this is reasonable for the use cases we have in mind).</div><div><br=
></div><div>Another point I wanted to bring up is about the rules around v1=
 package validation generally, and the use of a blockhash in transaction re=
lay specifically.=C2=A0 My first observation is that it won&#39;t always be=
 the case that a v1 package relay node will be able to validate that a set =
of package transactions is fully sorted topologically, because there may be=
 (non-parent) ancestors that are missing from the package and the best a pe=
er can validate is topology within the package -- this means that a peer ca=
n validly (under this BIP) relay transaction packages out of the true topol=
ogical sort (if all ancestors were included).</div><div><br></div><div>This=
 makes me wonder how useful this topological rule is.=C2=A0 I suppose there=
 is some value in preventing completely broken implementations from staying=
 connected and so there is no harm in having the rule, but perhaps it would=
 be helpful to add that nodes SHOULD order transactions based on topologica=
l sort in the complete transaction graph, so that if missing-from-package a=
ncestors are already known by a peer (which is the expected case when using=
 v1 package relay on transactions that have more than one generation of unc=
onfirmed ancestor) then the remaining transactions are already properly ord=
ered, and this is helpful even if unenforceable in general.=C2=A0=C2=A0</di=
v><div><br></div><div>The other observation I wanted to make was that havin=
g transaction relay gated on whether two nodes agree on chain tip seems lik=
e an overly restrictive criteria.=C2=A0 I think an important design princip=
le is that we want to minimize disruption from network splits -- if there a=
re competing blocks found in a small window of time, it&#39;s likely that t=
he utxo set is not materially different on the two chains (assuming miners =
are selecting from roughly the same sets of transactions when this happens,=
 which is typical).=C2=A0 Having transaction relay bifurcate on the two net=
work halves would seem to exacerbate the difference between the two sides o=
f the split -- users ought to be agnostic about how benign splits are resol=
ved and would likely want their transactions to relay across the whole netw=
ork.</div><div><br></div><div>Additionally, use of a chain tip might impose=
 a larger burden than is necessary on software that would seek to participa=
te in transaction relay without implementing headers sync/validation.=C2=A0=
 I don&#39;t know what software exists on the network, but I imagine there =
are a lot of scripts out there for transaction submission to the public p2p=
 network, and in thinking about=C2=A0modifying such a script to utilize pac=
kage relay it seems=C2=A0like an unnecessary added burden to first learn a =
node&#39;s tip before trying to relay a transaction.</div><div><br></div><d=
iv>Could you explain again what the benefit of including the blockhash is?=
=C2=A0 It seems like it is just so that a node could prioritize transaction=
 relay from peers with the same chain tip to maximize the likelihood of tra=
nsaction acceptance, but in the common case this seems like a pretty neglig=
ible concern, and in the case of a chain fork that persists for many minute=
s it seems better to me that we not partition the network into package-rela=
y regimes and just risk a little extra bandwidth in one direction or the ot=
her.=C2=A0 If we solve the problem I brought up at the beginning (of de-dup=
licating package data across peers with a package-wtxid-commitment in the a=
nnouncement), I think this is just some wasted pkginfo bandwidth on a singl=
e-link, and not across links (as we could cache validation failure for a pa=
ckage-hash to avoid re-requesting duplicate pkginfo1 messages).</div><div><=
br></div><div>Best,</div><div>Suhas</div><div><br></div></div><br><div clas=
s=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 7, 2022=
 at 1:57 PM Gloria Zhao via bitcoin-dev &lt;<a href=3D"mailto:bitcoin-dev@l=
ists.linuxfoundation.org" target=3D"_blank">bitcoin-dev@lists.linuxfoundati=
on.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><div dir=3D"ltr"><div>Hi Eric, aj, all,</div><div><br></div><div>Sorr=
y for the delayed response. @aj I&#39;m including some paraphrased points f=
rom our offline discussion (thanks).<br></div><div><br></div><div>&gt; Othe=
r idea: what if you encode the parent txs as a short hash of the=20
wtxid (something like bip152 short ids? perhaps seeded per peer so=20
collisions will be different per peer?) and include that in the inv=20
announcement? Would that work to avoid a round trip almost all of the=20
time, while still giving you enough info to save bw by deduping parents?</d=
iv><div><span><br></span></div><div><span>&gt; As I suggested earlier, a pa=
ckage is fundamentally a compact block (or<br>
&gt; block) announcement without the header. Compact block (BIP152) announc=
ement<br>
&gt; is already well-defined and widely implemented...<br>
</span></div><div><span><br></span></div><div><span>&gt; Let us not reinven=
t the wheel and/or introduce accidental complexity. I see<br>
&gt; no reason why packaging is not simply BIP152 without the &#39;header&#=
39; field, an<br>
&gt; updated protocol version, and the following sort of changes to names</=
span></div><div><br></div><div>Interestingly, &quot;why not use BIP 152 sho=
rtids to save bandwidth?&quot; is by far the most common suggestion I hear =
(including offline feedback). Here&#39;s a full explanation:<br><br>BIP 152=
 shortens transaction hashes (32 bytes) to shortids (6 bytes) to save a sig=
nificant amount of network bandwidth, which is extremely important in block=
 relay. However, this comes at the expense of computational complexity. The=
re is no way to directly calculate a transaction hash from a shortid; upon =
receipt of a compact block, a node is expected to calculate the shortids of=
 every unconfirmed transaction it knows about to find the matches (BIP 152:=
 [1], Bitcoin Core: [2]). This is expensive but appropriate for block relay=
, since the block must have a valid Proof of Work and new blocks only come =
every ~10 minutes. On the other hand, if we require nodes to calculate shor=
tids for every transaction in their mempools every time they receive a pack=
age, we are creating a DoS vector. Unconfirmed transactions don&#39;t need =
PoW and, to have a live transaction relay network, we should expect nodes t=
o handle transactions at a high-ish rate (i.e. at least 1000s of times more=
 transactions than blocks). We can&#39;t pre-calculate or cache shortids fo=
r mempool transactions, since the SipHash key depends on the block hash and=
 a per-connection salt.<br><br>Additionally, shortid calculation is not des=
igned to prevent intentional individual collisions. If we were to use these=
 shortids to deduplicate transactions we&#39;ve supposedly already seen, we=
 may have a censorship vector. Again, these tradeoffs make sense for compac=
t block relay (see shortid section in BIP 152 [3]), but not package relay.<=
/div><div><br></div><div>TLDR: DoSy if we calculate shortids on every packa=
ge and censorship vector if we use shortids for deduplication.</div><div><b=
r></div><div>&gt; Given this message there is no reason =C2=A0<br>&gt; to s=
end a (potentially bogus) fee rate with every package. It can only be =C2=
=A0<br>&gt; validated by obtaining the full set of txs, and the only recour=
se is =C2=A0<br>&gt; dropping (etc.) the peer, as is the case with single t=
xs.<br><br></div><div>Yeah, I agree with this. Combined with the previous d=
iscussion with aj (i.e. we can&#39;t accurately communicate the incentive c=
ompatibility of a package without sending the full graph, and this whole da=
nce is to avoid downloading a few low-fee transactions in uncommon edge cas=
es), I&#39;ve realized I should remove the fee + weight information from pk=
ginfo. Yay for less complexity!<br></div><div><br></div><div>Also, this mig=
ht be pedantic, but I said something incorrect earlier and would like to co=
rrect myself:<br><br>&gt;&gt; In theory, yes, but maybe it was announced ea=
rlier (while our node was down?) or had dropped from our mempool or similar=
, either way we don&#39;t have those txs yet. =C2=A0<br><br>I said &quot;It=
&#39;s fine if they have Erlay, since a sender would know in advance that B=
 is missing and announce it as a package.&quot; But this isn&#39;t true sin=
ce we&#39;re only using reconciliation in place of flooding to announce tra=
nsactions as they arrive, not for rebroadcast, and we&#39;re not doing full=
 mempool set reconciliation. In any case, making sure a node receives the t=
ransactions announced when it was offline is not something we guarantee, no=
t an intended use case for package relay, and not worsened by this.</div><d=
iv><br></div><div>Thanks for your feedback!</div><div><br></div><div>Best,<=
br></div><div>Gloria</div><div><div><br></div><div>[1]: <a href=3D"https://=
github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#cmpctblock" target=
=3D"_blank">https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#=
cmpctblock</a><br>[2]: <a href=3D"https://github.com/bitcoin/bitcoin/blob/m=
aster/src/blockencodings.cpp#L49" target=3D"_blank">https://github.com/bitc=
oin/bitcoin/blob/master/src/blockencodings.cpp#L49</a><br>[3]: <a href=3D"h=
ttps://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#short-transac=
tion-id-calculation" target=3D"_blank">https://github.com/bitcoin/bips/blob=
/master/bip-0152.mediawiki#short-transaction-id-calculation</a></div></div>=
</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=
On Thu, May 26, 2022 at 3:59 AM &lt;<a href=3D"mailto:eric@voskuil.org" tar=
get=3D"_blank">eric@voskuil.org</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Given that packages have no header, the pa=
ckage requires identity in a<br>
BIP152 scheme. For example &#39;header&#39; and &#39;blockhash&#39; fields =
can be replaced<br>
with a Merkle root (e.g. &quot;identity&quot; field) for the package, uniqu=
ely<br>
identifying the partially-ordered set of txs. And use of &#39;getdata&#39; =
(to<br>
obtain a package by hash) can be eliminated (not a use case).<br>
<br>
e<br>
<br>
&gt; -----Original Message-----<br>
&gt; From: <a href=3D"mailto:eric@voskuil.org" target=3D"_blank">eric@vosku=
il.org</a> &lt;<a href=3D"mailto:eric@voskuil.org" target=3D"_blank">eric@v=
oskuil.org</a>&gt;<br>
&gt; Sent: Wednesday, May 25, 2022 1:52 PM<br>
&gt; To: &#39;Anthony Towns&#39; &lt;<a href=3D"mailto:aj@erisian.com.au" t=
arget=3D"_blank">aj@erisian.com.au</a>&gt;; &#39;Bitcoin Protocol Discussio=
n&#39;<br>
&gt; &lt;<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" target=3D=
"_blank">bitcoin-dev@lists.linuxfoundation.org</a>&gt;; &#39;Gloria Zhao&#3=
9;<br>
&gt; &lt;<a href=3D"mailto:gloriajzhao@gmail.com" target=3D"_blank">gloriaj=
zhao@gmail.com</a>&gt;<br>
&gt; Subject: RE: [bitcoin-dev] Package Relay Proposal<br>
&gt; <br>
&gt; &gt; From: bitcoin-dev &lt;<a href=3D"mailto:bitcoin-dev-bounces@lists=
.linuxfoundation.org" target=3D"_blank">bitcoin-dev-bounces@lists.linuxfoun=
dation.org</a>&gt; On<br>
&gt; Behalf<br>
&gt; &gt; Of Anthony Towns via bitcoin-dev<br>
&gt; &gt; Sent: Wednesday, May 25, 2022 11:56 AM<br>
&gt; <br>
&gt; &gt; So the other thing is what happens if the peer announcing package=
s to us<br>
&gt; is<br>
&gt; &gt; dishonest?<br>
&gt; &gt;<br>
&gt; &gt; They announce pkg X, say X has parents A B C and the fee rate is<=
br>
garbage.<br>
&gt; But<br>
&gt; &gt; actually X has parent D and the fee rate is excellent. Do we requ=
est the<br>
&gt; &gt; package from another peer, or every peer, to double check? Otherw=
ise<br>
&gt; we&#39;re<br>
&gt; &gt; allowing the first peer we ask about a package to censor that tx =
from<br>
us?<br>
&gt; &gt;<br>
&gt; &gt; I think the fix for that is just to provide the fee and weight wh=
en<br>
&gt; announcing<br>
&gt; &gt; the package rather than only being asked for its info? Then if on=
e peer<br>
&gt; makes<br>
&gt; &gt; it sound like a good deal you ask for the parent txids from them,=
<br>
dedupe,<br>
&gt; &gt; request, and verify they were honest about the parents.<br>
&gt; <br>
&gt; Single tx broadcasts do not carry an advertised fee rate, however the&=
#39;<br>
&gt; feefilter&#39; message (BIP133) provides this distinction. This should=
 be<br>
&gt; interpreted as applicable to packages. Given this message there is no<=
br>
reason<br>
&gt; to send a (potentially bogus) fee rate with every package. It can only=
 be<br>
&gt; validated by obtaining the full set of txs, and the only recourse is<b=
r>
&gt; dropping (etc.) the peer, as is the case with single txs. Relying on t=
he<br>
&gt; existing message is simpler, more consistent, and more efficient.<br>
&gt; <br>
&gt; &gt; &gt;&gt; Is it plausible to add the graph in?<br>
&gt; &gt;<br>
&gt; &gt; Likewise, I think you&#39;d have to have the graph info from many=
 nodes if<br>
&gt; you&#39;re<br>
&gt; &gt; going to make decisions based on it and don&#39;t want hostile pe=
ers to be<br>
&gt; able to<br>
&gt; &gt; trick you into ignoring txs.<br>
&gt; &gt;<br>
&gt; &gt; Other idea: what if you encode the parent txs as a short hash of =
the<br>
wtxid<br>
&gt; &gt; (something like bip152 short ids? perhaps seeded per peer so coll=
isions<br>
&gt; will<br>
&gt; &gt; be different per peer?) and include that in the inv announcement?=
 Would<br>
&gt; &gt; that work to avoid a round trip almost all of the time, while sti=
ll<br>
giving<br>
&gt; you<br>
&gt; &gt; enough info to save bw by deduping parents?<br>
&gt; <br>
&gt; As I suggested earlier, a package is fundamentally a compact block (or=
<br>
&gt; block) announcement without the header. Compact block (BIP152)<br>
&gt; announcement<br>
&gt; is already well-defined and widely implemented. A node should never be=
<br>
&gt; required to retain an orphan, and BIP152 ensures this is not required.=
<br>
&gt; <br>
&gt; Once a validated set of txs within the package has been obtained with<=
br>
&gt; sufficient fee, a fee-optimal node would accept the largest subgraph o=
f<br>
the<br>
&gt; package that conforms to fee constraints and drop any peer that provid=
es a<br>
&gt; package for which the full graph does not.<br>
&gt; <br>
&gt; Let us not reinvent the wheel and/or introduce accidental complexity. =
I<br>
see<br>
&gt; no reason why packaging is not simply BIP152 without the &#39;header&#=
39; field,<br>
an<br>
&gt; updated protocol version, and the following sort of changes to names:<=
br>
&gt; <br>
&gt; sendpkg<br>
&gt; MSG_CMPCT_PKG<br>
&gt; cmpctpkg<br>
&gt; getpkgtxn<br>
&gt; pkgtxn<br>
&gt; <br>
&gt; &gt; &gt; For a maximum 25 transactions,<br>
&gt; &gt; &gt;23*24/2 =3D 276, seems like 36 bytes for a child-with-parents=
 package.<br>
&gt; &gt;<br>
&gt; &gt; If you&#39;re doing short ids that&#39;s maybe 25*4B=3D100B alrea=
dy, then the<br>
above<br>
&gt; is<br>
&gt; &gt; up to 36% overhead, I guess. Might be worth thinking more about, =
but<br>
&gt; maybe<br>
&gt; &gt; more interesting with ancestors than just parents.<br>
&gt; &gt;<br>
&gt; &gt; &gt;Also side note, since there are no size/count params,<br>
&gt; <br>
&gt; Size is restricted in the same manner as block and transaction broadca=
sts,<br>
&gt; by consensus. If the fee rate is sufficient there would be no reason t=
o<br>
&gt; preclude any valid size up to what can be mined in one block (packagin=
g<br>
&gt; across blocks is not economically rational under the assumption that o=
ne<br>
&gt; miner cannot expect to mine multiple blocks in a row). Count is<br>
incorporated<br>
&gt; into BIP152 as &#39;shortids_length&#39;.<br>
&gt; <br>
&gt; &gt; &gt; wondering if we<br>
&gt; &gt; &gt;should just have &quot;version&quot; in &quot;sendpackages&qu=
ot; be a bit field instead of<br>
&gt; &gt; &gt;sending a message for each version. 32 versions should be eno=
ugh right?<br>
&gt; <br>
&gt; Adding versioning to individual protocols is just a reflection of the<=
br>
&gt; insufficiency of the initial protocol versioning design, and that of t=
he<br>
&gt; various ad-hoc changes to it (including yet another approach in this<b=
r>
&gt; proposal) that have been introduced to compensate for it, though I&#39=
;ll<br>
&gt; address this in an independent post at some point.<br>
&gt; <br>
&gt; Best,<br>
&gt; e<br>
&gt; <br>
&gt; &gt; Maybe but a couple of messages per connection doesn&#39;t really =
seem worth<br>
&gt; &gt; arguing about?<br>
&gt; &gt;<br>
&gt; &gt; Cheers,<br>
&gt; &gt; aj<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Sent from my phone.<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; bitcoin-dev mailing list<br>
&gt; &gt; <a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" target=
=3D"_blank">bitcoin-dev@lists.linuxfoundation.org</a><br>
&gt; &gt; <a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bit=
coin-dev" rel=3D"noreferrer" target=3D"_blank">https://lists.linuxfoundatio=
n.org/mailman/listinfo/bitcoin-dev</a><br>
<br>
<br>
</blockquote></div>
_______________________________________________<br>
bitcoin-dev mailing list<br>
<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" target=3D"_blank">=
bitcoin-dev@lists.linuxfoundation.org</a><br>
<a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" =
rel=3D"noreferrer" target=3D"_blank">https://lists.linuxfoundation.org/mail=
man/listinfo/bitcoin-dev</a><br>
</blockquote></div>
_______________________________________________<br>
bitcoin-dev mailing list<br>
<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" target=3D"_blank">=
bitcoin-dev@lists.linuxfoundation.org</a><br>
<a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" =
rel=3D"noreferrer" target=3D"_blank">https://lists.linuxfoundation.org/mail=
man/listinfo/bitcoin-dev</a><br>
</blockquote></div>

--00000000000038845905e1657654--