-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use prefix comparison for account selective statediffing #247
Use prefix comparison for account selective statediffing #247
Conversation
4110c75
to
3fac5fa
Compare
3fac5fa
to
365369d
Compare
365369d
to
0438809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM! I reviewed the difference iterator a bit and it appears it would be a bit tricky to get it to respect the "descend" flag. Pruning away subtries is much less pertinent for a difference trie than it is when doing a complete trie snapshot but I think it is worth investigating further as a separate issue.
@@ -322,33 +328,44 @@ func (sdb *StateDiffBuilder) createdAndUpdatedState(a, b trie.NodeIterator, watc | |||
} | |||
partialPath := trie.CompactToHex(nodeElements[0].([]byte)) | |||
valueNodePath := append(node.Path, partialPath...) | |||
|
|||
// ignore leaf node if it is not a watched address | |||
if !isWatchedAddress(watchedAddressesLeafPaths, valueNodePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the path check on 309 already exclude this possibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required since there is an edge case where before a watched contract is deployed, there might be some other account deployed on its path.
Eg. Let's say a leaf node of contract B to be watched has path 0309
when it is deployed at block number 20. Another contract A, which was deployed at block number 15, had leaf node at path 03
. If we start statediffing at block number 10 with contract B as the only watched contract, it will index unncessary diff for contract A at block number 15 which just happens to be on the prospective path to contract B.
Created #252 |
Part of #29