ethereum / devp2p

Ethereum peer-to-peer networking specifications
984 stars 275 forks source link

discv5: questions regarding wait period and topic search #84

Closed NIC619 closed 4 years ago

NIC619 commented 5 years ago

(1) In topic-advertisement-storage section:

target-ad-lifetime = 600 # how long ads stay queued (10 min)
target-registration-interval = target-ad-lifetime / queue-length
min-wait-period = 60 # (1 min)
control-loop-constant = 600

period = time-of-registration - time-of-previous-registration
new-wait-period = wait-period * exp((target-registration-interval - period) / control-loop-constant)
wait-period = max(new-wait-period, min-wait-period)

In the second to last line wait-period was referenced before assignment.

(2) In the second paragraph of topic-search section:

To find nodes, the searcher generates random node IDs inside the topic radius and performs recursive Kademlia lookups on them. All (intermediate) nodes encountered during lookup are asked for topic queue enties using the TOPICQUERY packet.

Why are random generated node IDs used instead of just the hash of the topic(keccak256(T))?

fjl commented 5 years ago

About (1): we're not super strict about assignment order, but I can fix it.

About(2): maybe it should be explained better. The idea is that topic search generates random targets within the topic radius and performs lookups for them. This basically 'walks' the topic radius space at random.

NIC619 commented 5 years ago

The idea is that topic search generates random targets within the topic radius and performs lookups for them.

Generating random targets within the topic radius feels like doing proof of work. Wouldn't this impose quite a burden on searchers once the radius is getting small enough?

fjl commented 5 years ago

Not really. Lookups for a specific ID in node ID space are easy in v5. They were expensive in v4 because the FINDNODE target parameter was a public key and hashed on the node answering the query. In v5 FINDNODE takes a bucket number as parameter (in the current spec draft at least).

fjl commented 5 years ago

But your PoW idea is very nice, we should investigate it! One problem with the current topic advertisement design is that it claims to be secure also for small topics. If we make lookup for a specific target more expensive it can help with security.

fjl commented 4 years ago

The spec has now been updated significantly and the formula in the original issue doesn't exist anymore.