spacemeshos / SMIPS

Spacemesh Improvement Proposals
https://spacemesh.io
Creative Commons Zero v1.0 Universal
7 stars 1 forks source link

Sync + Gossip state machine #43

Closed antonlerner closed 1 year ago

antonlerner commented 3 years ago

General description

The sync state of the node affects some key components and processes in the node, since some of them rely on having most up to date data and blocks. The node cannot participate in any consensus process until it has all up to date data from nodes.

Sync - Gossip deadlock

Syncing the node requires the node to query it's peers for all blocks, transactions, ATXs and NIPoSTs so that it can calculate current mesh state that in consensus. While the node queries all peers and receives the synced data some more data is likely to be shared via gossip. since validating the data requires all previous data to be present - when a node is syncing data it does not listen to gossip network. So the issue that arises is - how do we know when to open gossip so that messages can be validated

Enabling gossip

The describes state machine describes the transition of the entire node state, it can be reduced to the toggling of a single state identifier that will toggle between 3 states: Not synced, Sync + Gossip and Synced.

The state transition between modes affects the processes in the node. as described above, some processes can work only when the node is synced. the following table describes for each component whether it should be active or not in different stats of sync

  Not synced Sync + gossip Synced
Block creation N N Y
Hare protocol N N Y
Gossip N Y Y
Tortoise beacon N N Y
POST N N Y
Verifying Tortoise Y Y Y
countvonzero commented 1 year ago

implemented