Merge PR #6529: Export validator addresses

This commit is contained in:
Michael FIG 2020-06-29 12:56:08 -06:00 committed by GitHub
parent 74eb56dd2a
commit 6251d28389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -171,6 +171,7 @@ be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposa
### Bug Fixes
* (x/staking) [\#6529](https://github.com/cosmos/cosmos-sdk/pull/6529) Export validator addresses (previously was empty).
* (export) [\#6510](https://github.com/cosmos/cosmos-sdk/pull/6510/) Field TimeIotaMs now is included in genesis file while exporting.
* (client) [\#6402](https://github.com/cosmos/cosmos-sdk/issues/6402) Fix `keys add` `--algo` flag which only worked for Tendermint's `secp256k1` default key signing algorithm.
* (x/bank) [\#6283](https://github.com/cosmos/cosmos-sdk/pull/6283) Create account if recipient does not exist on handing `MsgMultiSend`.

View File

@ -185,9 +185,10 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.GenesisValidator) {
keeper.IterateLastValidators(ctx, func(_ int64, validator exported.ValidatorI) (stop bool) {
vals = append(vals, tmtypes.GenesisValidator{
PubKey: validator.GetConsPubKey(),
Power: validator.GetConsensusPower(),
Name: validator.GetMoniker(),
Address: validator.GetConsAddr().Bytes(),
PubKey: validator.GetConsPubKey(),
Power: validator.GetConsensusPower(),
Name: validator.GetMoniker(),
})
return false

View File

@ -71,6 +71,11 @@ func TestInitGenesis(t *testing.T) {
require.Equal(t, genesisState.Delegations, actualGenesis.Delegations)
require.EqualValues(t, app.StakingKeeper.GetAllValidators(ctx), actualGenesis.Validators)
// Ensure validators have addresses.
for _, val := range staking.WriteValidators(ctx, app.StakingKeeper) {
require.NotEmpty(t, val.Address)
}
// now make sure the validators are bonded and intra-tx counters are correct
resVal, found := app.StakingKeeper.GetValidator(ctx, sdk.ValAddress(addrs[0]))
require.True(t, found)