Skip to content

Commit

Permalink
add pubkey in PairValConAddrProviderAndConsumer struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanhNhann committed Dec 13, 2023
1 parent d25fa28 commit a5647a8
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 83 deletions.
2 changes: 2 additions & 0 deletions proto/interchain_security/ccv/provider/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "google/protobuf/timestamp.proto";
import "interchain_security/ccv/provider/v1/provider.proto";
import "interchain_security/ccv/v1/shared_consumer.proto";
import "interchain_security/ccv/v1/wire.proto";
import "tendermint/crypto/keys.proto";

service Query {
// ConsumerGenesis queries the genesis state needed to start a consumer chain
Expand Down Expand Up @@ -195,4 +196,5 @@ message PairValConAddrProviderAndConsumer {
string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ];
// The consensus address of the validator on the consumer chain
string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
tendermint.crypto.PublicKey consumer_key = 3;
}
2 changes: 2 additions & 0 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context,
ctx := sdk.UnwrapSDKContext(goCtx)
validatorConsumerAddrs := k.GetAllValidatorsByConsumerAddr(ctx, &req.ChainId)
for _, data := range validatorConsumerAddrs {
pubKey, _, _ := k.GetKeyAssignmentReplacement(ctx, req.ChainId, types.ProviderConsAddress{Address: data.ConsumerAddr})
pairValConAddrs = append(pairValConAddrs, &types.PairValConAddrProviderAndConsumer{
ProviderAddress: string(data.ProviderAddr),
ConsumerAddress: string(data.ConsumerAddr),
ConsumerKey: &pubKey,
})
}
return &types.QueryAllPairsValConAddrByConsumerChainIDResponse{
Expand Down
Loading

0 comments on commit a5647a8

Please sign in to comment.