Skip to content

Is there a better, but still simple, way for Bob to find his favorite nodes? #2222

@jMyles

Description

@jMyles

@cygnusv says:

As a follow-up of my comment here (#1741 (comment)), I have this idea for an alternative method for Bob.matching_nodes:

def matching_nodes(self, nodes: FleetSensor):

    bob_bytes = bytes(self.public_keys(DecryptingPower))

    def node_index(canonical_address: bytes) -> int:
        digest = SHA256(bob_bytes + canonical_address)  # potentially some metadata too (e.g. label?)
        index = int.from_bytes(digest, 'big')
        return index

    indexed_nodes = sorted([(node_index(node.canonical_public_address), node) for node in nodes])
    target_nodes = list(zip(*indexed_nodes))[1]
    return target_nodes

Instead of giving you a selection of nodes, this would give you a deterministic ordering of nodes, where you're guaranteed that the TMap is in some of the first nodes of that list (assuming there's still one of these original Ursulas online, obviously). This would work even as the network grows, at the expense of decreasing the success probability for Bob per Ursula (i.e, if the network is 10 times bigger, then Bob will get a 10x longer list, with ~9 false positives in that list per correct Ursula).

If this is something that you like, I'd be happy to contribute with this in a follow-up PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bob 👨‍💼Effects the "Bob" development areaEnhancementNew or improved featuresP2PNode discovery and P2P

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions