This revives the standalone repo for these tools now that we're liberated from the Geth fork.
pulls changes from geth fork
remove unused: StartPath, SubtrieIteratorFactory
changes module name to reflect bundled tracker
This revives the standalone repo for these tools now that we're liberated from the Geth fork.
* pulls changes from geth fork
* remove unused: StartPath, SubtrieIteratorFactory
* changes module name to reflect bundled `tracker`
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.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This revives the standalone repo for these tools now that we're liberated from the Geth fork.
trackerAdd 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-snapshotcode 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.
ba7e7b79b6to013571b42f013571b42ftoe6f72b7081