fix: fixed key in slashing bitmap migration (backport #18016) (#18033)

Co-authored-by: swelf19 <62722506+swelf19@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2023-10-10 08:24:32 +00:00 committed by GitHub
parent 95c008392a
commit 8ab33f58d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes
* (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals that cannot be decoded.
* (x/slashing) [#18016](https://github.com/cosmos/cosmos-sdk/pull/18016) Fixed builder function for missed blocks key (`validatorMissedBlockBitArrayPrefixKey`) in slashing/migration/v4
### Client Breaking Changes

View File

@ -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 {

View File

@ -41,10 +41,6 @@ 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))