Skip to content
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

Merged
merged 2 commits into from
Dec 12, 2018

Conversation

jackzampolin
Copy link
Member

Fixes: #3074

cc @cwgoes

@cwgoes
Copy link
Contributor

cwgoes commented Dec 11, 2018

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.

Copy link
Contributor

@alexanderbez alexanderbez left a 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.

if validatorCacheList.Len() > 500 {
valToRemove := validatorCacheList.Remove(validatorCacheList.Front()).(cachedValidator)
delete(validatorCache, valToRemove.marshalled)
if k.validatorCacheList.Len() > 500 {
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So moved!

@jackzampolin
Copy link
Member Author

jackzampolin commented Dec 11, 2018

@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
Copy link

codecov bot commented Dec 11, 2018

Codecov Report

Merging #3075 into develop will increase coverage by <.01%.
The diff coverage is 80%.

@@             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

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@cwgoes cwgoes mentioned this pull request Dec 12, 2018
@cwgoes
Copy link
Contributor

cwgoes commented Dec 12, 2018

Do you want me to move forward with this, or should we drop it?

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

@jackzampolin jackzampolin merged commit 582ca8e into develop Dec 12, 2018
@cwgoes cwgoes deleted the jack/stake-cache-conc branch December 12, 2018 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants