Add tracker package, update and simplify #1
Labels
No Label
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/eth-iterator-utils#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This revives the standalone repo for these tools now that we're liberated from the Geth fork.
tracker
Add tracker package, update and clean upto Add tracker package, update and simplify@ -44,0 +45,4 @@
// behavior would be to make this a strict less-than, so that iterators cover mutually disjoint
// subtries. Unfortunately, the NodeIterator constructor takes a compact path, meaning
// odd-length paths must be padded with a 0, so e.g. [8] becomes [8, 0], which means we would
// skip [8]. So, we use <= here to cover that node for the "next" bin.
Good comment.
@ -77,1 +55,3 @@
ret = &Iterator{it, tr, iterSeekedPath, endPath}
// Tracked wraps an iterator in a Iterator. This should not be called once halts are possible.
func (tr *Tracker) Tracked(it trie.NodeIterator) (ret *Iterator) {
ret = &Iterator{it, tr}
Could you elaborate on this change a bit? I like the simplification, but I'm not sure I followed what allows for it.
The
ipld-eth-state-snapshot
code was the original use case for this tracking, and that code was written recursively, so that a single iterator would only visit its direct children, constructing new iterators for each child sub-trie. A consequence of that is the sub-iterator's stored path is relative to where it was created, not the state root. So, the seekedPath was added to track the absolute path (by leaking the field's pointer to the recursive function to be updated).But this recursive pattern isn't necessary, since the iterator handles trie recursion internally. So by using a direct iterative pattern like in the statediff code (since we're just using that code now) we avoid all this.
ba7e7b79b6
to013571b42f
013571b42f
toe6f72b7081