From 2f96ebec0a5fd170b1a0b46a59a9a5ea29cbde8e Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:19:40 +0900 Subject: [PATCH] feat: add channel halt feature from the permissioned relayers (#256) * add channel halt feature from the permissioned relayers * fix linter --- .golangci.yml | 10 - app/modules.go | 2 +- proto/ibc/applications/perm/v1/genesis.proto | 6 +- proto/ibc/applications/perm/v1/query.proto | 55 +- proto/ibc/applications/perm/v1/tx.proto | 62 +- proto/ibc/applications/perm/v1/types.proto | 24 +- x/evidence/keeper/grpc_query.go | 2 +- x/gov/keeper/proposal.go | 4 +- x/ibc/perm/ibc_module.go | 29 +- x/ibc/perm/keeper/genesis.go | 26 +- x/ibc/perm/keeper/genesis_test.go | 30 +- x/ibc/perm/keeper/grpc_query.go | 38 +- x/ibc/perm/keeper/grpc_query_test.go | 43 +- x/ibc/perm/keeper/keeper.go | 86 +- x/ibc/perm/keeper/keeper_test.go | 33 +- x/ibc/perm/keeper/msg_server.go | 100 +- x/ibc/perm/keeper/msg_server_test.go | 108 ++- x/ibc/perm/module.go | 12 +- x/ibc/perm/types/errors.go | 11 + x/ibc/perm/types/events.go | 11 +- x/ibc/perm/types/extended.go | 58 +- x/ibc/perm/types/genesis.go | 43 +- x/ibc/perm/types/genesis.pb.go | 46 +- x/ibc/perm/types/key.go | 10 +- x/ibc/perm/types/query.pb.go | 700 +++++++------- x/ibc/perm/types/query.pb.gw.go | 144 +-- x/ibc/perm/types/tx.go | 65 +- x/ibc/perm/types/tx.pb.go | 950 +++++++++++++++++-- x/ibc/perm/types/types.pb.go | 272 ++++-- x/move/types/authz.go | 4 +- x/mstaking/keeper/grpc_query.go | 2 +- 31 files changed, 2122 insertions(+), 864 deletions(-) create mode 100644 x/ibc/perm/types/errors.go diff --git a/.golangci.yml b/.golangci.yml index a9aaa908..49393d04 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,17 +4,7 @@ linters: - thelper - varnamelen - tagliatelle - - interfacer - wrapcheck - - deadcode - - exhaustivestruct - - golint - - ifshort - - maligned - - nosnakecase - - scopelint - - structcheck - - varcheck linters-settings: gocyclo: min-complexity: 11 diff --git a/app/modules.go b/app/modules.go index eaf67754..517270cc 100644 --- a/app/modules.go +++ b/app/modules.go @@ -143,7 +143,7 @@ func appModules( ica.NewAppModule(app.ICAControllerKeeper, app.ICAHostKeeper), icaauth.NewAppModule(app.appCodec, *app.ICAAuthKeeper), ibcfee.NewAppModule(*app.IBCFeeKeeper), - ibcperm.NewAppModule(*app.IBCPermKeeper), + ibcperm.NewAppModule(app.appCodec, *app.IBCPermKeeper), ibctm.NewAppModule(), solomachine.NewAppModule(), packetforward.NewAppModule(app.PacketForwardKeeper, nil), diff --git a/proto/ibc/applications/perm/v1/genesis.proto b/proto/ibc/applications/perm/v1/genesis.proto index 36182b65..c5982179 100644 --- a/proto/ibc/applications/perm/v1/genesis.proto +++ b/proto/ibc/applications/perm/v1/genesis.proto @@ -9,6 +9,8 @@ option go_package = "github.com/initia-labs/initia/x/ibc/perm/types"; // GenesisState defines the ibc perm genesis state message GenesisState { - repeated PermissionedRelayers permissioned_relayers = 1 - [(gogoproto.moretags) = "yaml:\"permissioned_relayers\"", (gogoproto.nullable) = false]; + repeated ChannelState channel_states = 1 [ + (gogoproto.moretags) = "yaml:\"channel_states\"", + (gogoproto.nullable) = false + ]; } diff --git a/proto/ibc/applications/perm/v1/query.proto b/proto/ibc/applications/perm/v1/query.proto index 9ab57605..29bce3a8 100644 --- a/proto/ibc/applications/perm/v1/query.proto +++ b/proto/ibc/applications/perm/v1/query.proto @@ -2,53 +2,48 @@ syntax = "proto3"; package ibc.applications.perm.v1; +import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/perm/v1/types.proto"; option go_package = "github.com/initia-labs/initia/x/ibc/perm/types"; // Query provides defines the gRPC querier service. service Query { - // PermissionedRelayersByChannel queries a set of permissioned ibc relayers for the specific channel. - rpc PermissionedRelayersByChannel(QueryPermissionedRelayersByChannelRequest) - returns (QueryPermissionedRelayersByChannelResponse) { - option (google.api.http).get = "/ibc/apps/perm/v1/relayers/{port_id}/{channel_id}"; + // ChannelStates queries all channel states. + rpc ChannelStates(QueryChannelStatesRequest) returns (QueryChannelStatesResponse) { + option (google.api.http).get = "/ibc/apps/perm/v1/channel_states"; } - // AllPermissionedRelayers queries all sets of permissioned relayers for all channels. - rpc AllPermissionedRelayers(QueryAllPermissionedRelayersRequest) returns (QueryAllPermissionedRelayersResponse) { - option (google.api.http).get = "/ibc/apps/perm/v1/relayers"; + // ChannelState queries the channel state for the specific port-id:channel-id pair. + rpc ChannelState(QueryChannelStateRequest) returns (QueryChannelStateResponse) { + option (google.api.http).get = "/ibc/apps/perm/v1/channel_states/{channel_id}/{port_id}"; } } -// QueryPermissionedRelayersOfOneChannelRequest is the request type for the Query/PermissionedRelayer RPC -// method -message QueryPermissionedRelayersByChannelRequest { - string port_id = 1; - string channel_id = 2; -} - -// QueryPermissionedRelayerResponse is the response type for the Query/PermissionedRelayer RPC -// method. -message QueryPermissionedRelayersByChannelResponse { - // class_trace returns the requested class id trace information. - PermissionedRelayers permissioned_relayers = 1; -} - -// QueryAllPermissionedRelayersRequest is the request type for the Query/AllPermissionedRelayers RPC -// method -message QueryAllPermissionedRelayersRequest { +// QueryChannelStatesRequest is the request type for the Query/ChannelStates RPC method. +message QueryChannelStatesRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryAllPermissionedRelayersResponse is the response type for the Query/AllPermissionedRelayers RPC -// method. -message QueryAllPermissionedRelayersResponse { - // class_trace returns the requested class id trace information. - repeated PermissionedRelayers permissioned_relayers = 1 [(gogoproto.nullable) = false]; +// QueryChannelStatesResponse is the response type for the Query/ChannelStates RPC method. +message QueryChannelStatesResponse { + // channel_states returns all stored ChannelState objects. + repeated ChannelState channel_states = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +// QueryChannelStateRequest is the request type for the Query/ChannelState RPC method. +message QueryChannelStateRequest { + string channel_id = 1; + string port_id = 2; +} + +// QueryChannelStateResponse is the response type for the Query/ChannelState RPC method. +message QueryChannelStateResponse { + // channel_state returns the stored ChannelState object. + ChannelState channel_state = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/ibc/applications/perm/v1/tx.proto b/proto/ibc/applications/perm/v1/tx.proto index 74d342a0..aba2f019 100644 --- a/proto/ibc/applications/perm/v1/tx.proto +++ b/proto/ibc/applications/perm/v1/tx.proto @@ -5,6 +5,7 @@ import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; + option go_package = "github.com/initia-labs/initia/x/ibc/perm/types"; // Msg defines the ibc/perm Msg service @@ -13,24 +14,75 @@ service Msg { // SetPermissionedRelayers defines a rpc handler method for MsgSetPermissionedRelayers. rpc SetPermissionedRelayers(MsgSetPermissionedRelayers) returns (MsgSetPermissionedRelayersResponse); + + // HaltChannel defines a rpc handler method for MsgHaltChannel. + rpc HaltChannel(MsgHaltChannel) returns (MsgHaltChannelResponse); + + // ResumeChannel defines a rpc handler method for MsgResumeChannel. + rpc ResumeChannel(MsgResumeChannel) returns (MsgResumeChannelResponse); } // MsgSetPermissionedRelayers defines msg to set permissioned relyer for // the specific ibc channel. message MsgSetPermissionedRelayers { option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "perm/MsgSetPermissionedRelayers"; + option (amino.name) = "perm/MsgSetPermissionedRelayers"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // authority is the address that controls the module // (defaults to x/gov unless overwritten). - string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\"", (cosmos_proto.scalar) = "cosmos.AddressString"]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string authority = 1 [ + (gogoproto.moretags) = "yaml:\"authority\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; + string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; repeated string relayers = 4 [(gogoproto.moretags) = "yaml:\"relayers\""]; } // MsgSetPermissionedRelayersResponse defines the Msg/SetPermissionedRelayer response type. message MsgSetPermissionedRelayersResponse {} + +// MsgHaltChannel defines msg to halt the specific ibc channel. +message MsgHaltChannel { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "perm/MsgHaltChannel"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // authority is the address that controls the module + // (defaults to x/gov unless overwritten). + string authority = 1 [ + (gogoproto.moretags) = "yaml:\"authority\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; + string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; +} + +// MsgHaltChannelResponse defines the Msg/HaltChannel response type. +message MsgHaltChannelResponse {} + +// MsgResumeChannel defines msg to resume the specific ibc channel. +message MsgResumeChannel { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "perm/MsgResumeChannel"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // authority is the address that controls the module + // (defaults to x/gov unless overwritten). + string authority = 1 [ + (gogoproto.moretags) = "yaml:\"authority\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; + string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; +} + +// MsgResumeChannelResponse defines the Msg/ResumeChannel response type. +message MsgResumeChannelResponse {} diff --git a/proto/ibc/applications/perm/v1/types.proto b/proto/ibc/applications/perm/v1/types.proto index 864a9250..c1841979 100644 --- a/proto/ibc/applications/perm/v1/types.proto +++ b/proto/ibc/applications/perm/v1/types.proto @@ -2,18 +2,20 @@ syntax = "proto3"; package ibc.applications.perm.v1; +import "gogoproto/gogo.proto"; + option go_package = "github.com/initia-labs/initia/x/ibc/perm/types"; -// PermissionedRelayer is used to specifiy the permissioned relayer for -// the specific port-id:channel-id pair. -message PermissionedRelayers { - string port_id = 1; - string channel_id = 2; - repeated string relayers = 3; +// ChannelState defines the channel state for the specific port-id:channel-id pair. +message ChannelState { + string port_id = 1; + string channel_id = 2; + HaltState halt_state = 3 [(gogoproto.nullable) = false]; + repeated string relayers = 4; } -// PermissionedRelayersList is used to specify the list of permissioned relayers -// for the specific port-id:channel-id pair. -message PermissionedRelayersList { - repeated string relayers = 1; -} \ No newline at end of file +// HaltState defines the halt state for the specific port-id:channel-id pair. +message HaltState { + bool halted = 1; + string halted_by = 2; +} diff --git a/x/evidence/keeper/grpc_query.go b/x/evidence/keeper/grpc_query.go index 178d39d3..5956e531 100644 --- a/x/evidence/keeper/grpc_query.go +++ b/x/evidence/keeper/grpc_query.go @@ -57,7 +57,7 @@ func (k Querier) Evidence(c context.Context, req *types.QueryEvidenceRequest) (* evidenceAny, err := codectypes.NewAnyWithValue(msg) if err != nil { - return nil, status.Errorf(codes.Internal, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &types.QueryEvidenceResponse{Evidence: evidenceAny}, nil diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index a286bd0a..72075f70 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -68,7 +68,7 @@ func (k Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata return customtypes.Proposal{}, err } - return customtypes.Proposal{}, errorsmod.Wrapf(types.ErrInvalidSigner, signerStr) + return customtypes.Proposal{}, errorsmod.Wrap(types.ErrInvalidSigner, signerStr) } // use the msg service router to see that there is a valid route for that message. @@ -85,7 +85,7 @@ func (k Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata if msg, ok := msg.(*v1.MsgExecLegacyContent); ok { cacheCtx, _ := sdkCtx.CacheContext() if _, err := handler(cacheCtx, msg); err != nil { - if errors.Is(types.ErrNoProposalHandlerExists, err) { + if errors.Is(err, types.ErrNoProposalHandlerExists) { return customtypes.Proposal{}, err } return customtypes.Proposal{}, errorsmod.Wrap(types.ErrInvalidProposalContent, err.Error()) diff --git a/x/ibc/perm/ibc_module.go b/x/ibc/perm/ibc_module.go index 7fc090a0..00fe1325 100644 --- a/x/ibc/perm/ibc_module.go +++ b/x/ibc/perm/ibc_module.go @@ -155,27 +155,16 @@ func (im IBCMiddleware) OnRecvPacket( packet channeltypes.Packet, relayer sdk.AccAddress, ) ibcexported.Acknowledgement { - if ok, err := im.keeper.HasPermission(ctx, packet.DestinationPort, packet.DestinationChannel, relayer); err != nil { + if ok, err := im.keeper.IsHalted(ctx, packet.DestinationPort, packet.DestinationChannel); err != nil { return newEmitErrorAcknowledgement(ctx, err) - } else if !ok { - /* - Raise a panic to prevent abnormal relayers from disrupting operations by - continuously sending error acknowledgements. For instance, abnormal relaying - can interfere with oracle price fetching. - - return newEmitErrorAcknowledgement( - ctx, - fmt.Errorf( - "all packets of the channel `%s` should be relayed by the relayer `%s`", - packet.DestinationChannel, - permissionedRelayer, - ), - ) - */ - panic(fmt.Errorf( - "all packets of the channel `%s` should be relayed by the permissioned relayers", - packet.DestinationChannel, - )) + } else if ok { + return newEmitErrorAcknowledgement( + ctx, + fmt.Errorf( + "channel `%s` is halted, no packets should be relayed", + packet.DestinationChannel, + ), + ) } return im.app.OnRecvPacket(ctx, packet, relayer) diff --git a/x/ibc/perm/keeper/genesis.go b/x/ibc/perm/keeper/genesis.go index b73cbc1f..0ba556ed 100644 --- a/x/ibc/perm/keeper/genesis.go +++ b/x/ibc/perm/keeper/genesis.go @@ -1,7 +1,6 @@ package keeper import ( - "cosmossdk.io/collections" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/initia-labs/initia/x/ibc/perm/types" @@ -9,19 +8,9 @@ import ( // InitGenesis initializes the ibc-perm state. func (k Keeper) InitGenesis(ctx sdk.Context, genesisState types.GenesisState) { - - for _, relayersByChannel := range genesisState.PermissionedRelayers { - var channelRelayers []string - for _, channelRelayer := range relayersByChannel.Relayers { - _, err := k.ac.StringToBytes(channelRelayer) - if err != nil { - panic(err) - } - channelRelayers = append(channelRelayers, channelRelayer) - } - if err := k.PermissionedRelayers.Set(ctx, collections.Join(relayersByChannel.PortId, relayersByChannel.ChannelId), types.PermissionedRelayersList{ - Relayers: channelRelayers, - }); err != nil { + for _, channelState := range genesisState.ChannelStates { + err := k.SetChannelState(ctx, channelState) + if err != nil { panic(err) } } @@ -29,16 +18,17 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genesisState types.GenesisState) { // ExportGenesis exports ibc-perm module's channel relayers. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - channelRelayerSets := []types.PermissionedRelayers{} - err := k.IteratePermissionedRelayers(ctx, func(channelRelayer types.PermissionedRelayers) (bool, error) { - channelRelayerSets = append(channelRelayerSets, channelRelayer) + channelStates := []types.ChannelState{} + err := k.IterateChannelStates(ctx, func(channelRelayer types.ChannelState) (bool, error) { + channelStates = append(channelStates, channelRelayer) return false, nil }) + if err != nil { panic(err) } return &types.GenesisState{ - PermissionedRelayers: channelRelayerSets, + ChannelStates: channelStates, } } diff --git a/x/ibc/perm/keeper/genesis_test.go b/x/ibc/perm/keeper/genesis_test.go index cb70a677..806d0160 100644 --- a/x/ibc/perm/keeper/genesis_test.go +++ b/x/ibc/perm/keeper/genesis_test.go @@ -26,16 +26,24 @@ func Test_InitGenesis(t *testing.T) { addrB := sdk.AccAddress(pubKeyB.Address()) k.InitGenesis(ctx, types.GenesisState{ - PermissionedRelayers: []types.PermissionedRelayers{ + ChannelStates: []types.ChannelState{ { PortId: portA, ChannelId: channelA, Relayers: []string{addrA.String()}, + HaltState: types.HaltState{ + Halted: true, + HaltedBy: addrA.String(), + }, }, { PortId: portB, ChannelId: channelB, Relayers: []string{addrB.String()}, + HaltState: types.HaltState{ + Halted: false, + HaltedBy: "", + }, }, }, }) @@ -44,9 +52,23 @@ func Test_InitGenesis(t *testing.T) { require.NoError(t, err) require.True(t, ok) + cs, err := k.GetChannelState(ctx, portA, channelA) + require.NoError(t, err) + require.Equal(t, types.HaltState{ + Halted: true, + HaltedBy: addrA.String(), + }, cs.HaltState) + ok, _ = k.HasPermission(ctx, portB, channelB, addrB) require.NoError(t, err) require.True(t, ok) + + cs, err = k.GetChannelState(ctx, portA, channelB) + require.NoError(t, err) + require.Equal(t, types.HaltState{ + Halted: false, + HaltedBy: "", + }, cs.HaltState) } func Test_ExportGenesis(t *testing.T) { ctx, k := _createTestInput(t, dbm.NewMemDB()) @@ -63,11 +85,15 @@ func Test_ExportGenesis(t *testing.T) { addrB := sdk.AccAddress(pubKeyB.Address()) genState := types.NewGenesisState( - []types.PermissionedRelayers{ + []types.ChannelState{ { PortId: portA, ChannelId: channelA, Relayers: []string{addrA.String()}, + HaltState: types.HaltState{ + Halted: true, + HaltedBy: addrA.String(), + }, }, { PortId: portB, diff --git a/x/ibc/perm/keeper/grpc_query.go b/x/ibc/perm/keeper/grpc_query.go index 7ef29238..e2db3218 100644 --- a/x/ibc/perm/keeper/grpc_query.go +++ b/x/ibc/perm/keeper/grpc_query.go @@ -20,42 +20,24 @@ func NewQueryServer(k *Keeper) QueryServerImpl { return QueryServerImpl{k} } -// PermissionedRelayersByChannel implements the Query/PermissionedRelayersByChannel gRPC method -func (q QueryServerImpl) PermissionedRelayersByChannel(c context.Context, req *types.QueryPermissionedRelayersByChannelRequest) (*types.QueryPermissionedRelayersByChannelResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - relayersList, err := q.Keeper.PermissionedRelayers.Get(ctx, collections.Join(req.PortId, req.ChannelId)) +func (q QueryServerImpl) ChannelStates(ctx context.Context, req *types.QueryChannelStatesRequest) (*types.QueryChannelStatesResponse, error) { + channelStates, pageRes, err := query.CollectionPaginate(ctx, q.Keeper.ChannelStates, req.Pagination, func(key collections.Pair[string, string], channelState types.ChannelState) (types.ChannelState, error) { + return channelState, nil + }) if err != nil { return nil, err } - return &types.QueryPermissionedRelayersByChannelResponse{ - PermissionedRelayers: &types.PermissionedRelayers{ - PortId: req.PortId, - ChannelId: req.ChannelId, - Relayers: relayersList.Relayers, - }, - }, nil + return &types.QueryChannelStatesResponse{ChannelStates: channelStates, Pagination: pageRes}, nil } -// AllPermissionedRelayers implements the Query/AllPermissionedRelayers gRPC method -func (q QueryServerImpl) AllPermissionedRelayers(ctx context.Context, req *types.QueryAllPermissionedRelayersRequest) (*types.QueryAllPermissionedRelayersResponse, error) { - relayers, pageRes, err := query.CollectionPaginate( - ctx, q.Keeper.PermissionedRelayers, req.Pagination, - func(key collections.Pair[string, string], relayersList types.PermissionedRelayersList) (types.PermissionedRelayers, error) { - - return types.PermissionedRelayers{ - PortId: key.K1(), - ChannelId: key.K2(), - Relayers: relayersList.Relayers, - }, nil - }, - ) +func (q QueryServerImpl) ChannelState(ctx context.Context, req *types.QueryChannelStateRequest) (*types.QueryChannelStateResponse, error) { + ctx = sdk.UnwrapSDKContext(ctx) + + channelState, err := q.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId) if err != nil { return nil, err } - return &types.QueryAllPermissionedRelayersResponse{ - PermissionedRelayers: relayers, - Pagination: pageRes, - }, nil + return &types.QueryChannelStateResponse{ChannelState: channelState}, nil } diff --git a/x/ibc/perm/keeper/grpc_query_test.go b/x/ibc/perm/keeper/grpc_query_test.go index bd574ad0..5670e338 100644 --- a/x/ibc/perm/keeper/grpc_query_test.go +++ b/x/ibc/perm/keeper/grpc_query_test.go @@ -4,7 +4,6 @@ import ( "slices" "testing" - "cosmossdk.io/collections" "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/stretchr/testify/require" @@ -16,7 +15,7 @@ import ( "github.com/initia-labs/initia/x/ibc/perm/types" ) -func Test_QueryPermissionedRelayersOneChannel(t *testing.T) { +func Test_QueryChannelState(t *testing.T) { ctx, k := _createTestInput(t, dbm.NewMemDB()) portID := "port-123" @@ -25,23 +24,27 @@ func Test_QueryPermissionedRelayersOneChannel(t *testing.T) { addr := sdk.AccAddress(pubKey.Address()) // set relayer - require.NoError(t, k.PermissionedRelayers.Set(ctx, collections.Join(portID, channelID), types.PermissionedRelayersList{Relayers: []string{addr.String()}})) + require.NoError(t, k.SetChannelState(ctx, types.ChannelState{ + PortId: portID, + ChannelId: channelID, + Relayers: []string{addr.String()}, + })) // set channel relayer via msg handler queryServer := keeper.NewQueryServer(k) - res, err := queryServer.PermissionedRelayersByChannel(ctx, &types.QueryPermissionedRelayersByChannelRequest{ + res, err := queryServer.ChannelState(ctx, &types.QueryChannelStateRequest{ PortId: portID, ChannelId: channelID, }) require.NoError(t, err) - require.True(t, slices.Contains(res.PermissionedRelayers.Relayers, addr.String())) + require.True(t, slices.Contains(res.ChannelState.Relayers, addr.String())) - _, err = queryServer.PermissionedRelayersByChannel(ctx, &types.QueryPermissionedRelayersByChannelRequest{ + res, err = queryServer.ChannelState(ctx, &types.QueryChannelStateRequest{ PortId: portID, ChannelId: channelID + "4", }) - require.Error(t, err) - + require.NoError(t, err) + require.Empty(t, res.ChannelState.Relayers) } func Test_QueryAllPermissionedRelayers(t *testing.T) { @@ -57,16 +60,26 @@ func Test_QueryAllPermissionedRelayers(t *testing.T) { addr2 := sdk.AccAddress(pubKey2.Address()) // set relayers - require.NoError(t, k.PermissionedRelayers.Set(ctx, collections.Join(portID1, channelID1), types.PermissionedRelayersList{Relayers: []string{addr1.String()}})) - require.NoError(t, k.PermissionedRelayers.Set(ctx, collections.Join(portID2, channelID2), types.PermissionedRelayersList{Relayers: []string{addr2.String()}})) + err := k.SetChannelState(ctx, types.ChannelState{ + PortId: portID1, + ChannelId: channelID1, + Relayers: []string{addr1.String()}, + }) + require.NoError(t, err) + err = k.SetChannelState(ctx, types.ChannelState{ + PortId: portID2, + ChannelId: channelID2, + Relayers: []string{addr2.String()}, + }) + require.NoError(t, err) // set channel relayer via msg handler queryServer := keeper.NewQueryServer(k) - res, err := queryServer.AllPermissionedRelayers(ctx, &types.QueryAllPermissionedRelayersRequest{}) + res, err := queryServer.ChannelStates(ctx, &types.QueryChannelStatesRequest{}) require.NoError(t, err) - require.Len(t, res.PermissionedRelayers, 2) - if res.PermissionedRelayers[0].ChannelId == channelID1 { - require.Equal(t, res.PermissionedRelayers, []types.PermissionedRelayers{ + require.Len(t, res.ChannelStates, 2) + if res.ChannelStates[0].ChannelId == channelID1 { + require.Equal(t, res.ChannelStates, []types.ChannelState{ { PortId: portID1, ChannelId: channelID1, @@ -79,7 +92,7 @@ func Test_QueryAllPermissionedRelayers(t *testing.T) { }, }) } else { - require.Equal(t, res.PermissionedRelayers, []types.PermissionedRelayers{ + require.Equal(t, res.ChannelStates, []types.ChannelState{ { PortId: portID2, ChannelId: channelID2, diff --git a/x/ibc/perm/keeper/keeper.go b/x/ibc/perm/keeper/keeper.go index 722745f6..2ffb9dd9 100644 --- a/x/ibc/perm/keeper/keeper.go +++ b/x/ibc/perm/keeper/keeper.go @@ -23,8 +23,8 @@ type Keeper struct { authority string - Schema collections.Schema - PermissionedRelayers collections.Map[collections.Pair[string, string], types.PermissionedRelayersList] + Schema collections.Schema + ChannelStates collections.Map[collections.Pair[string, string], types.ChannelState] } // NewKeeper creates a new IBC perm Keeper instance @@ -40,10 +40,10 @@ func NewKeeper( sb := collections.NewSchemaBuilder(storeService) k := &Keeper{ - cdc: cdc, - authority: authority, - PermissionedRelayers: collections.NewMap(sb, types.PermissionedRelayersPrefixKey, "channel_relayers", collections.PairKeyCodec[string, string](collections.StringKey, collections.StringKey), codec.CollValue[types.PermissionedRelayersList](cdc)), - ac: ac, + cdc: cdc, + authority: authority, + ChannelStates: collections.NewMap(sb, types.ChannelStatePrefix, "channel_state", collections.PairKeyCodec[string, string](collections.StringKey, collections.StringKey), codec.CollValue[types.ChannelState](cdc)), + ac: ac, } schema, err := sb.Build() @@ -61,42 +61,71 @@ func (k Keeper) Logger(ctx context.Context) log.Logger { return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) } -// IteratePermissionedRelayers iterates over all the permissioned relayers. -func (k Keeper) IteratePermissionedRelayers(ctx context.Context, cb func(channelRelayer types.PermissionedRelayers) (bool, error)) error { - return k.PermissionedRelayers.Walk(ctx, nil, func(key collections.Pair[string, string], relayersList types.PermissionedRelayersList) (stop bool, err error) { - return cb(types.PermissionedRelayers{ - PortId: key.K1(), - ChannelId: key.K2(), - Relayers: relayersList.Relayers, - }) +// IterateChannelState iterates over all the permissioned relayers. +func (k Keeper) IterateChannelStates(ctx context.Context, cb func(channelRelayer types.ChannelState) (bool, error)) error { + return k.ChannelStates.Walk(ctx, nil, func(key collections.Pair[string, string], channelState types.ChannelState) (stop bool, err error) { + return cb(channelState) }) } -// SetPermissionedRelayer sets the relayer as the permissioned relayer for the channel. +// SetChannelState sets the relayer as the permissioned relayer for the channel. +func (k Keeper) SetChannelState(ctx context.Context, channelState types.ChannelState) error { + return k.ChannelStates.Set(ctx, collections.Join(channelState.PortId, channelState.ChannelId), channelState) +} + +// GetChannelState returns the permissioned relayer for the channel. +func (k Keeper) GetChannelState(ctx context.Context, portID, channelID string) (types.ChannelState, error) { + channelState, err := k.ChannelStates.Get(ctx, collections.Join(portID, channelID)) + if err != nil && errors.Is(err, collections.ErrNotFound) { + cs := types.NewChannelState(portID, channelID) + return cs, nil + } else if err != nil { + return types.ChannelState{}, err + } + + return channelState, nil +} + func (k Keeper) SetPermissionedRelayers(ctx context.Context, portID, channelID string, relayers []sdk.AccAddress) error { - relayerList, err := types.ToRelayerList(k.ac, relayers) + permRelayers, err := k.GetChannelState(ctx, portID, channelID) if err != nil { return err } - return k.PermissionedRelayers.Set(ctx, collections.Join(portID, channelID), relayerList) + + strRelayers := make([]string, len(relayers)) + for _, relayer := range relayers { + relayerStr, err := k.ac.BytesToString(relayer) + if err != nil { + return err + } + strRelayers = append(strRelayers, relayerStr) + } + + permRelayers.Relayers = strRelayers + return k.SetChannelState(ctx, permRelayers) } -// GetPermissionedRelayer returns the permissioned relayer for the channel. func (k Keeper) GetPermissionedRelayers(ctx context.Context, portID, channelID string) ([]sdk.AccAddress, error) { - relayers, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) + permRelayers, err := k.GetChannelState(ctx, portID, channelID) if err != nil { return nil, err } - relayersAcc, err := relayers.GetAccAddr(k.ac) - if err != nil { - return nil, err + + relayers := make([]sdk.AccAddress, len(permRelayers.Relayers)) + for i, relayer := range permRelayers.Relayers { + relayerBytes, err := k.ac.StringToBytes(relayer) + if err != nil { + return nil, err + } + relayers[i] = relayerBytes } - return relayersAcc, nil + + return relayers, nil } // HasPermission checks if the relayer has permission to relay packets on the channel. func (k Keeper) HasPermission(ctx context.Context, portID, channelID string, relayer sdk.AccAddress) (bool, error) { - permRelayers, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) + permRelayers, err := k.ChannelStates.Get(ctx, collections.Join(portID, channelID)) if err != nil && errors.Is(err, collections.ErrNotFound) { // if no permissioned relayers are set, all relayers are allowed return true, nil @@ -111,3 +140,12 @@ func (k Keeper) HasPermission(ctx context.Context, portID, channelID string, rel return permRelayers.HasRelayer(relayerStr), nil } + +func (k Keeper) IsHalted(ctx context.Context, portID, channelID string) (bool, error) { + cs, err := k.GetChannelState(ctx, portID, channelID) + if err != nil { + return false, err + } + + return cs.HaltState.Halted, nil +} diff --git a/x/ibc/perm/keeper/keeper_test.go b/x/ibc/perm/keeper/keeper_test.go index 6ad4c732..8ae5824e 100644 --- a/x/ibc/perm/keeper/keeper_test.go +++ b/x/ibc/perm/keeper/keeper_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/collections" "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/metrics" @@ -87,17 +86,18 @@ func Test_GetPermissionedRelayers(t *testing.T) { addr, addr2 := sdk.AccAddress(pubKey.Address()), sdk.AccAddress(pubKey2.Address()) // should be empty - _, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) - require.ErrorIs(t, err, collections.ErrNotFound) + cs, err := k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.Empty(t, cs.Relayers) // set channel relayer via msg handler - err = k.PermissionedRelayers.Set(ctx, collections.Join(portID, channelID), types.PermissionedRelayersList{Relayers: []string{addr.String()}}) + err = k.SetChannelState(ctx, types.ChannelState{PortId: portID, ChannelId: channelID, Relayers: []string{addr.String()}}) require.NoError(t, err) // check properly set - res, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) + cs, err = k.GetChannelState(ctx, portID, channelID) require.NoError(t, err) - require.True(t, res.HasRelayer(addr.String())) + require.True(t, cs.HasRelayer(addr.String())) // check properly set ok, err := k.HasPermission(ctx, portID, channelID, addr) @@ -108,6 +108,11 @@ func Test_GetPermissionedRelayers(t *testing.T) { ok, err = k.HasPermission(ctx, portID, channelID, addr2) require.NoError(t, err) require.False(t, ok) + + relayers, err := k.GetPermissionedRelayers(ctx, portID, channelID) + require.NoError(t, err) + require.Len(t, relayers, 1) + require.Equal(t, addr.String(), relayers[0].String()) } func Test_SetPermissionedRelayers(t *testing.T) { @@ -123,10 +128,11 @@ func Test_SetPermissionedRelayers(t *testing.T) { require.NoError(t, err) // check properly set - res, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) + cs, err := k.GetChannelState(ctx, portID, channelID) require.NoError(t, err) - require.True(t, res.HasRelayer(addr.String())) + require.True(t, cs.HasRelayer(addr.String())) } + func Test_HasPermission(t *testing.T) { ctx, k := _createTestInput(t, dbm.NewMemDB()) @@ -141,4 +147,15 @@ func Test_HasPermission(t *testing.T) { ok, err := k.HasPermission(ctx, portID, channelID, addr) require.NoError(t, err) require.True(t, ok) + + // if no permissioned relayers are set, all relayers are allowed + ok, err = k.HasPermission(ctx, portID, channelID+"2", addr) + require.NoError(t, err) + require.True(t, ok) + + pubKey2 := secp256k1.GenPrivKey().PubKey() + addr2 := sdk.AccAddress(pubKey2.Address()) + ok, err = k.HasPermission(ctx, portID, channelID, addr2) + require.NoError(t, err) + require.False(t, ok) } diff --git a/x/ibc/perm/keeper/msg_server.go b/x/ibc/perm/keeper/msg_server.go index 82adc40b..ff99856f 100644 --- a/x/ibc/perm/keeper/msg_server.go +++ b/x/ibc/perm/keeper/msg_server.go @@ -33,12 +33,14 @@ func (ms MsgServer) SetPermissionedRelayers(ctx context.Context, req *types.MsgS return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) } - relayers, err := types.ToRelayerAccAddr(ms.ac, req.Relayers) + cs, err := ms.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId) if err != nil { return nil, err } - if err := ms.Keeper.SetPermissionedRelayers(ctx, req.PortId, req.ChannelId, relayers); err != nil { + cs.Relayers = req.Relayers + err = ms.Keeper.SetChannelState(ctx, cs) + if err != nil { return nil, err } @@ -57,11 +59,99 @@ func (ms MsgServer) SetPermissionedRelayers(ctx context.Context, req *types.MsgS sdk.NewAttribute(types.AttributeKeyChannelId, req.ChannelId), sdk.NewAttribute(types.AttributeKeyRelayers, strings.Join(req.Relayers, ",")), ), + }) + + return &types.MsgSetPermissionedRelayersResponse{}, nil +} + +// HaltChannel implements types.MsgServer. +func (ms MsgServer) HaltChannel(ctx context.Context, req *types.MsgHaltChannel) (*types.MsgHaltChannelResponse, error) { + if err := req.Validate(ms.Keeper.ac); err != nil { + return nil, err + } + + cs, err := ms.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId) + if err != nil { + return nil, err + } + + if cs.HaltState.Halted { + return nil, errors.Wrap(types.ErrInvalidHaltState, "channel is already halted") + } + + if ms.authority != req.Authority && !cs.HasRelayer(req.Authority) { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s or one of permissinoed-relayers, got %s", ms.authority, req.Authority) + } + + cs.HaltState.Halted = true + cs.HaltState.HaltedBy = req.Authority + err = ms.Keeper.SetChannelState(ctx, cs) + if err != nil { + return nil, err + } + + ms.Logger(ctx).Info( + "IBC permissioned channel halted", + "port id", req.PortId, + "channel id", req.ChannelId, + "halted by", req.Authority, + ) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + types.EventTypeHaltChannel, + sdk.NewAttribute(types.AttributeKeyPortId, req.PortId), + sdk.NewAttribute(types.AttributeKeyChannelId, req.ChannelId), + sdk.NewAttribute(types.AttributeKeyHaltedBy, req.Authority), ), }) - return &types.MsgSetPermissionedRelayersResponse{}, nil + return &types.MsgHaltChannelResponse{}, nil +} + +// ResumeChannel implements types.MsgServer. +func (ms MsgServer) ResumeChannel(ctx context.Context, req *types.MsgResumeChannel) (*types.MsgResumeChannelResponse, error) { + if err := req.Validate(ms.Keeper.ac); err != nil { + return nil, err + } + + cs, err := ms.Keeper.GetChannelState(ctx, req.PortId, req.ChannelId) + if err != nil { + return nil, err + } + + if !cs.HaltState.Halted { + return nil, errors.Wrap(types.ErrInvalidHaltState, "channel is not halted") + } + + if ms.authority != req.Authority && req.Authority != cs.HaltState.HaltedBy { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s or %s, got %s", ms.authority, cs.HaltState.HaltedBy, req.Authority) + } + + cs.HaltState.Halted = false + cs.HaltState.HaltedBy = "" + err = ms.Keeper.SetChannelState(ctx, cs) + if err != nil { + return nil, err + } + + ms.Logger(ctx).Info( + "IBC permissioned channel resumed", + "port id", req.PortId, + "channel id", req.ChannelId, + "resumed by", req.Authority, + ) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeHaltChannel, + sdk.NewAttribute(types.AttributeKeyPortId, req.PortId), + sdk.NewAttribute(types.AttributeKeyChannelId, req.ChannelId), + sdk.NewAttribute(types.AttributeKeyResumedBy, req.Authority), + ), + }) + + return &types.MsgResumeChannelResponse{}, nil } diff --git a/x/ibc/perm/keeper/msg_server_test.go b/x/ibc/perm/keeper/msg_server_test.go index 7982178f..7d04bc17 100644 --- a/x/ibc/perm/keeper/msg_server_test.go +++ b/x/ibc/perm/keeper/msg_server_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "cosmossdk.io/collections" "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/stretchr/testify/require" @@ -27,8 +26,9 @@ func Test_SetPermissionedRelayer(t *testing.T) { addr2 := sdk.AccAddress(pubKey.Address()) // should be empty - _, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) - require.ErrorIs(t, err, collections.ErrNotFound) + cs, err := k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.Empty(t, cs.Relayers) // set channel relayer via msg handler msgServer := keeper.NewMsgServerImpl(k) @@ -39,8 +39,104 @@ func Test_SetPermissionedRelayer(t *testing.T) { require.NoError(t, err) // check properly set - res, err := k.PermissionedRelayers.Get(ctx, collections.Join(portID, channelID)) + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.True(t, cs.HasRelayer(addr1.String())) + require.True(t, cs.HasRelayer(addr2.String())) +} + +func Test_HaltChannel(t *testing.T) { + ctx, k := _createTestInput(t, dbm.NewMemDB()) + + portID := "port-123" + channelID := "channel-123" + pubKey := secp256k1.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pubKey.Address()) + addr2 := sdk.AccAddress(pubKey.Address()) + + // set channel relayer via msg handler + msgServer := keeper.NewMsgServerImpl(k) + _, err := msgServer.SetPermissionedRelayers(ctx, types.NewMsgSetPermissionedRelayers( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + portID, channelID, []string{addr1.String(), addr2.String()}, + )) + require.NoError(t, err) + + // check properly set + cs, err := k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.True(t, cs.HasRelayer(addr1.String())) + require.True(t, cs.HasRelayer(addr2.String())) + + // halt channel + _, err = msgServer.HaltChannel(ctx, types.NewMsgHaltChannel( + addr1.String(), portID, channelID, + )) + require.NoError(t, err) + + // check properly set + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.True(t, cs.HaltState.Halted) + require.Equal(t, addr1.String(), cs.HaltState.HaltedBy) + + // resume channel + _, err = msgServer.ResumeChannel(ctx, types.NewMsgResumeChannel( + addr1.String(), portID, channelID, + )) + require.NoError(t, err) + + // check properly set + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.False(t, cs.HaltState.Halted) + require.Empty(t, cs.HaltState.HaltedBy) + + // halt channel + _, err = msgServer.HaltChannel(ctx, types.NewMsgHaltChannel( + addr2.String(), portID, channelID, + )) + require.NoError(t, err) + + // check properly set + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.True(t, cs.HaltState.Halted) + require.Equal(t, addr2.String(), cs.HaltState.HaltedBy) + + // resume channel by govtypes.ModuleName + _, err = msgServer.ResumeChannel(ctx, types.NewMsgResumeChannel( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), portID, channelID, + )) + require.NoError(t, err) + + // check properly set + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.False(t, cs.HaltState.Halted) + require.Empty(t, cs.HaltState.HaltedBy) + + // halt channel by govtypes.ModuleName + _, err = msgServer.HaltChannel(ctx, types.NewMsgHaltChannel( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), portID, channelID, + )) + require.NoError(t, err) + + // check properly set + cs, err = k.GetChannelState(ctx, portID, channelID) + require.NoError(t, err) + require.True(t, cs.HaltState.Halted) + require.Equal(t, authtypes.NewModuleAddress(govtypes.ModuleName).String(), cs.HaltState.HaltedBy) + + // resume channel by addr1 + _, err = msgServer.ResumeChannel(ctx, types.NewMsgResumeChannel( + addr1.String(), portID, channelID, + )) + require.Error(t, err) + + // resume channel by govtypes.ModuleName + _, err = msgServer.ResumeChannel(ctx, types.NewMsgResumeChannel( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), portID, channelID, + )) require.NoError(t, err) - require.True(t, res.HasRelayer(addr1.String())) - require.True(t, res.HasRelayer(addr2.String())) } diff --git a/x/ibc/perm/module.go b/x/ibc/perm/module.go index 0ee7ca06..feb8b146 100644 --- a/x/ibc/perm/module.go +++ b/x/ibc/perm/module.go @@ -34,7 +34,9 @@ var ( ) // AppModuleBasic is the IBC Transfer AppModuleBasic -type AppModuleBasic struct{} +type AppModuleBasic struct { + cdc codec.Codec +} // Name implements AppModuleBasic interface func (AppModuleBasic) Name() string { @@ -58,13 +60,13 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the ibc transfer module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var gs types.GenesisState if err := cdc.UnmarshalJSON(bz, &gs); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } - return gs.Validate() + return gs.Validate(b.cdc.InterfaceRegistry().SigningContext().AddressCodec()) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the ibc-transfer module. @@ -81,9 +83,9 @@ type AppModule struct { } // NewAppModule creates a new 20-transfer module -func NewAppModule(k keeper.Keeper) AppModule { +func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { return AppModule{ - AppModuleBasic: AppModuleBasic{}, + AppModuleBasic: AppModuleBasic{cdc}, keeper: k, } } diff --git a/x/ibc/perm/types/errors.go b/x/ibc/perm/types/errors.go new file mode 100644 index 00000000..cc35b231 --- /dev/null +++ b/x/ibc/perm/types/errors.go @@ -0,0 +1,11 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" +) + +// Move Errors +var ( + // ErrInvalidHaltState error for the invalid halt state + ErrInvalidHaltState = errorsmod.Register(ModuleName, 2, "invalid halt state") +) diff --git a/x/ibc/perm/types/events.go b/x/ibc/perm/types/events.go index a8369d5b..b1621be5 100644 --- a/x/ibc/perm/types/events.go +++ b/x/ibc/perm/types/events.go @@ -2,7 +2,12 @@ package types const ( EventTypeSetPermissionedRelayers = "update_channel_relayers" - AttributeKeyPortId = "port_id" - AttributeKeyChannelId = "channel_id" - AttributeKeyRelayers = "relayers" + EventTypeHaltChannel = "halt_channel" + EventTypeResumeChannel = "resume_channel" + + AttributeKeyPortId = "port_id" + AttributeKeyChannelId = "channel_id" + AttributeKeyRelayers = "relayers" + AttributeKeyHaltedBy = "halted_by" + AttributeKeyResumedBy = "resumed_by" ) diff --git a/x/ibc/perm/types/extended.go b/x/ibc/perm/types/extended.go index 580b234d..9fafb8ce 100644 --- a/x/ibc/perm/types/extended.go +++ b/x/ibc/perm/types/extended.go @@ -2,56 +2,24 @@ package types import ( "slices" - - "cosmossdk.io/errors" - - "cosmossdk.io/core/address" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func (rl *PermissionedRelayersList) HasRelayer(addrStr string) bool { - return slices.Contains(rl.Relayers, addrStr) -} -func (rl *PermissionedRelayersList) AddRelayer(addrStr string) { - rl.Relayers = append(rl.Relayers, addrStr) -} - -func (rl *PermissionedRelayersList) GetAccAddr(ac address.Codec) ([]sdk.AccAddress, error) { - - var relayerStrs []sdk.AccAddress - for _, relayer := range rl.Relayers { - - relayer, err := ac.StringToBytes(relayer) - if err != nil { - return nil, errors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - relayerStrs = append(relayerStrs, relayer) +func NewChannelState(portID, channelID string) ChannelState { + return ChannelState{ + ChannelId: channelID, + PortId: portID, + HaltState: HaltState{ + Halted: false, + HaltedBy: "", + }, + Relayers: []string{}, } - - return relayerStrs, nil } -func ToRelayerList(ac address.Codec, relayers []sdk.AccAddress) (PermissionedRelayersList, error) { - var relayerList PermissionedRelayersList - for _, relayer := range relayers { - relayerStr, error := ac.BytesToString(relayer) - if error != nil { - return relayerList, errors.Wrapf(sdkerrors.ErrInvalidAddress, "relayer address could not be converted to string : %v", error) - } - relayerList.AddRelayer(relayerStr) - } - return relayerList, nil +func (rl *ChannelState) HasRelayer(addrStr string) bool { + return slices.Contains(rl.Relayers, addrStr) } -func ToRelayerAccAddr(ac address.Codec, relayerStrs []string) ([]sdk.AccAddress, error) { - var relayerAccAddrs []sdk.AccAddress - for _, relayerStr := range relayerStrs { - relayer, err := ac.StringToBytes(relayerStr) - if err != nil { - return nil, errors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - relayerAccAddrs = append(relayerAccAddrs, relayer) - } - return relayerAccAddrs, nil +func (rl *ChannelState) AddRelayer(addrStr string) { + rl.Relayers = append(rl.Relayers, addrStr) } diff --git a/x/ibc/perm/types/genesis.go b/x/ibc/perm/types/genesis.go index 9c20550f..71944dbf 100644 --- a/x/ibc/perm/types/genesis.go +++ b/x/ibc/perm/types/genesis.go @@ -1,21 +1,56 @@ package types +import ( + "cosmossdk.io/core/address" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" +) + // NewGenesisState creates a new ibc perm GenesisState instance. -func NewGenesisState(permissionedRelayers []PermissionedRelayers) *GenesisState { +func NewGenesisState(channelStates []ChannelState) *GenesisState { return &GenesisState{ - PermissionedRelayers: permissionedRelayers, + ChannelStates: channelStates, } } // DefaultGenesisState returns a default empty GenesisState. func DefaultGenesisState() *GenesisState { return &GenesisState{ - PermissionedRelayers: []PermissionedRelayers{}, + ChannelStates: []ChannelState{}, } } // Validate performs basic genesis state validation returning an error upon any // failure. -func (gs GenesisState) Validate() error { +func (gs GenesisState) Validate(ac address.Codec) error { + for _, channelState := range gs.ChannelStates { + if err := channelState.Validate(ac); err != nil { + return err + } + } + + return nil +} + +func (cs ChannelState) Validate(ac address.Codec) error { + if err := host.ChannelIdentifierValidator(cs.ChannelId); err != nil { + return err + } + + if err := host.PortIdentifierValidator(cs.PortId); err != nil { + return err + } + + for _, relayer := range cs.Relayers { + if _, err := ac.StringToBytes(relayer); err != nil { + return err + } + } + + if cs.HaltState.Halted { + if !cs.HasRelayer(cs.HaltState.HaltedBy) { + return ErrInvalidHaltState.Wrap("halted by relayer not in relayers list") + } + } + return nil } diff --git a/x/ibc/perm/types/genesis.pb.go b/x/ibc/perm/types/genesis.pb.go index 1fd68429..9aa61642 100644 --- a/x/ibc/perm/types/genesis.pb.go +++ b/x/ibc/perm/types/genesis.pb.go @@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the ibc perm genesis state type GenesisState struct { - PermissionedRelayers []PermissionedRelayers `protobuf:"bytes,1,rep,name=permissioned_relayers,json=permissionedRelayers,proto3" json:"permissioned_relayers" yaml:"permissioned_relayers"` + ChannelStates []ChannelState `protobuf:"bytes,1,rep,name=channel_states,json=channelStates,proto3" json:"channel_states" yaml:"channel_states"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -61,9 +61,9 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetPermissionedRelayers() []PermissionedRelayers { +func (m *GenesisState) GetChannelStates() []ChannelState { if m != nil { - return m.PermissionedRelayers + return m.ChannelStates } return nil } @@ -77,23 +77,23 @@ func init() { } var fileDescriptor_9b6fe0c483250b7c = []byte{ - // 250 bytes of a gzipped FileDescriptorProto + // 241 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x4c, 0x4a, 0xd6, 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0x48, 0x2d, 0xca, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xc8, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa7, 0x07, 0x52, 0xa7, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0xa9, 0xe0, - 0x34, 0xb7, 0xa4, 0xb2, 0x20, 0x15, 0x6a, 0xaa, 0xd2, 0x2c, 0x46, 0x2e, 0x1e, 0x77, 0x88, 0x3d, - 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x9d, 0x8c, 0x5c, 0xa2, 0x20, 0x85, 0x99, 0xc5, 0xc5, 0x99, - 0xf9, 0x79, 0xa9, 0x29, 0xf1, 0x45, 0xa9, 0x39, 0x89, 0x95, 0xa9, 0x45, 0xc5, 0x12, 0x8c, 0x0a, - 0xcc, 0x1a, 0xdc, 0x46, 0x7a, 0x7a, 0xb8, 0xdc, 0xa1, 0x17, 0x80, 0xa4, 0x2d, 0x08, 0xaa, 0xcb, - 0x49, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x4f, 0xf7, 0xe4, 0x65, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, - 0xb0, 0x1a, 0xad, 0x14, 0x24, 0x52, 0x80, 0x4d, 0xaf, 0xc7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, - 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, - 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, - 0x67, 0xe6, 0x65, 0x96, 0x64, 0x26, 0xea, 0xe6, 0x24, 0x26, 0x15, 0x43, 0xd9, 0xfa, 0x15, 0xfa, - 0x20, 0xcf, 0x83, 0xfd, 0x0b, 0xf6, 0x6c, 0x12, 0x1b, 0xd8, 0xb7, 0xc6, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x47, 0xed, 0x68, 0x8b, 0x6d, 0x01, 0x00, 0x00, + 0x34, 0xb7, 0xa4, 0xb2, 0x20, 0x15, 0x6a, 0xaa, 0x52, 0x0d, 0x17, 0x8f, 0x3b, 0xc4, 0x9a, 0xe0, + 0x92, 0xc4, 0x92, 0x54, 0xa1, 0x1c, 0x2e, 0xbe, 0xe4, 0x8c, 0xc4, 0xbc, 0xbc, 0xd4, 0x9c, 0xf8, + 0x62, 0x90, 0x40, 0xb1, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x9a, 0x1e, 0x2e, 0xeb, 0xf5, + 0x9c, 0x21, 0xea, 0xc1, 0xfa, 0x9d, 0x64, 0x4f, 0xdc, 0x93, 0x67, 0xf8, 0x74, 0x4f, 0x5e, 0xb4, + 0x32, 0x31, 0x37, 0xc7, 0x4a, 0x09, 0xd5, 0x2c, 0xa5, 0x20, 0xde, 0x64, 0x24, 0xc5, 0xc5, 0x4e, + 0x1e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, + 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, + 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x99, 0x97, 0x59, 0x92, 0x99, 0xa8, 0x9b, 0x93, + 0x98, 0x54, 0x0c, 0x65, 0xeb, 0x57, 0xe8, 0x83, 0x7c, 0x07, 0xf6, 0x10, 0xd8, 0x37, 0x49, 0x6c, + 0x60, 0xef, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xac, 0x93, 0x4d, 0x7d, 0x4e, 0x01, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -116,10 +116,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.PermissionedRelayers) > 0 { - for iNdEx := len(m.PermissionedRelayers) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ChannelStates) > 0 { + for iNdEx := len(m.ChannelStates) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.PermissionedRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ChannelStates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -150,8 +150,8 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - if len(m.PermissionedRelayers) > 0 { - for _, e := range m.PermissionedRelayers { + if len(m.ChannelStates) > 0 { + for _, e := range m.ChannelStates { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -196,7 +196,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PermissionedRelayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelStates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -223,8 +223,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PermissionedRelayers = append(m.PermissionedRelayers, PermissionedRelayers{}) - if err := m.PermissionedRelayers[len(m.PermissionedRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ChannelStates = append(m.ChannelStates, ChannelState{}) + if err := m.ChannelStates[len(m.ChannelStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ibc/perm/types/key.go b/x/ibc/perm/types/key.go index 59bf31d9..45e74081 100644 --- a/x/ibc/perm/types/key.go +++ b/x/ibc/perm/types/key.go @@ -15,11 +15,11 @@ const ( ) var ( - // PermissionedRelayersPrefixKey defines the key to store the channel relayers in store - PermissionedRelayersPrefixKey = []byte{0x01} + // ChannelStatePrefix defines the key to store the channel state in store + ChannelStatePrefix = []byte{0x01} ) -// GetPermissionedRelayersKey return channel relayers key of the channel. -func GetPermissionedRelayersKey(channel string) []byte { - return append(PermissionedRelayersPrefixKey, []byte(channel)...) +// GetChannelStateKey return channel relayers key of the channel. +func GetChannelStateKey(channel string) []byte { + return append(ChannelStatePrefix, []byte(channel)...) } diff --git a/x/ibc/perm/types/query.pb.go b/x/ibc/perm/types/query.pb.go index b920e31a..97acd90a 100644 --- a/x/ibc/perm/types/query.pb.go +++ b/x/ibc/perm/types/query.pb.go @@ -30,29 +30,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryPermissionedRelayersOfOneChannelRequest is the request type for the Query/PermissionedRelayer RPC -// method -type QueryPermissionedRelayersByChannelRequest struct { - PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` +// QueryChannelStatesRequest is the request type for the Query/ChannelStates RPC method. +type QueryChannelStatesRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryPermissionedRelayersByChannelRequest) Reset() { - *m = QueryPermissionedRelayersByChannelRequest{} -} -func (m *QueryPermissionedRelayersByChannelRequest) String() string { - return proto.CompactTextString(m) -} -func (*QueryPermissionedRelayersByChannelRequest) ProtoMessage() {} -func (*QueryPermissionedRelayersByChannelRequest) Descriptor() ([]byte, []int) { +func (m *QueryChannelStatesRequest) Reset() { *m = QueryChannelStatesRequest{} } +func (m *QueryChannelStatesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryChannelStatesRequest) ProtoMessage() {} +func (*QueryChannelStatesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_835b754d3cf5eb3d, []int{0} } -func (m *QueryPermissionedRelayersByChannelRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryChannelStatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPermissionedRelayersByChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChannelStatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPermissionedRelayersByChannelRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChannelStatesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -62,55 +57,45 @@ func (m *QueryPermissionedRelayersByChannelRequest) XXX_Marshal(b []byte, determ return b[:n], nil } } -func (m *QueryPermissionedRelayersByChannelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPermissionedRelayersByChannelRequest.Merge(m, src) +func (m *QueryChannelStatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChannelStatesRequest.Merge(m, src) } -func (m *QueryPermissionedRelayersByChannelRequest) XXX_Size() int { +func (m *QueryChannelStatesRequest) XXX_Size() int { return m.Size() } -func (m *QueryPermissionedRelayersByChannelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPermissionedRelayersByChannelRequest.DiscardUnknown(m) +func (m *QueryChannelStatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChannelStatesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPermissionedRelayersByChannelRequest proto.InternalMessageInfo - -func (m *QueryPermissionedRelayersByChannelRequest) GetPortId() string { - if m != nil { - return m.PortId - } - return "" -} +var xxx_messageInfo_QueryChannelStatesRequest proto.InternalMessageInfo -func (m *QueryPermissionedRelayersByChannelRequest) GetChannelId() string { +func (m *QueryChannelStatesRequest) GetPagination() *query.PageRequest { if m != nil { - return m.ChannelId + return m.Pagination } - return "" + return nil } -// QueryPermissionedRelayerResponse is the response type for the Query/PermissionedRelayer RPC -// method. -type QueryPermissionedRelayersByChannelResponse struct { - // class_trace returns the requested class id trace information. - PermissionedRelayers *PermissionedRelayers `protobuf:"bytes,1,opt,name=permissioned_relayers,json=permissionedRelayers,proto3" json:"permissioned_relayers,omitempty"` +// QueryChannelStatesResponse is the response type for the Query/ChannelStates RPC method. +type QueryChannelStatesResponse struct { + // channel_states returns all stored ChannelState objects. + ChannelStates []ChannelState `protobuf:"bytes,1,rep,name=channel_states,json=channelStates,proto3" json:"channel_states"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryPermissionedRelayersByChannelResponse) Reset() { - *m = QueryPermissionedRelayersByChannelResponse{} -} -func (m *QueryPermissionedRelayersByChannelResponse) String() string { - return proto.CompactTextString(m) -} -func (*QueryPermissionedRelayersByChannelResponse) ProtoMessage() {} -func (*QueryPermissionedRelayersByChannelResponse) Descriptor() ([]byte, []int) { +func (m *QueryChannelStatesResponse) Reset() { *m = QueryChannelStatesResponse{} } +func (m *QueryChannelStatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryChannelStatesResponse) ProtoMessage() {} +func (*QueryChannelStatesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_835b754d3cf5eb3d, []int{1} } -func (m *QueryPermissionedRelayersByChannelResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryChannelStatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPermissionedRelayersByChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChannelStatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPermissionedRelayersByChannelResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChannelStatesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -120,44 +105,50 @@ func (m *QueryPermissionedRelayersByChannelResponse) XXX_Marshal(b []byte, deter return b[:n], nil } } -func (m *QueryPermissionedRelayersByChannelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPermissionedRelayersByChannelResponse.Merge(m, src) +func (m *QueryChannelStatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChannelStatesResponse.Merge(m, src) } -func (m *QueryPermissionedRelayersByChannelResponse) XXX_Size() int { +func (m *QueryChannelStatesResponse) XXX_Size() int { return m.Size() } -func (m *QueryPermissionedRelayersByChannelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPermissionedRelayersByChannelResponse.DiscardUnknown(m) +func (m *QueryChannelStatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChannelStatesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPermissionedRelayersByChannelResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryChannelStatesResponse proto.InternalMessageInfo -func (m *QueryPermissionedRelayersByChannelResponse) GetPermissionedRelayers() *PermissionedRelayers { +func (m *QueryChannelStatesResponse) GetChannelStates() []ChannelState { if m != nil { - return m.PermissionedRelayers + return m.ChannelStates } return nil } -// QueryAllPermissionedRelayersRequest is the request type for the Query/AllPermissionedRelayers RPC -// method -type QueryAllPermissionedRelayersRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +func (m *QueryChannelStatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryChannelStateRequest is the request type for the Query/ChannelState RPC method. +type QueryChannelStateRequest struct { + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` } -func (m *QueryAllPermissionedRelayersRequest) Reset() { *m = QueryAllPermissionedRelayersRequest{} } -func (m *QueryAllPermissionedRelayersRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllPermissionedRelayersRequest) ProtoMessage() {} -func (*QueryAllPermissionedRelayersRequest) Descriptor() ([]byte, []int) { +func (m *QueryChannelStateRequest) Reset() { *m = QueryChannelStateRequest{} } +func (m *QueryChannelStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryChannelStateRequest) ProtoMessage() {} +func (*QueryChannelStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_835b754d3cf5eb3d, []int{2} } -func (m *QueryAllPermissionedRelayersRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryChannelStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPermissionedRelayersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChannelStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPermissionedRelayersRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChannelStateRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -167,46 +158,50 @@ func (m *QueryAllPermissionedRelayersRequest) XXX_Marshal(b []byte, deterministi return b[:n], nil } } -func (m *QueryAllPermissionedRelayersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPermissionedRelayersRequest.Merge(m, src) +func (m *QueryChannelStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChannelStateRequest.Merge(m, src) } -func (m *QueryAllPermissionedRelayersRequest) XXX_Size() int { +func (m *QueryChannelStateRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllPermissionedRelayersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPermissionedRelayersRequest.DiscardUnknown(m) +func (m *QueryChannelStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChannelStateRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPermissionedRelayersRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryChannelStateRequest proto.InternalMessageInfo -func (m *QueryAllPermissionedRelayersRequest) GetPagination() *query.PageRequest { +func (m *QueryChannelStateRequest) GetChannelId() string { if m != nil { - return m.Pagination + return m.ChannelId } - return nil + return "" } -// QueryAllPermissionedRelayersResponse is the response type for the Query/AllPermissionedRelayers RPC -// method. -type QueryAllPermissionedRelayersResponse struct { - // class_trace returns the requested class id trace information. - PermissionedRelayers []PermissionedRelayers `protobuf:"bytes,1,rep,name=permissioned_relayers,json=permissionedRelayers,proto3" json:"permissioned_relayers"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +func (m *QueryChannelStateRequest) GetPortId() string { + if m != nil { + return m.PortId + } + return "" +} + +// QueryChannelStateResponse is the response type for the Query/ChannelState RPC method. +type QueryChannelStateResponse struct { + // channel_state returns the stored ChannelState object. + ChannelState ChannelState `protobuf:"bytes,1,opt,name=channel_state,json=channelState,proto3" json:"channel_state"` } -func (m *QueryAllPermissionedRelayersResponse) Reset() { *m = QueryAllPermissionedRelayersResponse{} } -func (m *QueryAllPermissionedRelayersResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllPermissionedRelayersResponse) ProtoMessage() {} -func (*QueryAllPermissionedRelayersResponse) Descriptor() ([]byte, []int) { +func (m *QueryChannelStateResponse) Reset() { *m = QueryChannelStateResponse{} } +func (m *QueryChannelStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryChannelStateResponse) ProtoMessage() {} +func (*QueryChannelStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_835b754d3cf5eb3d, []int{3} } -func (m *QueryAllPermissionedRelayersResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryChannelStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPermissionedRelayersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChannelStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPermissionedRelayersResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChannelStateResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -216,37 +211,30 @@ func (m *QueryAllPermissionedRelayersResponse) XXX_Marshal(b []byte, determinist return b[:n], nil } } -func (m *QueryAllPermissionedRelayersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPermissionedRelayersResponse.Merge(m, src) +func (m *QueryChannelStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChannelStateResponse.Merge(m, src) } -func (m *QueryAllPermissionedRelayersResponse) XXX_Size() int { +func (m *QueryChannelStateResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllPermissionedRelayersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPermissionedRelayersResponse.DiscardUnknown(m) +func (m *QueryChannelStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChannelStateResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPermissionedRelayersResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryChannelStateResponse proto.InternalMessageInfo -func (m *QueryAllPermissionedRelayersResponse) GetPermissionedRelayers() []PermissionedRelayers { +func (m *QueryChannelStateResponse) GetChannelState() ChannelState { if m != nil { - return m.PermissionedRelayers + return m.ChannelState } - return nil -} - -func (m *QueryAllPermissionedRelayersResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil + return ChannelState{} } func init() { - proto.RegisterType((*QueryPermissionedRelayersByChannelRequest)(nil), "ibc.applications.perm.v1.QueryPermissionedRelayersByChannelRequest") - proto.RegisterType((*QueryPermissionedRelayersByChannelResponse)(nil), "ibc.applications.perm.v1.QueryPermissionedRelayersByChannelResponse") - proto.RegisterType((*QueryAllPermissionedRelayersRequest)(nil), "ibc.applications.perm.v1.QueryAllPermissionedRelayersRequest") - proto.RegisterType((*QueryAllPermissionedRelayersResponse)(nil), "ibc.applications.perm.v1.QueryAllPermissionedRelayersResponse") + proto.RegisterType((*QueryChannelStatesRequest)(nil), "ibc.applications.perm.v1.QueryChannelStatesRequest") + proto.RegisterType((*QueryChannelStatesResponse)(nil), "ibc.applications.perm.v1.QueryChannelStatesResponse") + proto.RegisterType((*QueryChannelStateRequest)(nil), "ibc.applications.perm.v1.QueryChannelStateRequest") + proto.RegisterType((*QueryChannelStateResponse)(nil), "ibc.applications.perm.v1.QueryChannelStateResponse") } func init() { @@ -254,39 +242,38 @@ func init() { } var fileDescriptor_835b754d3cf5eb3d = []byte{ - // 502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x4d, 0x6e, 0xd4, 0x30, - 0x14, 0xc7, 0xc7, 0x53, 0x28, 0xaa, 0xd9, 0x59, 0x45, 0xad, 0xa2, 0x36, 0xa0, 0x50, 0xf1, 0x51, - 0x09, 0x5b, 0x69, 0x57, 0x2c, 0x40, 0x62, 0x8a, 0x80, 0xee, 0x4a, 0x96, 0x6c, 0x2a, 0xc7, 0x63, - 0xa5, 0x96, 0x12, 0xdb, 0x8d, 0x3d, 0x23, 0x46, 0x55, 0x37, 0x9c, 0x00, 0xc4, 0x3d, 0x38, 0x01, - 0x07, 0xe8, 0xb2, 0x12, 0x1b, 0xc4, 0x02, 0xa1, 0x19, 0xb8, 0x07, 0x8a, 0xe3, 0x6a, 0x82, 0x94, - 0x4c, 0x0b, 0xec, 0x12, 0xbf, 0xff, 0xfb, 0xf8, 0xbd, 0xf7, 0x6c, 0xb8, 0x25, 0x52, 0x46, 0xa8, - 0xd6, 0xb9, 0x60, 0xd4, 0x0a, 0x25, 0x0d, 0xd1, 0xbc, 0x2c, 0xc8, 0x38, 0x26, 0xc7, 0x23, 0x5e, - 0x4e, 0xb0, 0x2e, 0x95, 0x55, 0x68, 0x5d, 0xa4, 0x0c, 0x37, 0x55, 0xb8, 0x52, 0xe1, 0x71, 0x1c, - 0xac, 0x66, 0x2a, 0x53, 0x4e, 0x44, 0xaa, 0xaf, 0x5a, 0x1f, 0x6c, 0x64, 0x4a, 0x65, 0x39, 0x27, - 0x54, 0x0b, 0x42, 0xa5, 0x54, 0xf6, 0xc2, 0xcb, 0x59, 0xb7, 0x99, 0x32, 0x85, 0x32, 0x24, 0xa5, - 0x86, 0xd7, 0x69, 0xc8, 0x38, 0x4e, 0xb9, 0xa5, 0x31, 0xd1, 0x34, 0x13, 0xd2, 0x89, 0xbd, 0xb6, - 0xbb, 0x3e, 0x3b, 0xd1, 0xdc, 0x47, 0x8c, 0x18, 0x7c, 0xf8, 0xba, 0x8a, 0x73, 0xc0, 0xcb, 0x42, - 0x18, 0x23, 0x94, 0xe4, 0xc3, 0x84, 0xe7, 0x74, 0xc2, 0x4b, 0x33, 0x98, 0xec, 0x1d, 0x51, 0x29, - 0x79, 0x9e, 0xf0, 0xe3, 0x11, 0x37, 0x16, 0xad, 0xc1, 0x1b, 0x5a, 0x95, 0xf6, 0x50, 0x0c, 0xd7, - 0xc1, 0x1d, 0xf0, 0x60, 0x25, 0x59, 0xae, 0x7e, 0xf7, 0x87, 0x68, 0x13, 0x42, 0x56, 0x4b, 0x2b, - 0x5b, 0xdf, 0xd9, 0x56, 0xfc, 0xc9, 0xfe, 0x30, 0xfa, 0x00, 0xe0, 0xf6, 0x55, 0xb2, 0x18, 0xad, - 0xa4, 0xe1, 0x88, 0xc1, 0x5b, 0xba, 0x21, 0x3c, 0x2c, 0xbd, 0xd2, 0x25, 0xbd, 0xb9, 0x83, 0x71, - 0x57, 0x4f, 0x71, 0x5b, 0xfc, 0x64, 0x55, 0xb7, 0x9c, 0x46, 0x05, 0xbc, 0xeb, 0x4a, 0x7a, 0x96, - 0xe7, 0xad, 0x5e, 0x1e, 0xf9, 0x05, 0x84, 0xf3, 0xce, 0xfa, 0x02, 0xee, 0xe1, 0x7a, 0x0c, 0xb8, - 0x1a, 0x03, 0xae, 0xa7, 0xed, 0xc7, 0x80, 0x0f, 0x68, 0xc6, 0xbd, 0x6f, 0xd2, 0xf0, 0x8c, 0xbe, - 0x01, 0xb8, 0xb5, 0x38, 0x9f, 0x87, 0x17, 0xdd, 0xf0, 0x4b, 0x7f, 0x0f, 0x3f, 0xb8, 0x76, 0xf6, - 0xfd, 0x76, 0xaf, 0xbd, 0x05, 0xe8, 0xe5, 0x1f, 0x6c, 0x7d, 0xc7, 0x76, 0xff, 0x52, 0xb6, 0xba, - 0xce, 0x26, 0xdc, 0xce, 0xa7, 0x25, 0x78, 0xdd, 0xc1, 0xa1, 0x5f, 0x00, 0x6e, 0x2e, 0x1c, 0x32, - 0xda, 0xeb, 0x06, 0xb8, 0xf2, 0x22, 0x06, 0xcf, 0xff, 0x2f, 0x48, 0x8d, 0x10, 0x3d, 0x7e, 0xf7, - 0xe5, 0xe7, 0xc7, 0xfe, 0x2e, 0x8a, 0x89, 0xbf, 0x2a, 0xf3, 0x2b, 0x72, 0xd1, 0x75, 0x72, 0xe2, - 0x17, 0xfe, 0x94, 0x9c, 0xcc, 0x37, 0xfc, 0x14, 0x7d, 0x06, 0x70, 0xad, 0x63, 0x92, 0xe8, 0xc9, - 0x25, 0xc5, 0x2d, 0xde, 0xb8, 0xe0, 0xe9, 0xbf, 0xba, 0x7b, 0xaa, 0xc8, 0x51, 0x6d, 0xa0, 0xa0, - 0x9b, 0x6a, 0xf0, 0xea, 0x6c, 0x1a, 0x82, 0xf3, 0x69, 0x08, 0x7e, 0x4c, 0x43, 0xf0, 0x7e, 0x16, - 0xf6, 0xce, 0x67, 0x61, 0xef, 0xeb, 0x2c, 0xec, 0xbd, 0xc1, 0x99, 0xb0, 0x47, 0xa3, 0x14, 0x33, - 0x55, 0x10, 0x21, 0x85, 0x15, 0xf4, 0x51, 0x4e, 0x53, 0xe3, 0xbf, 0xc9, 0x5b, 0x17, 0xd4, 0xc5, - 0x73, 0xaf, 0x48, 0xba, 0xec, 0x9e, 0x91, 0xdd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x0e, - 0x6b, 0x78, 0x0e, 0x05, 0x00, 0x00, + // 483 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6a, 0x14, 0x31, + 0x1c, 0xc7, 0x37, 0xab, 0x56, 0x1a, 0xbb, 0x1e, 0x82, 0xe0, 0xba, 0xe8, 0xb8, 0x0c, 0xa2, 0x45, + 0x30, 0x61, 0x77, 0x05, 0xf1, 0x24, 0x54, 0x50, 0x7b, 0xb3, 0xd3, 0x9b, 0x17, 0xc9, 0x64, 0xc3, + 0x34, 0x30, 0x9b, 0xa4, 0x93, 0xec, 0x62, 0x29, 0xbd, 0xf8, 0x04, 0x82, 0xaf, 0xe0, 0x43, 0x88, + 0x4f, 0xd0, 0x63, 0xc1, 0x8b, 0x27, 0x91, 0x5d, 0x2f, 0xbe, 0x85, 0x4c, 0x26, 0xd3, 0x9d, 0xa1, + 0x1d, 0xca, 0xdc, 0x32, 0xf3, 0xfb, 0xf3, 0xfd, 0xe4, 0xfb, 0xfb, 0x05, 0x3e, 0x12, 0x31, 0x23, + 0x54, 0xeb, 0x54, 0x30, 0x6a, 0x85, 0x92, 0x86, 0x68, 0x9e, 0xcd, 0xc8, 0x62, 0x44, 0x0e, 0xe7, + 0x3c, 0x3b, 0xc2, 0x3a, 0x53, 0x56, 0xa1, 0xbe, 0x88, 0x19, 0xae, 0x66, 0xe1, 0x3c, 0x0b, 0x2f, + 0x46, 0x83, 0xa7, 0x4c, 0x99, 0x99, 0x32, 0x24, 0xa6, 0x86, 0x17, 0x25, 0x64, 0x31, 0x8a, 0xb9, + 0xa5, 0x23, 0xa2, 0x69, 0x22, 0xa4, 0x4b, 0x2f, 0xba, 0x0c, 0xee, 0x24, 0x2a, 0x51, 0xee, 0x48, + 0xf2, 0x93, 0xff, 0x7b, 0x3f, 0x51, 0x2a, 0x49, 0x39, 0xa1, 0x5a, 0x10, 0x2a, 0xa5, 0xb2, 0xa5, + 0x82, 0x8b, 0x36, 0xf3, 0xd9, 0x23, 0xcd, 0x7d, 0x56, 0xc8, 0xe0, 0xbd, 0xbd, 0x5c, 0xfb, 0xf5, + 0x01, 0x95, 0x92, 0xa7, 0xfb, 0x96, 0x5a, 0x6e, 0x22, 0x7e, 0x38, 0xe7, 0xc6, 0xa2, 0x37, 0x10, + 0xae, 0x51, 0xfa, 0x60, 0x08, 0xb6, 0x6f, 0x8d, 0x1f, 0xe3, 0x82, 0x1b, 0xe7, 0xdc, 0xb8, 0xb8, + 0xaa, 0xe7, 0xc6, 0xef, 0x69, 0xc2, 0x7d, 0x6d, 0x54, 0xa9, 0x0c, 0x7f, 0x00, 0x38, 0xb8, 0x4c, + 0xc5, 0x68, 0x25, 0x0d, 0x47, 0xfb, 0xf0, 0x36, 0x2b, 0x02, 0x1f, 0x8d, 0x8b, 0xf4, 0xc1, 0xf0, + 0x9a, 0x93, 0x6a, 0x32, 0x0f, 0x57, 0x1b, 0xed, 0x5c, 0x3f, 0xfd, 0xfd, 0xb0, 0x13, 0xf5, 0x58, + 0xb5, 0x39, 0x7a, 0x5b, 0x63, 0xef, 0x3a, 0xf6, 0x27, 0x57, 0xb2, 0x17, 0x44, 0x35, 0xf8, 0x08, + 0xf6, 0x2f, 0xb0, 0x97, 0x06, 0x3d, 0x80, 0xb0, 0x24, 0x17, 0x53, 0x67, 0xd0, 0x66, 0xb4, 0xe9, + 0xff, 0xec, 0x4e, 0xd1, 0x5d, 0x78, 0x53, 0xab, 0xcc, 0xe6, 0xb1, 0xae, 0x8b, 0x6d, 0xe4, 0x9f, + 0xbb, 0xd3, 0x50, 0x5e, 0xe2, 0xfa, 0xb9, 0x1d, 0x7b, 0xb0, 0x57, 0xb3, 0xe3, 0xdc, 0xf8, 0x36, + 0x6e, 0x6c, 0x55, 0xdd, 0x18, 0xff, 0xeb, 0xc2, 0x1b, 0x4e, 0x10, 0x7d, 0x03, 0xb0, 0x57, 0x9b, + 0x02, 0x9a, 0x34, 0xf7, 0x6d, 0xdc, 0x8c, 0xc1, 0xf3, 0x76, 0x45, 0xc5, 0xcd, 0xc2, 0xed, 0xcf, + 0x3f, 0xff, 0x7e, 0xed, 0x86, 0x68, 0x48, 0xfc, 0x6e, 0xae, 0x77, 0xb2, 0xbe, 0x00, 0xe8, 0x3b, + 0x80, 0x5b, 0xd5, 0x1e, 0x68, 0xdc, 0x42, 0xb0, 0x84, 0x9c, 0xb4, 0xaa, 0xf1, 0x8c, 0xaf, 0x1c, + 0xe3, 0x4b, 0xf4, 0xe2, 0x2a, 0x46, 0x72, 0xbc, 0x1e, 0xfd, 0x09, 0x39, 0xf6, 0x83, 0x3e, 0xd9, + 0x79, 0x77, 0xba, 0x0c, 0xc0, 0xd9, 0x32, 0x00, 0x7f, 0x96, 0x01, 0xf8, 0xb2, 0x0a, 0x3a, 0x67, + 0xab, 0xa0, 0xf3, 0x6b, 0x15, 0x74, 0x3e, 0xe0, 0x44, 0xd8, 0x83, 0x79, 0x8c, 0x99, 0x9a, 0x11, + 0x21, 0x85, 0x15, 0xf4, 0x59, 0x4a, 0x63, 0xe3, 0xcf, 0xe4, 0x93, 0x53, 0x74, 0x62, 0xee, 0x85, + 0xc6, 0x1b, 0xee, 0x89, 0x4e, 0xfe, 0x07, 0x00, 0x00, 0xff, 0xff, 0xba, 0xf7, 0x96, 0xad, 0x6a, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -301,10 +288,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // PermissionedRelayersByChannel queries a set of permissioned ibc relayers for the specific channel. - PermissionedRelayersByChannel(ctx context.Context, in *QueryPermissionedRelayersByChannelRequest, opts ...grpc.CallOption) (*QueryPermissionedRelayersByChannelResponse, error) - // AllPermissionedRelayers queries all sets of permissioned relayers for all channels. - AllPermissionedRelayers(ctx context.Context, in *QueryAllPermissionedRelayersRequest, opts ...grpc.CallOption) (*QueryAllPermissionedRelayersResponse, error) + // ChannelStates queries all channel states. + ChannelStates(ctx context.Context, in *QueryChannelStatesRequest, opts ...grpc.CallOption) (*QueryChannelStatesResponse, error) + // ChannelState queries the channel state for the specific port-id:channel-id pair. + ChannelState(ctx context.Context, in *QueryChannelStateRequest, opts ...grpc.CallOption) (*QueryChannelStateResponse, error) } type queryClient struct { @@ -315,18 +302,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) PermissionedRelayersByChannel(ctx context.Context, in *QueryPermissionedRelayersByChannelRequest, opts ...grpc.CallOption) (*QueryPermissionedRelayersByChannelResponse, error) { - out := new(QueryPermissionedRelayersByChannelResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Query/PermissionedRelayersByChannel", in, out, opts...) +func (c *queryClient) ChannelStates(ctx context.Context, in *QueryChannelStatesRequest, opts ...grpc.CallOption) (*QueryChannelStatesResponse, error) { + out := new(QueryChannelStatesResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Query/ChannelStates", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) AllPermissionedRelayers(ctx context.Context, in *QueryAllPermissionedRelayersRequest, opts ...grpc.CallOption) (*QueryAllPermissionedRelayersResponse, error) { - out := new(QueryAllPermissionedRelayersResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Query/AllPermissionedRelayers", in, out, opts...) +func (c *queryClient) ChannelState(ctx context.Context, in *QueryChannelStateRequest, opts ...grpc.CallOption) (*QueryChannelStateResponse, error) { + out := new(QueryChannelStateResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Query/ChannelState", in, out, opts...) if err != nil { return nil, err } @@ -335,59 +322,59 @@ func (c *queryClient) AllPermissionedRelayers(ctx context.Context, in *QueryAllP // QueryServer is the server API for Query service. type QueryServer interface { - // PermissionedRelayersByChannel queries a set of permissioned ibc relayers for the specific channel. - PermissionedRelayersByChannel(context.Context, *QueryPermissionedRelayersByChannelRequest) (*QueryPermissionedRelayersByChannelResponse, error) - // AllPermissionedRelayers queries all sets of permissioned relayers for all channels. - AllPermissionedRelayers(context.Context, *QueryAllPermissionedRelayersRequest) (*QueryAllPermissionedRelayersResponse, error) + // ChannelStates queries all channel states. + ChannelStates(context.Context, *QueryChannelStatesRequest) (*QueryChannelStatesResponse, error) + // ChannelState queries the channel state for the specific port-id:channel-id pair. + ChannelState(context.Context, *QueryChannelStateRequest) (*QueryChannelStateResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) PermissionedRelayersByChannel(ctx context.Context, req *QueryPermissionedRelayersByChannelRequest) (*QueryPermissionedRelayersByChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PermissionedRelayersByChannel not implemented") +func (*UnimplementedQueryServer) ChannelStates(ctx context.Context, req *QueryChannelStatesRequest) (*QueryChannelStatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChannelStates not implemented") } -func (*UnimplementedQueryServer) AllPermissionedRelayers(ctx context.Context, req *QueryAllPermissionedRelayersRequest) (*QueryAllPermissionedRelayersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllPermissionedRelayers not implemented") +func (*UnimplementedQueryServer) ChannelState(ctx context.Context, req *QueryChannelStateRequest) (*QueryChannelStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChannelState not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_PermissionedRelayersByChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPermissionedRelayersByChannelRequest) +func _Query_ChannelStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryChannelStatesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).PermissionedRelayersByChannel(ctx, in) + return srv.(QueryServer).ChannelStates(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.perm.v1.Query/PermissionedRelayersByChannel", + FullMethod: "/ibc.applications.perm.v1.Query/ChannelStates", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PermissionedRelayersByChannel(ctx, req.(*QueryPermissionedRelayersByChannelRequest)) + return srv.(QueryServer).ChannelStates(ctx, req.(*QueryChannelStatesRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_AllPermissionedRelayers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllPermissionedRelayersRequest) +func _Query_ChannelState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryChannelStateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).AllPermissionedRelayers(ctx, in) + return srv.(QueryServer).ChannelState(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.perm.v1.Query/AllPermissionedRelayers", + FullMethod: "/ibc.applications.perm.v1.Query/ChannelState", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllPermissionedRelayers(ctx, req.(*QueryAllPermissionedRelayersRequest)) + return srv.(QueryServer).ChannelState(ctx, req.(*QueryChannelStateRequest)) } return interceptor(ctx, in, info, handler) } @@ -397,19 +384,19 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "PermissionedRelayersByChannel", - Handler: _Query_PermissionedRelayersByChannel_Handler, + MethodName: "ChannelStates", + Handler: _Query_ChannelStates_Handler, }, { - MethodName: "AllPermissionedRelayers", - Handler: _Query_AllPermissionedRelayers_Handler, + MethodName: "ChannelState", + Handler: _Query_ChannelState_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/perm/v1/query.proto", } -func (m *QueryPermissionedRelayersByChannelRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryChannelStatesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -419,34 +406,32 @@ func (m *QueryPermissionedRelayersByChannelRequest) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *QueryPermissionedRelayersByChannelRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChannelStatesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPermissionedRelayersByChannelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChannelStatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0x12 - } - if len(m.PortId) > 0 { - i -= len(m.PortId) - copy(dAtA[i:], m.PortId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.PortId))) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPermissionedRelayersByChannelResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryChannelStatesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -456,19 +441,19 @@ func (m *QueryPermissionedRelayersByChannelResponse) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *QueryPermissionedRelayersByChannelResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChannelStatesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPermissionedRelayersByChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChannelStatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.PermissionedRelayers != nil { + if m.Pagination != nil { { - size, err := m.PermissionedRelayers.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -476,12 +461,26 @@ func (m *QueryPermissionedRelayersByChannelResponse) MarshalToSizedBuffer(dAtA [ i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if len(m.ChannelStates) > 0 { + for iNdEx := len(m.ChannelStates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChannelStates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *QueryAllPermissionedRelayersRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryChannelStateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -491,32 +490,34 @@ func (m *QueryAllPermissionedRelayersRequest) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryAllPermissionedRelayersRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChannelStateRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPermissionedRelayersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChannelStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryAllPermissionedRelayersResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryChannelStateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -526,42 +527,26 @@ func (m *QueryAllPermissionedRelayersResponse) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *QueryAllPermissionedRelayersResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChannelStateResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPermissionedRelayersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChannelStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.PermissionedRelayers) > 0 { - for iNdEx := len(m.PermissionedRelayers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PermissionedRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + { + size, err := m.ChannelState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -576,65 +561,63 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryPermissionedRelayersByChannelRequest) Size() (n int) { +func (m *QueryChannelStatesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.PortId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ChannelId) - if l > 0 { + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryPermissionedRelayersByChannelResponse) Size() (n int) { +func (m *QueryChannelStatesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.PermissionedRelayers != nil { - l = m.PermissionedRelayers.Size() + if len(m.ChannelStates) > 0 { + for _, e := range m.ChannelStates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryAllPermissionedRelayersRequest) Size() (n int) { +func (m *QueryChannelStateRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.PortId) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryAllPermissionedRelayersResponse) Size() (n int) { +func (m *QueryChannelStateResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.PermissionedRelayers) > 0 { - for _, e := range m.PermissionedRelayers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } + l = m.ChannelState.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -644,7 +627,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryPermissionedRelayersByChannelRequest) Unmarshal(dAtA []byte) error { +func (m *QueryChannelStatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -667,17 +650,17 @@ func (m *QueryPermissionedRelayersByChannelRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPermissionedRelayersByChannelRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChannelStatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPermissionedRelayersByChannelRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChannelStatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -687,55 +670,27 @@ func (m *QueryPermissionedRelayersByChannelRequest) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.PortId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -758,7 +713,7 @@ func (m *QueryPermissionedRelayersByChannelRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryPermissionedRelayersByChannelResponse) Unmarshal(dAtA []byte) error { +func (m *QueryChannelStatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -781,15 +736,15 @@ func (m *QueryPermissionedRelayersByChannelResponse) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPermissionedRelayersByChannelResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChannelStatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPermissionedRelayersByChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChannelStatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PermissionedRelayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelStates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -816,10 +771,44 @@ func (m *QueryPermissionedRelayersByChannelResponse) Unmarshal(dAtA []byte) erro if postIndex > l { return io.ErrUnexpectedEOF } - if m.PermissionedRelayers == nil { - m.PermissionedRelayers = &PermissionedRelayers{} + m.ChannelStates = append(m.ChannelStates, ChannelState{}) + if err := m.ChannelStates[len(m.ChannelStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - if err := m.PermissionedRelayers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -844,7 +833,7 @@ func (m *QueryPermissionedRelayersByChannelResponse) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryAllPermissionedRelayersRequest) Unmarshal(dAtA []byte) error { +func (m *QueryChannelStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -867,17 +856,17 @@ func (m *QueryAllPermissionedRelayersRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPermissionedRelayersRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChannelStateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPermissionedRelayersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChannelStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -887,27 +876,55 @@ func (m *QueryAllPermissionedRelayersRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.PortId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -930,7 +947,7 @@ func (m *QueryAllPermissionedRelayersRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { +func (m *QueryChannelStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -953,15 +970,15 @@ func (m *QueryAllPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPermissionedRelayersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChannelStateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPermissionedRelayersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChannelStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PermissionedRelayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelState", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -988,44 +1005,7 @@ func (m *QueryAllPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PermissionedRelayers = append(m.PermissionedRelayers, PermissionedRelayers{}) - if err := m.PermissionedRelayers[len(m.PermissionedRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ChannelState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ibc/perm/types/query.pb.gw.go b/x/ibc/perm/types/query.pb.gw.go index 5a434dce..dba5eb51 100644 --- a/x/ibc/perm/types/query.pb.gw.go +++ b/x/ibc/perm/types/query.pb.gw.go @@ -33,8 +33,44 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_PermissionedRelayersByChannel_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPermissionedRelayersByChannelRequest +var ( + filter_Query_ChannelStates_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ChannelStates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChannelStatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChannelStates_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ChannelStates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ChannelStates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChannelStatesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChannelStates_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ChannelStates(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ChannelState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChannelStateRequest var metadata runtime.ServerMetadata var ( @@ -44,35 +80,35 @@ func request_Query_PermissionedRelayersByChannel_0(ctx context.Context, marshale _ = err ) - val, ok = pathParams["port_id"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.PortId, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.PortId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } - msg, err := client.PermissionedRelayersByChannel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ChannelState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_PermissionedRelayersByChannel_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPermissionedRelayersByChannelRequest +func local_request_Query_ChannelState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChannelStateRequest var metadata runtime.ServerMetadata var ( @@ -82,17 +118,6 @@ func local_request_Query_PermissionedRelayersByChannel_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["port_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") - } - - protoReq.PortId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) - } - val, ok = pathParams["channel_id"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") @@ -104,43 +129,18 @@ func local_request_Query_PermissionedRelayersByChannel_0(ctx context.Context, ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - msg, err := server.PermissionedRelayersByChannel(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_AllPermissionedRelayers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_AllPermissionedRelayers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPermissionedRelayersRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllPermissionedRelayers_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + val, ok = pathParams["port_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - msg, err := client.AllPermissionedRelayers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AllPermissionedRelayers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPermissionedRelayersRequest - var metadata runtime.ServerMetadata + protoReq.PortId, err = runtime.String(val) - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllPermissionedRelayers_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } - msg, err := server.AllPermissionedRelayers(ctx, &protoReq) + msg, err := server.ChannelState(ctx, &protoReq) return msg, metadata, err } @@ -151,7 +151,7 @@ func local_request_Query_AllPermissionedRelayers_0(ctx context.Context, marshale // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_PermissionedRelayersByChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChannelStates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -162,7 +162,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PermissionedRelayersByChannel_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ChannelStates_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -170,11 +170,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PermissionedRelayersByChannel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChannelStates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AllPermissionedRelayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChannelState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -185,7 +185,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AllPermissionedRelayers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ChannelState_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -193,7 +193,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AllPermissionedRelayers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChannelState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -238,7 +238,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_PermissionedRelayersByChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChannelStates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -247,18 +247,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PermissionedRelayersByChannel_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ChannelStates_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_PermissionedRelayersByChannel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChannelStates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AllPermissionedRelayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChannelState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -267,14 +267,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_AllPermissionedRelayers_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ChannelState_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_AllPermissionedRelayers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChannelState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -282,13 +282,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_PermissionedRelayersByChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"ibc", "apps", "perm", "v1", "relayers", "port_id", "channel_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ChannelStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "perm", "v1", "channel_states"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_AllPermissionedRelayers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "perm", "v1", "relayers"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ChannelState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6}, []string{"ibc", "apps", "perm", "v1", "channel_states", "channel_id", "port_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_PermissionedRelayersByChannel_0 = runtime.ForwardResponseMessage + forward_Query_ChannelStates_0 = runtime.ForwardResponseMessage - forward_Query_AllPermissionedRelayers_0 = runtime.ForwardResponseMessage + forward_Query_ChannelState_0 = runtime.ForwardResponseMessage ) diff --git a/x/ibc/perm/types/tx.go b/x/ibc/perm/types/tx.go index ebbbf43a..27deb156 100644 --- a/x/ibc/perm/types/tx.go +++ b/x/ibc/perm/types/tx.go @@ -20,22 +20,19 @@ func NewMsgSetPermissionedRelayers( ) *MsgSetPermissionedRelayers { return &MsgSetPermissionedRelayers{ Authority: authority, - PortId: portID, ChannelId: channelID, + PortId: portID, Relayers: relayers, } } // ValidateBasic performs a basic check of the MsgSetPermissionedRelayer fields. -// NOTE: timeout height or timestamp values can be 0 to disable the timeout. -// NOTE: The recipient addresses format is not validated as the format defined by -// the chain is not known to IBC. func (msg MsgSetPermissionedRelayers) Validate(ac address.Codec) error { - if err := host.PortIdentifierValidator(msg.PortId); err != nil { + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { return err } - if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + if err := host.PortIdentifierValidator(msg.PortId); err != nil { return err } @@ -53,3 +50,59 @@ func (msg MsgSetPermissionedRelayers) Validate(ac address.Codec) error { return nil } + +func NewMsgHaltChannel( + authority, portID, channelID string, +) *MsgHaltChannel { + return &MsgHaltChannel{ + Authority: authority, + ChannelId: channelID, + PortId: portID, + } +} + +// ValidateBasic performs a basic check of the MsgHaltChannel fields. +func (msg MsgHaltChannel) Validate(ac address.Codec) error { + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + return err + } + + if err := host.PortIdentifierValidator(msg.PortId); err != nil { + return err + } + + _, err := ac.StringToBytes(msg.Authority) + if err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + + return nil +} + +func NewMsgResumeChannel( + authority, portID, channelID string, +) *MsgResumeChannel { + return &MsgResumeChannel{ + Authority: authority, + ChannelId: channelID, + PortId: portID, + } +} + +// ValidateBasic performs a basic check of the MsgResumeChannel fields. +func (msg MsgResumeChannel) Validate(ac address.Codec) error { + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + return err + } + + if err := host.PortIdentifierValidator(msg.PortId); err != nil { + return err + } + + _, err := ac.StringToBytes(msg.Authority) + if err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + + return nil +} diff --git a/x/ibc/perm/types/tx.pb.go b/x/ibc/perm/types/tx.pb.go index a0498ff5..8a07b1d3 100644 --- a/x/ibc/perm/types/tx.pb.go +++ b/x/ibc/perm/types/tx.pb.go @@ -37,8 +37,8 @@ type MsgSetPermissionedRelayers struct { // authority is the address that controls the module // (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` - PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` - ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` Relayers []string `protobuf:"bytes,4,rep,name=relayers,proto3" json:"relayers,omitempty" yaml:"relayers"` } @@ -112,44 +112,212 @@ func (m *MsgSetPermissionedRelayersResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetPermissionedRelayersResponse proto.InternalMessageInfo +// MsgHaltChannel defines msg to halt the specific ibc channel. +type MsgHaltChannel struct { + // authority is the address that controls the module + // (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` +} + +func (m *MsgHaltChannel) Reset() { *m = MsgHaltChannel{} } +func (m *MsgHaltChannel) String() string { return proto.CompactTextString(m) } +func (*MsgHaltChannel) ProtoMessage() {} +func (*MsgHaltChannel) Descriptor() ([]byte, []int) { + return fileDescriptor_9ea92a5af9136e08, []int{2} +} +func (m *MsgHaltChannel) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHaltChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHaltChannel.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHaltChannel) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHaltChannel.Merge(m, src) +} +func (m *MsgHaltChannel) XXX_Size() int { + return m.Size() +} +func (m *MsgHaltChannel) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHaltChannel.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHaltChannel proto.InternalMessageInfo + +// MsgHaltChannelResponse defines the Msg/HaltChannel response type. +type MsgHaltChannelResponse struct { +} + +func (m *MsgHaltChannelResponse) Reset() { *m = MsgHaltChannelResponse{} } +func (m *MsgHaltChannelResponse) String() string { return proto.CompactTextString(m) } +func (*MsgHaltChannelResponse) ProtoMessage() {} +func (*MsgHaltChannelResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ea92a5af9136e08, []int{3} +} +func (m *MsgHaltChannelResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHaltChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHaltChannelResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHaltChannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHaltChannelResponse.Merge(m, src) +} +func (m *MsgHaltChannelResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgHaltChannelResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHaltChannelResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHaltChannelResponse proto.InternalMessageInfo + +// MsgResumeChannel defines msg to resume the specific ibc channel. +type MsgResumeChannel struct { + // authority is the address that controls the module + // (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` +} + +func (m *MsgResumeChannel) Reset() { *m = MsgResumeChannel{} } +func (m *MsgResumeChannel) String() string { return proto.CompactTextString(m) } +func (*MsgResumeChannel) ProtoMessage() {} +func (*MsgResumeChannel) Descriptor() ([]byte, []int) { + return fileDescriptor_9ea92a5af9136e08, []int{4} +} +func (m *MsgResumeChannel) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgResumeChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgResumeChannel.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgResumeChannel) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgResumeChannel.Merge(m, src) +} +func (m *MsgResumeChannel) XXX_Size() int { + return m.Size() +} +func (m *MsgResumeChannel) XXX_DiscardUnknown() { + xxx_messageInfo_MsgResumeChannel.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgResumeChannel proto.InternalMessageInfo + +// MsgResumeChannelResponse defines the Msg/ResumeChannel response type. +type MsgResumeChannelResponse struct { +} + +func (m *MsgResumeChannelResponse) Reset() { *m = MsgResumeChannelResponse{} } +func (m *MsgResumeChannelResponse) String() string { return proto.CompactTextString(m) } +func (*MsgResumeChannelResponse) ProtoMessage() {} +func (*MsgResumeChannelResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9ea92a5af9136e08, []int{5} +} +func (m *MsgResumeChannelResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgResumeChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgResumeChannelResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgResumeChannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgResumeChannelResponse.Merge(m, src) +} +func (m *MsgResumeChannelResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgResumeChannelResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgResumeChannelResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgResumeChannelResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSetPermissionedRelayers)(nil), "ibc.applications.perm.v1.MsgSetPermissionedRelayers") proto.RegisterType((*MsgSetPermissionedRelayersResponse)(nil), "ibc.applications.perm.v1.MsgSetPermissionedRelayersResponse") + proto.RegisterType((*MsgHaltChannel)(nil), "ibc.applications.perm.v1.MsgHaltChannel") + proto.RegisterType((*MsgHaltChannelResponse)(nil), "ibc.applications.perm.v1.MsgHaltChannelResponse") + proto.RegisterType((*MsgResumeChannel)(nil), "ibc.applications.perm.v1.MsgResumeChannel") + proto.RegisterType((*MsgResumeChannelResponse)(nil), "ibc.applications.perm.v1.MsgResumeChannelResponse") } func init() { proto.RegisterFile("ibc/applications/perm/v1/tx.proto", fileDescriptor_9ea92a5af9136e08) } var fileDescriptor_9ea92a5af9136e08 = []byte{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xed, 0x06, 0x0a, 0xb9, 0x01, 0xa8, 0x29, 0x6a, 0xf0, 0x60, 0x17, 0x8b, 0xa1, 0x0a, - 0xd4, 0xa7, 0x42, 0xa7, 0x88, 0x85, 0x4c, 0x14, 0xa9, 0x12, 0x72, 0x37, 0x96, 0xea, 0x6c, 0x9f, - 0x2e, 0x27, 0xf9, 0xee, 0xac, 0x7b, 0xd7, 0xaa, 0xd9, 0x10, 0x13, 0x42, 0x42, 0xe2, 0x0f, 0x60, - 0xe8, 0x9f, 0x90, 0x81, 0x81, 0x3f, 0x81, 0xb1, 0x62, 0x62, 0x8a, 0x50, 0x32, 0x84, 0x39, 0x7f, - 0x01, 0xb2, 0xcf, 0x4d, 0x58, 0xbc, 0x74, 0x39, 0xbd, 0x77, 0x9f, 0xef, 0xfb, 0xa1, 0xf7, 0x1e, - 0x7a, 0xc2, 0xd3, 0x0c, 0x93, 0xb2, 0x2c, 0x78, 0x46, 0x0c, 0x57, 0x12, 0x70, 0x49, 0xb5, 0xc0, - 0xe7, 0x07, 0xd8, 0x5c, 0xc4, 0xa5, 0x56, 0x46, 0x79, 0x3d, 0x9e, 0x66, 0xf1, 0xff, 0x92, 0xb8, - 0x92, 0xc4, 0xe7, 0x07, 0xfe, 0x16, 0x11, 0x5c, 0x2a, 0x5c, 0xbf, 0x56, 0xec, 0xef, 0x64, 0x0a, - 0x84, 0x02, 0x2c, 0x80, 0x55, 0x49, 0x04, 0xb0, 0x06, 0x3c, 0xb6, 0xe0, 0xb4, 0xf6, 0xb0, 0x75, - 0x1a, 0xb4, 0xcd, 0x14, 0x53, 0xf6, 0xbf, 0xb2, 0xec, 0x6f, 0xf4, 0x63, 0x03, 0xf9, 0xc7, 0xc0, - 0x4e, 0xa8, 0x79, 0x47, 0xb5, 0xe0, 0x00, 0x5c, 0x49, 0x9a, 0x27, 0xb4, 0x20, 0x63, 0xaa, 0xc1, - 0x7b, 0x8b, 0xba, 0xe4, 0xcc, 0x8c, 0x94, 0xe6, 0x66, 0xdc, 0x73, 0x77, 0xdd, 0xbd, 0xee, 0xf0, - 0xf9, 0x72, 0x1a, 0x3e, 0x18, 0x13, 0x51, 0x0c, 0xa2, 0x15, 0x8a, 0x7e, 0x7d, 0xdf, 0xdf, 0x6e, - 0xaa, 0xbd, 0xce, 0x73, 0x4d, 0x01, 0x4e, 0x8c, 0xe6, 0x92, 0x25, 0xeb, 0x70, 0xef, 0x19, 0xba, - 0x53, 0x2a, 0x6d, 0x4e, 0x79, 0xde, 0xdb, 0xa8, 0x33, 0x79, 0xcb, 0x69, 0x78, 0xcf, 0x66, 0x6a, - 0x40, 0x94, 0x6c, 0x56, 0xd6, 0x51, 0xee, 0x1d, 0x22, 0x94, 0x8d, 0x88, 0x94, 0xb4, 0xa8, 0xf4, - 0x9d, 0x5a, 0xff, 0x68, 0x39, 0x0d, 0xb7, 0xac, 0x7e, 0xcd, 0xa2, 0xa4, 0xdb, 0x38, 0x47, 0xb9, - 0x87, 0xd1, 0x5d, 0xdd, 0xb4, 0xde, 0xbb, 0xb5, 0xdb, 0xd9, 0xeb, 0x0e, 0x1f, 0x2e, 0xa7, 0xe1, - 0x7d, 0x1b, 0x73, 0x4d, 0xa2, 0x64, 0x25, 0x1a, 0x0c, 0x3e, 0x5d, 0x86, 0xce, 0xdf, 0xcb, 0xd0, - 0xf9, 0xb8, 0x98, 0xf4, 0xd7, 0xbd, 0x7e, 0x5e, 0x4c, 0xfa, 0x61, 0xbd, 0xa2, 0xf6, 0xd9, 0x44, - 0x4f, 0x51, 0xd4, 0x4e, 0x13, 0x0a, 0xa5, 0x92, 0x40, 0x5f, 0x7c, 0x73, 0x51, 0xe7, 0x18, 0x98, - 0xf7, 0xc5, 0x45, 0x3b, 0x6d, 0x53, 0x3e, 0x8c, 0xdb, 0x96, 0x1f, 0xb7, 0x57, 0xf0, 0x5f, 0xdd, - 0x24, 0xea, 0xba, 0x2f, 0xff, 0xf6, 0x87, 0xc5, 0xa4, 0xef, 0x0e, 0xdf, 0xfc, 0x9c, 0x05, 0xee, - 0xd5, 0x2c, 0x70, 0xff, 0xcc, 0x02, 0xf7, 0xeb, 0x3c, 0x70, 0xae, 0xe6, 0x81, 0xf3, 0x7b, 0x1e, - 0x38, 0xef, 0x63, 0xc6, 0xcd, 0xe8, 0x2c, 0x8d, 0x33, 0x25, 0x30, 0x97, 0xdc, 0x70, 0xb2, 0x5f, - 0x90, 0x14, 0x1a, 0x1b, 0x5f, 0xe0, 0xea, 0xa6, 0xeb, 0x19, 0x99, 0x71, 0x49, 0x21, 0xdd, 0xac, - 0x0f, 0xea, 0xe5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0c, 0xab, 0x07, 0x3c, 0xec, 0x02, 0x00, - 0x00, + // 551 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x3d, 0x6f, 0xd3, 0x4e, + 0x18, 0x8f, 0x93, 0xff, 0xbf, 0x90, 0x43, 0x94, 0xd6, 0x6d, 0xa9, 0xf1, 0x60, 0x97, 0x13, 0x43, + 0x14, 0xa8, 0xaf, 0x2d, 0x9d, 0x22, 0x16, 0xc2, 0xd2, 0x22, 0x45, 0x42, 0xee, 0xc6, 0x52, 0x9d, + 0xed, 0xd3, 0xe5, 0x24, 0xdb, 0x67, 0xf9, 0x2e, 0x55, 0xb3, 0x21, 0x26, 0x84, 0x84, 0xc4, 0x47, + 0xe8, 0x47, 0xc8, 0xc0, 0xc0, 0x47, 0x60, 0xac, 0x98, 0x98, 0x22, 0x94, 0x0c, 0x61, 0x43, 0x0a, + 0x0b, 0x23, 0xf2, 0x5b, 0x5e, 0x90, 0x5c, 0x55, 0x6c, 0x5d, 0xac, 0xbb, 0xe7, 0xf7, 0x7b, 0xde, + 0x7e, 0xf7, 0xf8, 0x01, 0x0f, 0x99, 0xe3, 0x22, 0x1c, 0x45, 0x3e, 0x73, 0xb1, 0x64, 0x3c, 0x14, + 0x28, 0x22, 0x71, 0x80, 0xce, 0xf6, 0x91, 0x3c, 0xb7, 0xa2, 0x98, 0x4b, 0xae, 0x6a, 0xcc, 0x71, + 0xad, 0x45, 0x8a, 0x95, 0x50, 0xac, 0xb3, 0x7d, 0x7d, 0x1d, 0x07, 0x2c, 0xe4, 0x28, 0xfd, 0x66, + 0x64, 0x7d, 0xdb, 0xe5, 0x22, 0xe0, 0x02, 0x05, 0x82, 0x26, 0x41, 0x02, 0x41, 0x73, 0xe0, 0x41, + 0x06, 0x9c, 0xa6, 0x37, 0x94, 0x5d, 0x72, 0x68, 0x93, 0x72, 0xca, 0x33, 0x7b, 0x72, 0xca, 0xac, + 0xf0, 0x73, 0x15, 0xe8, 0x1d, 0x41, 0x4f, 0x88, 0x7c, 0x45, 0xe2, 0x80, 0x09, 0xc1, 0x78, 0x48, + 0x3c, 0x9b, 0xf8, 0xb8, 0x4f, 0x62, 0xa1, 0xbe, 0x04, 0x75, 0xdc, 0x93, 0x5d, 0x1e, 0x33, 0xd9, + 0xd7, 0x94, 0x1d, 0xa5, 0x51, 0x6f, 0x3f, 0x99, 0x0e, 0xcd, 0xb5, 0x3e, 0x0e, 0xfc, 0x16, 0x9c, + 0x41, 0xf0, 0xeb, 0xa7, 0xdd, 0xcd, 0x3c, 0xdb, 0x73, 0xcf, 0x8b, 0x89, 0x10, 0x27, 0x32, 0x66, + 0x21, 0xb5, 0xe7, 0xee, 0xea, 0x21, 0x00, 0x6e, 0x17, 0x87, 0x21, 0xf1, 0x4f, 0x99, 0xa7, 0x55, + 0xd3, 0x60, 0x5b, 0xd3, 0xa1, 0xb9, 0x9e, 0x05, 0x9b, 0x63, 0xd0, 0xae, 0xe7, 0x97, 0x63, 0x4f, + 0x7d, 0x0c, 0x6e, 0x45, 0x3c, 0x96, 0x89, 0x4b, 0x2d, 0x75, 0x51, 0xa7, 0x43, 0x73, 0x35, 0x73, + 0xc9, 0x01, 0x68, 0xaf, 0x24, 0xa7, 0x63, 0x4f, 0x45, 0xe0, 0x76, 0x9c, 0x97, 0xae, 0xfd, 0xb7, + 0x53, 0x6b, 0xd4, 0xdb, 0x1b, 0xd3, 0xa1, 0x79, 0x2f, 0x63, 0x17, 0x08, 0xb4, 0x67, 0xa4, 0x56, + 0xeb, 0xdd, 0x85, 0x59, 0xf9, 0x71, 0x61, 0x56, 0xde, 0x4e, 0x06, 0xcd, 0x79, 0xad, 0xef, 0x27, + 0x83, 0xa6, 0x99, 0x3e, 0x51, 0xb9, 0x36, 0xf0, 0x11, 0x80, 0xe5, 0xa8, 0x4d, 0x44, 0xc4, 0x43, + 0x41, 0xe0, 0x4f, 0x05, 0xac, 0x76, 0x04, 0x3d, 0xc2, 0xbe, 0x7c, 0x91, 0x35, 0x75, 0xc3, 0x44, + 0x6d, 0x59, 0xe5, 0x1a, 0x6d, 0x14, 0x1a, 0x2d, 0xb4, 0x07, 0x35, 0x70, 0x7f, 0xd9, 0x32, 0xd3, + 0xe2, 0x97, 0x02, 0xd6, 0x3a, 0x82, 0xda, 0x44, 0xf4, 0x02, 0x72, 0x43, 0xd5, 0xd8, 0x2b, 0x57, + 0x63, 0xab, 0x50, 0x63, 0xa9, 0x41, 0xa8, 0x03, 0xed, 0x6f, 0x5b, 0xa1, 0xc8, 0xc1, 0xef, 0x2a, + 0xa8, 0x75, 0x04, 0x55, 0x3f, 0x28, 0x60, 0xbb, 0xec, 0x1f, 0x3c, 0xb4, 0xca, 0x56, 0x83, 0x55, + 0x3e, 0x7f, 0xfa, 0xb3, 0x7f, 0xf1, 0x2a, 0xea, 0x52, 0x19, 0xb8, 0xb3, 0x38, 0xb1, 0x8d, 0x2b, + 0x83, 0x2d, 0x30, 0xf5, 0xbd, 0xeb, 0x32, 0x67, 0xa9, 0x38, 0xb8, 0xbb, 0x3c, 0x10, 0xcd, 0x2b, + 0x43, 0x2c, 0x71, 0xf5, 0x83, 0xeb, 0x73, 0x8b, 0x84, 0xfa, 0xff, 0x6f, 0x26, 0x83, 0xa6, 0xd2, + 0x3e, 0xfa, 0x32, 0x32, 0x94, 0xcb, 0x91, 0xa1, 0x7c, 0x1f, 0x19, 0xca, 0xc7, 0xb1, 0x51, 0xb9, + 0x1c, 0x1b, 0x95, 0x6f, 0x63, 0xa3, 0xf2, 0xda, 0xa2, 0x4c, 0x76, 0x7b, 0x8e, 0xe5, 0xf2, 0x00, + 0xb1, 0x90, 0x49, 0x86, 0x77, 0x7d, 0xec, 0x88, 0xfc, 0x8c, 0xce, 0x51, 0xb2, 0xcd, 0xd3, 0xb7, + 0x96, 0xfd, 0x88, 0x08, 0x67, 0x25, 0x5d, 0xa5, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x5a, + 0xa5, 0xaa, 0x82, 0xe6, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -166,6 +334,10 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // SetPermissionedRelayers defines a rpc handler method for MsgSetPermissionedRelayers. SetPermissionedRelayers(ctx context.Context, in *MsgSetPermissionedRelayers, opts ...grpc.CallOption) (*MsgSetPermissionedRelayersResponse, error) + // HaltChannel defines a rpc handler method for MsgHaltChannel. + HaltChannel(ctx context.Context, in *MsgHaltChannel, opts ...grpc.CallOption) (*MsgHaltChannelResponse, error) + // ResumeChannel defines a rpc handler method for MsgResumeChannel. + ResumeChannel(ctx context.Context, in *MsgResumeChannel, opts ...grpc.CallOption) (*MsgResumeChannelResponse, error) } type msgClient struct { @@ -185,10 +357,32 @@ func (c *msgClient) SetPermissionedRelayers(ctx context.Context, in *MsgSetPermi return out, nil } +func (c *msgClient) HaltChannel(ctx context.Context, in *MsgHaltChannel, opts ...grpc.CallOption) (*MsgHaltChannelResponse, error) { + out := new(MsgHaltChannelResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Msg/HaltChannel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ResumeChannel(ctx context.Context, in *MsgResumeChannel, opts ...grpc.CallOption) (*MsgResumeChannelResponse, error) { + out := new(MsgResumeChannelResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.perm.v1.Msg/ResumeChannel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SetPermissionedRelayers defines a rpc handler method for MsgSetPermissionedRelayers. SetPermissionedRelayers(context.Context, *MsgSetPermissionedRelayers) (*MsgSetPermissionedRelayersResponse, error) + // HaltChannel defines a rpc handler method for MsgHaltChannel. + HaltChannel(context.Context, *MsgHaltChannel) (*MsgHaltChannelResponse, error) + // ResumeChannel defines a rpc handler method for MsgResumeChannel. + ResumeChannel(context.Context, *MsgResumeChannel) (*MsgResumeChannelResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -198,6 +392,12 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) SetPermissionedRelayers(ctx context.Context, req *MsgSetPermissionedRelayers) (*MsgSetPermissionedRelayersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetPermissionedRelayers not implemented") } +func (*UnimplementedMsgServer) HaltChannel(ctx context.Context, req *MsgHaltChannel) (*MsgHaltChannelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HaltChannel not implemented") +} +func (*UnimplementedMsgServer) ResumeChannel(ctx context.Context, req *MsgResumeChannel) (*MsgResumeChannelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeChannel not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -221,6 +421,42 @@ func _Msg_SetPermissionedRelayers_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Msg_HaltChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgHaltChannel) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HaltChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.perm.v1.Msg/HaltChannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HaltChannel(ctx, req.(*MsgHaltChannel)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ResumeChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgResumeChannel) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ResumeChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.perm.v1.Msg/ResumeChannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ResumeChannel(ctx, req.(*MsgResumeChannel)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.perm.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -229,6 +465,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetPermissionedRelayers", Handler: _Msg_SetPermissionedRelayers_Handler, }, + { + MethodName: "HaltChannel", + Handler: _Msg_HaltChannel_Handler, + }, + { + MethodName: "ResumeChannel", + Handler: _Msg_ResumeChannel_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/perm/v1/tx.proto", @@ -263,18 +507,152 @@ func (m *MsgSetPermissionedRelayers) MarshalToSizedBuffer(dAtA []byte) (int, err dAtA[i] = 0x22 } } + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintTx(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0x1a + } if len(m.ChannelId) > 0 { i -= len(m.ChannelId) copy(dAtA[i:], m.ChannelId) i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetPermissionedRelayersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetPermissionedRelayersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetPermissionedRelayersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgHaltChannel) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHaltChannel) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHaltChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintTx(dAtA, i, uint64(len(m.PortId))) + i-- dAtA[i] = 0x1a } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgHaltChannelResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHaltChannelResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHaltChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgResumeChannel) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgResumeChannel) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgResumeChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if len(m.PortId) > 0 { i -= len(m.PortId) copy(dAtA[i:], m.PortId) i = encodeVarintTx(dAtA, i, uint64(len(m.PortId))) i-- + dAtA[i] = 0x1a + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- dAtA[i] = 0x12 } if len(m.Authority) > 0 { @@ -287,7 +665,7 @@ func (m *MsgSetPermissionedRelayers) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *MsgSetPermissionedRelayersResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgResumeChannelResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -297,12 +675,12 @@ func (m *MsgSetPermissionedRelayersResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *MsgSetPermissionedRelayersResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgResumeChannelResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSetPermissionedRelayersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgResumeChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -331,11 +709,11 @@ func (m *MsgSetPermissionedRelayers) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.PortId) + l = len(m.ChannelId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ChannelId) + l = len(m.PortId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -345,25 +723,313 @@ func (m *MsgSetPermissionedRelayers) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - return n -} + return n +} + +func (m *MsgSetPermissionedRelayersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgHaltChannel) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgHaltChannelResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgResumeChannel) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgResumeChannelResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetPermissionedRelayers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetPermissionedRelayers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Relayers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Relayers = append(m.Relayers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *MsgSetPermissionedRelayersResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n + return nil } +func (m *MsgSetPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetPermissionedRelayersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetPermissionedRelayersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { +func (m *MsgHaltChannel) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -386,10 +1052,10 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetPermissionedRelayers: wiretype end group for non-group") + return fmt.Errorf("proto: MsgHaltChannel: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetPermissionedRelayers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgHaltChannel: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -425,6 +1091,38 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) } @@ -456,7 +1154,139 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { } m.PortId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgHaltChannelResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgHaltChannelResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHaltChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgResumeChannel) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgResumeChannel: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgResumeChannel: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -488,9 +1318,9 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { } m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Relayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -518,7 +1348,7 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Relayers = append(m.Relayers, string(dAtA[iNdEx:postIndex])) + m.PortId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -541,7 +1371,7 @@ func (m *MsgSetPermissionedRelayers) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { +func (m *MsgResumeChannelResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -564,10 +1394,10 @@ func (m *MsgSetPermissionedRelayersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetPermissionedRelayersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgResumeChannelResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetPermissionedRelayersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgResumeChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/ibc/perm/types/types.pb.go b/x/ibc/perm/types/types.pb.go index e6ee130d..87117c4d 100644 --- a/x/ibc/perm/types/types.pb.go +++ b/x/ibc/perm/types/types.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -22,26 +23,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// PermissionedRelayer is used to specifiy the permissioned relayer for -// the specific port-id:channel-id pair. -type PermissionedRelayers struct { - PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - Relayers []string `protobuf:"bytes,3,rep,name=relayers,proto3" json:"relayers,omitempty"` +// ChannelState defines the channel state for the specific port-id:channel-id pair. +type ChannelState struct { + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + HaltState HaltState `protobuf:"bytes,3,opt,name=halt_state,json=haltState,proto3" json:"halt_state"` + Relayers []string `protobuf:"bytes,4,rep,name=relayers,proto3" json:"relayers,omitempty"` } -func (m *PermissionedRelayers) Reset() { *m = PermissionedRelayers{} } -func (m *PermissionedRelayers) String() string { return proto.CompactTextString(m) } -func (*PermissionedRelayers) ProtoMessage() {} -func (*PermissionedRelayers) Descriptor() ([]byte, []int) { +func (m *ChannelState) Reset() { *m = ChannelState{} } +func (m *ChannelState) String() string { return proto.CompactTextString(m) } +func (*ChannelState) ProtoMessage() {} +func (*ChannelState) Descriptor() ([]byte, []int) { return fileDescriptor_58b3976370e0fa77, []int{0} } -func (m *PermissionedRelayers) XXX_Unmarshal(b []byte) error { +func (m *ChannelState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PermissionedRelayers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ChannelState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PermissionedRelayers.Marshal(b, m, deterministic) + return xxx_messageInfo_ChannelState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -51,57 +52,64 @@ func (m *PermissionedRelayers) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *PermissionedRelayers) XXX_Merge(src proto.Message) { - xxx_messageInfo_PermissionedRelayers.Merge(m, src) +func (m *ChannelState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelState.Merge(m, src) } -func (m *PermissionedRelayers) XXX_Size() int { +func (m *ChannelState) XXX_Size() int { return m.Size() } -func (m *PermissionedRelayers) XXX_DiscardUnknown() { - xxx_messageInfo_PermissionedRelayers.DiscardUnknown(m) +func (m *ChannelState) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelState.DiscardUnknown(m) } -var xxx_messageInfo_PermissionedRelayers proto.InternalMessageInfo +var xxx_messageInfo_ChannelState proto.InternalMessageInfo -func (m *PermissionedRelayers) GetPortId() string { +func (m *ChannelState) GetPortId() string { if m != nil { return m.PortId } return "" } -func (m *PermissionedRelayers) GetChannelId() string { +func (m *ChannelState) GetChannelId() string { if m != nil { return m.ChannelId } return "" } -func (m *PermissionedRelayers) GetRelayers() []string { +func (m *ChannelState) GetHaltState() HaltState { + if m != nil { + return m.HaltState + } + return HaltState{} +} + +func (m *ChannelState) GetRelayers() []string { if m != nil { return m.Relayers } return nil } -// PermissionedRelayersList is used to specify the list of permissioned relayers -// for the specific port-id:channel-id pair. -type PermissionedRelayersList struct { - Relayers []string `protobuf:"bytes,1,rep,name=relayers,proto3" json:"relayers,omitempty"` +// HaltState defines the halt state for the specific port-id:channel-id pair. +type HaltState struct { + Halted bool `protobuf:"varint,1,opt,name=halted,proto3" json:"halted,omitempty"` + HaltedBy string `protobuf:"bytes,2,opt,name=halted_by,json=haltedBy,proto3" json:"halted_by,omitempty"` } -func (m *PermissionedRelayersList) Reset() { *m = PermissionedRelayersList{} } -func (m *PermissionedRelayersList) String() string { return proto.CompactTextString(m) } -func (*PermissionedRelayersList) ProtoMessage() {} -func (*PermissionedRelayersList) Descriptor() ([]byte, []int) { +func (m *HaltState) Reset() { *m = HaltState{} } +func (m *HaltState) String() string { return proto.CompactTextString(m) } +func (*HaltState) ProtoMessage() {} +func (*HaltState) Descriptor() ([]byte, []int) { return fileDescriptor_58b3976370e0fa77, []int{1} } -func (m *PermissionedRelayersList) XXX_Unmarshal(b []byte) error { +func (m *HaltState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PermissionedRelayersList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *HaltState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PermissionedRelayersList.Marshal(b, m, deterministic) + return xxx_messageInfo_HaltState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -111,28 +119,35 @@ func (m *PermissionedRelayersList) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *PermissionedRelayersList) XXX_Merge(src proto.Message) { - xxx_messageInfo_PermissionedRelayersList.Merge(m, src) +func (m *HaltState) XXX_Merge(src proto.Message) { + xxx_messageInfo_HaltState.Merge(m, src) } -func (m *PermissionedRelayersList) XXX_Size() int { +func (m *HaltState) XXX_Size() int { return m.Size() } -func (m *PermissionedRelayersList) XXX_DiscardUnknown() { - xxx_messageInfo_PermissionedRelayersList.DiscardUnknown(m) +func (m *HaltState) XXX_DiscardUnknown() { + xxx_messageInfo_HaltState.DiscardUnknown(m) } -var xxx_messageInfo_PermissionedRelayersList proto.InternalMessageInfo +var xxx_messageInfo_HaltState proto.InternalMessageInfo -func (m *PermissionedRelayersList) GetRelayers() []string { +func (m *HaltState) GetHalted() bool { if m != nil { - return m.Relayers + return m.Halted } - return nil + return false +} + +func (m *HaltState) GetHaltedBy() string { + if m != nil { + return m.HaltedBy + } + return "" } func init() { - proto.RegisterType((*PermissionedRelayers)(nil), "ibc.applications.perm.v1.PermissionedRelayers") - proto.RegisterType((*PermissionedRelayersList)(nil), "ibc.applications.perm.v1.PermissionedRelayersList") + proto.RegisterType((*ChannelState)(nil), "ibc.applications.perm.v1.ChannelState") + proto.RegisterType((*HaltState)(nil), "ibc.applications.perm.v1.HaltState") } func init() { @@ -140,26 +155,29 @@ func init() { } var fileDescriptor_58b3976370e0fa77 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0x4c, 0x4a, 0xd6, - 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0x48, 0x2d, - 0xca, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x92, 0xc8, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa5, 0x07, 0x52, 0xa5, 0x57, 0x66, 0xa8, 0x94, - 0xc5, 0x25, 0x12, 0x90, 0x5a, 0x94, 0x9b, 0x59, 0x5c, 0x9c, 0x99, 0x9f, 0x97, 0x9a, 0x12, 0x94, - 0x9a, 0x93, 0x58, 0x99, 0x5a, 0x54, 0x2c, 0x24, 0xce, 0xc5, 0x5e, 0x90, 0x5f, 0x54, 0x12, 0x9f, - 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x06, 0xe2, 0x7a, 0xa6, 0x08, 0xc9, 0x72, - 0x71, 0x25, 0x67, 0x24, 0xe6, 0xe5, 0xa5, 0xe6, 0x80, 0xe4, 0x98, 0xc0, 0x72, 0x9c, 0x50, 0x11, - 0xcf, 0x14, 0x21, 0x29, 0x2e, 0x8e, 0x22, 0xa8, 0x19, 0x12, 0xcc, 0x0a, 0xcc, 0x1a, 0x9c, 0x41, - 0x70, 0xbe, 0x92, 0x19, 0x97, 0x04, 0x36, 0xbb, 0x7c, 0x32, 0x8b, 0x4b, 0x50, 0xf4, 0x31, 0xa2, - 0xea, 0x73, 0xf2, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xbd, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xbc, 0xcc, 0x92, 0xcc, 0x44, - 0xdd, 0x9c, 0xc4, 0xa4, 0x62, 0x28, 0x5b, 0xbf, 0x42, 0x1f, 0x14, 0x3a, 0xe0, 0x00, 0x01, 0x87, - 0x46, 0x12, 0x1b, 0x38, 0x38, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x33, 0xe2, 0x9d, - 0x36, 0x01, 0x00, 0x00, + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xb1, 0x4e, 0xc3, 0x30, + 0x14, 0x8c, 0x69, 0x55, 0x6a, 0xc3, 0x64, 0x21, 0x88, 0x8a, 0x30, 0x55, 0x61, 0xe8, 0x82, 0xad, + 0xc2, 0x0f, 0xa0, 0xb2, 0xb4, 0x6b, 0xd8, 0x58, 0x2a, 0x3b, 0xb5, 0x1a, 0x4b, 0x6e, 0x6c, 0x25, + 0xa6, 0x22, 0x7f, 0xc1, 0x87, 0xf0, 0x21, 0x1d, 0x3b, 0x32, 0x21, 0xd4, 0xfc, 0x08, 0xb2, 0x13, + 0x2a, 0x16, 0xb6, 0xbb, 0x7b, 0xf7, 0xec, 0xd3, 0x3d, 0x74, 0xab, 0x44, 0xca, 0xb8, 0xb5, 0x5a, + 0xa5, 0xdc, 0x29, 0x93, 0x97, 0xcc, 0xca, 0x62, 0xcd, 0x36, 0x13, 0xe6, 0x2a, 0x2b, 0x4b, 0x6a, + 0x0b, 0xe3, 0x0c, 0x8e, 0x95, 0x48, 0xe9, 0x5f, 0x17, 0xf5, 0x2e, 0xba, 0x99, 0x0c, 0xce, 0x56, + 0x66, 0x65, 0x82, 0x89, 0x79, 0xd4, 0xf8, 0x47, 0x1f, 0x00, 0x9d, 0x3e, 0x65, 0x3c, 0xcf, 0xa5, + 0x7e, 0x76, 0xdc, 0x49, 0x7c, 0x81, 0x8e, 0xad, 0x29, 0xdc, 0x42, 0x2d, 0x63, 0x30, 0x04, 0x63, + 0x98, 0xf4, 0x3c, 0x9d, 0x2f, 0xf1, 0x15, 0x42, 0x69, 0x63, 0xf4, 0xb3, 0xa3, 0x30, 0x83, 0xad, + 0x32, 0x5f, 0xe2, 0x19, 0x42, 0x19, 0xd7, 0x6e, 0x51, 0xfa, 0x57, 0xe2, 0xce, 0x10, 0x8c, 0x4f, + 0xee, 0x6f, 0xe8, 0x7f, 0x69, 0xe8, 0x8c, 0x6b, 0x17, 0x3e, 0x9c, 0x76, 0xb7, 0x5f, 0xd7, 0x51, + 0x02, 0xb3, 0x5f, 0x01, 0x0f, 0x50, 0xbf, 0x90, 0x9a, 0x57, 0xb2, 0x28, 0xe3, 0xee, 0xb0, 0x33, + 0x86, 0xc9, 0x81, 0x8f, 0x1e, 0x11, 0x3c, 0x6c, 0xe2, 0x73, 0xd4, 0xf3, 0x5b, 0xb2, 0x49, 0xda, + 0x4f, 0x5a, 0x86, 0x2f, 0x11, 0x6c, 0xd0, 0x42, 0x54, 0x6d, 0xd0, 0x7e, 0x23, 0x4c, 0xab, 0xe9, + 0x6c, 0xbb, 0x27, 0x60, 0xb7, 0x27, 0xe0, 0x7b, 0x4f, 0xc0, 0x7b, 0x4d, 0xa2, 0x5d, 0x4d, 0xa2, + 0xcf, 0x9a, 0x44, 0x2f, 0x74, 0xa5, 0x5c, 0xf6, 0x2a, 0x68, 0x6a, 0xd6, 0x4c, 0xe5, 0xca, 0x29, + 0x7e, 0xa7, 0xb9, 0x28, 0x5b, 0xcc, 0xde, 0x98, 0x3f, 0x40, 0xe8, 0x3c, 0x14, 0x2e, 0x7a, 0xa1, + 0xc1, 0x87, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x24, 0xab, 0x03, 0x0b, 0x99, 0x01, 0x00, 0x00, } -func (m *PermissionedRelayers) Marshal() (dAtA []byte, err error) { +func (m *ChannelState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -169,12 +187,12 @@ func (m *PermissionedRelayers) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PermissionedRelayers) MarshalTo(dAtA []byte) (int, error) { +func (m *ChannelState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PermissionedRelayers) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ChannelState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -185,9 +203,19 @@ func (m *PermissionedRelayers) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Relayers[iNdEx]) i = encodeVarintTypes(dAtA, i, uint64(len(m.Relayers[iNdEx]))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } + { + size, err := m.HaltState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.ChannelId) > 0 { i -= len(m.ChannelId) copy(dAtA[i:], m.ChannelId) @@ -205,7 +233,7 @@ func (m *PermissionedRelayers) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PermissionedRelayersList) Marshal() (dAtA []byte, err error) { +func (m *HaltState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -215,24 +243,32 @@ func (m *PermissionedRelayersList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PermissionedRelayersList) MarshalTo(dAtA []byte) (int, error) { +func (m *HaltState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PermissionedRelayersList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *HaltState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Relayers) > 0 { - for iNdEx := len(m.Relayers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Relayers[iNdEx]) - copy(dAtA[i:], m.Relayers[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Relayers[iNdEx]))) - i-- - dAtA[i] = 0xa + if len(m.HaltedBy) > 0 { + i -= len(m.HaltedBy) + copy(dAtA[i:], m.HaltedBy) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HaltedBy))) + i-- + dAtA[i] = 0x12 + } + if m.Halted { + i-- + if m.Halted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -248,7 +284,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *PermissionedRelayers) Size() (n int) { +func (m *ChannelState) Size() (n int) { if m == nil { return 0 } @@ -262,6 +298,8 @@ func (m *PermissionedRelayers) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + l = m.HaltState.Size() + n += 1 + l + sovTypes(uint64(l)) if len(m.Relayers) > 0 { for _, s := range m.Relayers { l = len(s) @@ -271,17 +309,18 @@ func (m *PermissionedRelayers) Size() (n int) { return n } -func (m *PermissionedRelayersList) Size() (n int) { +func (m *HaltState) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Relayers) > 0 { - for _, s := range m.Relayers { - l = len(s) - n += 1 + l + sovTypes(uint64(l)) - } + if m.Halted { + n += 2 + } + l = len(m.HaltedBy) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) } return n } @@ -292,7 +331,7 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *PermissionedRelayers) Unmarshal(dAtA []byte) error { +func (m *ChannelState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -315,10 +354,10 @@ func (m *PermissionedRelayers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PermissionedRelayers: wiretype end group for non-group") + return fmt.Errorf("proto: ChannelState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PermissionedRelayers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ChannelState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -386,6 +425,39 @@ func (m *PermissionedRelayers) Unmarshal(dAtA []byte) error { m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HaltState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.HaltState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Relayers", wireType) } @@ -438,7 +510,7 @@ func (m *PermissionedRelayers) Unmarshal(dAtA []byte) error { } return nil } -func (m *PermissionedRelayersList) Unmarshal(dAtA []byte) error { +func (m *HaltState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -461,15 +533,35 @@ func (m *PermissionedRelayersList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PermissionedRelayersList: wiretype end group for non-group") + return fmt.Errorf("proto: HaltState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PermissionedRelayersList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HaltState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Halted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Halted = bool(v != 0) + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Relayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HaltedBy", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -497,7 +589,7 @@ func (m *PermissionedRelayersList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Relayers = append(m.Relayers, string(dAtA[iNdEx:postIndex])) + m.HaltedBy = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/move/types/authz.go b/x/move/types/authz.go index 50a0bfe2..ab1a91e9 100644 --- a/x/move/types/authz.go +++ b/x/move/types/authz.go @@ -120,8 +120,8 @@ func (a ExecuteAuthorization) ValidateBasic() error { if len(v.ModuleName) == 0 { return errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid module name: %s", v.ModuleName) } - if v.FunctionNames == nil || len(v.FunctionNames) == 0 { - return errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid module names") + if len(v.FunctionNames) == 0 { + return errors.Wrap(sdkerrors.ErrInvalidRequest, "invalid module names") } if module, ok := moduleMap[v.ModuleAddress]; ok { for _, m := range module { diff --git a/x/mstaking/keeper/grpc_query.go b/x/mstaking/keeper/grpc_query.go index ecb6a3c2..2067c9d0 100644 --- a/x/mstaking/keeper/grpc_query.go +++ b/x/mstaking/keeper/grpc_query.go @@ -73,7 +73,7 @@ func (q Querier) Validator(ctx context.Context, req *types.QueryValidatorRequest validator, err := q.Keeper.Validators.Get(ctx, valAddr) if err != nil { - return nil, status.Errorf(codes.NotFound, err.Error()) + return nil, status.Error(codes.NotFound, err.Error()) } return &types.QueryValidatorResponse{Validator: validator}, nil