diff --git a/CHANGELOG.md b/CHANGELOG.md index 240be85848..bde6d010d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/x/staking/genesis.go b/x/staking/genesis.go index 8bd5ef6d69..4cb8dd95ba 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -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 diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index fdd580bc60..d67f66b9a8 100644 --- a/x/staking/genesis_test.go +++ b/x/staking/genesis_test.go @@ -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)