-
Notifications
You must be signed in to change notification settings - Fork 626
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
added switch case to detect blank pointers in keeper #2403
added switch case to detect blank pointers in keeper #2403
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.
Thanks for fixing this, @alizahidraja!
Could you also please try to add some tests for the empty pointer situations here?
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.
Thanks for your contributions @alizahidraja, much appreciated! 🙏
I have some doubts over this code needing to change, but perhaps some additional tests could get to the bottom of it!
@crodriguezvega will have a look and add some tests for empty pointers |
@crodriguezvega @damiannolan I added 2 new test cases and ran them on both, the switch case code and previous code; the previous code fail the new test cases with pointers Please do have a look and lmk your thoughts |
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.
Thanks, @alizahidraja!
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.
Thanks for picking this up @alizahidraja. It's a bit of a tricky issue so I appreciate your patience. See my latest comment. I think it makes sense to add this to the bottom of the keeper.go file
No worries @colin-axner, I'll make a function to check for that at the bottom |
Added an isEmpty function at the bottom of the keeper The final concern would be that the error message cannot specify if the keeper object is a struct or a pointer, dk if that is important, lmk what you guys think |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2403 +/- ##
==========================================
+ Coverage 78.63% 78.64% +0.01%
==========================================
Files 178 178
Lines 12354 12365 +11
==========================================
+ Hits 9714 9725 +11
Misses 2208 2208
Partials 432 432
|
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.
Thanks @alizahidraja!
No, I think as you have it now is great. We mostly just want to panic if something is misconfigured so the chain developer knows to look into the code |
* added switch case to detect blank pointers in keeper * updated changelog.md * updated error message for keeper * fixed switch-case; added test cases * added function to check for empty keeper Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> (cherry picked from commit 462ccb6) # Conflicts: # CHANGELOG.md
…#2447) * added switch case to detect blank pointers in keeper (#2403) * added switch case to detect blank pointers in keeper * updated changelog.md * updated error message for keeper * fixed switch-case; added test cases * added function to check for empty keeper Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> (cherry picked from commit 462ccb6) # Conflicts: # CHANGELOG.md * fix conflict * Update CHANGELOG.md Co-authored-by: Ali Zahid Raja <alizahidrajaa@gmail.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Description
Added switch case to detect blank pointers in the keeper.
closes: #2268
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
) (not applicable)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes