nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 787 forks source link

Vote hinting improvements for unconfirmed predecessors #4290

Closed qwahzi closed 1 year ago

qwahzi commented 1 year ago

Summary

Piotr is working on potential vote hinting improvements for the Nano node. Screenshot from a heavily desynchronized local dev environment (~2M backlog):

image

More details from Piotr & Bob:

The larger the backlog the larger the timestamp differences between nodes. Elections start by least-recently-used timestamps, so each node starts a different set & everyone gets stuck. Hinting takes ~1k blocks with the most vote weight & starts elections for those (ignoring timestamps & buckets), which allows the whole network to make progress & resync

Vote hinting runs continuously, but Piotr's work makes it much better. Each node can only activate so many elections, & nodes only vote/confirm transactions in active elections. But if a threshold of votes is reached, vote hinting kicks in, & an election is started for that block. By default, there are 5000 slots for regular elections, & an additional 1000 slots for hinted elections

This approach appears to eliminate election churn; not a single scheduled election timed out. The problem was that elections always degraded to the point where some nodes had the dependencies confirmed and some did not. The improved hinting checks for that and activates elections for any predecessors that are not yet confirmed

qwahzi commented 1 year ago

Additional related PR here: https://github.com/nanocurrency/nano-node/pull/4334