From b96a287323380f30e7466c4d4e485461eda7115a Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 25 Feb 2022 17:03:06 +0000 Subject: [PATCH 1/6] adding query for total packet recv fees to proto query server --- docs/ibc/proto-docs.md | 33 ++ modules/apps/29-fee/types/query.pb.go | 477 ++++++++++++++++++++-- modules/apps/29-fee/types/query.pb.gw.go | 160 ++++++++ proto/ibc/applications/fee/v1/query.proto | 26 +- 4 files changed, 658 insertions(+), 38 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index eb2ddc97e3a..f9ba594468d 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -49,6 +49,8 @@ - [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) - [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) - [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) + - [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) + - [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) - [Query](#ibc.applications.fee.v1.Query) @@ -983,6 +985,36 @@ QueryIncentivizedPacketsResponse is the response type for the incentivized packe + + + +### QueryTotalRecvFeesRequest +QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `packet_id` | [ibc.core.channel.v1.PacketId](#ibc.core.channel.v1.PacketId) | | the packet identifier for the associated fees | + + + + + + + + +### QueryTotalRecvFeesResponse +QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `recv_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + @@ -999,6 +1031,7 @@ Query provides defines the gRPC querier service. | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `IncentivizedPackets` | [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) | [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) | Gets all incentivized packets | GET|/ibc/apps/fee/v1/incentivized_packets| | `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 aggregates the total amount of receive fees for a packet | GET|/ibc/apps/fee/v1/total_recv_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index ef1b0512d25..69bc6bab069 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -6,6 +6,8 @@ package types import ( context "context" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" types "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" _ "github.com/gogo/protobuf/gogoproto" @@ -233,11 +235,104 @@ func (m *QueryIncentivizedPacketResponse) GetIncentivizedPacket() IdentifiedPack return IdentifiedPacketFees{} } +// QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc +type QueryTotalRecvFeesRequest 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 *QueryTotalRecvFeesRequest) Reset() { *m = QueryTotalRecvFeesRequest{} } +func (m *QueryTotalRecvFeesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalRecvFeesRequest) ProtoMessage() {} +func (*QueryTotalRecvFeesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{4} +} +func (m *QueryTotalRecvFeesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalRecvFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalRecvFeesRequest.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 *QueryTotalRecvFeesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalRecvFeesRequest.Merge(m, src) +} +func (m *QueryTotalRecvFeesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalRecvFeesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalRecvFeesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalRecvFeesRequest proto.InternalMessageInfo + +func (m *QueryTotalRecvFeesRequest) GetPacketId() types.PacketId { + if m != nil { + return m.PacketId + } + return types.PacketId{} +} + +// QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc +type QueryTotalRecvFeesResponse struct { + RecvFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=recv_fees,json=recvFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"recv_fees" yaml:"recv_fees"` +} + +func (m *QueryTotalRecvFeesResponse) Reset() { *m = QueryTotalRecvFeesResponse{} } +func (m *QueryTotalRecvFeesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalRecvFeesResponse) ProtoMessage() {} +func (*QueryTotalRecvFeesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{5} +} +func (m *QueryTotalRecvFeesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalRecvFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalRecvFeesResponse.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 *QueryTotalRecvFeesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalRecvFeesResponse.Merge(m, src) +} +func (m *QueryTotalRecvFeesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalRecvFeesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalRecvFeesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalRecvFeesResponse proto.InternalMessageInfo + +func (m *QueryTotalRecvFeesResponse) GetRecvFees() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.RecvFees + } + return nil +} + func init() { proto.RegisterType((*QueryIncentivizedPacketsRequest)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsRequest") proto.RegisterType((*QueryIncentivizedPacketsResponse)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsResponse") proto.RegisterType((*QueryIncentivizedPacketRequest)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketRequest") proto.RegisterType((*QueryIncentivizedPacketResponse)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketResponse") + proto.RegisterType((*QueryTotalRecvFeesRequest)(nil), "ibc.applications.fee.v1.QueryTotalRecvFeesRequest") + proto.RegisterType((*QueryTotalRecvFeesResponse)(nil), "ibc.applications.fee.v1.QueryTotalRecvFeesResponse") } func init() { @@ -245,42 +340,51 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0xb4, 0x55, 0x74, 0xe2, 0x69, 0x52, 0x30, 0x04, 0xdd, 0xa6, 0x11, 0x35, 0x08, 0x99, - 0x21, 0x29, 0x62, 0x7b, 0x93, 0x1e, 0x8a, 0x39, 0x59, 0x73, 0xf4, 0x12, 0x76, 0x67, 0x5f, 0x36, - 0x83, 0xc9, 0xce, 0x36, 0x33, 0x59, 0x68, 0xb5, 0x97, 0x82, 0x08, 0xd2, 0x83, 0xe0, 0xaf, 0xf1, - 0x1f, 0xf4, 0x58, 0xf4, 0xe2, 0x49, 0x24, 0xf1, 0x87, 0xc8, 0xec, 0xce, 0xc6, 0x85, 0x64, 0xb1, - 0xed, 0x6d, 0xf7, 0xbd, 0xef, 0x7b, 0xdf, 0xb7, 0xdf, 0x9b, 0x1d, 0xfc, 0x48, 0x78, 0x9c, 0xb9, - 0x51, 0x34, 0x12, 0xdc, 0xd5, 0x42, 0x86, 0x8a, 0x0d, 0x00, 0x58, 0xdc, 0x66, 0x47, 0x53, 0x98, - 0x1c, 0xd3, 0x68, 0x22, 0xb5, 0x24, 0xf7, 0x85, 0xc7, 0x69, 0x1e, 0x44, 0x07, 0x00, 0x34, 0x6e, - 0xd7, 0x36, 0x03, 0x19, 0xc8, 0x04, 0xc3, 0xcc, 0x53, 0x0a, 0xaf, 0x6d, 0x17, 0xcd, 0x34, 0xac, - 0x14, 0xf2, 0x20, 0x90, 0x32, 0x18, 0x01, 0x73, 0x23, 0xc1, 0xdc, 0x30, 0x94, 0xda, 0xce, 0xcd, - 0x0d, 0xe0, 0x72, 0x02, 0x8c, 0x0f, 0xdd, 0x30, 0x84, 0x91, 0x21, 0xdb, 0x47, 0x0b, 0x79, 0xc6, - 0xa5, 0x1a, 0x4b, 0xc5, 0x3c, 0x57, 0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 0x8a, 0x55, 0x40, 0x05, 0x00, 0x00, + // 695 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0x33, 0xb5, 0x95, 0x76, 0xaa, 0x20, 0xd3, 0x82, 0x6d, 0xd0, 0x4d, 0xba, 0xa2, 0x06, + 0x21, 0x3b, 0x24, 0x45, 0x6c, 0x3d, 0x49, 0x95, 0x62, 0x4f, 0xd6, 0xe0, 0x49, 0x90, 0xb0, 0x99, + 0x7d, 0xd9, 0x0c, 0x4d, 0x76, 0xb6, 0x99, 0xcd, 0x62, 0x6b, 0xeb, 0xa1, 0x20, 0x82, 0xf4, 0x20, + 0x78, 0xf3, 0x23, 0xf8, 0x0d, 0xfc, 0x06, 0xbd, 0x08, 0x05, 0x2f, 0x9e, 0xaa, 0xb4, 0x7e, 0x02, + 0x4f, 0x1e, 0x65, 0x66, 0x67, 0x63, 0x4a, 0x12, 0x6d, 0x8b, 0x9e, 0xb2, 0x3b, 0xef, 0xff, 0x66, + 0x7e, 0xef, 0xbf, 0xef, 0x4d, 0xf0, 0x35, 0x5e, 0x63, 0xd4, 0x0d, 0xc3, 0x26, 0x67, 0x6e, 0xc4, + 0x45, 0x20, 0x69, 0x1d, 0x80, 0xc6, 0x25, 0xba, 0xde, 0x81, 0xf6, 0x86, 0x13, 0xb6, 0x45, 0x24, + 0xc8, 0x65, 0x5e, 0x63, 0x4e, 0xaf, 0xc8, 0xa9, 0x03, 0x38, 0x71, 0x29, 0x3b, 0xed, 0x0b, 0x5f, + 0x68, 0x0d, 0x55, 0x4f, 0x89, 0x3c, 0x7b, 0xc5, 0x17, 0xc2, 0x6f, 0x02, 0x75, 0x43, 0x4e, 0xdd, + 0x20, 0x10, 0x91, 0x49, 0x4a, 0xa2, 0xb7, 0x98, 0x90, 0x2d, 0x21, 0x69, 0xcd, 0x95, 0x90, 0x9c, + 0x42, 0xe3, 0x52, 0x0d, 0x22, 0xb7, 0x44, 0x43, 0xd7, 0xe7, 0x81, 0x16, 0x1b, 0xad, 0xd5, 0xab, + 0x4d, 0x55, 0x4c, 0xf0, 0x34, 0x3e, 0x37, 0x8c, 0x5e, 0xf1, 0xf5, 0x48, 0x98, 0x68, 0x03, 0x65, + 0x0d, 0x37, 0x08, 0xa0, 0xa9, 0xc2, 0xe6, 0x31, 0x91, 0xd8, 0xbb, 0x08, 0xe7, 0x1e, 0x2b, 0x90, + 0x95, 0x80, 0x41, 0x10, 0xf1, 0x98, 0x6f, 0x82, 0xb7, 0xea, 0xb2, 0x35, 0x88, 0x64, 0x05, 0xd6, + 0x3b, 0x20, 0x23, 0xb2, 0x8c, 0xf1, 0x6f, 0xba, 0x19, 0x94, 0x47, 0x85, 0xc9, 0xf2, 0x0d, 0x27, + 0xc1, 0x73, 0x14, 0x9e, 0x93, 0x18, 0x66, 0x20, 0x9d, 0x55, 0xd7, 0x07, 0x93, 0x5b, 0xe9, 0xc9, + 0x24, 0x73, 0xf8, 0x82, 0x16, 0x56, 0x1b, 0xc0, 0xfd, 0x46, 0x34, 0x33, 0x92, 0x47, 0x85, 0xd1, + 0xca, 0xa4, 0x5e, 0x7b, 0xa8, 0x97, 0xec, 0x37, 0x08, 0xe7, 0x87, 0xe3, 0xc8, 0x50, 0x04, 0x12, + 0x48, 0x1d, 0x4f, 0xf3, 0x9e, 0x70, 0x35, 0x4c, 0xe2, 0x33, 0x28, 0x7f, 0xae, 0x30, 0x59, 0x2e, + 0x3a, 0x43, 0xbe, 0x98, 0xb3, 0xe2, 0xa9, 0x9c, 0x3a, 0x4f, 0x77, 0x5c, 0x06, 0x90, 0x4b, 0xa3, + 0x7b, 0x07, 0xb9, 0x4c, 0x65, 0x8a, 0xf7, 0x9f, 0x67, 0xbf, 0x42, 0xd8, 0x1a, 0x02, 0x93, 0x5a, + 0x73, 0x0f, 0x4f, 0x24, 0xa7, 0x57, 0xb9, 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 0xdc, 0x39, + 0x2d, 0x40, 0x4a, 0xbe, 0x70, 0xfa, 0x44, 0x03, 0xbe, 0x83, 0x34, 0xf9, 0x16, 0xd9, 0x3c, 0x09, + 0x39, 0x0d, 0x45, 0x3b, 0xa2, 0x2f, 0xba, 0x0d, 0xe6, 0xa8, 0xf7, 0x2a, 0xf7, 0xb6, 0xbb, 0x57, + 0x5b, 0x4f, 0xcc, 0x2c, 0xe9, 0xb0, 0x54, 0xa0, 0x01, 0x83, 0xde, 0x78, 0xba, 0xb6, 0x4d, 0x7e, + 0x22, 0x7c, 0xf1, 0x58, 0xb3, 0x91, 0xf2, 0x9f, 0x0b, 0x1a, 0xd4, 0xf9, 0xd9, 0xf9, 0x53, 0xe5, + 0x98, 0xfa, 0x5f, 0xea, 0xf2, 0x9f, 0x93, 0xb8, 0xaf, 0xfc, 0x48, 0xe9, 0xab, 0xdd, 0x86, 0xfd, + 0x3f, 0xa5, 0x2f, 0x3d, 0xda, 0x3b, 0xb4, 0xd0, 0xfe, 0xa1, 0x85, 0xbe, 0x1d, 0x5a, 0xe8, 0xed, + 0x91, 0x95, 0xd9, 0x3f, 0xb2, 0x32, 0x5f, 0x8e, 0xac, 0xcc, 0xd3, 0xdb, 0xfd, 0xd3, 0xc1, 0x6b, + 0xac, 0xe8, 0x0b, 0x1a, 0xcf, 0xd3, 0x96, 0xf0, 0x3a, 0x4d, 0x90, 0x09, 0x70, 0x79, 0xb1, 0xa8, + 0x98, 0xf5, 0xc0, 0xd4, 0xce, 0xeb, 0x7f, 0x94, 0xf9, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x25, + 0xf2, 0x59, 0x47, 0x57, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -300,6 +404,8 @@ type QueryClient interface { // Gets the fees expected for submitting the ReceivePacket, AcknowledgementPacket, and TimeoutPacket messages for the // given packet IncentivizedPacket(ctx context.Context, in *QueryIncentivizedPacketRequest, opts ...grpc.CallOption) (*QueryIncentivizedPacketResponse, error) + // TotalRecvFees aggregates the total amount of receive fees for a packet + TotalRecvFees(ctx context.Context, in *QueryTotalRecvFeesRequest, opts ...grpc.CallOption) (*QueryTotalRecvFeesResponse, error) } type queryClient struct { @@ -328,6 +434,15 @@ func (c *queryClient) IncentivizedPacket(ctx context.Context, in *QueryIncentivi return out, nil } +func (c *queryClient) TotalRecvFees(ctx context.Context, in *QueryTotalRecvFeesRequest, opts ...grpc.CallOption) (*QueryTotalRecvFeesResponse, error) { + out := new(QueryTotalRecvFeesResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Query/TotalRecvFees", 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 @@ -335,6 +450,8 @@ type QueryServer interface { // Gets the fees expected for submitting the ReceivePacket, AcknowledgementPacket, and TimeoutPacket messages for the // given packet IncentivizedPacket(context.Context, *QueryIncentivizedPacketRequest) (*QueryIncentivizedPacketResponse, error) + // TotalRecvFees aggregates the total amount of receive fees for a packet + TotalRecvFees(context.Context, *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -347,6 +464,9 @@ func (*UnimplementedQueryServer) IncentivizedPackets(ctx context.Context, req *Q func (*UnimplementedQueryServer) IncentivizedPacket(ctx context.Context, req *QueryIncentivizedPacketRequest) (*QueryIncentivizedPacketResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IncentivizedPacket not implemented") } +func (*UnimplementedQueryServer) TotalRecvFees(ctx context.Context, req *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalRecvFees not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -388,6 +508,24 @@ func _Query_IncentivizedPacket_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_TotalRecvFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalRecvFeesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalRecvFees(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.fee.v1.Query/TotalRecvFees", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalRecvFees(ctx, req.(*QueryTotalRecvFeesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.fee.v1.Query", HandlerType: (*QueryServer)(nil), @@ -400,6 +538,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "IncentivizedPacket", Handler: _Query_IncentivizedPacket_Handler, }, + { + MethodName: "TotalRecvFees", + Handler: _Query_TotalRecvFees_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/fee/v1/query.proto", @@ -553,6 +695,76 @@ func (m *QueryIncentivizedPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *QueryTotalRecvFeesRequest) 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 *QueryTotalRecvFeesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalRecvFeesRequest) 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 *QueryTotalRecvFeesResponse) 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 *QueryTotalRecvFeesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalRecvFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecvFees) > 0 { + for iNdEx := len(m.RecvFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RecvFees[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 @@ -620,6 +832,32 @@ func (m *QueryIncentivizedPacketResponse) Size() (n int) { return n } +func (m *QueryTotalRecvFeesRequest) 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 *QueryTotalRecvFeesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RecvFees) > 0 { + for _, e := range m.RecvFees { + 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 } @@ -1000,6 +1238,173 @@ func (m *QueryIncentivizedPacketResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryTotalRecvFeesRequest) 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: QueryTotalRecvFeesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalRecvFeesRequest: 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 *QueryTotalRecvFeesResponse) 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: QueryTotalRecvFeesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalRecvFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecvFees", 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.RecvFees = append(m.RecvFees, types1.Coin{}) + if err := m.RecvFees[len(m.RecvFees)-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 3a9b3d581b2..e9626d2a08e 100644 --- a/modules/apps/29-fee/types/query.pb.gw.go +++ b/modules/apps/29-fee/types/query.pb.gw.go @@ -183,6 +183,122 @@ func local_request_Query_IncentivizedPacket_0(ctx context.Context, marshaler run } +var ( + filter_Query_TotalRecvFees_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_TotalRecvFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalRecvFeesRequest + 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_TotalRecvFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TotalRecvFees(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalRecvFeesRequest + 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_TotalRecvFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TotalRecvFees(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. @@ -229,6 +345,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TotalRecvFees_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_TotalRecvFees_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_TotalRecvFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -310,6 +446,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TotalRecvFees_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_TotalRecvFees_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_TotalRecvFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -317,10 +473,14 @@ var ( pattern_Query_IncentivizedPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "fee", "v1", "incentivized_packets"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_IncentivizedPacket_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", "incentivized_packet", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + + 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))) ) var ( forward_Query_IncentivizedPackets_0 = runtime.ForwardResponseMessage forward_Query_IncentivizedPacket_0 = runtime.ForwardResponseMessage + + forward_Query_TotalRecvFees_0 = runtime.ForwardResponseMessage ) diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index a588240a285..7341b802709 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -5,10 +5,11 @@ package ibc.applications.fee.v1; option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; -import "ibc/applications/fee/v1/fee.proto"; import "google/api/annotations.proto"; -import "ibc/core/channel/v1/channel.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/applications/fee/v1/fee.proto"; +import "ibc/core/channel/v1/channel.proto"; // Query provides defines the gRPC querier service. service Query { @@ -24,6 +25,12 @@ service Query { "/ibc/apps/fee/v1/incentivized_packet/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/" "{packet_id.sequence}"; } + + // TotalRecvFees returns the total receive fees for a packet + rpc TotalRecvFees(QueryTotalRecvFeesRequest) returns (QueryTotalRecvFeesResponse) { + option (google.api.http).get = "/ibc/apps/fee/v1/total_recv_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 @@ -53,3 +60,18 @@ message QueryIncentivizedPacketResponse { // Incentivized_packet ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packet = 1 [(gogoproto.nullable) = false]; } + +// QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc +message QueryTotalRecvFeesRequest { + // the packet identifier for the associated fees + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; +} + +// QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc +message QueryTotalRecvFeesResponse { + repeated cosmos.base.v1beta1.Coin recv_fees = 1 [ + (gogoproto.moretags) = "yaml:\"recv_fees\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} From c901a388135363acf2f4e189d8dcfc7287a76cb2 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 25 Feb 2022 17:03:29 +0000 Subject: [PATCH 2/6] adding total packet recv fee query impl and tests --- modules/apps/29-fee/keeper/grpc_query.go | 26 ++++++++ modules/apps/29-fee/keeper/grpc_query_test.go | 64 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/modules/apps/29-fee/keeper/grpc_query.go b/modules/apps/29-fee/keeper/grpc_query.go index 3d4852831ad..dfaa5d86a35 100644 --- a/modules/apps/29-fee/keeper/grpc_query.go +++ b/modules/apps/29-fee/keeper/grpc_query.go @@ -65,3 +65,29 @@ func (k Keeper) IncentivizedPacket(c context.Context, req *types.QueryIncentiviz IncentivizedPacket: types.NewIdentifiedPacketFees(req.PacketId, feesInEscrow.PacketFees), }, nil } + +// TotalRecvFees implements the Query/TotalRecvFees gRPC method +func (k Keeper) TotalRecvFees(goCtx context.Context, req *types.QueryTotalRecvFeesRequest) (*types.QueryTotalRecvFeesResponse, 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 recvFees sdk.Coins + for _, packetFee := range feesInEscrow.PacketFees { + recvFees = recvFees.Add(packetFee.Fee.RecvFee...) + } + + return &types.QueryTotalRecvFeesResponse{ + RecvFees: recvFees, + }, nil +} diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index 37626b40bac..c9df54665f0 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -139,3 +139,67 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { }) } } + +func (suite *KeeperTestSuite) TestQueryTotalRecvFees() { + var ( + req *types.QueryTotalRecvFeesRequest + ) + + 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.QueryTotalRecvFeesRequest{ + PacketId: packetID, + } + + tc.malleate() + + ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) + res, err := suite.queryClient.TotalRecvFees(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + + // expected total is three times the default recv fee + expectedFees := defaultReceiveFee.Add(defaultReceiveFee...).Add(defaultReceiveFee...) + suite.Require().Equal(expectedFees, res.RecvFees) + } else { + suite.Require().Error(err) + } + }) + } +} From ca6c6e00b6af758a3b4d55783012f162b53c0b11 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 25 Feb 2022 17:09:40 +0000 Subject: [PATCH 3/6] updating doc comments --- docs/ibc/proto-docs.md | 4 +- modules/apps/29-fee/types/query.pb.go | 95 ++++++++++++----------- proto/ibc/applications/fee/v1/query.proto | 3 +- 3 files changed, 52 insertions(+), 50 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index f9ba594468d..eda1ca9bf69 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1009,7 +1009,7 @@ QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `recv_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `recv_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | the total packet receive fees | @@ -1031,7 +1031,7 @@ Query provides defines the gRPC querier service. | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `IncentivizedPackets` | [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) | [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) | Gets all incentivized packets | GET|/ibc/apps/fee/v1/incentivized_packets| | `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 aggregates the total amount of receive fees for a packet | GET|/ibc/apps/fee/v1/total_recv_fees/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}| diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index 69bc6bab069..fdbaa9766c8 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -283,6 +283,7 @@ func (m *QueryTotalRecvFeesRequest) GetPacketId() types.PacketId { // QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc type QueryTotalRecvFeesResponse struct { + // the total packet receive fees RecvFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=recv_fees,json=recvFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"recv_fees" yaml:"recv_fees"` } @@ -340,51 +341,51 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 695 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0x33, 0xb5, 0x95, 0x76, 0xaa, 0x20, 0xd3, 0x82, 0x6d, 0xd0, 0x4d, 0xba, 0xa2, 0x06, - 0x21, 0x3b, 0x24, 0x45, 0x6c, 0x3d, 0x49, 0x95, 0x62, 0x4f, 0xd6, 0xe0, 0x49, 0x90, 0xb0, 0x99, - 0x7d, 0xd9, 0x0c, 0x4d, 0x76, 0xb6, 0x99, 0xcd, 0x62, 0x6b, 0xeb, 0xa1, 0x20, 0x82, 0xf4, 0x20, - 0x78, 0xf3, 0x23, 0xf8, 0x0d, 0xfc, 0x06, 0xbd, 0x08, 0x05, 0x2f, 0x9e, 0xaa, 0xb4, 0x7e, 0x02, - 0x4f, 0x1e, 0x65, 0x66, 0x67, 0x63, 0x4a, 0x12, 0x6d, 0x8b, 0x9e, 0xb2, 0x3b, 0xef, 0xff, 0x66, - 0x7e, 0xef, 0xbf, 0xef, 0x4d, 0xf0, 0x35, 0x5e, 0x63, 0xd4, 0x0d, 0xc3, 0x26, 0x67, 0x6e, 0xc4, - 0x45, 0x20, 0x69, 0x1d, 0x80, 0xc6, 0x25, 0xba, 0xde, 0x81, 0xf6, 0x86, 0x13, 0xb6, 0x45, 0x24, - 0xc8, 0x65, 0x5e, 0x63, 0x4e, 0xaf, 0xc8, 0xa9, 0x03, 0x38, 0x71, 0x29, 0x3b, 0xed, 0x0b, 0x5f, - 0x68, 0x0d, 0x55, 0x4f, 0x89, 0x3c, 0x7b, 0xc5, 0x17, 0xc2, 0x6f, 0x02, 0x75, 0x43, 0x4e, 0xdd, - 0x20, 0x10, 0x91, 0x49, 0x4a, 0xa2, 0xb7, 0x98, 0x90, 0x2d, 0x21, 0x69, 0xcd, 0x95, 0x90, 0x9c, - 0x42, 0xe3, 0x52, 0x0d, 0x22, 0xb7, 0x44, 0x43, 0xd7, 0xe7, 0x81, 0x16, 0x1b, 0xad, 0xd5, 0xab, - 0x4d, 0x55, 0x4c, 0xf0, 0x34, 0x3e, 0x37, 0x8c, 0x5e, 0xf1, 0xf5, 0x48, 0x98, 0x68, 0x03, 0x65, - 0x0d, 0x37, 0x08, 0xa0, 0xa9, 0xc2, 0xe6, 0x31, 0x91, 0xd8, 0xbb, 0x08, 0xe7, 0x1e, 0x2b, 0x90, - 0x95, 0x80, 0x41, 0x10, 0xf1, 0x98, 0x6f, 0x82, 0xb7, 0xea, 0xb2, 0x35, 0x88, 0x64, 0x05, 0xd6, - 0x3b, 0x20, 0x23, 0xb2, 0x8c, 0xf1, 0x6f, 0xba, 0x19, 0x94, 0x47, 0x85, 0xc9, 0xf2, 0x0d, 0x27, - 0xc1, 0x73, 0x14, 0x9e, 0x93, 0x18, 0x66, 0x20, 0x9d, 0x55, 0xd7, 0x07, 0x93, 0x5b, 0xe9, 0xc9, - 0x24, 0x73, 0xf8, 0x82, 0x16, 0x56, 0x1b, 0xc0, 0xfd, 0x46, 0x34, 0x33, 0x92, 0x47, 0x85, 0xd1, - 0xca, 0xa4, 0x5e, 0x7b, 0xa8, 0x97, 0xec, 0x37, 0x08, 0xe7, 0x87, 0xe3, 0xc8, 0x50, 0x04, 0x12, - 0x48, 0x1d, 0x4f, 0xf3, 0x9e, 0x70, 0x35, 0x4c, 0xe2, 0x33, 0x28, 0x7f, 0xae, 0x30, 0x59, 0x2e, - 0x3a, 0x43, 0xbe, 0x98, 0xb3, 0xe2, 0xa9, 0x9c, 0x3a, 0x4f, 0x77, 0x5c, 0x06, 0x90, 0x4b, 0xa3, - 0x7b, 0x07, 0xb9, 0x4c, 0x65, 0x8a, 0xf7, 0x9f, 0x67, 0xbf, 0x42, 0xd8, 0x1a, 0x02, 0x93, 0x5a, - 0x73, 0x0f, 0x4f, 0x24, 0xa7, 0x57, 0xb9, 0x67, 0x9c, 0xb9, 0xaa, 0xcf, 0x57, 0xae, 0x3b, 0xa9, - 0xd5, 0xb1, 0xf2, 0x44, 0xa9, 0x56, 0x3c, 0x73, 0xde, 0x78, 0x68, 0xde, 0x4f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b, 0xa2, 0x2f, 0xba, 0x0d, 0xe6, 0xa8, 0xf7, 0x2a, 0xf7, 0xb6, 0xbb, 0x57, - 0x5b, 0x4f, 0xcc, 0x2c, 0xe9, 0xb0, 0x54, 0xa0, 0x01, 0x83, 0xde, 0x78, 0xba, 0xb6, 0x4d, 0x7e, - 0x22, 0x7c, 0xf1, 0x58, 0xb3, 0x91, 0xf2, 0x9f, 0x0b, 0x1a, 0xd4, 0xf9, 0xd9, 0xf9, 0x53, 0xe5, - 0x98, 0xfa, 0x5f, 0xea, 0xf2, 0x9f, 0x93, 0xb8, 0xaf, 0xfc, 0x48, 0xe9, 0xab, 0xdd, 0x86, 0xfd, - 0x3f, 0xa5, 0x2f, 0x3d, 0xda, 0x3b, 0xb4, 0xd0, 0xfe, 0xa1, 0x85, 0xbe, 0x1d, 0x5a, 0xe8, 0xed, - 0x91, 0x95, 0xd9, 0x3f, 0xb2, 0x32, 0x5f, 0x8e, 0xac, 0xcc, 0xd3, 0xdb, 0xfd, 0xd3, 0xc1, 0x6b, - 0xac, 0xe8, 0x0b, 0x1a, 0xcf, 0xd3, 0x96, 0xf0, 0x3a, 0x4d, 0x90, 0x09, 0x70, 0x79, 0xb1, 0xa8, - 0x98, 0xf5, 0xc0, 0xd4, 0xce, 0xeb, 0x7f, 0x94, 0xf9, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x25, - 0xf2, 0x59, 0x47, 0x57, 0x07, 0x00, 0x00, + // 698 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6b, 0x13, 0x4d, + 0x18, 0xc7, 0x33, 0x7d, 0xdb, 0x97, 0x76, 0xfa, 0xbe, 0x20, 0xd3, 0x82, 0x6d, 0xd0, 0x4d, 0xba, + 0xa2, 0x06, 0x21, 0x3b, 0x34, 0x45, 0x6c, 0x3d, 0x49, 0x95, 0x62, 0x4f, 0xd6, 0x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 0xae, + 0xed, 0xa0, 0xef, 0x00, 0xfe, 0x7f, 0x62, 0xd8, 0x50, 0xed, 0xd7, 0x0d, 0x0d, 0x9a, 0xfc, 0xe2, + 0xc2, 0x99, 0x72, 0x4c, 0xff, 0xcf, 0x75, 0xfb, 0x4f, 0x51, 0xdc, 0xd7, 0xbe, 0x54, 0xfa, 0x46, + 0x36, 0xb0, 0x7f, 0xa7, 0xf5, 0xe5, 0x07, 0xfb, 0x47, 0x16, 0x38, 0x38, 0xb2, 0xc0, 0x97, 0x23, + 0x0b, 0xbc, 0x3e, 0xb6, 0x0a, 0x07, 0xc7, 0x56, 0xe1, 0xd3, 0xb1, 0x55, 0x78, 0x7c, 0xb3, 0xff, + 0x74, 0x30, 0x8f, 0x54, 0x03, 0x8e, 0xe3, 0x05, 0xdc, 0xe1, 0x7e, 0xaf, 0x4d, 0x45, 0x02, 0x5c, + 0x5b, 0xaa, 0x2a, 0x66, 0x7d, 0x60, 0xbc, 0x7f, 0xf5, 0x3f, 0xca, 0xc2, 0x8f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xdd, 0x79, 0x2b, 0x91, 0x57, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -404,7 +405,7 @@ type QueryClient interface { // Gets the fees expected for submitting the ReceivePacket, AcknowledgementPacket, and TimeoutPacket messages for the // given packet IncentivizedPacket(ctx context.Context, in *QueryIncentivizedPacketRequest, opts ...grpc.CallOption) (*QueryIncentivizedPacketResponse, error) - // TotalRecvFees aggregates the total amount of receive fees for a packet + // TotalRecvFees returns the total receive fees for a packet given its identifier TotalRecvFees(ctx context.Context, in *QueryTotalRecvFeesRequest, opts ...grpc.CallOption) (*QueryTotalRecvFeesResponse, error) } @@ -450,7 +451,7 @@ type QueryServer interface { // Gets the fees expected for submitting the ReceivePacket, AcknowledgementPacket, and TimeoutPacket messages for the // given packet IncentivizedPacket(context.Context, *QueryIncentivizedPacketRequest) (*QueryIncentivizedPacketResponse, error) - // TotalRecvFees aggregates the total amount of receive fees for a packet + // TotalRecvFees returns the total receive fees for a packet given its identifier TotalRecvFees(context.Context, *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) } diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 7341b802709..65b677c2fdb 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -26,7 +26,7 @@ service Query { "{packet_id.sequence}"; } - // TotalRecvFees returns the total receive fees for a packet + // TotalRecvFees returns the total receive fees for a packet given its identifier rpc TotalRecvFees(QueryTotalRecvFeesRequest) returns (QueryTotalRecvFeesResponse) { option (google.api.http).get = "/ibc/apps/fee/v1/total_recv_fees/port/{packet_id.port_id}/channel/" "{packet_id.channel_id}/sequence/{packet_id.sequence}"; @@ -69,6 +69,7 @@ message QueryTotalRecvFeesRequest { // QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc message QueryTotalRecvFeesResponse { + // the total packet receive fees repeated cosmos.base.v1beta1.Coin recv_fees = 1 [ (gogoproto.moretags) = "yaml:\"recv_fees\"", (gogoproto.nullable) = false, From 1b2cfcfed578dc70834db83182916f84294f7ab3 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 28 Feb 2022 21:05:27 +0000 Subject: [PATCH 4/6] adding protos and codegen --- docs/ibc/proto-docs.md | 33 ++ modules/apps/29-fee/types/query.pb.go | 490 ++++++++++++++++++++-- modules/apps/29-fee/types/query.pb.gw.go | 160 +++++++ proto/ibc/applications/fee/v1/query.proto | 22 + 4 files changed, 660 insertions(+), 45 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index eda1ca9bf69..fe3c031e566 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -49,6 +49,8 @@ - [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) - [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) - [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) + - [QueryTotalAckFeesRequest](#ibc.applications.fee.v1.QueryTotalAckFeesRequest) + - [QueryTotalAckFeesResponse](#ibc.applications.fee.v1.QueryTotalAckFeesResponse) - [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) - [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) @@ -986,6 +988,36 @@ QueryIncentivizedPacketsResponse is the response type for the incentivized packe + + +### QueryTotalAckFeesRequest +QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `packet_id` | [ibc.core.channel.v1.PacketId](#ibc.core.channel.v1.PacketId) | | the packet identifier for the associated fees | + + + + + + + + +### QueryTotalAckFeesResponse +QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `ack_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | the total packet receive fees | + + + + + + ### QueryTotalRecvFeesRequest @@ -1032,6 +1064,7 @@ Query provides defines the gRPC querier service. | `IncentivizedPackets` | [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) | [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) | Gets all incentivized packets | GET|/ibc/apps/fee/v1/incentivized_packets| | `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}| diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index fdbaa9766c8..63311c9d8c4 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -327,6 +327,98 @@ func (m *QueryTotalRecvFeesResponse) GetRecvFees() github_com_cosmos_cosmos_sdk_ return nil } +// QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc +type QueryTotalAckFeesRequest 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 *QueryTotalAckFeesRequest) Reset() { *m = QueryTotalAckFeesRequest{} } +func (m *QueryTotalAckFeesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalAckFeesRequest) ProtoMessage() {} +func (*QueryTotalAckFeesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{6} +} +func (m *QueryTotalAckFeesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalAckFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalAckFeesRequest.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 *QueryTotalAckFeesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalAckFeesRequest.Merge(m, src) +} +func (m *QueryTotalAckFeesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalAckFeesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalAckFeesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalAckFeesRequest proto.InternalMessageInfo + +func (m *QueryTotalAckFeesRequest) GetPacketId() types.PacketId { + if m != nil { + return m.PacketId + } + return types.PacketId{} +} + +// QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc +type QueryTotalAckFeesResponse struct { + // the total packet receive fees + AckFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=ack_fees,json=ackFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"ack_fees" yaml:"ack_fees"` +} + +func (m *QueryTotalAckFeesResponse) Reset() { *m = QueryTotalAckFeesResponse{} } +func (m *QueryTotalAckFeesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalAckFeesResponse) ProtoMessage() {} +func (*QueryTotalAckFeesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0638a8a78ca2503c, []int{7} +} +func (m *QueryTotalAckFeesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalAckFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalAckFeesResponse.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 *QueryTotalAckFeesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalAckFeesResponse.Merge(m, src) +} +func (m *QueryTotalAckFeesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalAckFeesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalAckFeesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalAckFeesResponse proto.InternalMessageInfo + +func (m *QueryTotalAckFeesResponse) GetAckFees() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.AckFees + } + return nil +} + func init() { proto.RegisterType((*QueryIncentivizedPacketsRequest)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsRequest") proto.RegisterType((*QueryIncentivizedPacketsResponse)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketsResponse") @@ -334,6 +426,8 @@ func init() { proto.RegisterType((*QueryIncentivizedPacketResponse)(nil), "ibc.applications.fee.v1.QueryIncentivizedPacketResponse") proto.RegisterType((*QueryTotalRecvFeesRequest)(nil), "ibc.applications.fee.v1.QueryTotalRecvFeesRequest") 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") } func init() { @@ -341,51 +435,56 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6b, 0x13, 0x4d, - 0x18, 0xc7, 0x33, 0x7d, 0xdb, 0x97, 0x76, 0xfa, 0xbe, 0x20, 0xd3, 0x82, 0x6d, 0xd0, 0x4d, 0xba, - 0xa2, 0x06, 0x21, 0x3b, 0x34, 0x45, 0x6c, 0x3d, 0x49, 0x95, 0x62, 0x4f, 0xd6, 0xe0, 0x49, 0x90, - 0xb0, 0x3b, 0x3b, 0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0x7f, 0x62, 0xd8, 0x50, 0xed, 0xd7, 0x0d, 0x0d, 0x9a, 0xfc, 0xe2, - 0xc2, 0x99, 0x72, 0x4c, 0xff, 0xcf, 0x75, 0xfb, 0x4f, 0x51, 0xdc, 0xd7, 0xbe, 0x54, 0xfa, 0x46, - 0x36, 0xb0, 0x7f, 0xa7, 0xf5, 0xe5, 0x07, 0xfb, 0x47, 0x16, 0x38, 0x38, 0xb2, 0xc0, 0x97, 0x23, - 0x0b, 0xbc, 0x3e, 0xb6, 0x0a, 0x07, 0xc7, 0x56, 0xe1, 0xd3, 0xb1, 0x55, 0x78, 0x7c, 0xb3, 0xff, - 0x74, 0x30, 0x8f, 0x54, 0x03, 0x8e, 0xe3, 0x05, 0xdc, 0xe1, 0x7e, 0xaf, 0x4d, 0x45, 0x02, 0x5c, - 0x5b, 0xaa, 0x2a, 0x66, 0x7d, 0x60, 0xbc, 0x7f, 0xf5, 0x3f, 0xca, 0xc2, 0x8f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xdd, 0x79, 0x2b, 0x91, 0x57, 0x07, 0x00, 0x00, + // 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, 0x01, 0x09, 0x89, 0x03, 0x3f, 0x81, 0x7f, 0xc0, 0x9d, 0x43, 0x8f, 0x95, 0xb8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e8, 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, } // Reference imports to suppress errors if they are not otherwise used. @@ -407,6 +506,8 @@ type QueryClient interface { IncentivizedPacket(ctx context.Context, in *QueryIncentivizedPacketRequest, opts ...grpc.CallOption) (*QueryIncentivizedPacketResponse, error) // TotalRecvFees returns the total receive fees for a packet given its identifier 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) } type queryClient struct { @@ -444,6 +545,15 @@ func (c *queryClient) TotalRecvFees(ctx context.Context, in *QueryTotalRecvFeesR return out, nil } +func (c *queryClient) TotalAckFees(ctx context.Context, in *QueryTotalAckFeesRequest, opts ...grpc.CallOption) (*QueryTotalAckFeesResponse, error) { + out := new(QueryTotalAckFeesResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Query/TotalAckFees", 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 @@ -453,6 +563,8 @@ type QueryServer interface { IncentivizedPacket(context.Context, *QueryIncentivizedPacketRequest) (*QueryIncentivizedPacketResponse, error) // TotalRecvFees returns the total receive fees for a packet given its identifier TotalRecvFees(context.Context, *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) + // TotalAckFees returns the total acknowledgement fees for a packet given its identifier + TotalAckFees(context.Context, *QueryTotalAckFeesRequest) (*QueryTotalAckFeesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -468,6 +580,9 @@ func (*UnimplementedQueryServer) IncentivizedPacket(ctx context.Context, req *Qu func (*UnimplementedQueryServer) TotalRecvFees(ctx context.Context, req *QueryTotalRecvFeesRequest) (*QueryTotalRecvFeesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalRecvFees not implemented") } +func (*UnimplementedQueryServer) TotalAckFees(ctx context.Context, req *QueryTotalAckFeesRequest) (*QueryTotalAckFeesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalAckFees not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -527,6 +642,24 @@ func _Query_TotalRecvFees_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Query_TotalAckFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalAckFeesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalAckFees(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.fee.v1.Query/TotalAckFees", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalAckFees(ctx, req.(*QueryTotalAckFeesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.fee.v1.Query", HandlerType: (*QueryServer)(nil), @@ -543,6 +676,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TotalRecvFees", Handler: _Query_TotalRecvFees_Handler, }, + { + MethodName: "TotalAckFees", + Handler: _Query_TotalAckFees_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/applications/fee/v1/query.proto", @@ -766,6 +903,76 @@ func (m *QueryTotalRecvFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryTotalAckFeesRequest) 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 *QueryTotalAckFeesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalAckFeesRequest) 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 *QueryTotalAckFeesResponse) 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 *QueryTotalAckFeesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalAckFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AckFees) > 0 { + for iNdEx := len(m.AckFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AckFees[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 @@ -859,6 +1066,32 @@ func (m *QueryTotalRecvFeesResponse) Size() (n int) { return n } +func (m *QueryTotalAckFeesRequest) 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 *QueryTotalAckFeesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AckFees) > 0 { + for _, e := range m.AckFees { + 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 } @@ -1406,6 +1639,173 @@ func (m *QueryTotalRecvFeesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryTotalAckFeesRequest) 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: QueryTotalAckFeesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalAckFeesRequest: 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 *QueryTotalAckFeesResponse) 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: QueryTotalAckFeesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalAckFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AckFees", 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.AckFees = append(m.AckFees, types1.Coin{}) + if err := m.AckFees[len(m.AckFees)-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 e9626d2a08e..b2e40834aa8 100644 --- a/modules/apps/29-fee/types/query.pb.gw.go +++ b/modules/apps/29-fee/types/query.pb.gw.go @@ -299,6 +299,122 @@ func local_request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime. } +var ( + filter_Query_TotalAckFees_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_TotalAckFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalAckFeesRequest + 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_TotalAckFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TotalAckFees(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalAckFeesRequest + 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_TotalAckFees_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TotalAckFees(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. @@ -365,6 +481,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TotalAckFees_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_TotalAckFees_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_TotalAckFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -466,6 +602,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TotalAckFees_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_TotalAckFees_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_TotalAckFees_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -475,6 +631,8 @@ var ( pattern_Query_IncentivizedPacket_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", "incentivized_packet", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) 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))) ) var ( @@ -483,4 +641,6 @@ var ( forward_Query_IncentivizedPacket_0 = runtime.ForwardResponseMessage forward_Query_TotalRecvFees_0 = runtime.ForwardResponseMessage + + forward_Query_TotalAckFees_0 = runtime.ForwardResponseMessage ) diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 65b677c2fdb..9a745e1502c 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -31,6 +31,12 @@ service Query { option (google.api.http).get = "/ibc/apps/fee/v1/total_recv_fees/port/{packet_id.port_id}/channel/" "{packet_id.channel_id}/sequence/{packet_id.sequence}"; } + + // TotalAckFees returns the total acknowledgement fees for a packet given its identifier + rpc TotalAckFees(QueryTotalAckFeesRequest) returns (QueryTotalAckFeesResponse) { + 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}"; + } } // QueryIncentivizedPacketsRequest is the request type for querying for all incentivized packets @@ -76,3 +82,19 @@ message QueryTotalRecvFeesResponse { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } + +// QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc +message QueryTotalAckFeesRequest { + // the packet identifier for the associated fees + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; +} + +// QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc +message QueryTotalAckFeesResponse { + // the total packet receive fees + repeated cosmos.base.v1beta1.Coin ack_fees = 1 [ + (gogoproto.moretags) = "yaml:\"ack_fees\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} From d620c98de10104fc9aed673ae053949e2c62dd65 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 28 Feb 2022 21:05:40 +0000 Subject: [PATCH 5/6] adding total ack fees query and tests --- modules/apps/29-fee/keeper/grpc_query.go | 26 ++++++++ modules/apps/29-fee/keeper/grpc_query_test.go | 64 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/modules/apps/29-fee/keeper/grpc_query.go b/modules/apps/29-fee/keeper/grpc_query.go index dfaa5d86a35..dd527f0fe59 100644 --- a/modules/apps/29-fee/keeper/grpc_query.go +++ b/modules/apps/29-fee/keeper/grpc_query.go @@ -91,3 +91,29 @@ func (k Keeper) TotalRecvFees(goCtx context.Context, req *types.QueryTotalRecvFe RecvFees: recvFees, }, nil } + +// TotalAckFees implements the Query/TotalAckFees gRPC method +func (k Keeper) TotalAckFees(goCtx context.Context, req *types.QueryTotalAckFeesRequest) (*types.QueryTotalAckFeesResponse, 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 ackFees sdk.Coins + for _, packetFee := range feesInEscrow.PacketFees { + ackFees = ackFees.Add(packetFee.Fee.AckFee...) + } + + return &types.QueryTotalAckFeesResponse{ + AckFees: ackFees, + }, nil +} diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index c9df54665f0..5bcb7d31416 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -203,3 +203,67 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() { }) } } + +func (suite *KeeperTestSuite) TestQueryTotalAckFees() { + var ( + req *types.QueryTotalAckFeesRequest + ) + + 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.QueryTotalAckFeesRequest{ + PacketId: packetID, + } + + tc.malleate() + + ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) + res, err := suite.queryClient.TotalAckFees(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + + // expected total is three times the default acknowledgement fee + expectedFees := defaultAckFee.Add(defaultAckFee...).Add(defaultAckFee...) + suite.Require().Equal(expectedFees, res.AckFees) + } else { + suite.Require().Error(err) + } + }) + } +} From 6d8a5bc9304cab4bb246f58c39524f81bc0bc0d6 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 1 Mar 2022 09:49:41 +0000 Subject: [PATCH 6/6] fixing protodoc comment --- docs/ibc/proto-docs.md | 2 +- modules/apps/29-fee/types/query.pb.go | 2 +- proto/ibc/applications/fee/v1/query.proto | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index fe3c031e566..d2093dd5c5d 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1011,7 +1011,7 @@ QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `ack_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | the total packet receive fees | +| `ack_fees` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | the total packet acknowledgement fees | diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index 63311c9d8c4..a4c5b0ee658 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -375,7 +375,7 @@ func (m *QueryTotalAckFeesRequest) GetPacketId() types.PacketId { // QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc type QueryTotalAckFeesResponse struct { - // the total packet receive fees + // the total packet acknowledgement fees AckFees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=ack_fees,json=ackFees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"ack_fees" yaml:"ack_fees"` } diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 9a745e1502c..e6ccb64fc77 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -91,7 +91,7 @@ message QueryTotalAckFeesRequest { // QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc message QueryTotalAckFeesResponse { - // the total packet receive fees + // the total packet acknowledgement fees repeated cosmos.base.v1beta1.Coin ack_fees = 1 [ (gogoproto.moretags) = "yaml:\"ack_fees\"", (gogoproto.nullable) = false,