From 848529c66c59d351c67bc0eb1b2d5876cbee6e06 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Tue, 19 Sep 2023 18:56:53 +0200 Subject: [PATCH] provider: fix TestSimulatedAssignmentsAndUpdateApplication --- x/ccv/provider/keeper/key_assignment.go | 3 --- x/ccv/provider/keeper/key_assignment_test.go | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index 4adf0aedbf..90623f3e3d 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -379,14 +379,12 @@ func (k Keeper) AssignConsumerKey( consumerKey tmprotocrypto.PublicKey, ) error { consAddrTmp, err := ccvtypes.TMCryptoPublicKeyToConsAddr(consumerKey) - fmt.Println("#consAddrTmp", err) if err != nil { return err } consumerAddr := types.NewConsumerConsAddress(consAddrTmp) consAddrTmp, err = validator.GetConsAddr() - fmt.Println("2 #consAddrTmp", err) if err != nil { return err } @@ -478,7 +476,6 @@ func (k Keeper) AssignConsumerKey( // get the previous key assigned for this validator on this consumer chain if oldConsumerKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, providerAddr); found { oldConsumerAddrTmp, err := ccvtypes.TMCryptoPublicKeyToConsAddr(oldConsumerKey) - fmt.Println("6 #ccvtypes.TMCryptoPublicKeyToConsAddr(oldConsumerKey)", err) if err != nil { return err } diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 7bb3ed024a..8d7ef33635 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "bytes" + "fmt" "math/rand" "sort" "testing" @@ -814,7 +815,11 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // in the provider valset and return its power. for i, id := range providerIDS { // TODO: @MSalopek -> double check - if id.SDKStakingValidator().GetOperator() == valAddr.String() { + valAddrFromHex, err := sdk.ValAddressFromHex(id.SDKStakingValidator().GetOperator()) + if err != nil { + panic(fmt.Sprintf("could not get val address from hex: %s", err)) + } + if valAddrFromHex.String() == valAddr.String() { return providerValset.power[i] } }