diff --git a/x/observer/client/cli/tx_vote_blame.go b/x/observer/client/cli/tx_vote_blame.go index 7406359c10..90f8761c9f 100644 --- a/x/observer/client/cli/tx_vote_blame.go +++ b/x/observer/client/cli/tx_vote_blame.go @@ -15,6 +15,7 @@ import ( "gitlab.com/thorchain/tss/go-tss/blame" "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/x/observer/utils" ) func CmdVoteBlame() *cobra.Command { @@ -48,7 +49,7 @@ func CmdVoteBlame() *cobra.Command { if err != nil { return err } - blameNodes := types.ConvertNodes(nodes) + blameNodes := utils.ConvertNodes(nodes) blameInfo := types.Blame{ Index: index, FailureReason: failureReason, diff --git a/x/observer/types/utils.go b/x/observer/types/utils.go deleted file mode 100644 index 009b419168..0000000000 --- a/x/observer/types/utils.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import "gitlab.com/thorchain/tss/go-tss/blame" - -func ConvertNodes(n []blame.Node) (nodes []*Node) { - for _, node := range n { - var entry Node - entry.PubKey = node.Pubkey - entry.BlameSignature = node.BlameSignature - entry.BlameData = node.BlameData - - nodes = append(nodes, &entry) - } - return -} diff --git a/x/observer/utils/utils.go b/x/observer/utils/utils.go new file mode 100644 index 0000000000..1b60db317f --- /dev/null +++ b/x/observer/utils/utils.go @@ -0,0 +1,19 @@ +package utils + +import ( + "gitlab.com/thorchain/tss/go-tss/blame" + + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func ConvertNodes(n []blame.Node) (nodes []*types.Node) { + for _, node := range n { + var entry types.Node + entry.PubKey = node.Pubkey + entry.BlameSignature = node.BlameSignature + entry.BlameData = node.BlameData + + nodes = append(nodes, &entry) + } + return +} diff --git a/x/observer/types/utils_test.go b/x/observer/utils/utils_test.go similarity index 95% rename from x/observer/types/utils_test.go rename to x/observer/utils/utils_test.go index 26a9867d2e..bdd6b7ea18 100644 --- a/x/observer/types/utils_test.go +++ b/x/observer/utils/utils_test.go @@ -1,4 +1,4 @@ -package types_test +package utils import ( "testing" @@ -49,7 +49,7 @@ func TestConvertNodes(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - result := types.ConvertNodes(tt.input) + result := ConvertNodes(tt.input) require.Equal(t, tt.expected, result) }) } diff --git a/zetaclient/zetacore/client_vote.go b/zetaclient/zetacore/client_vote.go index 4883eb7677..a0f493a05d 100644 --- a/zetaclient/zetacore/client_vote.go +++ b/zetaclient/zetacore/client_vote.go @@ -11,6 +11,7 @@ import ( "github.com/zeta-chain/zetacore/pkg/retry" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + observerutils "github.com/zeta-chain/zetacore/x/observer/utils" zctx "github.com/zeta-chain/zetacore/zetaclient/context" ) @@ -109,7 +110,7 @@ func (c *Client) PostVoteBlameData( zetaBlame := observertypes.Blame{ Index: index, FailureReason: blame.FailReason, - Nodes: observertypes.ConvertNodes(blame.BlameNodes), + Nodes: observerutils.ConvertNodes(blame.BlameNodes), } msg := observertypes.NewMsgVoteBlameMsg(signerAddress, chainID, zetaBlame)