-
Notifications
You must be signed in to change notification settings - Fork 102
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
fix(security): fix concurrency issues in tree key formats, and CPU usage in genesis tree roots #7392
Conversation
65b09c7
to
6f4540f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
zebra-state/src/service/finalized_state/disk_format/upgrade/cache_genesis_roots.rs
Outdated
Show resolved
Hide resolved
zebra-state/src/service/finalized_state/disk_format/upgrade/fix_tree_key_type.rs
Outdated
Show resolved
Hide resolved
|
This happened before the other way around, let me work on a better fix. |
Co-authored-by: Marek <[email protected]>
@arya2 your (deleted) suggestion here was really good and I ended up implementing it 🙂
|
Co-authored-by: Marek <[email protected]>
We've had two reviews on the production code, and I've just changed docs and test code. So I've taken the |
Motivation
Older Zebra versions did not cache the genesis tree roots.
Zebra currently does a lot of unnecessary writes to the anchors, sprout trees, and history trees.
Since block validation, mempool validation, and RPCs can read these trees, and block validation writes them, this is a potential remotely-triggered CPU or disk denial of service.
Part of #7664, alternative strategy 1 (stop deleting keys).
This is also part of a permanent fix for bug #7618.
Adds docs for part of #7737.
Solution
Improve the database size and performance, particularly during attacks via RPCs, mempool validation, or multiple block writes.
Format Upgrades
tip_height
to()
(empty key) in the code and docsdefault()
which is an empty tree)Format Tests
Refactors
Documentation
Review
This is a routine bug fix.
This is a database format change, so it needs 2 reviews.
Reviewer Checklist