-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R: Move validator cache to the keeper in stake #3075
Conversation
I'm not a fan of this style of caching (not the fault of this PR, more the existing solution), I think it will get messy quickly. Moving the cache into the keeper makes it parallel-keeper-safe but otherwise doesn't help. I'd rather we find a way to do this generally with Amino (maybe through the codec object). cc @jaekwon Do you have any recommendations? This seems like a common desire for Amino clients. |
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.
Changes look reasonable. Left a small remark. Also, not sure if this warrants a pending log update.
x/stake/keeper/validator.go
Outdated
if validatorCacheList.Len() > 500 { | ||
valToRemove := validatorCacheList.Remove(validatorCacheList.Front()).(cachedValidator) | ||
delete(validatorCache, valToRemove.marshalled) | ||
if k.validatorCacheList.Len() > 500 { |
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.
The 500 here and in the constructor should honestly be a constant imho.
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.
So moved!
@alexanderbez wasn't thinking this needed a pending update, also I've addressed comments here. @cwgoes do you want me to move forward with this, or should we drop it? |
Codecov Report
@@ Coverage Diff @@
## develop #3075 +/- ##
===========================================
+ Coverage 52.17% 52.18% +<.01%
===========================================
Files 136 136
Lines 9619 9621 +2
===========================================
+ Hits 5019 5021 +2
Misses 4263 4263
Partials 337 337 |
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.
ACK
This doesn't make things worse, and it would help with parallel simulations, so for that reason I think we can merge it unless anyone else objects - approved. I've moved my concerns to a separate issue: #3088 |
Fixes: #3074
cc @cwgoes