Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed QueryAllPairsValConAddrByConsumerChainID output formatting (backport #1722) #1795

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proto/interchain_security/ccv/provider/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ message QueryAllPairsValConAddrByConsumerChainIDResponse {

message PairValConAddrProviderAndConsumer {
// The consensus address of the validator on the provider chain
string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"provider_address\"" ];
// The consensus address of the validator on the consumer chain
string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"consumer_address\"" ];
tendermint.crypto.PublicKey consumer_key = 3;
}

Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context,
return nil, err
}
pairValConAddrs = append(pairValConAddrs, &types.PairValConAddrProviderAndConsumer{
ProviderAddress: string(data.ProviderAddr),
ConsumerAddress: string(consumerAddr),
ProviderAddress: sdk.ConsAddress(data.ProviderAddr).String(),
ConsumerAddress: consumerAddr.String(),
ConsumerKey: data.ConsumerKey,
})
}
Expand Down
10 changes: 7 additions & 3 deletions x/ccv/provider/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/stretchr/testify/require"

sdktypes "github.com/cosmos/cosmos-sdk/types"
cryptotestutil "github.com/cosmos/interchain-security/v4/testutil/crypto"
testkeeper "github.com/cosmos/interchain-security/v4/testutil/keeper"
"github.com/cosmos/interchain-security/v4/x/ccv/provider/types"
Expand All @@ -14,7 +15,10 @@ import (

func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) {
chainID := consumer
providerAddr := types.NewProviderConsAddress([]byte("providerAddr"))

providerConsAddress, err := sdktypes.ConsAddressFromBech32("cosmosvalcons1wpex7anfv3jhystyv3eq20r35a")
require.NoError(t, err)
providerAddr := types.NewProviderConsAddress(providerConsAddress)

consumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey()
consumerAddr, err := ccvtypes.TMCryptoPublicKeyToConsAddr(consumerKey)
Expand Down Expand Up @@ -48,8 +52,8 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) {
require.NoError(t, err)

expectedResult := types.PairValConAddrProviderAndConsumer{
ProviderAddress: "providerAddr",
ConsumerAddress: string(consumerAddr),
ProviderAddress: providerConsAddress.String(),
ConsumerAddress: consumerAddr.String(),
ConsumerKey: &consumerKey,
}
require.Equal(t, &consumerKey, response.PairValConAddr[0].ConsumerKey)
Expand Down
Loading