fix: fix two issues in trie iterator (ethereum/go-ethereum#24539)#258
fix: fix two issues in trie iterator (ethereum/go-ethereum#24539)#258
Conversation
WalkthroughThe changes modify the trie iterator to properly initialize an empty iterator state when the trie root is empty, refactor the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code graph analysis (2)trie/iterator_test.go (1)
trie/trie.go (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1. Purpose or design rationale of this PR
Sync from upstream (ethereum/go-ethereum#24539)
Fix memory leak in trie iterator
In the trie iterator, live nodes are tracked in a stack while iterating.
Popped node states should be explicitly set to nil in order to get
garbage-collected.
Fix empty trie iterator
The empty trie shouldn't be iterated out any values. Changed the check
from incorrect 'emptyState' to correct 'emptyRoot', and return an
iterator with errIteratorEnd to indicate iteration is complete.
2. PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
3. Deployment tag versioning
Has the version in
params/version.gobeen updated?4. Breaking change label
Does this PR have the
breaking-changelabel?Summary by CodeRabbit
Bug Fixes
Tests
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.