Cosmos-sdk: x/stake: Keeper - Improve Coverage, API and Documentation

Created on 6 Aug 2018  ·  4Comments  ·  Source: cosmos/cosmos-sdk

Currently the coverage for the keeper package in the stake module is ~71.6%. Things I noticed that I think could be improved:

  • Increasing unit test coverage (e.g. UpdateBondedValidatorsFull, GetAllValidators, GetValidators)
  • Improved/added documentation to some methods/functions
  • Cleaning up some APIs (e.g. a lot of methods can probably be condensed and GetValidatorsByPower is not indicative that it returns bonded validators).

I'd be happy to do all of the above.

/cc @cwgoes @rigelrozanski


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
Legacy API docs tests staking

Most helpful comment

All of those sound like great ideas. I think it's also worth seeing if we can reorganize or split up several of the complex validator update functions to clarify preconditions and postconditions for various intermediary states - that should be done before unit tests.

All 4 comments

All of those sound like great ideas. I think it's also worth seeing if we can reorganize or split up several of the complex validator update functions to clarify preconditions and postconditions for various intermediary states - that should be done before unit tests.

Yes x100 @cwgoes 👍

Another thing we should test out a bunch of comparisons for the power key https://github.com/cosmos/cosmos-sdk/blob/8053d7fdf509cb859a00be0166c502a182dc4a80/x/stake/keeper/key.go#L70

I think this has either been done or superseded by more recent issues, although more unit tests are always good!

Was this page helpful?
0 / 5 - 0 ratings