Add epoch-based validation of iterator-transaction lifetime#5031
Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom Feb 13, 2026
Merged
Conversation
Test Results for Commit 12740eaPull Request 5031: Results Test Case Results
Last updated: 2026-02-13 21:48:27 UTC |
19f7575 to
12740ea
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds epoch-based validation to detect iterator-transaction lifetime violations, preventing use of iterators after their associated transaction has been refreshed, reset, or committed. The implementation tracks transaction epochs and validates them in iterator destructors and move operations.
Changes:
- Added epoch-based validation mechanism to store iterators to detect lifetime violations
- Updated all iterator construction sites to pass transaction reference
- Refactored
wallet_store::find()to remove unreachable code and simplify logic
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| nano/store/iterator.hpp | Added transaction pointer and epoch fields; updated constructor to accept transaction reference; added destructor for epoch validation |
| nano/store/iterator.cpp | Implemented epoch validation in destructor and move assignment; nullify transaction pointer when moved from |
| nano/store/lmdb/backend_lmdb.cpp | Updated iterator construction to pass transaction reference for all begin/end operations |
| nano/store/rocksdb/backend_rocksdb.cpp | Updated iterator construction to pass transaction reference for all begin/end operations |
| nano/node/wallet.cpp | Updated iterator constructions; refactored find() to simplify logic and remove unreachable code |
| nano/core_test/backend.cpp | Added death tests for epoch validation on read and write transaction refresh |
💡 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.
No description provided.