Skip to content

Commit faf71d6

Browse files
committed
fixup! Finish description of sequence diagram
1 parent bc19e70 commit faf71d6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

discv5/discv5-theory.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,10 @@ registration algorithm if the same topic is being registered and searched for.
531531

532532
The protocol introduces the notification packet kind. There are 4 total message
533533
containers, these are abbreviated in the sequence diagram below as follows:
534-
- m - message packet
535-
- whoareyou - [WHOEAREYOU] packet
534+
- m - [message packet]
535+
- whoareyou - [WHOAREYOU packet]
536536
- hm - [handshake message packet]
537-
- n - notification packet
537+
- n - [notification packet]
538538

539539
```mermaid
540540
sequenceDiagram
@@ -550,6 +550,7 @@ containers, these are abbreviated in the sequence diagram below as follows:
550550
Relay->>Bob:n(RELAYMSG[nonce])
551551
Bob-->>Alice: whoareyou(nonce)
552552
Note right of Bob: Hole punched in Bob's NAT for Alice
553+
Alice-->>Bob: hm(FINDNODE)
553554
```
554555
Bob is behind a NAT. Bob is in Relay's kbuckets, they have a session together and Bob
555556
has sent a packet to Relay in the last ~20 seconds[^1].
@@ -561,15 +562,15 @@ Bob, if Alice is behind a NAT, Alice's NAT adds the filtering rule
561562
it's UDP session table[^2][^3]. This means a hole now is punched for Bob in Alice's NAT
562563
for the duration of `entry-lifetime`. The request to Bob times out as Bob is behind a NAT.
563564

564-
Alice initiates an attempt to punch a hole in Bob's NAT via Relay. Alice reset the request
565+
Alice initiates an attempt to punch a hole in Bob's NAT via Relay. Alice resets the request
565566
time out on the timed out [FINDNODE] message and wraps the message's nonce in a [RELAYINIT]
566567
notification and sends it to Relay. The notification also contains its ENR and Bob's node
567568
id.
568569

569570
Relay disassembles the [RELAYINIT] notification and uses the `tgt-id` to look up Bob's
570571
ENR in its kbuckets. With high probability, Relay will find Bob's ENR in its kbuckets
571572
as ~1 second ago, Relay assembled a [NODES] response for Alice containing Bob's ENR (see
572-
[UDP Communication] for recommended time out times). Relay assembles a [RELAYMSG]
573+
[UDP Communication] for recommended time out duration). Relay assembles a [RELAYMSG]
573574
notification with Alice's message nonce and ENR, then sends it to the address in Bob's
574575
ENR.
575576

@@ -592,13 +593,15 @@ From here on it's business as usual. See [Sessions].
592593
[PING]: ./discv5-wire.md#ping-request-0x01
593594
[PONG]: ./discv5-wire.md#pong-response-0x02
594595
[FINDNODE]: ./discv5-wire.md#findnode-request-0x03
596+
[NODES]: ./discv5-wire.md#nodes-response-0x04
595597
[REGTOPIC]: ./discv5-wire.md#regtopic-request-0x07
596598
[REGCONFIRMATION]: ./discv5-wire.md#regconfirmation-response-0x09
597599
[TOPICQUERY]: ./discv5-wire.md#topicquery-request-0x0a
598600
[RELAYINIT]: ./discv5-wire.md#relayinit-0x01
599601
[RELAYMSG]: ./discv5-wire.md#relaymsg-0x02
600602

601603
[UDP communication]: ./discv5-wire.md#udp-communication
604+
[Sessions]: ./discv5-theory.md#sessions
602605

603606
[^1]: https://pdos.csail.mit.edu/papers/p2pnat.pdf
604607
[^2]: https://datatracker.ietf.org/doc/html/rfc4787

0 commit comments

Comments
 (0)