-
Notifications
You must be signed in to change notification settings - Fork 138
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
Throttle related panic cleanup #640
Conversation
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.
Nice work @smarshall-spitzbart. See my comments below. Also, the following throttling methods are called from EndBlock:
k.CheckForSlashMeterReplenishment(ctx)
k.HandleLeadingVSCMaturedPackets(ctx)
k.HandleThrottleQueues(ctx)
Could you add for each one a docstring describing the scenarios when they panic?
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.
Suggestion: prefix every func which calls panic directly with Must
Tiny nit: some of the comments are a bit verbose ('Explanation:', 'Further', 'In this case'). They are very clear though so that's good
Overall good job!
@danwt Prefixing getters with Must may imply that the key must exist. I think it's okay to go ahead with the pattern that getters and setters panic if marshaling / unmarshaling fails. We just need to make sure that the data for setters is valid. |
Yup! See 19f6afa |
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.
Nice work @smarshall-spitzbart
Overall, LGTM! Maybe we could aggregate errors that happened during queue iteration and return them as part of the query result in another PR? Besides that, queries should use pagination to avoid dumping large number of records from the throttle queues. Not sure, but that could also be a very easy DoS attack vector. I doubt it would affect validator nodes (provided the validators use sentry nodes) but the RPC/proxy/sentry nodes could be affected. |
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.
Great work!
Re "must" naming conventions, see #650. We can then address this for the entire repo
Seems like a good idea 👍, thanks for the input @MSalopek. Could you make an issue for this, as you may have more context as to whether this error accumulation pattern could be applied to other queries as well |
Issue opened: #651 Thanks! |
Description
For every panic in
throttle.go
or closely related files, this PR either:Linked issues
Works toward #621
Type of change
Fix
: Changes and/or adds code behavior, specifically to fix a bugDocs
: Adds documentationNew behavior tests
n/a, fix was small and only related to queries