@@ -427,19 +427,34 @@ A node may at start-up be assigned an externally reachable socket to advertise a
427
427
listen socket. If those sockets are not equivalent, the node is behind NAT and the
428
428
[mechanism for keeping holes punched] is activated. Like so, a node assumes it is behind
429
429
NAT if an externally reachable socket is omitted from the initial configuration and must
430
- activate the [mechanism for keeping holes punched]. The
431
- [external socket used by the local node is assessed] at runtime. Once a new externally
432
- reachable IP address is known, implementations will try to bind to the address at some
433
- number of randomly selected ports from a given range of probably unused ports. If binding
434
- succeeds with any port, the node is not behind NAT and the
435
- [mechanism for keeping holes punched] is
436
- deactivated. This solution assumes, in most scenarios where port-forwarding cannot be
437
- configured the local node host's address is private to the address realm of the device
438
- operating the NAT level furthest from the local node host[^1]. If the host and NAT device
439
- use the same IP address, binding will always succeed, so this method may give a false
440
- negative. However, this is not detrimental. A node behind NAT that deactivates the
441
- [mechanism for keeping holes punched] will more frequently have to re-establish sessions
442
- to its peers.
430
+ activate the [mechanism for keeping holes punched]. [Runtime address discovery] asses the
431
+ external socket used by the local node. Once a new externally reachable IP address is known,
432
+ implementations will try to bind to the address at some number of randomly selected ports
433
+ from a given range of probably unused ports. If binding succeeds with any port, the node is
434
+ not behind NAT and the [mechanism for keeping holes punched] is deactivated. This solution
435
+ assumes, in most scenarios where port-forwarding cannot be configured the local node host's
436
+ address is private to the address realm of the device operating the NAT level furthest from
437
+ the local node host[^1]. If the host and NAT device use the same IP address, binding will
438
+ always succeed, so this method may give a false negative. However, this is not detrimental.
439
+ A node behind NAT that deactivates the [mechanism for keeping holes punched] will more
440
+ frequently have to re-establish sessions to its peers.
441
+
442
+ ### Limiting resource consumption of peers behind symmetric NATs, useful for light-clients
443
+
444
+ Peers with non-contactable ENRs do not get inserted into kbuckets. Nodes that are behind
445
+ symmetric NATs will naturally never succeed in pinpointing one external socket for peers
446
+ to reach them on by [runtime address discovery] and therefore their non-contactable ENRs
447
+ will never update to contactable ENRs. This means, these peers will never respond to
448
+ requests, as only peers in kbucktes are sent requests. This does not cohere with the
449
+ p2p-model, rather the server-client model where the peer with a non-contactable ENR acts
450
+ as the client. This misalignment is especially bothersome for well behaving (externally
451
+ reachable) light-clients operating on limited resources. Discv5.2 corrects this
452
+ side-effect of [runtime address discovery] by setting introducing a configurable limit to
453
+ the number of sessions at a time with peers with non-contactable ENRs, the lower limit
454
+ being 1. Nodes must accept sessions with at least one peer with a non-contactable ENR to
455
+ for [runtime address discovery] to be enabled on the discv5.2 network.
456
+
457
+ ### Fault tolerance
443
458
444
459
[EIP-778]: ../enr.md
445
460
[identity scheme]: ../enr.md#record-structure
@@ -457,7 +472,8 @@ to its peers.
457
472
[UDP communication]: ./discv5-wire.md#udp-communication
458
473
[Sessions]: ./discv5-theory.md#sessions
459
474
[liveness check]: ./discv5-theory.md#table-maintenance-in-practice
460
- [external socket used by the local node is assessed]: ./discv5-theory.md#maintaining-the-local-node-record
475
+ [Runtime address discovery]: ./discv5-theory.md#maintaining-the-local-node-record
476
+ [runtime address discovery]: ./discv5-theory.md#maintaining-the-local-node-record
461
477
[mechanism for keeping holes punched]: ./discv5-theory.md#job-of-keeping-the-hole-punched-falls-on-bob-and-bob's-incentive-to-do-so
462
478
463
479
[^1]: https://pdos.csail.mit.edu/papers/p2pnat.pdf
0 commit comments