Skip to content

Latest commit

 

History

History
63 lines (53 loc) · 1.8 KB

ARCHITECTURE.md

File metadata and controls

63 lines (53 loc) · 1.8 KB

Portalnetwork Module Architecture

The portalnetwork module is broken down into several components that all work together to produce a usable Portal Network client.

Main Dependency Flow

    graph TD
        remotePeer --> discv5
        discv5 --> remotePeer
        subgraph Ultralight Client
        discv5--TALKREQ/TALKRESP --> client
        client--TALKREQ/TALKRESP --> discv5
        client --> uTP
        uTP --> client
        end
Loading

Portal Network message flows

  graph LR
  PING --> PONG
  FINDNODES --> NODES
  FINDCONTENT --> FOUNDCONTENT
  FOUNDCONTENT --> uTP
  FOUNDCONTENT --> ENRs
  FOUNDCONTENT --> content
  OFFER --> ACCEPT
  ACCEPT --> uTP

Loading

Content Lookup

    graph TD
        startLookup--get nearest nodes --> lookupPeers
        lookupPeers--get nearest node--> nearestPeer
        subgraph single FindContent request
        nearestPeer --> sendFindContent
        sendFindContent --> enrs
        sendFindContent --> uTP
        sendFindContent --> content
        end
        enrs--add nodes to lookupPeers--> lookupPeers
Loading

Portal Network Message Lifecycle

    sequenceDiagram
        PNMessageHandler->>sendPortalNetworkMessage: nodeId/content
        sendPortalNetworkMessage->>routingTable: nodeId
        routingTable->>sendPortalNetworkMessage: ENR
        sendPortalNetworkMessage->>discv5.TalkReqHandler: content/(nodeId or ENR)
        discv5.TalkReqHandler->>discv5.RPCHandler: encoded message
        discv5.RPCHandler->>remotePeer: encoded message
        remotePeer->>discv5.RPCHandler: encoded response
        discv5.RPCHandler->>discv5.TalkReqHandler: encoded response
        discv5.TalkReqHandler->>sendPortalNetworkMessage: TalkResp payload
        sendPortalNetworkMessage->>PNMessageHandler: decoded message
        
Loading