-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
trie, eth/protocols/snap: sanitize the committed node data #29485
Conversation
if !op.valid() { | ||
return fmt.Errorf("invalid op, %s", op.string()) | ||
} | ||
if op.del { |
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.
Shouldn't you rewrite isDelete
into:
func (op *nodeOp) isDelete() bool {
return op.del
}
Alternatively: delete the method
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.
Yep, the method should be deleted
This PR seems simple and good, just maybe not needed (making the surrounding code harder to understand). My 2c, lets leave it open until the root cause for the sync issue is discovered and if it's related to this, we should merge. If it's unrelated, it might be better to close. |
5dd69d6
to
5292ddb
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.
LGTM
This pull request adds one more check before committing the trie nodes from the
trie.Syncer
:The check is cheap enough and shouldn't have any performance impact.
The node blob cached in the
trie.Syncer
is not deep-copied, rather than a reference of the network packet.Theoretically it should be safe the hold the network packet reference being originated from here, although i am not 100% confident about it.
If it's possible to empties the referenced blob somehow, than it could be the root cause of #29436