Persist wallet sync progress at checkpoints - #632
Open
3esmit wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Reduces wallet sync disk I/O by persisting wallet storage at fixed “checkpoint” intervals during WalletCore::sync_to_block, while still ensuring any remaining tail progress is durably saved before returning successfully.
Changes:
- Introduces a small checkpoint counter to trigger persistence every 100 processed blocks.
- Updates
sync_to_blockto persist only at checkpoints and once at the end if there’s a remaining tail. - Adds a unit test covering full checkpoint chunks and a final partial tail.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🎯 Purpose
WalletCore::sync_to_blockcurrently persists the complete wallet storage afterevery processed block. A wallet catching up over a large range therefore
performs one full local storage write per block, creating unnecessary disk I/O
and serialization work for every consumer of the wallet core.
Fixes #631
⚙️ Approach
last_synced_blockwatermark in the existingsingle persistence operation. If sync is interrupted between checkpoints,
reopening resumes from the last durable checkpoint and replays only the
unpersisted tail.
No wallet storage format, protocol behavior, or FFI/API surface changes.
🧪 How to Test
cargo +nightly fmt --all -- --check cargo +1.94.0 test -p wallet --lib RISC0_SKIP_BUILD=1 cargo +1.94.0 clippy -p wallet --lib --all-features -- -D warningsAll passed. The wallet unit suite includes coverage for full checkpoint chunks
and a final partial tail.
🔗 Dependencies
None.
🔜 Future Work
None.
📋 PR Completion Checklist