Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Use Request/Response protocol for availability distribution #2306

@eskimor

Description

@eskimor

Instead of gossiping via notifications, we should simply directly request our chunk from validators in the backing group of the candidate. No notifications are necessary, once a candidate is awaiting availability on chain, validators will start requesting their chunks. In the future, validators may request their chunks even sooner, if they discover locally via received statements that a candidate was successfully baked.

There are some benefits of this, in comparison to a solution that relies on notifications:

  1. It will be even more efficient than notifications could ever be, even with direct connections. As each validator in a backing group would send out notifications to all validators, thus each validator would still receive their chunks multiple times.
  2. We require way less connections. With directly sent notifications we would require open connections to all validators of the current session and possible even also for the next session. By means of the request/response approach worst case will only be approximately 2*N/g, where N is the number of validators in a session (2 N because of session boundaries), and g being the group size. So instead of 2000 connections, we only need approx 200 to 300 for a group size of 10. This is because, validators will download their chunks from different backing nodes - this should be achievable by picking a backer at random.
  3. It simplifies things: Possibly no need to synchronize views for this protocol or re-request stuff on a missed notification.
  4. Request/response is also perfect for availability recovery and PoV distribution. For availability recovery it also has the nice property that the code path for validators doing approval voting and collators that try to recover a PoV can be the same. For validators the TCP connection will stay open as requests keep coming in, for collators the connection would be opened for the request and shortly afterwards closed (because of lacking traffic), thus reducing load on validators.

Considerations

Spam: Spam protection should be relatively easy for availability distribution as each validator is only expected to fetch one piece and there are even multiple nodes it can fetch it from. Therefore we can keep a HashSet of all validator ids and remove those who fetched their piece. We will reject requests from nodes not in that set. Combined with a tight upper message size bound for requests, this should offer some level of protection.

Metadata

Metadata

Assignees

Labels

I10-optimisationAn enhancement to provide better overall performance in terms of time-to-completion for a task.I8-refactorCode needs refactoring.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions