From 12176e0953e07ede21f692b20e13d90ee726310a Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 29 Sep 2023 23:04:16 +0300 Subject: [PATCH 1/3] fixed key in slashing bitmap migration --- x/slashing/migrations/v4/keys.go | 2 +- x/slashing/migrations/v4/migrate_test.go | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/x/slashing/migrations/v4/keys.go b/x/slashing/migrations/v4/keys.go index 1ac42b6c1aff..c5ab30ff72bd 100644 --- a/x/slashing/migrations/v4/keys.go +++ b/x/slashing/migrations/v4/keys.go @@ -28,7 +28,7 @@ func ValidatorSigningInfoAddress(key []byte) (v sdk.ConsAddress) { } func validatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte { - return append(validatorMissedBlockBitArrayKeyPrefix, v.Bytes()...) + return append(validatorMissedBlockBitArrayKeyPrefix, address.MustLengthPrefix(v.Bytes())...) } func ValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte { diff --git a/x/slashing/migrations/v4/migrate_test.go b/x/slashing/migrations/v4/migrate_test.go index 844de3e900ed..65da59dfe808 100644 --- a/x/slashing/migrations/v4/migrate_test.go +++ b/x/slashing/migrations/v4/migrate_test.go @@ -40,11 +40,7 @@ func TestMigrate(t *testing.T) { err := v4.Migrate(ctx, cdc, store, params) require.NoError(t, err) - - // ensure old entries no longer exist and new bitmap chunk entries exist - entries := v4.GetValidatorMissedBlocks(ctx, cdc, store, consAddr, params) - require.Empty(t, entries) - + for i := int64(0); i < params.SignedBlocksWindow; i++ { chunkIndex := i / v4.MissedBlockBitmapChunkSize chunk := store.Get(v4.ValidatorMissedBlockBitmapKey(consAddr, chunkIndex)) From 99e60575f03d1064fa6a3caef72b3f8bdb6eb87c Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 10 Oct 2023 01:11:12 +0300 Subject: [PATCH 2/3] added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b0401c5261..9e152f9200d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (x/slashing) [#18016](https://github.com/cosmos/cosmos-sdk/pull/18016) Fixed builder function for missed blocks key (`validatorMissedBlockBitArrayPrefixKey`) in slashing/migration/v4 * (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals whose messages cannot be decoded. ### API Breaking Changes From e3fd98d9ae105c62a3ee2ecf6877a2f0b1bbd08e Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 10 Oct 2023 10:52:18 +0300 Subject: [PATCH 3/3] lint-fix --- x/slashing/migrations/v4/migrate_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/slashing/migrations/v4/migrate_test.go b/x/slashing/migrations/v4/migrate_test.go index 65da59dfe808..fc8a043610b9 100644 --- a/x/slashing/migrations/v4/migrate_test.go +++ b/x/slashing/migrations/v4/migrate_test.go @@ -40,7 +40,7 @@ func TestMigrate(t *testing.T) { err := v4.Migrate(ctx, cdc, store, params) require.NoError(t, err) - + for i := int64(0); i < params.SignedBlocksWindow; i++ { chunkIndex := i / v4.MissedBlockBitmapChunkSize chunk := store.Get(v4.ValidatorMissedBlockBitmapKey(consAddr, chunkIndex))