-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Optimistic elections #4111
Optimistic elections #4111
Conversation
@pwojcikdev Does the optimistic confirmation process apply per account-chain, or does it apply cross-chain too (and/or could that be an avenue for future optimization)? For example, if account_c has receives from account_a and account_b, if account_c's latest frontier is confirmed, are transactions from account_a and account_b (up to the send associated with account_c) confirmed too? Semi-related, does this change replace/modify previous automatic dependent block confirmations via confirmation_height? Or is it completely separate?
|
# Conflicts: # nano/lib/stats_enums.hpp
df59041
to
2176199
Compare
@pwojcikdev - I've been testing this for the last few days with good results, but it looks like my node just switched out of bootstrapping mode, even though it wasn't finished. Unchecked is suddenly capped to 256,000 (unchecked memory table?) and count/cemented drastically slowed down to ~20/hour (from 200k-300k/hr). It's probably not directly related to this branch/change, but I figured I'd report it just in case:
EDIT: Per some Discord discussion, this is probably just the legacy bootstrap implementation - I'll wait for the updated ascending bootstrap client |
The latest bootstrap cutoff point is: 169643594. |
@qwahzi This PR actually builds upon the improvements introduced in dependent block confirmation. It applies cross chain, so if we happen to confirm account A that has receives from B & C, then exactly as you said, both B & C chains will be confirmed (up to the associated sends). The problem before introduction of this PR was that there was no reliable mechanism to fully utilise those dependent elections. It's worth noting that the current mechanism is still not working to the fullest potential. The biggest bottleneck I see is the vote requesting, which will be improved by vote generator refactor & vote storage. |
# Conflicts: # nano/node/active_transactions.cpp # nano/node/election.cpp # nano/node/election.hpp # nano/node/election_scheduler.cpp
595857f
to
0d74cab
Compare
It was found during testing that a bit longer delay works better
2b1e711
to
bb4f14f
Compare
…-2-rebased # Conflicts: # nano/lib/stats_enums.hpp
7838664
to
f8587f6
Compare
…for it to be activated anyway
# Conflicts: # nano/core_test/active_transactions.cpp # nano/lib/stats_enums.hpp # nano/node/active_transactions.cpp # nano/node/active_transactions.hpp # nano/node/election.cpp # nano/node/election_scheduler.cpp # nano/node/node.cpp
nano/node/active_transactions.cpp
Outdated
@@ -210,8 +215,8 @@ int64_t nano::active_transactions::vacancy (nano::election_behavior behavior) co | |||
case nano::election_behavior::normal: | |||
return limit () - static_cast<int64_t> (roots.size ()); | |||
case nano::election_behavior::hinted: | |||
case nano::election_behavior::optimistic: | |||
return limit (nano::election_behavior::hinted) - count_by_behavior[nano::election_behavior::hinted]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clemahieu Merge introduced a small bug here, it should pass in 'behavior' parameter instead of fixed enum value.
Adding info for optimistic elections, based on Piotr's PR here: nanocurrency/nano-node#4111
Adding info for optimistic elections, based on Piotr's PR here: nanocurrency/nano-node#4111
When bootstrapping, a node needs to cement a large number of blocks (~175 million so far), so it is critical to ensure this process is as efficient and quick as possible. Currently, it is done in a very naive way of confirming blocks in account chains one by one, ie. election scheduler always activates election for account's confirmation frontier + 1. This means that the time to confirm all blocks is more or less proportional to number of all blocks in the ledger.
This PR introduces a helper mechanism to speed up this cementing process. An optimistic scheduler randomly samples accounts with unconfirmed blocks and activates an election for the account head block (the latest unconfirmed block in an account chain). This means that the time to confirm all blocks will be proportional to number of all accounts in the ledger. The number of optimistic elections is limited to 500, so it doesn't replace or impact the default election scheduling behavior.
This is a very simple algorithm that can definitely be improved further. However, even is such a basic form it provides a significant speedup to the cementing process.
The following test results are thanks to @gr0vity-dev:
Live network:
Beta network:
I suspect the main reason for such a big difference between live and beta performance is the greater variety of PRs, thus it's harder to gather enough votes for block confirmation.