-
Notifications
You must be signed in to change notification settings - Fork 129
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
Make sure setters and getters cover edge cases #160
Comments
IMO it's not always a good idea to program as defensively as this. Only the cases which can actually be called with nil, empty ect params should contain the checks. Also, do we really want to not panic? There are some panics already, for example if byte or json decoding fails. It might be reasonable to panic in some places. |
I think we should discuss this |
Regarding this issue, it seems that we all agree that every A good example relates to #254. We have two choices to handle the situation in which a duplicate proposal is passed (ie. a proposal for a consumer chainID that is already secured).
Unless I'm missing something in my understanding of this specific case, it seems that the decision comes down to, do we want extra safety around proposal-related human errors and/or attack vectors? Or do we trust that provider validators would catch all "duplicate proposals" and reject them? Thoughts? |
I don't think we should panic in such a case since there is no threat to the system. Dropping the duplicated proposal is the easiest way. |
In general I think that
The idea of this issue is to make sure that the code within setters / getters does not panic without us wanting that behavior, e.g., |
Got it, and thank you for the clarification of intention on this issue. Agreed on the points made here |
All of the panics (with the exception below) on getters and setters in consumer and provider keeper.go are related to database corruption- i.e. there is stuff in the database that should not be in there, and there is no way for our program to recover from it. However, we are inconsistent. Some database corruption errors in some getters and setters are returned. We should probably at least be consistent about it. Exception: This panic is in
|
Agree ^: we should panic iff the situation is not recoverable. |
Closing as there is no defined closing criteria |
The methods used to access the CCV state (both on provider and consumer) should be callable with all kind of params without panic.
The text was updated successfully, but these errors were encountered: