paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.78k stars 639 forks source link

Compute session topology ahead-of-time #761

Open rphmeier opened 1 year ago

rphmeier commented 1 year ago

rel: https://github.com/paritytech/polkadot-sdk/issues/842

By design, the validator indices, authority discovery keys, and random seed for a session s are always already determined as of s-1. Therefore, it is possible for the gossip-support subsystem to determine session topologies one session in advance. This means that there will be no loss of quality-of-service in the time between transitioning to a new session and determining the topology.

In practice, the session info for the upcoming session may not be readily available and this may require some runtime changes.

Some subsystems may not be able to gracefully handle anything other than a "current" topology, so some attention should be given to ensuring desired behavior.

eskimor commented 1 year ago

@rphmeier also suggest to change the protocol to request/response. So instead of an event going to the subsystems, the subsystems can just request (via a message containing a oneshot sender) the topology, which should be instantaneous. Hence the race between already in a new topology and actually knowing it can be resolved.

eskimor commented 1 year ago

Related: https://github.com/paritytech/polkadot-sdk/issues/762