-
Notifications
You must be signed in to change notification settings - Fork 5
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
Validate params in RPC server #268
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.
LGTM. Can you also add a basic max range check for the checkpoint messages timestamps as well? Just a sanity bound to avoid overloads (e.g. 2h range max between start and end)
- Check for nil - Check for invalid range - Check for range too large
@Hyodar added range check to RPC |
Int test failed with the timestamp range check because the first checkpoint is actually 0 -> current. We could change this without much of an issue so the first checkpoint is |
Could you point me out to where this would need to be changed? |
In |
There still seems to be an issue here. I've changed the toTimestamp := block.Time()
fromTimestamp := lastCheckpointToTimestamp + 1
if lastCheckpointToTimestamp == 0 {
fromTimestamp = toTimestamp - uint64(agg.checkpointInterval)
} yet the integration test continues to fail. |
I think you need to get the seconds only, seems to be underflowing. Here's the error:
|
Good catch, this is not the first time that I've had the same issue. |
Current Behavior
The current RPC server does not validate the parameters on each method, opening up the possibility of errors due to nil dereference panics or unsatisfied invariants.
New Behavior
Each method on the RPC server validates the parameters returning an error in case of failure before doing any actual work.
Breaking Changes
There should not be any breaking changes.
Observations
Currently we are only checking for hidden
nil
values.