nano-node icon indicating copy to clipboard operation
nano-node copied to clipboard

Optimistic elections are not working

Open dsiganos opened this issue 2 years ago • 2 comments

Optimistic elections are not working since at least the introduction of the election scheduler. We need to review the approach we want to take w.r.t. optimistic elections.

One reason (but it might not be the only one) that the optimistic election are not working is the call to node.ledger.dependents_confirmed (transaction, *block) in nano::election_scheduler::activate, which tells the node to not start an election for a block that doesn't have all its descendants confirmed.

What is an optimistic election: With a given set of unconfirmed connecting blocks (vertically in an account, as well as horizontally across accounts with send/receive links), we want to minimize the number of elections required to locally confirm all of them. Optimistic elections are an attempt to do so more efficiently, by starting an election at the highest block height within an account. If that elections succeeds then the node can assume that all its descendant blocks are also confirmed.

dsiganos avatar Mar 29 '22 09:03 dsiganos

We should check that when an optimistic election does not succeed, we walk back up the account history, ideally using a bisect strategy, and try to confirm election at older points in the account chain.

dsiganos avatar Mar 29 '22 10:03 dsiganos

We may need some heuristic to inform the rate at which we allow optimistic elections. Without that, there is a risk of wasted resources attempting to perform a lot of optimistic elections if the backlog is large. Traversing horizontally across accounts using send/receive is likely out of scope due to the account-based focus of the scheduler and other complexities.

Using the mode/median of cemented_count from network telemetry could help focus in on how behind the local node is cementing, and then scale optimistic elections in some way based on that. Although telemetry is not sybil protected, focusing on PR data could help and the impact of an attack along those lines should be minimal as it would only cause a bit of inefficiency in some extra failed elections.

zhyatt avatar Mar 30 '22 17:03 zhyatt

Looks like this will be addressed here:

https://github.com/nanocurrency/nano-node/pull/4111

EDIT:

Fix merged and planned for V25

qwahzi avatar Feb 28 '23 14:02 qwahzi