Repository navigation
feat(toolkit): keep transaction results in lite snapshot - #29
0xbigapple wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
No issues found across 3 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 960a2fdcde
ℹ️ 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".
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
What does this PR do?
db lite -o split -t snapshotnow copies thetransactionRetStoreentries of the retained blocks into the snapshot, together with the blocks and transactions it already copies.engine.propertiesoftransactionRetStoreis copied as well.plugins/README.mdstates what a snapshot contains.No new option is added.
Why are these changes required?
A lite snapshot held the latest 65,536 blocks without their transaction results, so a lite node started from it could not serve receipts or logs for any of these blocks:
eth_getLogsandeth_getBlockReceiptsreturned4444, andeth_getTransactionReceiptreturnednull.This PR has been tested by:
DbLiteTestwrites transaction results into the source database before splitting, and asserts that the snapshot holds exactly those of the retained blocks. All fiveDbLite*tests pass on JDK 8 / x86_64 (LevelDB and RocksDB); the three RocksDB ones also pass on JDK 17 / arm64.eth_getBlockReceiptsreturns one receipt per transaction at the lowest block of the window (237), the middle (328) and the head (460); the block below the window returns4444.eth_getTransactionReceiptreturns the receipt of a transaction in the lowest block;eth_getLogsover the first 100 blocks returns 5,228 logs.DbLite.setRecentBlks()to cover blocks both with and without them.eth_getBlockReceiptsreturns one receipt per transaction at the lowest block of the window, in the middle, and at the last block with source results; the block below the window returns4444.eth_getTransactionReceiptreturns the receipt of a transaction in the lowest block;eth_getLogsover the first 1,000 blocks returns 643 logs.Follow up
Extra details
mergeis unaffected: it already handlestransactionRetStoreby block number.transHistory.switch = offfor part of the window, the gap stays in the snapshot. Results the source never persisted cannot be recovered from its database; the only way to fill a gap is to sync again from an earlier snapshot with the switch on. Both points are documented inplugins/README.md; no recovery is implemented in Toolkit.Summary by cubic
Lite snapshots created with
db lite -o split -t snapshotnow include the transaction results of the retained blocks, so a lite node started from a snapshot can serve receipts and logs for those blocks.transactionRetStoreentry from the checkpoint alongside blocks and transactions; empty blocks (no entry) are skipped.engine.propertiesfortransactionRetStoreand updatesplugins/README.mdto describe snapshot contents, including the gaps left whenstorage.transHistory.switch = off.Written for commit 4338aad. Summary will update on new commits.