Skip to content

Conversation

@mediocregopher
Copy link
Collaborator

This was pointed out by @0x00101010 in a separate PR. Basically if the in-memory overlay completely deleted all nodes in the trie table, then there was no way to distinguish the cases of the db cursor being exhausted or having never been used; the cursor_entry field would be None in both cases.

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Nov 3, 2025
@mediocregopher mediocregopher added C-bug An unexpected or incorrect behavior A-trie Related to Merkle Patricia Trie implementation labels Nov 3, 2025
@mediocregopher mediocregopher marked this pull request as ready for review November 3, 2025 15:00
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

This makes sense to me, I wonder if, to make it more explicit, we should have an enum for cursor_entry, which would be:

enum CursorState {
    /// Initial cursor state, when we haven't seeked, open to renames
    Initial
    /// The cursor is currently pointing to an entry.
    Entry {
        /// Path to the node
        path: Nibbles,
        /// The node
        node: BranchNodeCompact,
    },
    /// The DB cursor is exhausted
    Exhausted
}

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Nov 3, 2025
@mediocregopher mediocregopher added this pull request to the merge queue Nov 5, 2025
@mediocregopher mediocregopher removed this pull request from the merge queue due to a manual request Nov 5, 2025
@mediocregopher mediocregopher added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit ea4a686 Nov 6, 2025
42 checks passed
@mediocregopher mediocregopher deleted the mediocregopher/in-mem-trie-cursor-all-empty-fix branch November 6, 2025 09:34
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-trie Related to Merkle Patricia Trie implementation C-bug An unexpected or incorrect behavior

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants