Skip to content

perf(wallet): checkpoint sync persistence - #32

Merged
3esmit merged 4 commits into
mainfrom
perf/wallet-sync-persistence
Aug 3, 2026
Merged

3esmit merged 4 commits into
mainfrom
perf/wallet-sync-persistence

Conversation

@3esmit

@3esmit 3esmit commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • persist wallet state once per 100 processed sync blocks instead of after every block
  • persist a final partial batch after a successful stream completes
  • cover bounded checkpoints and recovery from an unpersisted account/cursor tail

Root cause

WalletCore::sync_to_block synchronously serialized and fsynced the complete storage snapshot after every streamed block.

Validation

  • cargo +nightly fmt --all -- --check
  • cargo test -p wallet --lib
  • cargo clippy -p wallet --all-targets --all-features -- -D warnings

Closes #31

@3esmit

3esmit commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

Post-fix Testnet verification completed with the compiled branch binary.

Matched 20-second wallet account sync-private replays from isolated cursor-0 wallet states:

Build Blocks advanced Persistent writes
main baseline 7227fd3 1,200 1,200
this PR ec954239 6,600 66

Each controlled run reached its timeout normally. A continued branch replay then completed from block 16,800 to live target 42,209 with exit 0: 25,409 blocks and exactly 255 persistent writes (ceil(25,409 / 100)). This validates both checkpointing and the final partial-stream flush.

Also passed locally: cargo fmt --all -- --check, cargo test -p wallet --lib (55/55), and cargo clippy -p wallet --all-targets --all-features -- -D warnings.

@3esmit
3esmit marked this pull request as ready for review July 29, 2026 21:32
Copilot AI review requested due to automatic review settings July 29, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec95423962

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lez/wallet/src/lib.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9621778ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lez/wallet/src/lib.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b252ca70e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lez/wallet/src/lib.rs
@3esmit
3esmit marked this pull request as draft August 1, 2026 23:23
@3esmit

3esmit commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Upstream logos-blockchain#632 is the minimal happy-path optimization: checkpoint every 100 blocks and flush only on successful completion. This PR includes that behavior plus failure-path durability and atomicity safeguards: it flushes partial progress on polling/validation errors and validates a whole block before applying any privacy-state mutation. That makes this PR materially safer under retries/restarts, not just a different implementation style.

@3esmit
3esmit force-pushed the perf/wallet-sync-persistence branch from 2088fb4 to 2fa62b1 Compare August 3, 2026 20:22
@3esmit

3esmit commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto merged main commit 19df384b (PR #37), so the previous deny result no longer reflects the current dependency graph.

Post-rebase local verification passed:

  • cargo +nightly fmt --check
  • cargo test -p wallet --lib: 58 passed
  • wallet Clippy with -D warnings
  • cargo deny check: advisories, bans, licenses, and sources all passed

The branch was force-updated to 2fa62b1; GitHub CI is rerunning against the rebased head.

@3esmit
3esmit marked this pull request as ready for review August 3, 2026 23:09
@3esmit

3esmit commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

All required checks are green and review-thread audit shows no unresolved comments. Promoting for merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@3esmit
3esmit merged commit 06d70ff into main Aug 3, 2026
43 checks passed
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.

perf(wallet): avoid fsyncing persistent state for every synced block

2 participants