Skip to content

Add P2P gossip_bp_peer message #1245

@heifner

Description

@heifner

Add new gossip_bp_peer message for sending bp peer connection information.

P2P: Auto-management of Private BP connections

The current p2p-auto-bp-peer feature is not useful for Savanna consensus as it only maintains connections to immediate BPs in the schedule. With Savanna consensus, connection to all finalizers (currently BPs) is required. See #1227, fixed by #1244.

  • Update p2p-auto-bp-peer to maintain connections to the top 21 BPs.

    • Continues to tracks proposer schedule to know which peer keys are currently active.
    • If at least one configured p2p-auto-bp-peer then the feature is activated. The p2p-auto-bp-peer list is used to bootstrap the process. p2p-peer-address entries will also be included if they are bp peers; established by the gossip_bp_peer handshake.
  • Add gossip of connections to verifiable BP peers.

  • New P2P gossip message

    • struct gossip_bp_peers {
         struct bp_peer {
            eosio::name producer_name;
            std::string server_address;
            // sig over [producer_name, server_address]
            signature sig;
         };
         std::vector<bp_peer> peers;
      };
      
    • Configured p2p-signature-provider will verify received gossip_bp_peers and send out gossip_bp_peers if any new peers received.
    • gossip_bp_peers message only sent to verified gossip bp peers.
    • Any bp_peer entry where all peers can't be connected to and verified as a bp peer is dropped from tracked state. This is how no longer valid bp_peer entries are removed.
    • The server_address allows for one BP to have a number of peers and backup peers. A limit of 4 bp_peer entries is allowed per producer_name. The server_address acts to distinguish between them.
  • p2p-peer-address peers will also be used for bootstrapping as long as one p2p-auto-bp-peer is configured and will always be connected; subject to the p2p-peer-limit. The p2p-peer-limit only applies to p2p-peer-address, not to gossip bp peers.

    • Connection flow:
      • If configured with p2p-signature-provider and p2p-auto-bp-peer then send a signed empty gossip_bp_peer.
        • If peer receives a gossip_bp_peers with new information it will send the new merged gossip_bp_peers to all of its previously verified bp gossip peers.
  • Gossip peers will remain connected when the associated proposer/finalizer is in the top 21.

  • When a p2p-auto-bp-peer rotates into the the top 21 then it will connect to its p2p-auto-bp-peers and send an empty gossip_bp_peers to have current gossip_bp_peers sent back to it.

  • When a node rotates out of the top 21 then peers will disconnect from it unless they explicitly connected via p2p-peer-address. Also the bp peer that rotated out will itself disconnect from any bp peers and wait to be rotated back in before participating in the bp peer gossip.

  • The on-chain peer list can be queried every block. If a version can be quickly queried this is likely the easiest and quickest method. Only bp peer nodes need to make this state query. See Retrieval of peers public keys from chainbase db. #1228.

Metadata

Metadata

Assignees

Labels

OCIWork exclusive to OCI team👍 lgtm

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions