Statediffing mode for specific contract proofs #29
Closed
opened 2020-10-14 16:48:31 +00:00 by i-norden
·
4 comments
No Branch/Tag Specified
v1.11.6-statediff-v5
v1.10.26-statediff-4.2.2-alpha
jenkins_reborn
v1.10.25-statediff-v4
v1.10.25-statediff-v4-wip
cerc_refactor
release-v1.10.23-statediff-4.2.0-alpha
v1.10.23-statediff-v4
v1.10.23-statediff-v4-wip
v1.10.22-statediff-v4-wip
v1.10.22-statediff-v4
v1.10.21-statediff-v4
linter_updates_wip
release-v1.10-21-statediff-4.1.2-alpha
release-v1.10.21-statediff-4.1.2-alpha
v1.10.20-statediff-v4
v1.10.19-statediff-v4
statediff
v1.13.14
v1.11.6-statediff-v5.0.8
v1.10.23-statediff-4.2.0-alpha-cerc-unstable
v1.10.23-statediff-4.2.0-alpha-unstable
v1.10.25
v1.10.24
v1.10.23-statediff-4.2.0-alpha
v1.10.23-statediff-v4-unstable
v1.10.23
v1.10.22
v1.10.21-statediff-4.1.2-alpha
v1.10.21
v1.10.19-statediff-4.1.1-alpha
v1.10.20-statediff-4.1.0-alpha
v1.10.19-statediff-4.1.0-alpha
v1.10.20
v1.10.19-statediff-4.0.4-alpha
v1.10.19-statediff-4.0.3-alpha
v1.10.19-statediff-4.0.2-alpha
v1.10.19
v1.10.18-statediff-4.0.2-alpha
v1.10.18-statediff-3.2.2
v1.10.18-statediff-4.0.1-alpha
v1.10.18-statediff-3.2.1
v1.10.18
v1.10.17-statediff-4.0.1-alpha
v1.10.17-statediff-4.0.0-alpha
v1.10.17-statediff-3.2.1
v1.10.17-statediff-3.2.0
v1.10.17
v1.10.16-statediff-3.0.2
v3.0.2
v1.10.15-statediff-3.0.2
v1.10.16
v1.10.15-statediff-3.1.0
v1.10.15-statediff-3.0.1
v1.10.15-statediff-3.0.0
v1.10.11-statediff-3.0.0
v1.10.15-statediff-2.0.0
v1.10.15-statediff-0.0.29
v1.10.15
v1.10.11-statediff-0.1.0
v1.10.14-statediff-0.0.29
v1.10.14-statediff-0.0.28
v1.10.14
v1.10.13-statediff-0.0.29
v1.10.11-statediff-0.0.28a
v1.10.13-statediff-0.0.28
v1.10.12-statediff-0.0.28
v1.10.12-statediff-0.0.27
v1.10.11-statediff-0.0.27i
v1.10.11-statediff-0.0.27h
v1.10.11-statediff-0.0.27g
v1.10.11-statediff-0.0.27f
v1.10.11-statediff-0.0.27e
v1.10.13
v1.10.11-statediff-0.0.27d
v1.10.11-statediff-0.0.27c
v1.10.11-statediff-0.0.27b
v1.10.11-statediff-0.0.27a
v1.10.12
v1.10.11-statediff-0.0.27
v1.10.11
v1.10.10-statediff-0.0.27
v1.10.10
v1.10.9-statediff-0.0.27
v1.10.9
v1.10.8-statediff-0.0.27
v1.10.8-statediff-0.0.26
v1.10.8-statediff-0.0.25
v1.10.8
v1.10.7-statediff-0.0.25
v1.10.7
v1.10.6-statediff-0.0.25
v1.10.6
v1.10.5-statediff-0.0.25
v1.10.5
v1.10.4-statediff-0.0.25
v1.10.4-statediff-0.0.24
v1.10.3-statediff-0.0.24
v1.10.4-ir-0.0.1
v1.10.3-statediff-0.0.23
v1.10.4
v1.10.3-statediff-0.0.22
v1.10.3-statediff-0.0.21
v1.10.3
v1.10.2-statediff-0.0.21
v1.10.2-statediff-0.0.20
v1.10.2-statediff-0.0.19
v1.10.2-statediff-0.0.18
v1.10.2-statediff-0.0.17
v1.10.1-statediff-0.0.17
v1.10.2
v1.10.1-statediff-0.0.16
v1.10.1-statediff-0.0.15
v1.10.1
v1.10.0
v1.9.25-statediff-0.0.15
v1.9.25-statediff-0.0.14
v1.9.25-statediff-0.0.13
v1.9.25
v1.9.24-statediff-0.0.13
v1.9.24-statediff-0.0.12
v1.9.24-statediff-0.0.11
v1.9.23-statediff-0.0.11
v1.9.24
v1.9.23-statediff-0.0.10
v1.9.23-statediff-0.0.9
v1.9.11-statediff-0.0.9
v1.9.11-statediff-0.0.8
v1.9.23
v1.9.15-1559-0.0.1
v1.9.11-statediff-0.0.7
v1.9.10-optimism-0.0.2
v1.9.22
v1.9.21
v1.9.10-optimism-0.0.1
v1.9.11-statediff-0.0.6
v1.9.20
v1.9.11-statediff-0.0.5
v1.9.11-statediff-0.0.4
v1.9.11-statediff-0.0.3
v1.9.19
v1.9.18
v1.9.17
v1.9.16
v1.9.15
v1.9.11-statediff-0.0.2
v1.9.14
v1.9.13
v1.9.12
v1.10-alpha.2
v1.9.11
v1.9.10
v1.10-alpha.1
v1.9.9
v1.9.8
v1.9.7
v1.9.6
v1.9.5
v1.9.4
v1.9.3
v1.9.2
v1.10-alpha.0
v1.9.1
v1.9.0
v1.8.27
v1.8.26
v1.8.25
v1.8.24
v1.8.23
v1.8.22
v1.8.21
v1.8.20
v1.8.19
v1.8.18
v1.8.17
v1.8.16
v1.8.15
v1.8.14
v1.8.13
v1.8.12
v1.8.11
v1.8.10
v1.8.9
v1.8.8
v1.8.7
v1.8.6
v1.8.5
v1.8.4
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.7.3
v1.7.2
v1.7.1
v1.7.0
v1.6.7
v1.6.6
v1.6.5
v1.6.4
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.5.9
v1.5.8
v1.5.7
v1.5.6
v1.5.5
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.19
v1.4.18
v1.4.17
v1.4.16
v1.4.15
v1.4.14
v1.4.13
v1.4.12
v1.4.11
v1.4.10
v1.4.9
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.2.3
v1.2.2
1.2.1
v1.1.3
v1.0.5
v1.0.4
v1.1.2
v1.1.1
v1.0.3
v1.1.0
v1.0.2
v1.0.1.2
v1.0.1.1
v1.0.1
v1.0.0
v0.9.39
v0.9.38
v0.9.36
v0.9.34-1
v0.9.34
v0.9.32
v0.9.30
v0.9.28
v0.9.26
v0.9.25
v0.9.24
0.9.23
v0.9.23
v0.9.22
v0.9.21.1
v0.9.21
v0.9.20
v0.9.18
v0.9.17
0.9.16
v0.8.5-2
v0.8.5
v0.8.4
v0.8.4-1
v0.7.11
v0.7.10
vv0.7.10
v0.7.10-broken
PoC6
v0.6.8
v0.6.7
v0.6.6
v0.6.5-2
v0.6.5-1
v0.6.5
v0.6.4
v0.6.3
v0.6.0
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
poc5-rc12
poc5-rc11
2
poc5-rc10
poc5-rc9
poc5-rc8
poc5-rc7
poc5-rc6
poc5-rc4
poc5-rc3
poc5-rc2
poc5-rc1
0.3.1
0.3.0
0.2.2
poc1
Labels
Clear labels
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
An issue or PR manually copied from GitHub.
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
No labels
critical
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/go-ethereum#29
Reference in New Issue
Block a user
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.
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
createdAndUpdatedStatedo 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 increatedAndUpdatedStateWithIntermediateNodeswe 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:
WatchedAddresslist 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
descendflag 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