From ba88f50680001547cf358be480366fc51f9d0c5d Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 7 May 2024 11:55:57 +0200 Subject: [PATCH] remove extra methods & add section for the removal --- x/staking/CHANGELOG.md | 1 + x/staking/keeper/validator.go | 2 +- x/staking/types/validator.go | 10 ---------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/x/staking/CHANGELOG.md b/x/staking/CHANGELOG.md index c1bf5744f148..cfae69ea4fce 100644 --- a/x/staking/CHANGELOG.md +++ b/x/staking/CHANGELOG.md @@ -95,6 +95,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17335](https://github.com/cosmos/cosmos-sdk/pull/17335) Remove usage of `"cosmossdk.io/x/staking/types".Infraction_*` in favour of `"cosmossdk.io/api/cosmos/staking/v1beta1".Infraction_` in order to remove dependency between modules on staking * [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `QueryHistoricalInfo` was adjusted to return `HistoricalRecord` and marked `Hist` as deprecated. * [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.Pubkey` instead of `cometcrypto.Publickey`. The caller is responsible to translate the returned value to the expected type. + * Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct. ### State Breaking changes diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 92fddca8b1de..892b204da098 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -601,7 +601,7 @@ func (k Keeper) GetPubKeyByConsAddr(ctx context.Context, addr sdk.ConsAddress) ( return nil, err } - pubkey, err := v.CmtConsPublicKey() + pubkey, err := v.ConsPubKey() if err != nil { return nil, err } diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 02c522035523..9906bc2b8009 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -474,16 +474,6 @@ func (v Validator) ConsPubKey() (cryptotypes.PubKey, error) { return pk, nil } -// CmtConsPublicKey casts Validator.ConsensusPubkey to cmtprotocrypto.PubKey. -func (v Validator) CmtConsPublicKey() (cryptotypes.PubKey, error) { - pk, err := v.ConsPubKey() - if err != nil { - return nil, err - } - - return pk, nil -} - // GetConsAddr extracts Consensus key address func (v Validator) GetConsAddr() ([]byte, error) { pk, ok := v.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey)