diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d7c7cc84c..8a4ccf5fa01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core) [\#6055](https://github.com/cosmos/ibc-go/pull/6055) Introduce a new interface `ConsensusHost` used to validate an IBC `ClientState` and `ConsensusState` against the host chain's underlying consensus parameters. * (core/02-client) [\#5821](https://github.com/cosmos/ibc-go/pull/5821) Add rpc `VerifyMembershipProof` (querier approach for conditional clients). * (core/04-channel) [\#5788](https://github.com/cosmos/ibc-go/pull/5788) Add `NewErrorAcknowledgementWithCodespace` to allow codespaces in ack errors. +* (apps/27-interchain-accounts) [\#5785](https://github.com/cosmos/ibc-go/pull/5785) Introduce a new tx message that ICA host submodule can use to query the chain (only those marked with `module_query_safe`) and write the responses to the acknowledgement. ### Bug Fixes diff --git a/modules/apps/27-interchain-accounts/host/keeper/export_test.go b/modules/apps/27-interchain-accounts/host/keeper/export_test.go index 2cd4338dde2..cbd7a14ef34 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/export_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/export_test.go @@ -20,3 +20,8 @@ func (k *Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper { func (k Keeper) GetAppMetadata(ctx sdk.Context, portID, channelID string) (icatypes.Metadata, error) { return k.getAppMetadata(ctx, portID, channelID) } + +// NewModuleQuerySafeAllowList is a wrapper around newModuleQuerySafeAllowList to allow the function to be directly called in tests. +func NewModuleQuerySafeAllowList() []string { + return newModuleQuerySafeAllowList() +} diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index ce8bdad1234..170fa6e1f33 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -5,6 +5,12 @@ import ( "fmt" "strings" + gogoproto "github.com/cosmos/gogoproto/proto" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + msgv1 "cosmossdk.io/api/cosmos/msg/v1" + queryv1 "cosmossdk.io/api/cosmos/query/v1" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -36,7 +42,11 @@ type Keeper struct { scopedKeeper exported.ScopedKeeper - msgRouter icatypes.MessageRouter + msgRouter icatypes.MessageRouter + queryRouter icatypes.QueryRouter + + // mqsAllowList is a list of all module safe query paths + mqsAllowList []string // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. @@ -69,17 +79,30 @@ func NewKeeper( accountKeeper: accountKeeper, scopedKeeper: scopedKeeper, msgRouter: msgRouter, + mqsAllowList: newModuleQuerySafeAllowList(), authority: authority, } } // WithICS4Wrapper sets the ICS4Wrapper. This function may be used after -// the keepers creation to set the middleware which is above this module +// the keeper's creation to set the middleware which is above this module // in the IBC application stack. func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper) { k.ics4Wrapper = wrapper } +// WithQueryRouter sets the QueryRouter. This function may be used after +// the keeper's creation to set the query router to which queries in the +// ICA packet data will be routed to if they are module_safe_query. +// Panics if the queryRouter is nil. +func (k *Keeper) WithQueryRouter(queryRouter icatypes.QueryRouter) { + if queryRouter == nil { + panic(errors.New("cannot set a nil query router")) + } + + k.queryRouter = queryRouter +} + // Logger returns the application logger, scoped to the associated module func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) @@ -256,3 +279,40 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { bz := k.cdc.MustMarshal(¶ms) store.Set([]byte(types.ParamsKey), bz) } + +// newModuleQuerySafeAllowList returns a list of all query paths labeled with module_query_safe in the proto files. +func newModuleQuerySafeAllowList() []string { + protoFiles, err := gogoproto.MergedRegistry() + if err != nil { + panic(err) + } + + allowList := []string{} + protoFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { + for i := 0; i < fd.Services().Len(); i++ { + // Get the service descriptor + sd := fd.Services().Get(i) + + // Skip services that are annotated with the "cosmos.msg.v1.service" option. + if ext := proto.GetExtension(sd.Options(), msgv1.E_Service); ext != nil && ext.(bool) { + continue + } + + for j := 0; j < sd.Methods().Len(); j++ { + // Get the method descriptor + md := sd.Methods().Get(j) + + // Skip methods that are not annotated with the "cosmos.query.v1.module_query_safe" option. + if ext := proto.GetExtension(md.Options(), queryv1.E_ModuleQuerySafe); ext == nil || !ext.(bool) { + continue + } + + // Add the method to the whitelist + allowList = append(allowList, fmt.Sprintf("/%s/%s", sd.FullName(), md.Name())) + } + } + return true + }) + + return allowList +} diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index a300832818d..1643381fd08 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -198,6 +198,31 @@ func (suite *KeeperTestSuite) TestNewKeeper() { } } +func (suite *KeeperTestSuite) TestNewModuleQuerySafeAllowList() { + // Currently, all queries in bank, staking, auth, and circuit are marked safe + // Notably, the gov and distribution modules are not marked safe + + var allowList []string + suite.Require().NotPanics(func() { + allowList = keeper.NewModuleQuerySafeAllowList() + }) + + suite.Require().NotEmpty(allowList) + suite.Require().Contains(allowList, "/cosmos.bank.v1beta1.Query/Balance") + suite.Require().Contains(allowList, "/cosmos.bank.v1beta1.Query/AllBalances") + suite.Require().Contains(allowList, "/cosmos.staking.v1beta1.Query/Validator") + suite.Require().Contains(allowList, "/cosmos.staking.v1beta1.Query/Validators") + suite.Require().Contains(allowList, "/cosmos.circuit.v1.Query/Account") + suite.Require().Contains(allowList, "/cosmos.circuit.v1.Query/DisabledList") + suite.Require().Contains(allowList, "/cosmos.auth.v1beta1.Query/Accounts") + suite.Require().Contains(allowList, "/cosmos.auth.v1beta1.Query/ModuleAccountByName") + suite.Require().Contains(allowList, "/ibc.core.client.v1.Query/VerifyMembership") + suite.Require().NotContains(allowList, "/cosmos.gov.v1beta1.Query/Proposals") + suite.Require().NotContains(allowList, "/cosmos.gov.v1.Query/Proposals") + suite.Require().NotContains(allowList, "/cosmos.distribution.v1beta1.Query/Params") + suite.Require().NotContains(allowList, "/cosmos.distribution.v1beta1.Query/DelegationRewards") +} + func (suite *KeeperTestSuite) TestGetInterchainAccountAddress() { suite.SetupTest() diff --git a/modules/apps/27-interchain-accounts/host/keeper/msg_server.go b/modules/apps/27-interchain-accounts/host/keeper/msg_server.go index c71dba65576..711052f64bb 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/host/keeper/msg_server.go @@ -2,11 +2,15 @@ package keeper import ( "context" + "errors" + "slices" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) @@ -20,9 +24,51 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the ICS27 host MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper *Keeper) types.MsgServer { + if keeper.queryRouter == nil { + panic("query router must not be nil") + } return &msgServer{Keeper: keeper} } +// ModuleQuerySafe routes the queries to the keeper's query router if they are module_query_safe. +// This handler doesn't use the signer. +func (m msgServer) ModuleQuerySafe(goCtx context.Context, msg *types.MsgModuleQuerySafe) (*types.MsgModuleQuerySafeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + responses := make([][]byte, len(msg.Requests)) + for i, query := range msg.Requests { + isModuleQuerySafe := slices.Contains(m.mqsAllowList, query.Path) + if !isModuleQuerySafe { + return nil, errorsmod.Wrapf(ibcerrors.ErrInvalidRequest, "not module query safe: %s", query.Path) + } + + if m.queryRouter == nil { + return nil, errors.New("query router must not be nil") + } + + route := m.queryRouter.Route(query.Path) + if route == nil { + return nil, errorsmod.Wrapf(ibcerrors.ErrInvalidRequest, "no route to query: %s", query.Path) + } + + res, err := route(ctx, &abci.RequestQuery{ + Path: query.Path, + Data: query.Data, + }) + if err != nil { + m.Logger(ctx).Debug("query failed", "path", query.Path, "error", err) + return nil, err + } + if res == nil || res.Value == nil { + return nil, errorsmod.Wrapf(ibcerrors.ErrInvalidRequest, "no response for query: %s", query.Path) + } + + responses[i] = res.Value + } + + return &types.MsgModuleQuerySafeResponse{Responses: responses, Height: uint64(ctx.BlockHeight())}, nil +} + // UpdateParams updates the host submodule's params. func (m msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if m.GetAuthority() != msg.Signer { diff --git a/modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go index 4cc47f781d2..d358303fc12 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go @@ -1,10 +1,157 @@ package keeper_test import ( + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) +func (suite *KeeperTestSuite) TestModuleQuerySafe() { + var ( + msg *types.MsgModuleQuerySafe + expResponses [][]byte + ) + testCases := []struct { + name string + malleate func() + expErr error + }{ + { + "success", + func() { + balanceQueryBz, err := banktypes.NewQueryBalanceRequest(suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom).Marshal() + suite.Require().NoError(err) + + queryReq := types.QueryRequest{ + Path: "/cosmos.bank.v1beta1.Query/Balance", + Data: balanceQueryBz, + } + + msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq}) + + balance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) + + expResp := banktypes.QueryBalanceResponse{Balance: &balance} + expRespBz, err := expResp.Marshal() + suite.Require().NoError(err) + + expResponses = [][]byte{expRespBz} + }, + nil, + }, + { + "success: multiple queries", + func() { + balanceQueryBz, err := banktypes.NewQueryBalanceRequest(suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom).Marshal() + suite.Require().NoError(err) + + queryReq := types.QueryRequest{ + Path: "/cosmos.bank.v1beta1.Query/Balance", + Data: balanceQueryBz, + } + + paramsQuery := stakingtypes.QueryParamsRequest{} + paramsQueryBz, err := paramsQuery.Marshal() + suite.Require().NoError(err) + + paramsQueryReq := types.QueryRequest{ + Path: "/cosmos.staking.v1beta1.Query/Params", + Data: paramsQueryBz, + } + + msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq, ¶msQueryReq}) + + balance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) + + expResp := banktypes.QueryBalanceResponse{Balance: &balance} + expRespBz, err := expResp.Marshal() + suite.Require().NoError(err) + + params, err := suite.chainA.GetSimApp().StakingKeeper.GetParams(suite.chainA.GetContext()) + suite.Require().NoError(err) + expParamsResp := stakingtypes.QueryParamsResponse{Params: params} + expParamsRespBz, err := expParamsResp.Marshal() + suite.Require().NoError(err) + + expResponses = [][]byte{expRespBz, expParamsRespBz} + }, + nil, + }, + { + "failure: not module query safe", + func() { + balanceQueryBz, err := banktypes.NewQueryBalanceRequest(suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom).Marshal() + suite.Require().NoError(err) + + queryReq := types.QueryRequest{ + Path: "/cosmos.bank.v1beta1.Query/Balance", + Data: balanceQueryBz, + } + + paramsQuery := transfertypes.QueryParamsRequest{} + paramsQueryBz, err := paramsQuery.Marshal() + suite.Require().NoError(err) + + paramsQueryReq := types.QueryRequest{ + Path: "/ibc.applications.transfer.v1.Query/Params", + Data: paramsQueryBz, + } + + msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq, ¶msQueryReq}) + }, + ibcerrors.ErrInvalidRequest, + }, + { + "failure: invalid query path", + func() { + balanceQueryBz, err := banktypes.NewQueryBalanceRequest(suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom).Marshal() + suite.Require().NoError(err) + + queryReq := types.QueryRequest{ + Path: "/cosmos.invalid.Query/Invalid", + Data: balanceQueryBz, + } + + msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq}) + }, + ibcerrors.ErrInvalidRequest, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.SetupTest() + + // reset + msg = nil + expResponses = nil + + tc.malleate() + + ctx := suite.chainA.GetContext() + msgServer := keeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAHostKeeper) + res, err := msgServer.ModuleQuerySafe(ctx, msg) + + if tc.expErr == nil { + suite.Require().NoError(err) + suite.Require().NotNil(res) + + suite.Require().ElementsMatch(expResponses, res.Responses) + } else { + suite.Require().ErrorIs(err, tc.expErr) + suite.Require().Nil(res) + } + }) + } +} + func (suite *KeeperTestSuite) TestUpdateParams() { testCases := []struct { name string diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index a83626aa117..26dc5f79a41 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -273,6 +273,38 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { }, true, }, + { + "interchain account successfully executes icahosttypes.MsgModuleQuerySafe", + func(encoding string) { + interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID) + suite.Require().True(found) + + balanceQuery := banktypes.NewQueryBalanceRequest(suite.chainB.SenderAccount.GetAddress(), sdk.DefaultBondDenom) + queryBz, err := balanceQuery.Marshal() + suite.Require().NoError(err) + + msg := types.NewMsgModuleQuerySafe(interchainAccountAddr, []*types.QueryRequest{ + { + Path: "/cosmos.bank.v1beta1.Query/Balance", + Data: queryBz, + }, + }) + + data, err := icatypes.SerializeCosmosTx(suite.chainA.GetSimApp().AppCodec(), []proto.Message{msg}, encoding) + suite.Require().NoError(err) + + icaPacketData := icatypes.InterchainAccountPacketData{ + Type: icatypes.EXECUTE_TX, + Data: data, + } + + packetData = icaPacketData.GetBytes() + + params := types.NewParams(true, []string{sdk.MsgTypeURL(msg)}) + suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) + }, + true, + }, { "interchain account successfully executes disttypes.MsgSetWithdrawAddress", func(encoding string) { diff --git a/modules/apps/27-interchain-accounts/host/types/codec.go b/modules/apps/27-interchain-accounts/host/types/codec.go index 8752640e767..710d732573b 100644 --- a/modules/apps/27-interchain-accounts/host/types/codec.go +++ b/modules/apps/27-interchain-accounts/host/types/codec.go @@ -11,6 +11,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgUpdateParams{}, + &MsgModuleQuerySafe{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/apps/27-interchain-accounts/host/types/codec_test.go b/modules/apps/27-interchain-accounts/host/types/codec_test.go index 6fb2591cf47..581a9401e2b 100644 --- a/modules/apps/27-interchain-accounts/host/types/codec_test.go +++ b/modules/apps/27-interchain-accounts/host/types/codec_test.go @@ -23,6 +23,11 @@ func TestCodecTypeRegistration(t *testing.T) { sdk.MsgTypeURL(&types.MsgUpdateParams{}), true, }, + { + "success: MsgModuleQuerySafe", + sdk.MsgTypeURL(&types.MsgModuleQuerySafe{}), + true, + }, { "type not registered on codec", "ibc.invalid.MsgTypeURL", diff --git a/modules/apps/27-interchain-accounts/host/types/host.pb.go b/modules/apps/27-interchain-accounts/host/types/host.pb.go index 77db265b6b5..54df248f119 100644 --- a/modules/apps/27-interchain-accounts/host/types/host.pb.go +++ b/modules/apps/27-interchain-accounts/host/types/host.pb.go @@ -78,8 +78,67 @@ func (m *Params) GetAllowMessages() []string { return nil } +// QueryRequest defines the parameters for a particular query request +// by an interchain account. +type QueryRequest struct { + // path defines the path of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // data defines the payload of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *QueryRequest) Reset() { *m = QueryRequest{} } +func (m *QueryRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRequest) ProtoMessage() {} +func (*QueryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_48e202774f13d08e, []int{1} +} +func (m *QueryRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequest.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 *QueryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequest.Merge(m, src) +} +func (m *QueryRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequest proto.InternalMessageInfo + +func (m *QueryRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *QueryRequest) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "ibc.applications.interchain_accounts.host.v1.Params") + proto.RegisterType((*QueryRequest)(nil), "ibc.applications.interchain_accounts.host.v1.QueryRequest") } func init() { @@ -87,23 +146,25 @@ func init() { } var fileDescriptor_48e202774f13d08e = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xcf, 0xbf, 0x4a, 0xc4, 0x40, - 0x10, 0xc7, 0xf1, 0x44, 0xe1, 0xd0, 0xf8, 0xa7, 0x48, 0x75, 0xd5, 0x72, 0x0a, 0xc2, 0x15, 0x66, - 0x97, 0xd3, 0xe2, 0xac, 0x05, 0x1b, 0x41, 0x90, 0x94, 0x36, 0x61, 0x77, 0xb2, 0x24, 0x0b, 0xbb, - 0x3b, 0x21, 0xb3, 0x89, 0xf8, 0x16, 0x3e, 0x96, 0xe5, 0x95, 0x96, 0x92, 0xbc, 0x88, 0x24, 0x0a, - 0x2a, 0x58, 0x0d, 0x7c, 0xe0, 0x07, 0xf3, 0x4d, 0xb6, 0x46, 0x81, 0x90, 0x4d, 0x63, 0x0d, 0xc8, - 0x60, 0xd0, 0x93, 0x30, 0x3e, 0xe8, 0x16, 0x6a, 0x69, 0x7c, 0x21, 0x01, 0xb0, 0xf3, 0x81, 0x44, - 0x8d, 0x14, 0x44, 0xbf, 0x99, 0x2f, 0x6f, 0x5a, 0x0c, 0x98, 0x5e, 0x1a, 0x05, 0xfc, 0xf7, 0x90, - 0xff, 0x33, 0xe4, 0xf3, 0xa0, 0xdf, 0x9c, 0xe7, 0xc9, 0xe2, 0x51, 0xb6, 0xd2, 0x51, 0x7a, 0x96, - 0x1c, 0x4f, 0x58, 0x68, 0x2f, 0x95, 0xd5, 0xe5, 0x32, 0x5e, 0xc5, 0xeb, 0x83, 0xfc, 0x68, 0xb2, - 0xbb, 0x2f, 0x4a, 0x2f, 0x92, 0x53, 0x69, 0x2d, 0x3e, 0x17, 0x4e, 0x13, 0xc9, 0x4a, 0xd3, 0x72, - 0x6f, 0xb5, 0xbf, 0x3e, 0xcc, 0x4f, 0x66, 0x7d, 0xf8, 0xc6, 0xdb, 0xf2, 0x6d, 0x60, 0xf1, 0x6e, - 0x60, 0xf1, 0xc7, 0xc0, 0xe2, 0xd7, 0x91, 0x45, 0xbb, 0x91, 0x45, 0xef, 0x23, 0x8b, 0x9e, 0xee, - 0x2b, 0x13, 0xea, 0x4e, 0x71, 0x40, 0x27, 0x00, 0xc9, 0x21, 0x09, 0xa3, 0x20, 0xab, 0x50, 0xf4, - 0x37, 0xc2, 0x61, 0xd9, 0x59, 0x4d, 0x53, 0x34, 0x89, 0xab, 0x6d, 0xf6, 0xf3, 0x76, 0xf6, 0xb7, - 0x37, 0xbc, 0x34, 0x9a, 0xd4, 0x62, 0xce, 0xbd, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x51, 0x50, - 0x78, 0xd7, 0x29, 0x01, 0x00, 0x00, + // 284 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xd0, 0x31, 0x4b, 0xfc, 0x30, + 0x18, 0x06, 0xf0, 0xcb, 0xfd, 0xff, 0x1c, 0x5e, 0x3c, 0x1d, 0x3a, 0xdd, 0x14, 0xce, 0x03, 0xa1, + 0x83, 0x6d, 0x38, 0x05, 0xcf, 0x59, 0x70, 0x11, 0x04, 0xcd, 0xe8, 0x52, 0xde, 0xa4, 0xa1, 0x0d, + 0xb4, 0x4d, 0xed, 0x9b, 0x56, 0xee, 0x5b, 0xf8, 0xb1, 0x1c, 0x6f, 0x74, 0x94, 0xf6, 0x8b, 0x48, + 0xa3, 0xa0, 0x82, 0x53, 0x1e, 0x7e, 0xf0, 0x04, 0xde, 0x87, 0x6e, 0x8d, 0x54, 0x1c, 0xea, 0xba, + 0x30, 0x0a, 0x9c, 0xb1, 0x15, 0x72, 0x53, 0x39, 0xdd, 0xa8, 0x1c, 0x4c, 0x95, 0x80, 0x52, 0xb6, + 0xad, 0x1c, 0xf2, 0xdc, 0xa2, 0xe3, 0xdd, 0xc6, 0xbf, 0x71, 0xdd, 0x58, 0x67, 0x83, 0x33, 0x23, + 0x55, 0xfc, 0xb3, 0x18, 0xff, 0x51, 0x8c, 0x7d, 0xa1, 0xdb, 0xac, 0x05, 0x9d, 0xdd, 0x43, 0x03, + 0x25, 0x06, 0x27, 0x74, 0x31, 0x62, 0xa2, 0x2b, 0x90, 0x85, 0x4e, 0x97, 0x64, 0x45, 0xc2, 0x03, + 0x71, 0x38, 0xda, 0xcd, 0x27, 0x05, 0xa7, 0xf4, 0x18, 0x8a, 0xc2, 0x3e, 0x27, 0xa5, 0x46, 0x84, + 0x4c, 0xe3, 0x72, 0xba, 0xfa, 0x17, 0xce, 0xc5, 0x91, 0xd7, 0xbb, 0x2f, 0x5c, 0x5f, 0xd2, 0xc5, + 0x43, 0xab, 0x9b, 0x9d, 0xd0, 0x4f, 0xad, 0x46, 0x17, 0x04, 0xf4, 0x7f, 0x0d, 0x2e, 0xf7, 0x3f, + 0xce, 0x85, 0xcf, 0xa3, 0xa5, 0xe0, 0x60, 0x39, 0x5d, 0x91, 0x70, 0x21, 0x7c, 0xbe, 0x4e, 0x5f, + 0x7b, 0x46, 0xf6, 0x3d, 0x23, 0xef, 0x3d, 0x23, 0x2f, 0x03, 0x9b, 0xec, 0x07, 0x36, 0x79, 0x1b, + 0xd8, 0xe4, 0xf1, 0x36, 0x33, 0x2e, 0x6f, 0x65, 0xac, 0x6c, 0xc9, 0x95, 0xc5, 0xd2, 0x22, 0x37, + 0x52, 0x45, 0x99, 0xe5, 0xdd, 0x15, 0x2f, 0x6d, 0xda, 0x16, 0x1a, 0xc7, 0xb1, 0x90, 0x9f, 0x6f, + 0xa3, 0xef, 0x73, 0xa3, 0xdf, 0x3b, 0xb9, 0x5d, 0xad, 0x51, 0xce, 0xfc, 0x4c, 0x17, 0x1f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x56, 0xc6, 0xd2, 0x5a, 0x61, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -148,6 +209,43 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryRequest) 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 *QueryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintHost(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintHost(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintHost(dAtA []byte, offset int, v uint64) int { offset -= sovHost(v) base := offset @@ -177,6 +275,23 @@ func (m *Params) Size() (n int) { return n } +func (m *QueryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Path) + if l > 0 { + n += 1 + l + sovHost(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovHost(uint64(l)) + } + return n +} + func sovHost(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -285,6 +400,122 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryRequest) 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 ErrIntOverflowHost + } + 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: QueryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHost + } + 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 ErrInvalidLengthHost + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHost + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHost + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthHost + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHost + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHost(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHost + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipHost(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/apps/27-interchain-accounts/host/types/msgs.go b/modules/apps/27-interchain-accounts/host/types/msgs.go index 845139a4a34..06641c0b7e6 100644 --- a/modules/apps/27-interchain-accounts/host/types/msgs.go +++ b/modules/apps/27-interchain-accounts/host/types/msgs.go @@ -11,6 +11,9 @@ import ( var ( _ sdk.Msg = (*MsgUpdateParams)(nil) _ sdk.HasValidateBasic = (*MsgUpdateParams)(nil) + + _ sdk.Msg = (*MsgModuleQuerySafe)(nil) + _ sdk.HasValidateBasic = (*MsgModuleQuerySafe)(nil) ) // NewMsgUpdateParams creates a new MsgUpdateParams instance @@ -21,7 +24,7 @@ func NewMsgUpdateParams(signer string, params Params) *MsgUpdateParams { } } -// ValidateBasic implements sdk.Msg +// ValidateBasic implements sdk.HasValidateBasic func (msg MsgUpdateParams) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { @@ -40,3 +43,35 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{accAddr} } + +// NewMsgModuleQuerySafe creates a new MsgModuleQuerySafe instance +func NewMsgModuleQuerySafe(signer string, requests []*QueryRequest) *MsgModuleQuerySafe { + return &MsgModuleQuerySafe{ + Signer: signer, + Requests: requests, + } +} + +// ValidateBasic implements sdk.HasValidateBasic +func (msg MsgModuleQuerySafe) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + + if len(msg.Requests) == 0 { + return errorsmod.Wrapf(ibcerrors.ErrInvalidRequest, "no queries provided") + } + + return nil +} + +// GetSigners implements sdk.Msg +func (msg MsgModuleQuerySafe) GetSigners() []sdk.AccAddress { + accAddr, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{accAddr} +} diff --git a/modules/apps/27-interchain-accounts/host/types/msgs_test.go b/modules/apps/27-interchain-accounts/host/types/msgs_test.go index 1170f82b895..8b95e5d7e05 100644 --- a/modules/apps/27-interchain-accounts/host/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/host/types/msgs_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -71,3 +72,70 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } } } + +func TestMsgModuleQuerySafeValidateBasic(t *testing.T) { + queryRequest := &types.QueryRequest{ + Path: "/cosmos.bank.v1beta1.Query/Balance", + Data: []byte{}, + } + + testCases := []struct { + name string + msg *types.MsgModuleQuerySafe + expErr error + }{ + { + "success: valid signer address", + types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []*types.QueryRequest{queryRequest}), + nil, + }, + { + "failure: invalid signer address", + types.NewMsgModuleQuerySafe("signer", []*types.QueryRequest{queryRequest}), + ibcerrors.ErrInvalidAddress, + }, + { + "failure: empty query requests", + types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []*types.QueryRequest{}), + ibcerrors.ErrInvalidRequest, + }, + } + + for _, tc := range testCases { + tc := tc + + err := tc.msg.ValidateBasic() + + expPass := tc.expErr == nil + if expPass { + require.NoError(t, err) + } else { + require.Error(t, err) + require.ErrorIs(t, err, tc.expErr) + } + } +} + +func TestMsgModuleQuerySafeGetSigners(t *testing.T) { + testCases := []struct { + name string + address sdk.AccAddress + expPass bool + }{ + {"success: valid address", sdk.AccAddress(ibctesting.TestAccAddress), true}, + {"failure: nil address", nil, false}, + } + + for _, tc := range testCases { + tc := tc + + msg := types.NewMsgModuleQuerySafe(tc.address.String(), []*types.QueryRequest{}) + if tc.expPass { + require.Equal(t, []sdk.AccAddress{tc.address}, msg.GetSigners()) + } else { + require.Panics(t, func() { + msg.GetSigners() + }) + } + } +} diff --git a/modules/apps/27-interchain-accounts/host/types/tx.pb.go b/modules/apps/27-interchain-accounts/host/types/tx.pb.go index ebcc8995cb5..8663234557f 100644 --- a/modules/apps/27-interchain-accounts/host/types/tx.pb.go +++ b/modules/apps/27-interchain-accounts/host/types/tx.pb.go @@ -109,9 +109,107 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe +type MsgModuleQuerySafe struct { + // signer address + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // requests defines the module safe queries to execute. + Requests []*QueryRequest `protobuf:"bytes,2,rep,name=requests,proto3" json:"requests,omitempty"` +} + +func (m *MsgModuleQuerySafe) Reset() { *m = MsgModuleQuerySafe{} } +func (m *MsgModuleQuerySafe) String() string { return proto.CompactTextString(m) } +func (*MsgModuleQuerySafe) ProtoMessage() {} +func (*MsgModuleQuerySafe) Descriptor() ([]byte, []int) { + return fileDescriptor_fa437afde7f1e7ae, []int{2} +} +func (m *MsgModuleQuerySafe) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgModuleQuerySafe) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgModuleQuerySafe.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 *MsgModuleQuerySafe) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgModuleQuerySafe.Merge(m, src) +} +func (m *MsgModuleQuerySafe) XXX_Size() int { + return m.Size() +} +func (m *MsgModuleQuerySafe) XXX_DiscardUnknown() { + xxx_messageInfo_MsgModuleQuerySafe.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgModuleQuerySafe proto.InternalMessageInfo + +// MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe +type MsgModuleQuerySafeResponse struct { + // height at which the responses were queried + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // protobuf encoded responses for each query + Responses [][]byte `protobuf:"bytes,2,rep,name=responses,proto3" json:"responses,omitempty"` +} + +func (m *MsgModuleQuerySafeResponse) Reset() { *m = MsgModuleQuerySafeResponse{} } +func (m *MsgModuleQuerySafeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgModuleQuerySafeResponse) ProtoMessage() {} +func (*MsgModuleQuerySafeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fa437afde7f1e7ae, []int{3} +} +func (m *MsgModuleQuerySafeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgModuleQuerySafeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgModuleQuerySafeResponse.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 *MsgModuleQuerySafeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgModuleQuerySafeResponse.Merge(m, src) +} +func (m *MsgModuleQuerySafeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgModuleQuerySafeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgModuleQuerySafeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgModuleQuerySafeResponse proto.InternalMessageInfo + +func (m *MsgModuleQuerySafeResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *MsgModuleQuerySafeResponse) GetResponses() [][]byte { + if m != nil { + return m.Responses + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "ibc.applications.interchain_accounts.host.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgModuleQuerySafe)(nil), "ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe") + proto.RegisterType((*MsgModuleQuerySafeResponse)(nil), "ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafeResponse") } func init() { @@ -119,29 +217,36 @@ func init() { } var fileDescriptor_fa437afde7f1e7ae = []byte{ - // 352 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xcd, 0x4c, 0x4a, 0xd6, - 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0xcf, 0xcc, 0x2b, - 0x49, 0x2d, 0x4a, 0xce, 0x48, 0xcc, 0xcc, 0x8b, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, - 0xd6, 0xcf, 0xc8, 0x2f, 0x2e, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0xd2, 0xc9, 0x4c, 0x4a, 0xd6, 0x43, 0xd6, 0xa6, 0x87, 0x45, 0x9b, 0x1e, 0x48, 0x9b, - 0x5e, 0x99, 0xa1, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x58, 0xa3, 0x3e, 0x88, 0x05, 0x31, 0x43, - 0x4a, 0x3c, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, 0xb7, 0x38, 0x1d, 0x64, 0x76, 0x6e, 0x71, - 0x3a, 0x54, 0xc2, 0x9c, 0x24, 0x37, 0x81, 0x2d, 0x01, 0x6b, 0x54, 0xea, 0x63, 0xe4, 0xe2, 0xf7, - 0x2d, 0x4e, 0x0f, 0x2d, 0x48, 0x49, 0x2c, 0x49, 0x0d, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x16, 0x12, - 0xe3, 0x62, 0x2b, 0xce, 0x4c, 0xcf, 0x4b, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, - 0xf2, 0x84, 0x82, 0xb8, 0xd8, 0x0a, 0xc0, 0x2a, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0x4c, - 0xf4, 0x48, 0xf1, 0x92, 0x1e, 0xc4, 0x74, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x26, - 0x59, 0xf1, 0x77, 0x2c, 0x90, 0x67, 0x68, 0x7a, 0xbe, 0x41, 0x0b, 0x6a, 0x89, 0x92, 0x24, 0x97, - 0x38, 0x9a, 0x7b, 0x82, 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x8d, 0x16, 0x33, 0x72, 0x31, - 0xfb, 0x16, 0xa7, 0x0b, 0x4d, 0x61, 0xe4, 0xe2, 0x41, 0x71, 0xb0, 0x2d, 0x69, 0x0e, 0x41, 0x33, - 0x5f, 0xca, 0x95, 0x22, 0xed, 0x30, 0xe7, 0x49, 0xb1, 0x36, 0x3c, 0xdf, 0xa0, 0xc5, 0xe8, 0x94, - 0x72, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, - 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x5e, 0xe9, 0x99, 0x25, 0x19, - 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xd0, 0x88, 0xcc, 0x4c, 0x4a, 0xd6, 0x4d, 0xcf, 0xd7, - 0x2f, 0xb3, 0xd0, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x06, 0x45, 0x62, 0xb1, 0xbe, 0x91, - 0xb9, 0x2e, 0xc2, 0x05, 0xba, 0xa8, 0xf1, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, - 0x3e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0xa2, 0x96, 0x3e, 0x8d, 0x02, 0x00, 0x00, + // 456 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xc7, 0x33, 0x6d, 0x5d, 0xec, 0xb4, 0x50, 0x08, 0x62, 0x6b, 0x90, 0xb4, 0xec, 0x69, 0x29, + 0xee, 0x0c, 0x5d, 0x95, 0x4a, 0x41, 0x90, 0x82, 0x20, 0x42, 0x40, 0x47, 0xf4, 0xe0, 0x45, 0x26, + 0xb3, 0xe3, 0x64, 0xa0, 0xc9, 0xc4, 0xbc, 0xc9, 0x62, 0x6f, 0xe2, 0xc9, 0x93, 0x78, 0xd0, 0xa3, + 0xe0, 0x47, 0xe8, 0x77, 0xf0, 0xd2, 0x63, 0x8f, 0x9e, 0x44, 0x76, 0x0f, 0xfd, 0x1a, 0x92, 0x49, + 0xda, 0xda, 0xd4, 0x1e, 0x42, 0x6f, 0x99, 0x64, 0xfe, 0xbf, 0xf7, 0x7b, 0x99, 0x79, 0xf8, 0xbe, + 0x8e, 0x05, 0xe5, 0x79, 0xbe, 0xa7, 0x05, 0xb7, 0xda, 0x64, 0x40, 0x75, 0x66, 0x65, 0x21, 0x12, + 0xae, 0xb3, 0x37, 0x5c, 0x08, 0x53, 0x66, 0x16, 0x68, 0x62, 0xc0, 0xd2, 0xc9, 0x16, 0xb5, 0xef, + 0x49, 0x5e, 0x18, 0x6b, 0xfc, 0x3b, 0x3a, 0x16, 0xe4, 0xdf, 0x18, 0xf9, 0x4f, 0x8c, 0x54, 0x31, + 0x32, 0xd9, 0x0a, 0x6e, 0x28, 0xa3, 0x8c, 0x0b, 0xd2, 0xea, 0xa9, 0x66, 0x04, 0xab, 0xc2, 0x40, + 0x6a, 0x80, 0xa6, 0xa0, 0x2a, 0x76, 0x0a, 0xaa, 0xf9, 0xb0, 0xdd, 0xc9, 0xc9, 0x15, 0x71, 0xc1, + 0xfe, 0x67, 0x84, 0x57, 0x22, 0x50, 0x2f, 0xf3, 0x31, 0xb7, 0xf2, 0x19, 0x2f, 0x78, 0x0a, 0xfe, + 0x4d, 0xdc, 0x03, 0xad, 0x32, 0x59, 0xac, 0xa1, 0x0d, 0x34, 0x58, 0x64, 0xcd, 0xca, 0x67, 0xb8, + 0x97, 0xbb, 0x1d, 0x6b, 0x73, 0x1b, 0x68, 0xb0, 0x34, 0xba, 0x47, 0xba, 0xb4, 0x44, 0x6a, 0xfa, + 0xee, 0xc2, 0xe1, 0xef, 0x75, 0x8f, 0x35, 0xa4, 0x9d, 0x95, 0x4f, 0x3f, 0xd6, 0xbd, 0x8f, 0xc7, + 0x07, 0x9b, 0x4d, 0x91, 0xfe, 0x2d, 0xbc, 0xda, 0xf2, 0x61, 0x12, 0x72, 0x93, 0x81, 0xec, 0x7f, + 0x43, 0xd8, 0x8f, 0x40, 0x45, 0x66, 0x5c, 0xee, 0xc9, 0xe7, 0xa5, 0x2c, 0xf6, 0x5f, 0xf0, 0xb7, + 0xf2, 0x52, 0xdd, 0x57, 0xf8, 0x7a, 0x21, 0xdf, 0x95, 0x12, 0x6c, 0x25, 0x3c, 0x3f, 0x58, 0x1a, + 0xed, 0x74, 0x13, 0x76, 0x25, 0x58, 0x8d, 0x60, 0xa7, 0xac, 0x8b, 0xca, 0x0c, 0x07, 0x17, 0xb5, + 0x4e, 0xac, 0x2b, 0xbd, 0x44, 0x6a, 0x95, 0x58, 0xa7, 0xb7, 0xc0, 0x9a, 0x95, 0x7f, 0x1b, 0x2f, + 0x16, 0xcd, 0x9e, 0xda, 0x6f, 0x99, 0x9d, 0xbd, 0x18, 0xfd, 0x9c, 0xc3, 0xf3, 0x11, 0x28, 0xff, + 0x2b, 0xc2, 0xcb, 0xe7, 0x0e, 0xe7, 0x61, 0xb7, 0x1e, 0x5a, 0xff, 0x32, 0x78, 0x7c, 0xa5, 0xf8, + 0x69, 0x53, 0xdf, 0xab, 0x6b, 0xd3, 0x3a, 0x87, 0x47, 0x9d, 0xd1, 0x2d, 0x42, 0xf0, 0xe4, 0xaa, + 0x84, 0x13, 0xbf, 0xe0, 0xda, 0x87, 0xe3, 0x83, 0x4d, 0xb4, 0x3b, 0x3e, 0x9c, 0x86, 0xe8, 0x68, + 0x1a, 0xa2, 0x3f, 0xd3, 0x10, 0x7d, 0x99, 0x85, 0xde, 0xd1, 0x2c, 0xf4, 0x7e, 0xcd, 0x42, 0xef, + 0xf5, 0x53, 0xa5, 0x6d, 0x52, 0xc6, 0x44, 0x98, 0x94, 0x36, 0x43, 0xa5, 0x63, 0x31, 0x54, 0x86, + 0x4e, 0x1e, 0xd0, 0xd4, 0x51, 0xa1, 0x1a, 0x28, 0xa0, 0xa3, 0xed, 0xe1, 0x99, 0xc4, 0xf0, 0xfc, + 0x2c, 0xd9, 0xfd, 0x5c, 0x42, 0xdc, 0x73, 0xa3, 0x74, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x49, 0x5c, 0x48, 0xd7, 0x19, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -158,6 +263,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // UpdateParams defines a rpc handler for MsgUpdateParams. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. + ModuleQuerySafe(ctx context.Context, in *MsgModuleQuerySafe, opts ...grpc.CallOption) (*MsgModuleQuerySafeResponse, error) } type msgClient struct { @@ -177,10 +284,21 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) ModuleQuerySafe(ctx context.Context, in *MsgModuleQuerySafe, opts ...grpc.CallOption) (*MsgModuleQuerySafeResponse, error) { + out := new(MsgModuleQuerySafeResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.interchain_accounts.host.v1.Msg/ModuleQuerySafe", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a rpc handler for MsgUpdateParams. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. + ModuleQuerySafe(context.Context, *MsgModuleQuerySafe) (*MsgModuleQuerySafeResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -190,6 +308,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) ModuleQuerySafe(ctx context.Context, req *MsgModuleQuerySafe) (*MsgModuleQuerySafeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModuleQuerySafe not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -213,6 +334,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_ModuleQuerySafe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgModuleQuerySafe) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ModuleQuerySafe(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.interchain_accounts.host.v1.Msg/ModuleQuerySafe", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ModuleQuerySafe(ctx, req.(*MsgModuleQuerySafe)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.interchain_accounts.host.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -221,6 +360,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "ModuleQuerySafe", + Handler: _Msg_ModuleQuerySafe_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/interchain_accounts/host/v1/tx.proto", @@ -289,6 +432,87 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgModuleQuerySafe) 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 *MsgModuleQuerySafe) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgModuleQuerySafe) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Requests) > 0 { + for iNdEx := len(m.Requests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Requests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgModuleQuerySafeResponse) 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 *MsgModuleQuerySafeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgModuleQuerySafeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Responses) > 0 { + for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Responses[iNdEx]) + copy(dAtA[i:], m.Responses[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Responses[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Height != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -324,6 +548,43 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgModuleQuerySafe) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Requests) > 0 { + for _, e := range m.Requests { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgModuleQuerySafeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovTx(uint64(m.Height)) + } + if len(m.Responses) > 0 { + for _, b := range m.Responses { + l = len(b) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -495,6 +756,223 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgModuleQuerySafe) 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: MsgModuleQuerySafe: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgModuleQuerySafe: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Requests = append(m.Requests, &QueryRequest{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgModuleQuerySafeResponse) 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: MsgModuleQuerySafeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgModuleQuerySafeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Responses = append(m.Responses, make([]byte, postIndex-iNdEx)) + copy(m.Responses[len(m.Responses)-1], 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 + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/apps/27-interchain-accounts/types/router.go b/modules/apps/27-interchain-accounts/types/router.go index 007091b9d0d..32a334f5f46 100644 --- a/modules/apps/27-interchain-accounts/types/router.go +++ b/modules/apps/27-interchain-accounts/types/router.go @@ -10,3 +10,11 @@ import ( type MessageRouter interface { Handler(msg sdk.Msg) baseapp.MsgServiceHandler } + +// QueryRouter ADR 021 query type routing +// https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md +type QueryRouter interface { + // Route returns the GRPCQueryHandler for a given query route path or nil + // if not found + Route(path string) baseapp.GRPCQueryHandler +} diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index 56cce8c58d2..ab5669692a0 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -466,6 +466,7 @@ func NewSimApp( app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter()) // Create IBC Router ibcRouter := porttypes.NewRouter() diff --git a/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/proto/ibc/applications/interchain_accounts/host/v1/host.proto index f036857113a..9165f36e794 100644 --- a/proto/ibc/applications/interchain_accounts/host/v1/host.proto +++ b/proto/ibc/applications/interchain_accounts/host/v1/host.proto @@ -12,3 +12,14 @@ message Params { // allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. repeated string allow_messages = 2; } + +// QueryRequest defines the parameters for a particular query request +// by an interchain account. +message QueryRequest { + // path defines the path of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + string path = 1; + // data defines the payload of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + bytes data = 2; +} diff --git a/proto/ibc/applications/interchain_accounts/host/v1/tx.proto b/proto/ibc/applications/interchain_accounts/host/v1/tx.proto index 5a8073bc931..22e8c9b3567 100644 --- a/proto/ibc/applications/interchain_accounts/host/v1/tx.proto +++ b/proto/ibc/applications/interchain_accounts/host/v1/tx.proto @@ -14,6 +14,9 @@ service Msg { // UpdateParams defines a rpc handler for MsgUpdateParams. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. + rpc ModuleQuerySafe(MsgModuleQuerySafe) returns (MsgModuleQuerySafeResponse); } // MsgUpdateParams defines the payload for Msg/UpdateParams @@ -33,3 +36,25 @@ message MsgUpdateParams { // MsgUpdateParamsResponse defines the response for Msg/UpdateParams message MsgUpdateParamsResponse {} + +// MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe +message MsgModuleQuerySafe { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // requests defines the module safe queries to execute. + repeated QueryRequest requests = 2; +} + +// MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe +message MsgModuleQuerySafeResponse { + // height at which the responses were queried + uint64 height = 1; + + // protobuf encoded responses for each query + repeated bytes responses = 2; +} diff --git a/testing/simapp/app.go b/testing/simapp/app.go index dc44a54bd14..da2b35cc60c 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -458,10 +458,11 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, + scopedICAHostKeeper, app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter()) // Create IBC Router ibcRouter := porttypes.NewRouter()