refactor(x/slashing): migrate AddrPubkeyRelation to collections (#17044)

This commit is contained in:
Likhita Polavarapu
2023-08-10 08:08:56 +00:00
committed by GitHub
parent 40cf50a30a
commit 8035b5b524
10 changed files with 27 additions and 47 deletions
-5
View File
@@ -18,7 +18,6 @@ import (
var (
delPk1 = ed25519.GenPrivKey().PubKey()
delAddr1 = sdk.AccAddress(delPk1.Address())
consAddr1 = sdk.ConsAddress(delPk1.Address().Bytes())
)
@@ -29,14 +28,11 @@ func TestDecodeStore(t *testing.T) {
info := types.NewValidatorSigningInfo(consAddr1, 0, 1, time.Now().UTC(), false, 0)
missed := []byte{1} // we want to display the bytes for simulation diffs
bz, err := cdc.MarshalInterface(delPk1)
require.NoError(t, err)
kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{Key: types.ValidatorSigningInfoKey(consAddr1), Value: cdc.MustMarshal(&info)},
{Key: types.ValidatorMissedBlockBitmapKey(consAddr1, 6), Value: missed},
{Key: types.AddrPubkeyRelationKey(delAddr1), Value: bz},
{Key: []byte{0x99}, Value: []byte{0x99}}, // This test should panic
},
}
@@ -48,7 +44,6 @@ func TestDecodeStore(t *testing.T) {
}{
{"ValidatorSigningInfo", fmt.Sprintf("%v\n%v", info, info), false},
{"ValidatorMissedBlockBitArray", fmt.Sprintf("missedA: %v\nmissedB: %v\n", missed, missed), false},
{"AddrPubkeyRelation", fmt.Sprintf("PubKeyA: %s\nPubKeyB: %s", delPk1, delPk1), false},
{"other", "", true},
}
for i, tt := range tests {