execution/commitment/trie: DeleteSubtree(nil) keeps a branch root

Open
#26,465 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@awskii is already working on this.

Since Nov 18, 2026.

Assessment

This issue has not been assessed yet.

Description

Trie.DeleteSubtree(nil) clears a short-node root but leaves a branch root untouched.

  • Case: insert nonempty values at keys 0x10 and 0x20, then call DeleteSubtree(nil).
  • KeybytesToHex(nil) is the terminator alone, so deleteRecursive looks up child 16 in the DuoNode and FullNode cases, finds none, and keeps both values.
  • Production callers pass full account hashes, so only callers of the public prefix API see it.
  • Direction: treat an exhausted prefix in the DuoNode and FullNode cases as a full match when preserveAccountNode is set.

Present on main; found reviewing #26451.

Dominant language
Go
Stars
3.6k
Forks
1.6k
Avg merge
1d 17h
Merged PRs (30d)
820

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from erigontech/erigon

All issues in erigontech/erigon

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.