discv5 icon indicating copy to clipboard operation
discv5 copied to clipboard

allow per-query predicates

Open divagant-martian opened this issue 2 years ago • 0 comments

Right now the predicate we have for queries receives an enr and the query finishes when a number of peers is found. I think an improvement would be to allow a per query predicate that can accumulate the found peers and decide if it found the peers it needs.

The difference is that, as we have this right now, the grouped predicate is if n peers satisfy a predicate. The new version would allow to identify if a group satisfies a predicate.

In lh this would be useful since we have grouped queries for subnets and it might be more beneficial to ensure that at least one peers belongs to each subnet in the query than checking if every peer belongs to at least one, where this would finish when potentially all peers belong to the same one. Changing this logic would mitigate queries where the "individual" predicates have a distribution such that some are harder to satisfy than others

divagant-martian avatar Nov 16 '22 15:11 divagant-martian