You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
discv5-theory: recommend an algorithm for auxiliary ENR selection in lookup responses
The Lookup Responses section says the registrar "may also return
additional ENRs selected from its view of the service table" but
doesn't specify how the selection is made.
Add a recommended algorithm: when the wire-format request carries a
list of topic-distances at which the requester's service table has
free space, the registrar selects at most one ENR per requested
distance from the corresponding bucket of its own B(s), up to an
implementation-defined total cap.
One-per-distance keeps responses compact and spreads coverage across
the requester's free buckets rather than overrepresenting a single
distance.
Companion to the wire-spec definition of the topic-distance list in
REGTOPIC and TOPICQUERY.
Copy file name to clipboardExpand all lines: discv5/discv5-theory.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -656,6 +656,24 @@ Registration responses may include additional ENRs selected from the registrar's
656
656
advertiser may use these ENRs to update its advertise table `B(s)` after validating the ENRs and checking DISC-NG
657
657
capability.
658
658
659
+
When the wire-format request carries a list of topic-distances at which the requester's own service table has
660
+
free space, the registrar SHOULD bias the selection of auxiliary ENRs toward those distances. The recommended
661
+
algorithm is:
662
+
663
+
1. For each topic-distance in the requester's list, in order, select at most one ENR from the corresponding
664
+
bucket `bd(s)` of the registrar's own service table.
665
+
2. Stop once an implementation-defined cap on the number of auxiliary ENRs has been reached, or once every
666
+
requested distance has been visited.
667
+
668
+
Picking at most one ENR per requested distance keeps the response compact and spreads coverage across the
669
+
requester's free buckets rather than overrepresenting a single distance. It also serves as a security measure
670
+
against Sybil and eclipse attacks: a registrar whose service table happens to contain many ENRs at one distance
671
+
— for example because an attacker controls a cluster of node identities clustered in that bucket — cannot
672
+
flood a single response with those ENRs and thereby colonise the requester's `B(s)` at that distance. ENRs
673
+
that fail local validation rules (for example endpoint-versus-source checks) SHOULD be skipped.
674
+
675
+
The same auxiliary-ENR selection rule applies to lookup responses (see [Lookup Responses](#lookup-responses)).
676
+
659
677
### Renewal
660
678
661
679
An admitted advertisement remains stored until its expiry time `E`.
@@ -699,6 +717,8 @@ The registrar MUST NOT return expired advertisements. If more than `Freturn` adv
699
717
700
718
A registrar can also return additional ENRs selected from its view of the service table for `s`. These ENRs are not lookup results; they are auxiliary routing information used to improve future registration and lookup operations.
701
719
720
+
The auxiliary-ENR selection rule defined for registration responses (see [Registration Procedure](#registration-procedure)) applies here as well: when the wire-format request carries a list of topic-distances, the registrar SHOULD bias its selection toward those distances using the same one-ENR-per-requested-distance algorithm.
721
+
702
722
The registrar SHOULD select additional ENRs across buckets of its service table, for example by returning at most one randomly selected node from each bucket. This helps the requester improve its local service table `B(s)` across the service-centred key space, rather than only learning nodes closest to `s`.
703
723
704
724
The requester uses returned neighbour ENRs to update its local service table `B(s)` after validating the ENRs, checking DISC-NG capability, and applying local DISC-NG usability policy. The exact encoding of returned advertisements and neighbour ENRs is specified in the wire-format document.
0 commit comments