This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
ledger-tool create-snapshot uses write cache #29119
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Migrating everything to use write cache so we can eliminate the old code path.
ledger-tool create-snapshot does not use the write cache.
The biggest hang up with using the write cache is a call to
calculate_capitalization
. That tries to scan storages. But, if we have not written to storages yet because we're using the write cache, then we can't calculate cap correctly. But, if we flush to the write cache, then we later update sys vars in the same slot. As a result, we violate some design constraints by writing to a slot that has already been flushed from the write cache.A solution to this is to have
calculate_capitalization
use the index to calculate that capitalization. This could be revisited later but is sufficient for now since it does not affect any real validators.Summary of Changes
Fixes #