Skip to content

Ascending bootstrap dependency resolution#4692

Merged
pwojcikdev merged 26 commits intonanocurrency:developfrom
pwojcikdev:dependency-walking-rebased
Aug 6, 2024
Merged

Ascending bootstrap dependency resolution#4692
pwojcikdev merged 26 commits intonanocurrency:developfrom
pwojcikdev:dependency-walking-rebased

Conversation

@pwojcikdev
Copy link
Copy Markdown
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>
@pwojcikdev pwojcikdev force-pushed the dependency-walking-rebased branch from 3ea0c51 to 9f44594 Compare August 5, 2024 20:34
return result;
}

nano::block_hash nano::bootstrap_ascending::account_sets::next_blocking ()
Copy link
Copy Markdown
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
Copy Markdown
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.

}

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
Copy Markdown
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
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