tari-project / tari-dan

BSD 3-Clause "New" or "Revised" License
7 stars 18 forks source link

Gossip and request strategy for foreign proposals #1201

Open sdbondi opened 2 weeks ago

sdbondi commented 2 weeks ago

Problem

We currently have large (> 1Mb) gossip messages for foreign proposals. Gossipsub is not designed for large messages. In the case where a large amount of data must be transferred between many nodes, we've used the gossip and request strategy, which entails gossiping a succinct notification followed by an explicit request for the data.

Foreign proposals contains a block, a QC and substates. Additional data may be required to ensure authenticity (e.g. a merged merkle proof of the applicable substates) but this is out of scope for this issue.

Proposal 1

  1. Notify applicable foreign shard groups about a foreign proposal on each shard group's topic. The notification includes the block id and the shard-applicable transaction IDs.
  2. Each receiving node selects a member of the foreign committee (this may be random, or may be based on the relative index of the two nodes to reduce traffic to a single node)
  3. The node sends a ForeignProposalRequest(req_id) to the selected node
  4. The sending node streams responses containing the applicable data. Since substate sizes may exceed framing limits, these responses are broken up.
  5. The receiving node assembles the messages using req_id and when the stream is complete, passes the payloads to the foreign proposal handler.

Protocol details:

Edge cases:

Additional benefits: If a transaction is in LocalPrepared or LocalACcepted for some timeout, we can use the same mechanism to request an expected missing foreign proposal from the foreign node. If a foreign node is unaware of any of the requested transactions, it may request and sequence the previously unknown transactions.