Skip to content

Commit

Permalink
provider: fix TestSimulatedAssignmentsAndUpdateApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Sep 19, 2023
1 parent b74796e commit 848529c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions x/ccv/provider/keeper/key_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 6 additions & 1 deletion x/ccv/provider/keeper/key_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper_test

import (
"bytes"
"fmt"
"math/rand"
"sort"
"testing"
Expand Down Expand Up @@ -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]
}
}
Expand Down

0 comments on commit 848529c

Please sign in to comment.