refactor(x/staking): Migrate Validators to use Collections (#17123)

This commit is contained in:
Likhita Polavarapu
2023-08-28 14:56:14 +00:00
committed by GitHub
parent a734071c05
commit 70b3e85781
7 changed files with 95 additions and 30 deletions
-4
View File
@@ -25,15 +25,12 @@ func TestDecodeStore(t *testing.T) {
cdc := testutil.MakeTestEncodingConfig().Codec
dec := simulation.NewDecodeStore(cdc)
val, err := types.NewValidator(valAddr1.String(), delPk1, types.NewDescription("test", "test", "test", "test", "test"))
require.NoError(t, err)
oneIntBz, err := math.OneInt().Marshal()
require.NoError(t, err)
kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{Key: types.LastTotalPowerKey, Value: oneIntBz},
{Key: types.GetValidatorKey(valAddr1), Value: cdc.MustMarshal(&val)},
{Key: types.LastValidatorPowerKey, Value: valAddr1.Bytes()},
{Key: []byte{0x99}, Value: []byte{0x99}},
},
@@ -44,7 +41,6 @@ func TestDecodeStore(t *testing.T) {
expectedLog string
}{
{"LastTotalPower", fmt.Sprintf("%v\n%v", math.OneInt(), math.OneInt())},
{"Validator", fmt.Sprintf("%v\n%v", val, val)},
{"LastValidatorPower/ValidatorsByConsAddr/ValidatorsByPowerIndex", fmt.Sprintf("%v\n%v", valAddr1, valAddr1)},
{"other", ""},
}