Statediffing mode for specific contract proofs #29
Labels
No Label
bug
critical
duplicate
enhancement
epic
help wanted
in progress
invalid
low priority
question
rebase
v1
v5
wontfix
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/go-ethereum#29
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Mode for the statediffing service that returns a state object with only the nodes required for accessing and proving data in the specified contract(s)
Provided a set of contract addresses, we want to:
Iterate down state trie only along paths to leaf nodes for the provided contracts, collecting all of the nodes along this path (which are required for generating a proof against the state root hash)
Iterate through the entire storage tries for these contracts, producing complete statediff objects for the specified contracts only
Unit and integration tests
Support both ipld-eth-indexer endpoints and direct indexing from inside geth (should be able to use same database)
I will double check this is satisfied
@AFDudley @ashwinphatak I don't think this is currently satisfied, if we watch a set of addresses the builder only diffs leaf nodes: https://github.com/vulcanize/go-ethereum/blob/v1.10.18-statediff-4.0.2-alpha/statediff/builder.go#L173
And rather than just a potentially vestigial comment, here is the code:
Only in
createdAndUpdatedState
do we filter on the addresses https://github.com/vulcanize/go-ethereum/blob/v1.10.18-statediff-4.0.2-alpha/statediff/builder.go#L318 whereas increatedAndUpdatedStateWithIntermediateNodes
we do not https://github.com/vulcanize/go-ethereum/blob/v1.10.18-statediff-4.0.2-alpha/statediff/builder.go#L363Instead, what we want is that when we specify a list of watched addresses we can diff only those associated leaf nodes and all the intermediate nodes along the paths to them (required to prove them).
Seems there are two approaches to this:
WatchedAddress
list we either throw away the parent node stack or not (the simple approach we could take with the current iterator)2 would be a huge boon to performance as we would avoid traversing portions of the difference trie that we aren't actually interested in (instead of waiting til we get to a leaf to find out we didn't need to walk all the way down to said leaf).
@i-norden The suggested approach in https://github.com/vulcanize/ipld-eth-state-snapshot/pull/46#issue-1272566458 to limit the trie traversal only to paths that lead to watched addresses requires the ability to restrict the descent down the trie when required.
In state trie iteration, this is allowed by the
descend
flag to theiterator.Next()
method; whereas, in case of difference traversal done for statediffing, the difference iterator being used ignores the flag being passed to it'sNext()
method. So we can't readily avoid iterating the whole diff trie.However, I think that checking paths as prefix for filtering out nodes is still a simpler approach than using a stack to hold on to intermediate nodes.
Further optimization tracked in https://github.com/vulcanize/go-ethereum/issues/252