From 1e0614d9306aae42d9aef4eae44326ca85b4200f Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sat, 27 Jun 2020 18:00:41 -0600 Subject: [PATCH 1/3] fix: add the validator address to the exported validator data --- x/staking/genesis.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x/staking/genesis.go b/x/staking/genesis.go index 8bd5ef6d6911..4cb8dd95baa0 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 From eef4d1b2326f05d2edb0a416e97cabe9b54af69b Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sun, 28 Jun 2020 12:25:25 -0600 Subject: [PATCH 2/3] test: ensure exported validators have addresses --- x/staking/genesis_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index fdd580bc6026..d67f66b9a8cc 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) From c19769d1a7f3384fe5ffbb405cee81bd52683bdc Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sun, 28 Jun 2020 12:29:27 -0600 Subject: [PATCH 3/3] docs: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 240be858483e..bde6d010d329 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`.