From 9b264d9d8816510374ee1b0f5d676021413baeef Mon Sep 17 00:00:00 2001 From: Dmitry S <11892559+swift1337@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:31:20 +0100 Subject: [PATCH] Address PR comments [5] --- pkg/cosmos/cosmos.go | 7 ++++--- zetaclient/tss/crypto.go | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/cosmos/cosmos.go b/pkg/cosmos/cosmos.go index bcaccacf11..6e62957bc4 100644 --- a/pkg/cosmos/cosmos.go +++ b/pkg/cosmos/cosmos.go @@ -4,8 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" // nolint ) +const Bech32PubKeyTypeAccPub = legacybech32.AccPK + var ( - GetPubKeyFromBech32 = legacybech32.UnmarshalPubKey - Bech32ifyPubKey = legacybech32.MarshalPubKey - Bech32PubKeyTypeAccPub = legacybech32.AccPK + GetPubKeyFromBech32 = legacybech32.UnmarshalPubKey + Bech32ifyPubKey = legacybech32.MarshalPubKey ) diff --git a/zetaclient/tss/crypto.go b/zetaclient/tss/crypto.go index 011df48455..170f433657 100644 --- a/zetaclient/tss/crypto.go +++ b/zetaclient/tss/crypto.go @@ -104,10 +104,8 @@ func (k PubKey) Bytes(compress bool) []byte { // Example: `zetapub1addwnpepq2fdhcmfyv07s86djjca835l4f2n2ta0c7le6vnl508mseca2s9g6slj0gm` func (k PubKey) Bech32String() string { v, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, k.cosmosPubKey) - - // should not happen as we only set k.cosmosPubKey from the constructor if err != nil { - panic("PubKey.Bech32String: " + err.Error()) + return "" // not possible } return v