Add tracker package, update and simplify #1

Merged
roysc merged 5 commits from dev into main 2023-09-19 16:58:25 +00:00
Owner

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`
roysc added 1 commit 2023-08-03 14:17:35 +00:00
* pull changes from geth fork

* update deps

* remove unused: StartPath, SubtrieIteratorFactory

* change module name
roysc changed title from Add tracker package, update and clean up to Add tracker package, update and simplify 2023-08-04 06:58:51 +00:00
roysc added 2 commits 2023-08-30 16:12:08 +00:00
decrement by epsilon, and go up to parent from child 0
roysc requested review from i-norden 2023-09-01 20:55:49 +00:00
roysc requested review from telackey 2023-09-09 09:47:21 +00:00
roysc added 1 commit 2023-09-10 10:35:58 +00:00
telackey approved these changes 2023-09-15 20:50:59 +00:00
@ -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.
Member

Good comment.

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}
Member

Could you elaborate on this change a bit? I like the simplification, but I'm not sure I followed what allows for it.

Could you elaborate on this change a bit? I like the simplification, but I'm not sure I followed what allows for it.
Author
Owner

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.
roysc referenced this issue from a commit 2023-09-19 12:26:20 +00:00
roysc added 1 commit 2023-09-19 15:27:57 +00:00
roysc force-pushed dev from ba7e7b79b6 to 013571b42f 2023-09-19 16:52:14 +00:00 Compare
roysc force-pushed dev from 013571b42f to e6f72b7081 2023-09-19 16:55:07 +00:00 Compare
roysc merged commit e0c758f9f6 into main 2023-09-19 16:58:25 +00:00
roysc deleted branch dev 2023-09-19 16:58:25 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/eth-iterator-utils#1
No description provided.