Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascending bootstrap dependency resolution #4692

Merged

Conversation

pwojcikdev
Copy link
Contributor

This is the first part of our (mine & @gr0vity-dev) work on improving ascending bootstrapper. This part contains a new dependency resolution strategy among a few other smaller improvements.

An example of how it dependency resolution process works: let's have three accounts A, B, C. A depends on a transaction sent by B, and B depends on a transaction sent by C. Let's now assume we have a ledger that is not synced 100%, might be because we're doing an initial sync or our node was offline for a while. If account A performs a new live transaction, we can't process it immediately, because we're still missing chains for B & C. In the previous version resolving these dependencies was slow, as it was relying on sequential sampling of the whole ledger. With this improved algorithm, we first add account A to the blocking set, resolve its dependency as account B, since B is blocked we repeat the same process for B, finally arriving at account C that unblocks all these chains.

@qwahzi qwahzi added this to the V27 milestone Aug 5, 2024
pwojcikdev and others added 17 commits August 5, 2024 20:57
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
@@ -211,6 +209,25 @@ nano::account nano::bootstrap_ascending::account_sets::next ()
return result;
}

nano::block_hash nano::bootstrap_ascending::account_sets::next_blocking ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return optional rather than 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could and should be done. I didn't have too much time to cleanup everything though.

@@ -241,22 +273,52 @@ nano::account nano::bootstrap_ascending::service::wait_available_account ()
return { 0 };
}

bool nano::bootstrap_ascending::service::request (nano::account & account, std::shared_ptr<nano::transport::channel> & channel)
nano::block_hash nano::bootstrap_ascending::service::available_dependency ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionals for these too.

@pwojcikdev pwojcikdev merged commit b7ae57a into nanocurrency:develop Aug 6, 2024
25 of 28 checks passed
clemahieu pushed a commit that referenced this pull request Aug 6, 2024
* Dependency walking

* Parallel database scan

* Stats

* Throttling & backoff

* Dependency account scanning

* Sync dependencies

* Track source when throttling

* Count tags

* Priorities backoff

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Timestamps

* Avoid reprocessing old blocks

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Max tags limit

* Handle `gap_previous`

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Check timestamp

* Tune initial priority

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Fix config

* Verify response

* Use filters

* Remove random sampling

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Backoff adjustments

* Insert genesis on start

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Fix timestamp check performance

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>

* Adjust throttle size computation

* Config improvements

* Fix compilation

* Extend test timeout

---------

Co-authored-by: gr0vity-dev <85646666+gr0vity-dev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants