diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index d2093dd5c5d..e6bead7e83f 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -53,6 +53,8 @@ - [QueryTotalAckFeesResponse](#ibc.applications.fee.v1.QueryTotalAckFeesResponse) - [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) - [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) + - [QueryTotalTimeoutFeesRequest](#ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest) + - [QueryTotalTimeoutFeesResponse](#ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse) - [Query](#ibc.applications.fee.v1.Query) @@ -1047,6 +1049,36 @@ QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc + + + +### QueryTotalTimeoutFeesRequest +QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `packet_id` | [ibc.core.channel.v1.PacketId](#ibc.core.channel.v1.PacketId) | | the packet identifier for the associated fees | + + + + + + + + +### QueryTotalTimeoutFeesResponse +QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `timeout_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | the total packet timeout fees | + + + + + @@ -1065,6 +1097,7 @@ Query provides defines the gRPC querier service. | `IncentivizedPacket` | [QueryIncentivizedPacketRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketRequest) | [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) | Gets the fees expected for submitting the ReceivePacket, AcknowledgementPacket, and TimeoutPacket messages for the given packet | GET|/ibc/apps/fee/v1/incentivized_packet/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| | `TotalRecvFees` | [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) | [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) | TotalRecvFees returns the total receive fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_recv_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| | `TotalAckFees` | [QueryTotalAckFeesRequest](#ibc.applications.fee.v1.QueryTotalAckFeesRequest) | [QueryTotalAckFeesResponse](#ibc.applications.fee.v1.QueryTotalAckFeesResponse) | TotalAckFees returns the total acknowledgement fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_ack_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| +| `TotalTimeoutFees` | [QueryTotalTimeoutFeesRequest](#ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest) | [QueryTotalTimeoutFeesResponse](#ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse) | TotalTimeoutFees returns the total timeout fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_timeout_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| diff --git a/modules/apps/29-fee/keeper/grpc_query.go b/modules/apps/29-fee/keeper/grpc_query.go index dd527f0fe59..54969471086 100644 --- a/modules/apps/29-fee/keeper/grpc_query.go +++ b/modules/apps/29-fee/keeper/grpc_query.go @@ -117,3 +117,29 @@ func (k Keeper) TotalAckFees(goCtx context.Context, req *types.QueryTotalAckFees AckFees: ackFees, }, nil } + +// TotalTimeoutFees implements the Query/TotalTimeoutFees gRPC method +func (k Keeper) TotalTimeoutFees(goCtx context.Context, req *types.QueryTotalTimeoutFeesRequest) (*types.QueryTotalTimeoutFeesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + feesInEscrow, found := k.GetFeesInEscrow(ctx, req.PacketId) + if !found { + return nil, status.Errorf( + codes.NotFound, + sdkerrors.Wrapf(types.ErrFeeNotFound, "channel: %s, port: %s, sequence: %d", req.PacketId.ChannelId, req.PacketId.PortId, req.PacketId.Sequence).Error(), + ) + } + + var timeoutFees sdk.Coins + for _, packetFee := range feesInEscrow.PacketFees { + timeoutFees = timeoutFees.Add(packetFee.Fee.TimeoutFee...) + } + + return &types.QueryTotalTimeoutFeesResponse{ + TimeoutFees: timeoutFees, + }, nil +} diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index 5bcb7d31416..fe06afdc5bd 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -267,3 +267,67 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() { }) } } + +func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() { + var ( + req *types.QueryTotalTimeoutFeesRequest + ) + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "success", + func() {}, + true, + }, + { + "packet not found", + func() { + req.PacketId = channeltypes.NewPacketId(ibctesting.FirstChannelID, ibctesting.MockFeePort, 100) + }, + false, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + suite.SetupTest() // reset + + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), ibctesting.MockFeePort, ibctesting.FirstChannelID) + + packetID := channeltypes.NewPacketId(ibctesting.FirstChannelID, ibctesting.MockFeePort, 1) + + fee := types.NewFee(defaultReceiveFee, defaultAckFee, defaultTimeoutFee) + packetFee := types.NewPacketFee(fee, suite.chainA.SenderAccount.GetAddress().String(), []string(nil)) + + for i := 0; i < 3; i++ { + // escrow three packet fees for the same packet + err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), packetID, packetFee) + suite.Require().NoError(err) + } + + req = &types.QueryTotalTimeoutFeesRequest{ + PacketId: packetID, + } + + tc.malleate() + + ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) + res, err := suite.queryClient.TotalTimeoutFees(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + + // expected total is three times the default acknowledgement fee + expectedFees := defaultTimeoutFee.Add(defaultTimeoutFee...).Add(defaultTimeoutFee...) + suite.Require().Equal(expectedFees, res.TimeoutFees) + } else { + suite.Require().Error(err) + } + }) + } +} diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index a4c5b0ee658..b9f241000ab 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -419,6 +419,98 @@ func (m *QueryTotalAckFeesResponse) GetAckFees() github_com_cosmos_cosmos_sdk_ty return nil } +// QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc +type QueryTotalTimeoutFeesRequest struct { + // the packet identifier for the associated fees + PacketId types.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id"` +} + +func (m *QueryTotalTimeoutFeesRequest) Reset() { *m = QueryTotalTimeoutFeesRequest{} } +func (m *QueryTotalTimeoutFeesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTimeoutFeesRequest) ProtoMessage() {} +func (*QueryTotalTimeoutFeesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{8} +} +func (m *QueryTotalTimeoutFeesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTimeoutFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTimeoutFeesRequest.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 *QueryTotalTimeoutFeesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTimeoutFeesRequest.Merge(m, src) +} +func (m *QueryTotalTimeoutFeesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTimeoutFeesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTimeoutFeesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalTimeoutFeesRequest proto.InternalMessageInfo + +func (m *QueryTotalTimeoutFeesRequest) GetPacketId() types.PacketId { + if m != nil { + return m.PacketId + } + return types.PacketId{} +} + +// QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc +type QueryTotalTimeoutFeesResponse struct { + // the total packet timeout fees + TimeoutFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=timeout_fees,json=timeoutFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"timeout_fees" yaml:"timeout_fees"` +} + +func (m *QueryTotalTimeoutFeesResponse) Reset() { *m = QueryTotalTimeoutFeesResponse{} } +func (m *QueryTotalTimeoutFeesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalTimeoutFeesResponse) ProtoMessage() {} +func (*QueryTotalTimeoutFeesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{9} +} +func (m *QueryTotalTimeoutFeesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalTimeoutFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalTimeoutFeesResponse.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 *QueryTotalTimeoutFeesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalTimeoutFeesResponse.Merge(m, src) +} +func (m *QueryTotalTimeoutFeesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalTimeoutFeesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalTimeoutFeesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalTimeoutFeesResponse proto.InternalMessageInfo + +func (m *QueryTotalTimeoutFeesResponse) GetTimeoutFees() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.TimeoutFees + } + return nil +} + func init() { proto.RegisterType((*QueryIncentivizedPacketsRequest)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsRequest") proto.RegisterType((*QueryIncentivizedPacketsResponse)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsResponse") @@ -428,6 +520,8 @@ func init() { proto.RegisterType((*QueryTotalRecvFeesResponse)(nil), "ibc.applications.fee.v1.QueryTotalRecvFeesResponse") proto.RegisterType((*QueryTotalAckFeesRequest)(nil), "ibc.applications.fee.v1.QueryTotalAckFeesRequest") proto.RegisterType((*QueryTotalAckFeesResponse)(nil), "ibc.applications.fee.v1.QueryTotalAckFeesResponse") + proto.RegisterType((*QueryTotalTimeoutFeesRequest)(nil), "ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest") + proto.RegisterType((*QueryTotalTimeoutFeesResponse)(nil), "ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse") } func init() { @@ -435,56 +529,61 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 775 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x6f, 0xd3, 0x48, - 0x14, 0xce, 0x74, 0xbb, 0xdb, 0x76, 0xda, 0xd5, 0xae, 0xa6, 0x95, 0x36, 0x8d, 0x76, 0x9d, 0xd4, - 0xab, 0x5d, 0x22, 0xa4, 0x78, 0x94, 0x54, 0x88, 0x96, 0x13, 0xb4, 0xa8, 0xa2, 0x27, 0x4a, 0xc4, - 0x09, 0x81, 0x22, 0x67, 0x3c, 0x71, 0x46, 0x49, 0x3c, 0x6e, 0xec, 0x18, 0x52, 0x5a, 0x0e, 0x95, - 0x10, 0x12, 0xea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, 0x7d, 0xfc, 0x38, 0xbe, 0x5c, 0x86, 0x78, 0xaf, 0x30, 0x6b, 0x27, - 0xde, 0xe8, 0x89, 0x98, 0x3a, 0x92, 0x61, 0x4f, 0x10, 0x75, 0x08, 0x4d, 0xc6, 0xa3, 0xb3, 0x1d, - 0xf4, 0x0d, 0xc0, 0xdf, 0x4f, 0xcd, 0x18, 0x2a, 0xfd, 0x58, 0x50, 0xbf, 0x81, 0xcf, 0x2c, 0x8e, - 0x94, 0xa3, 0xf4, 0x3f, 0x91, 0xf2, 0x1f, 0xa1, 0xa0, 0x47, 0xbe, 0x2f, 0xf0, 0x95, 0x78, 0x4e, - 0x2f, 0x48, 0xfa, 0x57, 0x00, 0x67, 0x92, 0x33, 0x86, 0x8a, 0x43, 0xa8, 0x38, 0x3d, 0xee, 0x99, - 0xd2, 0x28, 0x29, 0x4a, 0xf7, 0x8e, 0xd4, 0xfd, 0x10, 0x75, 0x06, 0xe8, 0x8e, 0xc6, 0xf4, 0x62, - 0x64, 0xaf, 0xdc, 0xde, 0x3f, 0xd2, 0xc0, 0xc1, 0x91, 0x06, 0x3e, 0x1d, 0x69, 0xe0, 0xc5, 0xb1, - 0x96, 0x3a, 0x38, 0xd6, 0x52, 0x1f, 0x8e, 0xb5, 0xd4, 0xbd, 0x2b, 0xbd, 0x3b, 0x81, 0x55, 0x49, - 0xc1, 0xe6, 0x38, 0x58, 0xc4, 0x2d, 0x6e, 0x75, 0x9a, 0xd4, 0x0b, 0xf9, 0x96, 0x96, 0x0b, 0x82, - 0xb2, 0x5c, 0x13, 0xd5, 0xdf, 0xe4, 0xff, 0x87, 0xc5, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2b, - 0xa4, 0xf4, 0xa9, 0x45, 0x09, 0x00, 0x00, + // 853 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6e, 0xe3, 0x44,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 0xf0, 0x8e, 0x2d, 0xeb, 0x86, 0x68, 0x1f, 0xe5, + 0xe1, 0xed, 0x7f, 0x7b, 0x0d, 0x7a, 0xb8, 0x00, 0x8f, 0x59, 0xfb, 0x2b, 0xbf, 0xb1, 0x6c, 0x99, + 0x96, 0xe0, 0xcb, 0xe8, 0xe8, 0xef, 0xa1, 0x49, 0x86, 0x06, 0x69, 0xcb, 0xba, 0x19, 0x1d, 0x36, + 0x3e, 0x38, 0x39, 0x37, 0xc0, 0xe9, 0xb9, 0x01, 0x7e, 0x3f, 0x37, 0xc0, 0x37, 0x17, 0x46, 0xee, + 0xf4, 0xc2, 0xc8, 0xfd, 0x7a, 0x61, 0xe4, 0x3e, 0x7a, 0x38, 0xeb, 0x8f, 0xac, 0x43, 0xea, 0x2e, + 0xc7, 0xe1, 0x3a, 0x1e, 0x72, 0x67, 0x3c, 0xa0, 0x41, 0x84, 0xb9, 0xf9, 0xb8, 0x2e, 0x61, 0x2b, + 0xcb, 0xec, 0x3c, 0xa7, 0xfe, 0x53, 0xae, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xa6, 0xbd, + 0x0f, 0x59, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -508,6 +607,8 @@ type QueryClient interface { TotalRecvFees(ctx context.Context, in *QueryTotalRecvFeesRequest, opts ...grpc.CallOption) (*QueryTotalRecvFeesResponse, error) // TotalAckFees returns the total acknowledgement fees for a packet given its identifier TotalAckFees(ctx context.Context, in *QueryTotalAckFeesRequest, opts ...grpc.CallOption) (*QueryTotalAckFeesResponse, error) + // TotalTimeoutFees returns the total timeout fees for a packet given its identifier + TotalTimeoutFees(ctx context.Context, in *QueryTotalTimeoutFeesRequest, opts ...grpc.CallOption) (*QueryTotalTimeoutFeesResponse, error) } type queryClient struct { @@ -554,6 +655,15 @@ func (c *queryClient) TotalAckFees(ctx context.Context, in *QueryTotalAckFeesReq return out, nil } +func (c *queryClient) TotalTimeoutFees(ctx context.Context, in *QueryTotalTimeoutFeesRequest, opts ...grpc.CallOption) (*QueryTotalTimeoutFeesResponse, error) { + out := new(QueryTotalTimeoutFeesResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Query/TotalTimeoutFees", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Gets all incentivized packets @@ -565,6 +675,8 @@ type QueryServer interface { TotalRecvFees(context.Context, *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) // TotalAckFees returns the total acknowledgement fees for a packet given its identifier TotalAckFees(context.Context, *QueryTotalAckFeesRequest) (*QueryTotalAckFeesResponse, error) + // TotalTimeoutFees returns the total timeout fees for a packet given its identifier + TotalTimeoutFees(context.Context, *QueryTotalTimeoutFeesRequest) (*QueryTotalTimeoutFeesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -583,6 +695,9 @@ func (*UnimplementedQueryServer) TotalRecvFees(ctx context.Context, req *QueryTo func (*UnimplementedQueryServer) TotalAckFees(ctx context.Context, req *QueryTotalAckFeesRequest) (*QueryTotalAckFeesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalAckFees not implemented") } +func (*UnimplementedQueryServer) TotalTimeoutFees(ctx context.Context, req *QueryTotalTimeoutFeesRequest) (*QueryTotalTimeoutFeesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalTimeoutFees not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -660,6 +775,24 @@ func _Query_TotalAckFees_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Query_TotalTimeoutFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalTimeoutFeesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalTimeoutFees(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.fee.v1.Query/TotalTimeoutFees", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalTimeoutFees(ctx, req.(*QueryTotalTimeoutFeesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.fee.v1.Query", HandlerType: (*QueryServer)(nil), @@ -680,6 +813,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TotalAckFees", Handler: _Query_TotalAckFees_Handler, }, + { + MethodName: "TotalTimeoutFees", + Handler: _Query_TotalTimeoutFees_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/fee/v1/query.proto", @@ -973,6 +1110,76 @@ func (m *QueryTotalAckFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *QueryTotalTimeoutFeesRequest) 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 *QueryTotalTimeoutFeesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTimeoutFeesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.PacketId.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 *QueryTotalTimeoutFeesResponse) 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 *QueryTotalTimeoutFeesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalTimeoutFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TimeoutFees) > 0 { + for iNdEx := len(m.TimeoutFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TimeoutFees[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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1092,6 +1299,32 @@ func (m *QueryTotalAckFeesResponse) Size() (n int) { return n } +func (m *QueryTotalTimeoutFeesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PacketId.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalTimeoutFeesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TimeoutFees) > 0 { + for _, e := range m.TimeoutFees { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1806,6 +2039,173 @@ func (m *QueryTotalAckFeesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryTotalTimeoutFeesRequest) 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 ErrIntOverflowQuery + } + 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: QueryTotalTimeoutFeesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalTimeoutFeesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketId", 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 err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalTimeoutFeesResponse) 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 ErrIntOverflowQuery + } + 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: QueryTotalTimeoutFeesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalTimeoutFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutFees", 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 + } + m.TimeoutFees = append(m.TimeoutFees, types1.Coin{}) + if err := m.TimeoutFees[len(m.TimeoutFees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/apps/29-fee/types/query.pb.gw.go b/modules/apps/29-fee/types/query.pb.gw.go index b2e40834aa8..172967a9625 100644 --- a/modules/apps/29-fee/types/query.pb.gw.go +++ b/modules/apps/29-fee/types/query.pb.gw.go @@ -415,6 +415,122 @@ func local_request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.M } +var ( + filter_Query_TotalTimeoutFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "port_id": 1, "channel_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} +) + +func request_Query_TotalTimeoutFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalTimeoutFeesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["packet_id.port_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + } + + val, ok = pathParams["packet_id.channel_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + } + + val, ok = pathParams["packet_id.sequence"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.sequence") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.sequence", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.sequence", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TotalTimeoutFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TotalTimeoutFees(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalTimeoutFees_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalTimeoutFeesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["packet_id.port_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + } + + val, ok = pathParams["packet_id.channel_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + } + + val, ok = pathParams["packet_id.sequence"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.sequence") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.sequence", val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.sequence", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TotalTimeoutFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TotalTimeoutFees(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -501,6 +617,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TotalTimeoutFees_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TotalTimeoutFees_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalTimeoutFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -622,6 +758,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TotalTimeoutFees_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TotalTimeoutFees_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_TotalTimeoutFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -633,6 +789,8 @@ var ( pattern_Query_TotalRecvFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_recv_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_TotalAckFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_ack_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_TotalTimeoutFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_timeout_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -643,4 +801,6 @@ var ( forward_Query_TotalRecvFees_0 = runtime.ForwardResponseMessage forward_Query_TotalAckFees_0 = runtime.ForwardResponseMessage + + forward_Query_TotalTimeoutFees_0 = runtime.ForwardResponseMessage ) diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index e6ccb64fc77..8cbb51859a3 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -37,6 +37,12 @@ service Query { option (google.api.http).get = "/ibc/apps/fee/v1/total_ack_fees/port/{packet_id.port_id}/channel/" "{packet_id.channel_id}/sequence/{packet_id.sequence}"; } + + // TotalTimeoutFees returns the total timeout fees for a packet given its identifier + rpc TotalTimeoutFees(QueryTotalTimeoutFeesRequest) returns (QueryTotalTimeoutFeesResponse) { + option (google.api.http).get = "/ibc/apps/fee/v1/total_timeout_fees/port/{packet_id.port_id}/channel/" + "{packet_id.channel_id}/sequence/{packet_id.sequence}"; + } } // QueryIncentivizedPacketsRequest is the request type for querying for all incentivized packets @@ -98,3 +104,19 @@ message QueryTotalAckFeesResponse { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } + +// QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc +message QueryTotalTimeoutFeesRequest { + // the packet identifier for the associated fees + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; +} + +// QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc +message QueryTotalTimeoutFeesResponse { + // the total packet timeout fees + repeated cosmos.base.v1beta1.Coin timeout_fees = 1 [ + (gogoproto.moretags) = "yaml:\"timeout_fees\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +}