Skip to content

Commit 3e106fa

Browse files
committed
News268: Add review club n28165 (p2p v2 encrypted transport)
1 parent f36949a commit 3e106fa

File tree

1 file changed

+86
-4
lines changed

1 file changed

+86
-4
lines changed

_posts/en/newsletters/2023-09-13-newsletter.md

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,90 @@ Club][] meeting, highlighting some of the important questions and
5757
answers. Click on a question below to see a summary of the answer from
5858
the meeting.*
5959

60-
FIXME:LarryRuane
60+
[Transport abstraction][review club 28165] is a recently-merged PR by Pieter Wuille (sipa)
61+
that introduces a _transport_ abstraction (interface class). Concrete
62+
derivations of this class convert a (per-peer) connection's (already
63+
serialized) send and receive messages to and from wire format. This
64+
can be thought of as implementing a deeper level of serialization and
65+
deserialization. These classes do not do the actual sending and receiving.
66+
67+
The PR derives two concrete classes from the `Transport` class,
68+
`V1Transport` (what we have today) and `V2Transport` (encrypted on the
69+
wire). This PR is part of the
70+
[BIP324][topic v2 p2p transport]
71+
_Version 2 P2P Encrypted Transport Protocol_ [project][v2 p2p tracking pr].
6172

6273
{% include functions/details-list.md
63-
q0="FIXME"
64-
a0="FIXME"
65-
a0link="https://bitcoincore.reviews/28122#l-126FIXME"
74+
q0="What is the distinction between [*net*][net] and
75+
[*net_processing*][net_processing]?"
76+
a0="*Net* is at the bottom of the networking stack and handles
77+
low-level communication between peers, while *net_processing*
78+
builds on top of the *net* layer and handles the processing
79+
and validation of messages from *net* layer."
80+
a0link="https://bitcoincore.reviews/28165#l-22"
81+
82+
q1="More concretely, name examples of classes or functions that
83+
we'd associate with *net_processing*, and, in contrast,
84+
with *net*?"
85+
a1="*net_processing*: `PeerManager`, `ProcessMessage`.
86+
*net*: `CNode`, `ReceiveMsgBytes`, `CConnMan`."
87+
a1link="https://bitcoincore.reviews/28165#l-25"
88+
89+
q2="Does BIP324 require changes to the *net* layer, the
90+
*net_processing* layer, or both? Does it affect policy
91+
or consensus?"
92+
a2="These changes are only at the *net* layer; they don't affect consensus."
93+
a2link="https://bitcoincore.reviews/28165#l-37"
94+
95+
q3="What are examples of implementation bugs that could result in
96+
this PR being an (accidental) consensus change?"
97+
a3="A bug that restricts the maximum message size less to than
98+
4MB, resulting in a blockweight soft fork; a bug in block
99+
deserialization that causes the node to reject a consensus-valid
100+
block, also a soft fork."
101+
a3link="https://bitcoincore.reviews/28165#l-45"
102+
103+
q4="`CNetMsgMaker` and `Transport` both “serialize” messages.
104+
What is the difference in what they do?"
105+
a4="`CNetMsgMaker` performs the serialization of data structures
106+
into bytes; `Transport` receives these bytes, adds
107+
(serializes) the header, and actually sends it."
108+
a4link="https://bitcoincore.reviews/28165#l-60"
109+
110+
q5="In the process of turning an application object like a
111+
`CTransactionRef` (transaction) into bytes / network packets, what
112+
happens? Which data structures does it turn into in the process?"
113+
a5="`msgMaker.Make()` serializes the `CTransactionRef` message by
114+
calling `SerializeTransaction()`, then `PushMessage()` puts the
115+
serialized message into the `vSendMsg` queue, then `SocketSendData()`
116+
adds a header/checksum (after the changes from this PR) and asks the
117+
transport for the next packet to send, and finally calls `m_sock->Send()`."
118+
a5link="https://bitcoincore.reviews/28165#l-83"
119+
120+
q6="How many bytes are sent over the wire for the `sendtxrcncl`message
121+
(taking that message as a simple example)?"
122+
a6="36 bytes: 24 for the header (magic 4 bytes, command 12 bytes,
123+
message size 4 bytes, checksum 4 bytes), then 12 bytes for the
124+
payload (version 4 bytes, salt 8 bytes)."
125+
a6link="https://bitcoincore.reviews/28165#l-86"
126+
127+
q7="After `PushMessage()` returns, have we sent the bytes corresponding
128+
to this message to the peer already (yes/no/maybe)? Why?"
129+
a7="All are possible. **Yes**: we (*net_processing*) don't have to do
130+
anything else to cause the message to be sent.
131+
**No**: it's extremely unlikely to have
132+
been received by the recipient by the time that function returns.
133+
**Maybe**: if all the queues are empty it will have made it to the
134+
kernel socket layer, but if some of the queues aren't, then it
135+
will still be waiting on those to drain further before getting
136+
to the OS."
137+
a7link="https://bitcoincore.reviews/28165#l-112"
138+
139+
q8="Which threads access `CNode::vSendMsg`?"
140+
a8="`ThreadMessageHandler` if the message is sent synchronously
141+
(\"optimistically\"); `ThreadSocketHandler` if it gets queued
142+
and picked up and sent later."
143+
a8link="https://bitcoincore.reviews/28165#l-120"
66144
%}
67145

68146
## Releases and release candidates
@@ -93,9 +171,13 @@ Proposals (BIPs)][bips repo], [Lightning BOLTs][bolts repo], and
93171
{% include references.md %}
94172
{% include linkers/issues.md v=2 issues="26567" %}
95173
[LND v0.17.0-beta.rc2]: https://github.com/lightningnetwork/lnd/releases/tag/v0.17.0-beta.rc2
174+
[net]: https://github.com/bitcoin/bitcoin/blob/master/src/net.h
175+
[net_processing]: https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.h
96176
[news195 taro]: /en/newsletters/2022/04/13/#transferable-token-scheme
97177
[osuntokun bips]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-September/021938.html
98178
[osuntokun blip post]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2023-September/004089.html
99179
[osuntokun blip]: https://github.com/lightning/blips/pull/29
180+
[review club 28165]: https://bitcoincore.reviews/28165
100181
[sanders post]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2023-September/004088.html
101182
[sanders ptlc]: https://gist.github.com/instagibbs/1d02d0251640c250ceea1c66665ec163
183+
[v2 p2p tracking pr]: https://github.com/bitcoin/bitcoin/issues/27634

0 commit comments

Comments
 (0)