Cosmos-sdk: x/stake: Add another function for UpdateValidator if cliff validator doesn't exist

Created on 10 Sep 2018  Â·  7Comments  Â·  Source: cosmos/cosmos-sdk

Summary

I feel like we can significantly improve the code clarity for UpdateValidator if we separate concerns there, and have a different method if the cliff validator already exists, and doesn't already exist. This is evidenced by there being 3 "if cliff val exists" calls in the function.

/cc @rigelrozanski @cwgoes @alexanderbez

staking

Most helpful comment

@cwgoes let's discuss this more - of course we want the performance - however I think there may be other ways which we could get (nearly) the same performance increase without having all the headache and code complexity of the cliff validator - see thoughts here: https://github.com/cosmos/cosmos-sdk/issues/2312

Let's talk about it in today's call however

All 7 comments

Agreed this could be improved a bit. ref: #1923

good idea!

Concept ACK. Maybe there are other places in staking we could similarly simplify.

Possibly superseded issue if we remove cliff validator all-together....

Possibly superseded issue if we remove cliff validator all-together....

Maybe, but I think the cliff validator logic is a substantive performance improvement for the majority of likely real calls of UpdateValidator.

@cwgoes let's discuss this more - of course we want the performance - however I think there may be other ways which we could get (nearly) the same performance increase without having all the headache and code complexity of the cliff validator - see thoughts here: https://github.com/cosmos/cosmos-sdk/issues/2312

Let's talk about it in today's call however

Closing in favor of #2312, this becomes kind of irrelevant since we no longer have a reserved "cliff validator" seat, its just the 100th element of the arr, and we're switching to the end-block stuff.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ValarDragon picture ValarDragon  Â·  3Comments

jackzampolin picture jackzampolin  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments