From a8bd15f85ca8fa1c52da85570dac184e8773de91 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:24:07 -0400 Subject: [PATCH 01/12] Add query for PendingSendPacket --- .../ratelimit/pending_send_packet.proto | 12 + proto/dydxprotocol/ratelimit/query.proto | 12 + .../client/cli/pending_send_packets.go | 35 ++ .../client/cli/pending_send_packets_test.go | 30 ++ protocol/x/ratelimit/client/cli/query.go | 1 + protocol/x/ratelimit/keeper/grpc_query.go | 26 ++ .../x/ratelimit/keeper/grpc_query_test.go | 29 ++ protocol/x/ratelimit/types/keys.go | 19 +- .../ratelimit/types/pending_send_packet.pb.go | 357 ++++++++++++++++ protocol/x/ratelimit/types/query.pb.go | 398 ++++++++++++++++-- protocol/x/ratelimit/types/query.pb.gw.go | 65 +++ 11 files changed, 955 insertions(+), 29 deletions(-) create mode 100644 proto/dydxprotocol/ratelimit/pending_send_packet.proto create mode 100644 protocol/x/ratelimit/client/cli/pending_send_packets.go create mode 100644 protocol/x/ratelimit/client/cli/pending_send_packets_test.go create mode 100644 protocol/x/ratelimit/types/pending_send_packet.pb.go diff --git a/proto/dydxprotocol/ratelimit/pending_send_packet.proto b/proto/dydxprotocol/ratelimit/pending_send_packet.proto new file mode 100644 index 0000000000..3d0914a36f --- /dev/null +++ b/proto/dydxprotocol/ratelimit/pending_send_packet.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package dydxprotocol.ratelimit; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types"; + +// PendingSendPacket contains the channel_id and sequence pair to identify a pending packet +message PendingSendPacket { + string channel_id = 1; + uint64 sequence = 2; +} diff --git a/proto/dydxprotocol/ratelimit/query.proto b/proto/dydxprotocol/ratelimit/query.proto index 47ab6e62fb..5693bbe71a 100644 --- a/proto/dydxprotocol/ratelimit/query.proto +++ b/proto/dydxprotocol/ratelimit/query.proto @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "dydxprotocol/ratelimit/limit_params.proto"; import "dydxprotocol/ratelimit/capacity.proto"; +import "dydxprotocol/ratelimit/pending_send_packet.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types"; @@ -23,6 +24,11 @@ service Query { option (google.api.http).get = "/dydxprotocol/v4/ratelimit/capacity_by_denom"; } + rpc GetAllPendingSendPackets(GetAllPendingSendPacketsRequest) + returns (GetAllPendingSendPacketsResponse) { + option (google.api.http).get = + "/dydxprotocol/v4/ratelimit/get_all_pending_send_packet"; + } } // ListLimitParamsRequest is a request type of the ListLimitParams RPC method. @@ -43,3 +49,9 @@ message QueryCapacityByDenomResponse { repeated LimiterCapacity limiter_capacity_list = 1 [ (gogoproto.nullable) = false ]; } + +message GetAllPendingSendPacketsRequest {} + +message GetAllPendingSendPacketsResponse { + repeated PendingSendPacket pending_send_packets = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/protocol/x/ratelimit/client/cli/pending_send_packets.go b/protocol/x/ratelimit/client/cli/pending_send_packets.go new file mode 100644 index 0000000000..7655188e69 --- /dev/null +++ b/protocol/x/ratelimit/client/cli/pending_send_packets.go @@ -0,0 +1,35 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" + "github.com/spf13/cobra" +) + +func CmdPendingSendPackets() *cobra.Command { + cmd := &cobra.Command{ + Use: "pending-send-packets", + Short: "gets all pending send packets", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.GetAllPendingSendPackets(cmd.Context(), &types.GetAllPendingSendPacketsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/protocol/x/ratelimit/client/cli/pending_send_packets_test.go b/protocol/x/ratelimit/client/cli/pending_send_packets_test.go new file mode 100644 index 0000000000..d1675508bd --- /dev/null +++ b/protocol/x/ratelimit/client/cli/pending_send_packets_test.go @@ -0,0 +1,30 @@ +//go:build all || integration_test + +package cli_test + +import ( + "fmt" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/client/cli" + "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" + "github.com/stretchr/testify/require" + "gotest.tools/v3/assert" +) + +func TestPendingSendPackets(t *testing.T) { + net, ctx := setupNetwork(t) + + out, err := clitestutil.ExecTestCLICmd(ctx, + cli.CmdPendingSendPackets(), + []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + + require.NoError(t, err) + var resp types.GetAllPendingSendPacketsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + assert.Equal(t, 0, len(resp.PendingSendPackets)) +} diff --git a/protocol/x/ratelimit/client/cli/query.go b/protocol/x/ratelimit/client/cli/query.go index c031087082..2908d00a4e 100644 --- a/protocol/x/ratelimit/client/cli/query.go +++ b/protocol/x/ratelimit/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdListLimitParams()) cmd.AddCommand(CmdQueryCapacityByDenom()) + cmd.AddCommand(CmdPendingSendPackets()) return cmd } diff --git a/protocol/x/ratelimit/keeper/grpc_query.go b/protocol/x/ratelimit/keeper/grpc_query.go index a73a8eaf11..bc81bfd94d 100644 --- a/protocol/x/ratelimit/keeper/grpc_query.go +++ b/protocol/x/ratelimit/keeper/grpc_query.go @@ -3,6 +3,7 @@ package keeper import ( "context" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" "google.golang.org/grpc/codes" @@ -47,3 +48,28 @@ func (k Keeper) CapacityByDenom( LimiterCapacityList: limiterCapacityList, }, nil } + +func (k Keeper) GetAllPendingSendPackets( + ctx context.Context, + req *types.GetAllPendingSendPacketsRequest, +) (*types.GetAllPendingSendPacketsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + sdkCtx := sdk.UnwrapSDKContext(ctx) + + store := prefix.NewStore(sdkCtx.KVStore(k.storeKey), []byte(types.PendingSendPacketPrefix)) + pendingPackets := make([]types.PendingSendPacket, 0) + iterator := store.Iterator(nil, nil) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + channelId, sequence := types.SplitPendingSendPacketKey(iterator.Key()) + pendingPackets = append(pendingPackets, types.PendingSendPacket{ + ChannelId: channelId, + Sequence: sequence, + }) + } + return &types.GetAllPendingSendPacketsResponse{ + PendingSendPackets: pendingPackets, + }, nil +} diff --git a/protocol/x/ratelimit/keeper/grpc_query_test.go b/protocol/x/ratelimit/keeper/grpc_query_test.go index d726455cf7..7be2770b87 100644 --- a/protocol/x/ratelimit/keeper/grpc_query_test.go +++ b/protocol/x/ratelimit/keeper/grpc_query_test.go @@ -139,3 +139,32 @@ func TestCapacityByDenom(t *testing.T) { }) } } + +func TestGetAllPendingSendPacket(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.RatelimitKeeper + + channels := []string{"channel-0", "channel-1"} + sequences := []uint64{20, 22} + + for i := range channels { + k.SetPendingSendPacket(ctx, channels[i], sequences[i]) + } + + req := &types.GetAllPendingSendPacketsRequest{} + res, err := k.GetAllPendingSendPackets(ctx, req) + require.NoError(t, err) + require.Equal(t, &types.GetAllPendingSendPacketsResponse{ + PendingSendPackets: []types.PendingSendPacket{ + { + ChannelId: channels[0], + Sequence: sequences[0], + }, + { + ChannelId: channels[1], + Sequence: sequences[1], + }, + }, + }, res) +} diff --git a/protocol/x/ratelimit/types/keys.go b/protocol/x/ratelimit/types/keys.go index 5477868046..af1051bf28 100644 --- a/protocol/x/ratelimit/types/keys.go +++ b/protocol/x/ratelimit/types/keys.go @@ -1,6 +1,10 @@ package types -import fmt "fmt" +import ( + "bytes" + fmt "fmt" + "strconv" +) // Module name and store keys const ( @@ -27,3 +31,16 @@ const () func GetPendingSendPacketKey(channelId string, sequenceNumber uint64) []byte { return []byte(fmt.Sprintf("%s_%d", channelId, sequenceNumber)) } + +func SplitPendingSendPacketKey(key []byte) (channelId string, sequenceNumber uint64) { + parts := bytes.Split(key, []byte("_")) + if len(parts) != 2 { + panic(fmt.Sprintf("unexpected key format: %s", key)) + } + channelId = string(parts[0]) + // convert parts[1] to uint64 parts[1] is is a byte array with numeric characters of variable length + + sequenceNumberInt, _ := strconv.Atoi(string(parts[1])) + sequenceNumber = uint64(sequenceNumberInt) + return +} diff --git a/protocol/x/ratelimit/types/pending_send_packet.pb.go b/protocol/x/ratelimit/types/pending_send_packet.pb.go new file mode 100644 index 0000000000..f0c7bf5926 --- /dev/null +++ b/protocol/x/ratelimit/types/pending_send_packet.pb.go @@ -0,0 +1,357 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ratelimit/pending_send_packet.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// PendingSendPacket contains the channel_id and sequence pair to identify a pending packet +type PendingSendPacket struct { + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +func (m *PendingSendPacket) Reset() { *m = PendingSendPacket{} } +func (m *PendingSendPacket) String() string { return proto.CompactTextString(m) } +func (*PendingSendPacket) ProtoMessage() {} +func (*PendingSendPacket) Descriptor() ([]byte, []int) { + return fileDescriptor_0fa331693b6a2ba4, []int{0} +} +func (m *PendingSendPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingSendPacket.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 *PendingSendPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingSendPacket.Merge(m, src) +} +func (m *PendingSendPacket) XXX_Size() int { + return m.Size() +} +func (m *PendingSendPacket) XXX_DiscardUnknown() { + xxx_messageInfo_PendingSendPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingSendPacket proto.InternalMessageInfo + +func (m *PendingSendPacket) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *PendingSendPacket) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func init() { + proto.RegisterType((*PendingSendPacket)(nil), "dydxprotocol.ratelimit.PendingSendPacket") +} + +func init() { + proto.RegisterFile("dydxprotocol/ratelimit/pending_send_packet.proto", fileDescriptor_0fa331693b6a2ba4) +} + +var fileDescriptor_0fa331693b6a2ba4 = []byte{ + // 219 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2c, 0x49, 0xcd, 0xc9, 0xcc, + 0xcd, 0x2c, 0xd1, 0x2f, 0x48, 0xcd, 0x4b, 0xc9, 0xcc, 0x4b, 0x8f, 0x2f, 0x4e, 0xcd, 0x4b, 0x89, + 0x2f, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0xd1, 0x03, 0x2b, 0x13, 0x12, 0x43, 0xd6, 0xa1, 0x07, 0xd7, + 0x21, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x16, 0xd7, 0x07, 0xb1, 0x20, 0xaa, 0x95, 0xfc, 0xb8, + 0x04, 0x03, 0x20, 0x46, 0x05, 0xa7, 0xe6, 0xa5, 0x04, 0x80, 0x0d, 0x12, 0x92, 0xe5, 0xe2, 0x4a, + 0xce, 0x48, 0xcc, 0xcb, 0x4b, 0xcd, 0x89, 0xcf, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, + 0xe2, 0x84, 0x8a, 0x78, 0xa6, 0x08, 0x49, 0x71, 0x71, 0x14, 0xa7, 0x16, 0x96, 0xa6, 0xe6, 0x25, + 0xa7, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0xc1, 0xf9, 0x4e, 0xa1, 0x27, 0x1e, 0xc9, 0x31, + 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, + 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, + 0x9f, 0xab, 0x8f, 0xe2, 0xa9, 0x32, 0x13, 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x7d, 0xb8, 0x48, + 0x05, 0x92, 0x47, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x72, 0xc6, 0x80, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xaf, 0x02, 0x3a, 0xb5, 0x0f, 0x01, 0x00, 0x00, +} + +func (m *PendingSendPacket) 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 *PendingSendPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sequence != 0 { + i = encodeVarintPendingSendPacket(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintPendingSendPacket(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPendingSendPacket(dAtA []byte, offset int, v uint64) int { + offset -= sovPendingSendPacket(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PendingSendPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovPendingSendPacket(uint64(l)) + } + if m.Sequence != 0 { + n += 1 + sovPendingSendPacket(uint64(m.Sequence)) + } + return n +} + +func sovPendingSendPacket(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPendingSendPacket(x uint64) (n int) { + return sovPendingSendPacket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PendingSendPacket) 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 ErrIntOverflowPendingSendPacket + } + 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: PendingSendPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingSendPacket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingSendPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPendingSendPacket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPendingSendPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingSendPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPendingSendPacket(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPendingSendPacket + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPendingSendPacket(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingSendPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingSendPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingSendPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPendingSendPacket + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPendingSendPacket + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPendingSendPacket + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPendingSendPacket = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPendingSendPacket = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPendingSendPacket = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/ratelimit/types/query.pb.go b/protocol/x/ratelimit/types/query.pb.go index 184ff22ca1..290245f02c 100644 --- a/protocol/x/ratelimit/types/query.pb.go +++ b/protocol/x/ratelimit/types/query.pb.go @@ -203,11 +203,93 @@ func (m *QueryCapacityByDenomResponse) GetLimiterCapacityList() []LimiterCapacit return nil } +type GetAllPendingSendPacketsRequest struct { +} + +func (m *GetAllPendingSendPacketsRequest) Reset() { *m = GetAllPendingSendPacketsRequest{} } +func (m *GetAllPendingSendPacketsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllPendingSendPacketsRequest) ProtoMessage() {} +func (*GetAllPendingSendPacketsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f2e2dd1cb27aa65a, []int{4} +} +func (m *GetAllPendingSendPacketsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAllPendingSendPacketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAllPendingSendPacketsRequest.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 *GetAllPendingSendPacketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllPendingSendPacketsRequest.Merge(m, src) +} +func (m *GetAllPendingSendPacketsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAllPendingSendPacketsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllPendingSendPacketsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAllPendingSendPacketsRequest proto.InternalMessageInfo + +type GetAllPendingSendPacketsResponse struct { + PendingSendPackets []PendingSendPacket `protobuf:"bytes,1,rep,name=pending_send_packets,json=pendingSendPackets,proto3" json:"pending_send_packets"` +} + +func (m *GetAllPendingSendPacketsResponse) Reset() { *m = GetAllPendingSendPacketsResponse{} } +func (m *GetAllPendingSendPacketsResponse) String() string { return proto.CompactTextString(m) } +func (*GetAllPendingSendPacketsResponse) ProtoMessage() {} +func (*GetAllPendingSendPacketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f2e2dd1cb27aa65a, []int{5} +} +func (m *GetAllPendingSendPacketsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAllPendingSendPacketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAllPendingSendPacketsResponse.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 *GetAllPendingSendPacketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllPendingSendPacketsResponse.Merge(m, src) +} +func (m *GetAllPendingSendPacketsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAllPendingSendPacketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllPendingSendPacketsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAllPendingSendPacketsResponse proto.InternalMessageInfo + +func (m *GetAllPendingSendPacketsResponse) GetPendingSendPackets() []PendingSendPacket { + if m != nil { + return m.PendingSendPackets + } + return nil +} + func init() { proto.RegisterType((*ListLimitParamsRequest)(nil), "dydxprotocol.ratelimit.ListLimitParamsRequest") proto.RegisterType((*ListLimitParamsResponse)(nil), "dydxprotocol.ratelimit.ListLimitParamsResponse") proto.RegisterType((*QueryCapacityByDenomRequest)(nil), "dydxprotocol.ratelimit.QueryCapacityByDenomRequest") proto.RegisterType((*QueryCapacityByDenomResponse)(nil), "dydxprotocol.ratelimit.QueryCapacityByDenomResponse") + proto.RegisterType((*GetAllPendingSendPacketsRequest)(nil), "dydxprotocol.ratelimit.GetAllPendingSendPacketsRequest") + proto.RegisterType((*GetAllPendingSendPacketsResponse)(nil), "dydxprotocol.ratelimit.GetAllPendingSendPacketsResponse") } func init() { @@ -215,34 +297,40 @@ func init() { } var fileDescriptor_f2e2dd1cb27aa65a = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xa9, 0x4c, 0xa9, - 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2c, 0x49, 0xcd, 0xc9, 0xcc, - 0xcd, 0x2c, 0xd1, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x4b, 0x08, 0x89, 0x21, 0xab, 0xd1, - 0x83, 0xab, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x8b, 0xeb, 0x83, 0x58, 0x10, 0xd5, 0x52, - 0x32, 0xe9, 0xf9, 0xf9, 0xe9, 0x39, 0xa9, 0xfa, 0x89, 0x05, 0x99, 0xfa, 0x89, 0x79, 0x79, 0xf9, - 0x25, 0x89, 0x25, 0x99, 0xf9, 0x79, 0xc5, 0x50, 0x59, 0x4d, 0x1c, 0xf6, 0x81, 0xc9, 0xf8, 0x82, - 0xc4, 0xa2, 0xc4, 0x5c, 0x98, 0x52, 0x55, 0x1c, 0x4a, 0x93, 0x13, 0x0b, 0x12, 0x93, 0x33, 0x4b, - 0xa0, 0xae, 0x53, 0x92, 0xe0, 0x12, 0xf3, 0xc9, 0x2c, 0x2e, 0xf1, 0x01, 0xc9, 0x05, 0x80, 0xf5, - 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x28, 0x15, 0x70, 0x89, 0x63, 0xc8, 0x14, 0x17, 0xe4, - 0xe7, 0x15, 0xa7, 0x0a, 0x85, 0x72, 0x09, 0x22, 0xdb, 0x18, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, - 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xac, 0x87, 0xdd, 0xbb, 0x7a, 0x48, 0xe6, 0x38, 0xb1, 0x9c, - 0xb8, 0x27, 0xcf, 0x10, 0xc4, 0x9f, 0x83, 0x10, 0x02, 0xd9, 0xa4, 0x64, 0xcc, 0x25, 0x1d, 0x08, - 0x0a, 0x38, 0x67, 0xa8, 0x13, 0x9d, 0x2a, 0x5d, 0x52, 0xf3, 0xf2, 0x73, 0xa1, 0x0e, 0x12, 0x12, - 0xe1, 0x62, 0x4d, 0x01, 0xf1, 0x25, 0x18, 0x15,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52, - 0x8b, 0x93, 0xd8, 0xc0, 0x72, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x36, 0x18, 0xca, - 0xd0, 0x03, 0x00, 0x00, + // 525 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xee, 0xe8, 0xae, 0xe0, 0x78, 0x58, 0x1c, 0xeb, 0x5a, 0xe2, 0x92, 0xad, 0x11, 0x71, 0x17, + 0x34, 0x91, 0x6d, 0xd1, 0x05, 0x41, 0xb0, 0x0a, 0x5e, 0xf6, 0x50, 0x2b, 0x7b, 0xf1, 0x12, 0xa6, + 0xc9, 0x90, 0x1d, 0x9c, 0xce, 0xcc, 0x66, 0xa6, 0xb2, 0x39, 0x2a, 0x78, 0x17, 0xfc, 0x13, 0x9e, + 0xbd, 0xf8, 0x17, 0xf6, 0x22, 0x2c, 0x78, 0xf1, 0x24, 0xd2, 0xfa, 0x43, 0x24, 0x93, 0x6c, 0x4c, + 0xdb, 0xa4, 0xda, 0x4b, 0xc8, 0xbc, 0xf7, 0xbd, 0xf7, 0xbe, 0xf7, 0xbd, 0x0f, 0x3a, 0x61, 0x12, + 0x9e, 0xc8, 0x58, 0x68, 0x11, 0x08, 0xe6, 0xc5, 0x58, 0x13, 0x46, 0x47, 0x54, 0x7b, 0xc7, 0x63, + 0x12, 0x27, 0xae, 0x49, 0xa0, 0xcd, 0x32, 0xc6, 0x2d, 0x30, 0x56, 0x33, 0x12, 0x91, 0x30, 0x71, + 0x2f, 0xfd, 0xcb, 0xd0, 0xd6, 0x56, 0x24, 0x44, 0xc4, 0x88, 0x87, 0x25, 0xf5, 0x30, 0xe7, 0x42, + 0x63, 0x4d, 0x05, 0x57, 0x79, 0x76, 0xb7, 0x66, 0x9e, 0xf9, 0xfa, 0x12, 0xc7, 0x78, 0x74, 0x0e, + 0xb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 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -261,6 +349,7 @@ type QueryClient interface { ListLimitParams(ctx context.Context, in *ListLimitParamsRequest, opts ...grpc.CallOption) (*ListLimitParamsResponse, error) // Query capacity by denom. CapacityByDenom(ctx context.Context, in *QueryCapacityByDenomRequest, opts ...grpc.CallOption) (*QueryCapacityByDenomResponse, error) + GetAllPendingSendPackets(ctx context.Context, in *GetAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*GetAllPendingSendPacketsResponse, error) } type queryClient struct { @@ -289,12 +378,22 @@ func (c *queryClient) CapacityByDenom(ctx context.Context, in *QueryCapacityByDe return out, nil } +func (c *queryClient) GetAllPendingSendPackets(ctx context.Context, in *GetAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*GetAllPendingSendPacketsResponse, error) { + out := new(GetAllPendingSendPacketsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ratelimit.Query/GetAllPendingSendPackets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // List all limit params. ListLimitParams(context.Context, *ListLimitParamsRequest) (*ListLimitParamsResponse, error) // Query capacity by denom. CapacityByDenom(context.Context, *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) + GetAllPendingSendPackets(context.Context, *GetAllPendingSendPacketsRequest) (*GetAllPendingSendPacketsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -307,6 +406,9 @@ func (*UnimplementedQueryServer) ListLimitParams(ctx context.Context, req *ListL func (*UnimplementedQueryServer) CapacityByDenom(ctx context.Context, req *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CapacityByDenom not implemented") } +func (*UnimplementedQueryServer) GetAllPendingSendPackets(ctx context.Context, req *GetAllPendingSendPacketsRequest) (*GetAllPendingSendPacketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllPendingSendPackets not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -348,6 +450,24 @@ func _Query_CapacityByDenom_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_GetAllPendingSendPackets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllPendingSendPacketsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAllPendingSendPackets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.ratelimit.Query/GetAllPendingSendPackets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllPendingSendPackets(ctx, req.(*GetAllPendingSendPacketsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.ratelimit.Query", HandlerType: (*QueryServer)(nil), @@ -360,6 +480,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "CapacityByDenom", Handler: _Query_CapacityByDenom_Handler, }, + { + MethodName: "GetAllPendingSendPackets", + Handler: _Query_GetAllPendingSendPackets_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "dydxprotocol/ratelimit/query.proto", @@ -492,6 +616,66 @@ func (m *QueryCapacityByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *GetAllPendingSendPacketsRequest) 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 *GetAllPendingSendPacketsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAllPendingSendPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GetAllPendingSendPacketsResponse) 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 *GetAllPendingSendPacketsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAllPendingSendPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PendingSendPackets) > 0 { + for iNdEx := len(m.PendingSendPackets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PendingSendPackets[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 @@ -555,6 +739,30 @@ func (m *QueryCapacityByDenomResponse) Size() (n int) { return n } +func (m *GetAllPendingSendPacketsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GetAllPendingSendPacketsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PendingSendPackets) > 0 { + for _, e := range m.PendingSendPackets { + 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 } @@ -861,6 +1069,140 @@ func (m *QueryCapacityByDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *GetAllPendingSendPacketsRequest) 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: GetAllPendingSendPacketsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAllPendingSendPacketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *GetAllPendingSendPacketsResponse) 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: GetAllPendingSendPacketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAllPendingSendPacketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingSendPackets", 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.PendingSendPackets = append(m.PendingSendPackets, PendingSendPacket{}) + if err := m.PendingSendPackets[len(m.PendingSendPackets)-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/protocol/x/ratelimit/types/query.pb.gw.go b/protocol/x/ratelimit/types/query.pb.gw.go index d94c451c14..d691bab0a4 100644 --- a/protocol/x/ratelimit/types/query.pb.gw.go +++ b/protocol/x/ratelimit/types/query.pb.gw.go @@ -87,6 +87,24 @@ func local_request_Query_CapacityByDenom_0(ctx context.Context, marshaler runtim } +func request_Query_GetAllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllPendingSendPacketsRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetAllPendingSendPackets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllPendingSendPacketsRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetAllPendingSendPackets(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. @@ -139,6 +157,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetAllPendingSendPackets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + 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_GetAllPendingSendPackets_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -220,6 +261,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetAllPendingSendPackets_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_GetAllPendingSendPackets_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_GetAllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -227,10 +288,14 @@ var ( pattern_Query_ListLimitParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "list_limit_params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_CapacityByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "capacity_by_denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAllPendingSendPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "get_all_pending_send_packet"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_ListLimitParams_0 = runtime.ForwardResponseMessage forward_Query_CapacityByDenom_0 = runtime.ForwardResponseMessage + + forward_Query_GetAllPendingSendPackets_0 = runtime.ForwardResponseMessage ) From 62c2fcbace148012f2c9062f1a50e20a54c477a6 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:26:50 -0400 Subject: [PATCH 02/12] update go.mod --- protocol/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/go.mod b/protocol/go.mod index 5f093096bb..84acaa53dd 100644 --- a/protocol/go.mod +++ b/protocol/go.mod @@ -71,6 +71,7 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 google.golang.org/protobuf v1.32.0 + gotest.tools/v3 v3.5.1 ) require ( @@ -405,7 +406,6 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.1 // indirect honnef.co/go/tools v0.4.6 // indirect mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect From 6b21e6542e41ab6df0fed54621548c6e18ec6004 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:31:39 -0400 Subject: [PATCH 03/12] lint fixes --- proto/dydxprotocol/ratelimit/pending_send_packet.proto | 2 -- proto/dydxprotocol/ratelimit/query.proto | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/proto/dydxprotocol/ratelimit/pending_send_packet.proto b/proto/dydxprotocol/ratelimit/pending_send_packet.proto index 3d0914a36f..a0f84aa35a 100644 --- a/proto/dydxprotocol/ratelimit/pending_send_packet.proto +++ b/proto/dydxprotocol/ratelimit/pending_send_packet.proto @@ -1,8 +1,6 @@ syntax = "proto3"; package dydxprotocol.ratelimit; -import "gogoproto/gogo.proto"; - option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types"; // PendingSendPacket contains the channel_id and sequence pair to identify a pending packet diff --git a/proto/dydxprotocol/ratelimit/query.proto b/proto/dydxprotocol/ratelimit/query.proto index 5693bbe71a..77c95622dd 100644 --- a/proto/dydxprotocol/ratelimit/query.proto +++ b/proto/dydxprotocol/ratelimit/query.proto @@ -24,6 +24,7 @@ service Query { option (google.api.http).get = "/dydxprotocol/v4/ratelimit/capacity_by_denom"; } + // Get all pending send packets rpc GetAllPendingSendPackets(GetAllPendingSendPacketsRequest) returns (GetAllPendingSendPacketsResponse) { option (google.api.http).get = @@ -50,8 +51,10 @@ message QueryCapacityByDenomResponse { [ (gogoproto.nullable) = false ]; } +// GetAllPendingSendPacketsRequest is a request type for the GetAllPendingSendPackets RPC message GetAllPendingSendPacketsRequest {} +// GetAllPendingSendPacketsResponse is a response type of the GetAllPendingSendPackets RPC message GetAllPendingSendPacketsResponse { repeated PendingSendPacket pending_send_packets = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file From 813c4e769b0927356ec5c93057b63c25828c38c4 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:34:01 -0400 Subject: [PATCH 04/12] newline --- proto/dydxprotocol/ratelimit/pending_send_packet.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/dydxprotocol/ratelimit/pending_send_packet.proto b/proto/dydxprotocol/ratelimit/pending_send_packet.proto index a0f84aa35a..f16953ae2c 100644 --- a/proto/dydxprotocol/ratelimit/pending_send_packet.proto +++ b/proto/dydxprotocol/ratelimit/pending_send_packet.proto @@ -7,4 +7,4 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types message PendingSendPacket { string channel_id = 1; uint64 sequence = 2; -} +} \ No newline at end of file From 3e20e3db093179f37d9ef1ca3ad860b8a6c13689 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:36:02 -0400 Subject: [PATCH 05/12] protos --- .../ratelimit/types/pending_send_packet.pb.go | 22 +++++++++---------- protocol/x/ratelimit/types/query.pb.go | 4 ++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/protocol/x/ratelimit/types/pending_send_packet.pb.go b/protocol/x/ratelimit/types/pending_send_packet.pb.go index f0c7bf5926..7f1e39911e 100644 --- a/protocol/x/ratelimit/types/pending_send_packet.pb.go +++ b/protocol/x/ratelimit/types/pending_send_packet.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -85,21 +84,20 @@ func init() { } var fileDescriptor_0fa331693b6a2ba4 = []byte{ - // 219 bytes of a gzipped FileDescriptorProto + // 206 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1,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00, 0x00, - 0x00, 0xff, 0xff, 0xaf, 0x02, 0x3a, 0xb5, 0x0f, 0x01, 0x00, 0x00, + 0xa1, 0xe4, 0xc7, 0x25, 0x18, 0x00, 0xd1, 0x14, 0x9c, 0x9a, 0x97, 0x12, 0x00, 0xd6, 0x22, 0x24, + 0xcb, 0xc5, 0x95, 0x9c, 0x91, 0x98, 0x97, 0x97, 0x9a, 0x13, 0x9f, 0x99, 0x22, 0xc1, 0xa8, 0xc0, + 0xa8, 0xc1, 0x19, 0xc4, 0x09, 0x15, 0xf1, 0x4c, 0x11, 0x92, 0xe2, 0xe2, 0x28, 0x4e, 0x2d, 0x2c, + 0x4d, 0xcd, 0x4b, 0x4e, 0x95, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x09, 0x82, 0xf3, 0x9d, 0x42, 0x4f, + 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, + 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x3a, 0x3d, 0xb3, 0x24, 0xa3, 0x34, + 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xc5, 0xf9, 0x65, 0x26, 0xba, 0xc9, 0x19, 0x89, 0x99, 0x79, + 0xfa, 0x70, 0x91, 0x0a, 0x24, 0x2f, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xe5, 0x8c, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x41, 0x30, 0xc9, 0xf2, 0xf9, 0x00, 0x00, 0x00, } func (m *PendingSendPacket) Marshal() (dAtA []byte, err error) { diff --git a/protocol/x/ratelimit/types/query.pb.go b/protocol/x/ratelimit/types/query.pb.go index 290245f02c..9fcb792e7c 100644 --- a/protocol/x/ratelimit/types/query.pb.go +++ b/protocol/x/ratelimit/types/query.pb.go @@ -203,6 +203,7 @@ func (m *QueryCapacityByDenomResponse) GetLimiterCapacityList() []LimiterCapacit return nil } +// GetAllPendingSendPacketsRequest is a request type for the GetAllPendingSendPackets RPC type GetAllPendingSendPacketsRequest struct { } @@ -239,6 +240,7 @@ func (m *GetAllPendingSendPacketsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllPendingSendPacketsRequest proto.InternalMessageInfo +// GetAllPendingSendPacketsResponse is a response type of the GetAllPendingSendPackets RPC type GetAllPendingSendPacketsResponse struct { PendingSendPackets []PendingSendPacket `protobuf:"bytes,1,rep,name=pending_send_packets,json=pendingSendPackets,proto3" json:"pending_send_packets"` } @@ -349,6 +351,7 @@ type QueryClient interface { ListLimitParams(ctx context.Context, in *ListLimitParamsRequest, opts ...grpc.CallOption) (*ListLimitParamsResponse, error) // Query capacity by denom. CapacityByDenom(ctx context.Context, in *QueryCapacityByDenomRequest, opts ...grpc.CallOption) (*QueryCapacityByDenomResponse, error) + // Get all pending send packets GetAllPendingSendPackets(ctx context.Context, in *GetAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*GetAllPendingSendPacketsResponse, error) } @@ -393,6 +396,7 @@ type QueryServer interface { ListLimitParams(context.Context, *ListLimitParamsRequest) (*ListLimitParamsResponse, error) // Query capacity by denom. CapacityByDenom(context.Context, *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) + // Get all pending send packets GetAllPendingSendPackets(context.Context, *GetAllPendingSendPacketsRequest) (*GetAllPendingSendPacketsResponse, error) } From fb722007864816e7ab1bac6e8a8c430598977b8e Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 14 Mar 2024 16:40:20 -0400 Subject: [PATCH 06/12] proto stuff --- proto/dydxprotocol/ratelimit/pending_send_packet.proto | 3 ++- proto/dydxprotocol/ratelimit/query.proto | 9 ++++++--- protocol/x/ratelimit/types/pending_send_packet.pb.go | 3 ++- protocol/x/ratelimit/types/query.pb.go | 6 ++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/proto/dydxprotocol/ratelimit/pending_send_packet.proto b/proto/dydxprotocol/ratelimit/pending_send_packet.proto index f16953ae2c..e52677c4e9 100644 --- a/proto/dydxprotocol/ratelimit/pending_send_packet.proto +++ b/proto/dydxprotocol/ratelimit/pending_send_packet.proto @@ -3,7 +3,8 @@ package dydxprotocol.ratelimit; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types"; -// PendingSendPacket contains the channel_id and sequence pair to identify a pending packet +// PendingSendPacket contains the channel_id and sequence pair to identify a +// pending packet message PendingSendPacket { string channel_id = 1; uint64 sequence = 2; diff --git a/proto/dydxprotocol/ratelimit/query.proto b/proto/dydxprotocol/ratelimit/query.proto index 77c95622dd..a7e8abbd83 100644 --- a/proto/dydxprotocol/ratelimit/query.proto +++ b/proto/dydxprotocol/ratelimit/query.proto @@ -51,10 +51,13 @@ message QueryCapacityByDenomResponse { [ (gogoproto.nullable) = false ]; } -// GetAllPendingSendPacketsRequest is a request type for the GetAllPendingSendPackets RPC +// GetAllPendingSendPacketsRequest is a request type for the +// GetAllPendingSendPackets RPC message GetAllPendingSendPacketsRequest {} -// GetAllPendingSendPacketsResponse is a response type of the GetAllPendingSendPackets RPC +// GetAllPendingSendPacketsResponse is a response type of the +// GetAllPendingSendPackets RPC message GetAllPendingSendPacketsResponse { - repeated PendingSendPacket pending_send_packets = 1 [ (gogoproto.nullable) = false ]; + repeated PendingSendPacket pending_send_packets = 1 + [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/protocol/x/ratelimit/types/pending_send_packet.pb.go b/protocol/x/ratelimit/types/pending_send_packet.pb.go index 7f1e39911e..64a789df7c 100644 --- a/protocol/x/ratelimit/types/pending_send_packet.pb.go +++ b/protocol/x/ratelimit/types/pending_send_packet.pb.go @@ -22,7 +22,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// PendingSendPacket contains the channel_id and sequence pair to identify a pending packet +// PendingSendPacket contains the channel_id and sequence pair to identify a +// pending packet type PendingSendPacket struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` diff --git a/protocol/x/ratelimit/types/query.pb.go b/protocol/x/ratelimit/types/query.pb.go index 9fcb792e7c..b74006f225 100644 --- a/protocol/x/ratelimit/types/query.pb.go +++ b/protocol/x/ratelimit/types/query.pb.go @@ -203,7 +203,8 @@ func (m *QueryCapacityByDenomResponse) GetLimiterCapacityList() []LimiterCapacit return nil } -// GetAllPendingSendPacketsRequest is a request type for the GetAllPendingSendPackets RPC +// GetAllPendingSendPacketsRequest is a request type for the +// GetAllPendingSendPackets RPC type GetAllPendingSendPacketsRequest struct { } @@ -240,7 +241,8 @@ func (m *GetAllPendingSendPacketsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllPendingSendPacketsRequest proto.InternalMessageInfo -// GetAllPendingSendPacketsResponse is a response type of the GetAllPendingSendPackets RPC +// GetAllPendingSendPacketsResponse is a response type of the +// GetAllPendingSendPackets RPC type GetAllPendingSendPacketsResponse struct { PendingSendPackets []PendingSendPacket `protobuf:"bytes,1,rep,name=pending_send_packets,json=pendingSendPackets,proto3" json:"pending_send_packets"` } From 9a7a4a1463cb7951ac8c3f8052103a01aa2cfe1f Mon Sep 17 00:00:00 2001 From: affan Date: Fri, 15 Mar 2024 16:07:25 -0400 Subject: [PATCH 07/12] update tests --- protocol/x/ratelimit/module_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/x/ratelimit/module_test.go b/protocol/x/ratelimit/module_test.go index 1ac9620a5e..fe9b96fe96 100644 --- a/protocol/x/ratelimit/module_test.go +++ b/protocol/x/ratelimit/module_test.go @@ -132,7 +132,8 @@ func TestAppModuleBasic_GetQueryCmd(t *testing.T) { cmd := am.GetQueryCmd() require.Equal(t, "ratelimit", cmd.Use) - require.Equal(t, 2, len(cmd.Commands())) + require.Equal(t, 3, len(cmd.Commands())) require.Equal(t, "capacity-by-denom", cmd.Commands()[0].Name()) require.Equal(t, "list-limit-params", cmd.Commands()[1].Name()) + require.Equal(t, "pending-send-packets", cmd.Commands()[2].Name()) } From e1390d40e2ce64523d60bf635ad3c9d7c58cfe48 Mon Sep 17 00:00:00 2001 From: Mohammed Affan Date: Tue, 19 Mar 2024 16:19:45 -0400 Subject: [PATCH 08/12] Update protocol/x/ratelimit/types/keys.go Co-authored-by: Teddy Ding --- protocol/x/ratelimit/types/keys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/x/ratelimit/types/keys.go b/protocol/x/ratelimit/types/keys.go index af1051bf28..b3c4a227de 100644 --- a/protocol/x/ratelimit/types/keys.go +++ b/protocol/x/ratelimit/types/keys.go @@ -2,7 +2,7 @@ package types import ( "bytes" - fmt "fmt" + "fmt" "strconv" ) From 17e10b3c0cefb5902fb3a10c5c12f591975bd63f Mon Sep 17 00:00:00 2001 From: affan Date: Tue, 19 Mar 2024 16:39:57 -0400 Subject: [PATCH 09/12] address comments --- proto/dydxprotocol/ratelimit/query.proto | 16 +- .../client/cli/pending_send_packets.go | 2 +- .../client/cli/pending_send_packets_test.go | 2 +- protocol/x/ratelimit/keeper/grpc_query.go | 8 +- .../x/ratelimit/keeper/grpc_query_test.go | 6 +- protocol/x/ratelimit/types/keys_test.go | 11 + protocol/x/ratelimit/types/query.pb.go | 194 +++++++++--------- protocol/x/ratelimit/types/query.pb.gw.go | 28 +-- 8 files changed, 139 insertions(+), 128 deletions(-) diff --git a/proto/dydxprotocol/ratelimit/query.proto b/proto/dydxprotocol/ratelimit/query.proto index a7e8abbd83..ad462251d4 100644 --- a/proto/dydxprotocol/ratelimit/query.proto +++ b/proto/dydxprotocol/ratelimit/query.proto @@ -25,8 +25,8 @@ service Query { "/dydxprotocol/v4/ratelimit/capacity_by_denom"; } // Get all pending send packets - rpc GetAllPendingSendPackets(GetAllPendingSendPacketsRequest) - returns (GetAllPendingSendPacketsResponse) { + rpc AllPendingSendPackets(QueryAllPendingSendPacketsRequest) + returns (QueryAllPendingSendPacketsResponse) { option (google.api.http).get = "/dydxprotocol/v4/ratelimit/get_all_pending_send_packet"; } @@ -51,13 +51,13 @@ message QueryCapacityByDenomResponse { [ (gogoproto.nullable) = false ]; } -// GetAllPendingSendPacketsRequest is a request type for the -// GetAllPendingSendPackets RPC -message GetAllPendingSendPacketsRequest {} +// QueryAllPendingSendPacketsRequest is a request type for the +// AllPendingSendPackets RPC +message QueryAllPendingSendPacketsRequest {} -// GetAllPendingSendPacketsResponse is a response type of the -// GetAllPendingSendPackets RPC -message GetAllPendingSendPacketsResponse { +// QueryAllPendingSendPacketsResponse is a response type of the +// AllPendingSendPackets RPC +message QueryAllPendingSendPacketsResponse { repeated PendingSendPacket pending_send_packets = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/protocol/x/ratelimit/client/cli/pending_send_packets.go b/protocol/x/ratelimit/client/cli/pending_send_packets.go index 7655188e69..6ea4e4d2c8 100644 --- a/protocol/x/ratelimit/client/cli/pending_send_packets.go +++ b/protocol/x/ratelimit/client/cli/pending_send_packets.go @@ -20,7 +20,7 @@ func CmdPendingSendPackets() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.GetAllPendingSendPackets(cmd.Context(), &types.GetAllPendingSendPacketsRequest{}) + res, err := queryClient.AllPendingSendPackets(cmd.Context(), &types.QueryAllPendingSendPacketsRequest{}) if err != nil { return err } diff --git a/protocol/x/ratelimit/client/cli/pending_send_packets_test.go b/protocol/x/ratelimit/client/cli/pending_send_packets_test.go index d1675508bd..4af1b6abb0 100644 --- a/protocol/x/ratelimit/client/cli/pending_send_packets_test.go +++ b/protocol/x/ratelimit/client/cli/pending_send_packets_test.go @@ -24,7 +24,7 @@ func TestPendingSendPackets(t *testing.T) { }) require.NoError(t, err) - var resp types.GetAllPendingSendPacketsResponse + var resp types.QueryAllPendingSendPacketsResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) assert.Equal(t, 0, len(resp.PendingSendPackets)) } diff --git a/protocol/x/ratelimit/keeper/grpc_query.go b/protocol/x/ratelimit/keeper/grpc_query.go index bc81bfd94d..76eed9fe29 100644 --- a/protocol/x/ratelimit/keeper/grpc_query.go +++ b/protocol/x/ratelimit/keeper/grpc_query.go @@ -49,10 +49,10 @@ func (k Keeper) CapacityByDenom( }, nil } -func (k Keeper) GetAllPendingSendPackets( +func (k Keeper) AllPendingSendPackets( ctx context.Context, - req *types.GetAllPendingSendPacketsRequest, -) (*types.GetAllPendingSendPacketsResponse, error) { + req *types.QueryAllPendingSendPacketsRequest, +) (*types.QueryAllPendingSendPacketsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -69,7 +69,7 @@ func (k Keeper) GetAllPendingSendPackets( Sequence: sequence, }) } - return &types.GetAllPendingSendPacketsResponse{ + return &types.QueryAllPendingSendPacketsResponse{ PendingSendPackets: pendingPackets, }, nil } diff --git a/protocol/x/ratelimit/keeper/grpc_query_test.go b/protocol/x/ratelimit/keeper/grpc_query_test.go index 7be2770b87..c7a788c393 100644 --- a/protocol/x/ratelimit/keeper/grpc_query_test.go +++ b/protocol/x/ratelimit/keeper/grpc_query_test.go @@ -152,10 +152,10 @@ func TestGetAllPendingSendPacket(t *testing.T) { k.SetPendingSendPacket(ctx, channels[i], sequences[i]) } - req := &types.GetAllPendingSendPacketsRequest{} - res, err := k.GetAllPendingSendPackets(ctx, req) + req := &types.QueryAllPendingSendPacketsRequest{} + res, err := k.AllPendingSendPackets(ctx, req) require.NoError(t, err) - require.Equal(t, &types.GetAllPendingSendPacketsResponse{ + require.Equal(t, &types.QueryAllPendingSendPacketsResponse{ PendingSendPackets: []types.PendingSendPacket{ { ChannelId: channels[0], diff --git a/protocol/x/ratelimit/types/keys_test.go b/protocol/x/ratelimit/types/keys_test.go index b2e9cb16e4..5c6229d900 100644 --- a/protocol/x/ratelimit/types/keys_test.go +++ b/protocol/x/ratelimit/types/keys_test.go @@ -16,3 +16,14 @@ func TestStateKeys(t *testing.T) { require.Equal(t, "DenomCapacity:", types.DenomCapacityKeyPrefix) require.Equal(t, "LimitParams:", types.LimitParamsKeyPrefix) } + +func TestSplitPendingSendPacketKey(t *testing.T) { + channelId := "channel-0" + sequenceNumber := uint64(2) + channelIdReceived, sequenceNumberReceived := types.SplitPendingSendPacketKey( + types.GetPendingSendPacketKey(channelId, sequenceNumber), + ) + + require.Equal(t, channelId, channelIdReceived) + require.Equal(t, sequenceNumber, sequenceNumberReceived) +} diff --git a/protocol/x/ratelimit/types/query.pb.go b/protocol/x/ratelimit/types/query.pb.go index b74006f225..ae4e013110 100644 --- a/protocol/x/ratelimit/types/query.pb.go +++ b/protocol/x/ratelimit/types/query.pb.go @@ -203,23 +203,23 @@ func (m *QueryCapacityByDenomResponse) GetLimiterCapacityList() []LimiterCapacit return nil } -// GetAllPendingSendPacketsRequest is a request type for the -// GetAllPendingSendPackets RPC -type GetAllPendingSendPacketsRequest struct { +// QueryAllPendingSendPacketsRequest is a request type for the +// AllPendingSendPackets RPC +type QueryAllPendingSendPacketsRequest struct { } -func (m *GetAllPendingSendPacketsRequest) Reset() { *m = GetAllPendingSendPacketsRequest{} } -func (m *GetAllPendingSendPacketsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllPendingSendPacketsRequest) ProtoMessage() {} -func (*GetAllPendingSendPacketsRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllPendingSendPacketsRequest) Reset() { *m = QueryAllPendingSendPacketsRequest{} } +func (m *QueryAllPendingSendPacketsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingSendPacketsRequest) ProtoMessage() {} +func (*QueryAllPendingSendPacketsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f2e2dd1cb27aa65a, []int{4} } -func (m *GetAllPendingSendPacketsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPendingSendPacketsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAllPendingSendPacketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPendingSendPacketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAllPendingSendPacketsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPendingSendPacketsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -229,36 +229,36 @@ func (m *GetAllPendingSendPacketsRequest) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *GetAllPendingSendPacketsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllPendingSendPacketsRequest.Merge(m, src) +func (m *QueryAllPendingSendPacketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingSendPacketsRequest.Merge(m, src) } -func (m *GetAllPendingSendPacketsRequest) XXX_Size() int { +func (m *QueryAllPendingSendPacketsRequest) XXX_Size() int { return m.Size() } -func (m *GetAllPendingSendPacketsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllPendingSendPacketsRequest.DiscardUnknown(m) +func (m *QueryAllPendingSendPacketsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingSendPacketsRequest.DiscardUnknown(m) } -var xxx_messageInfo_GetAllPendingSendPacketsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPendingSendPacketsRequest proto.InternalMessageInfo -// GetAllPendingSendPacketsResponse is a response type of the -// GetAllPendingSendPackets RPC -type GetAllPendingSendPacketsResponse struct { +// QueryAllPendingSendPacketsResponse is a response type of the +// AllPendingSendPackets RPC +type QueryAllPendingSendPacketsResponse struct { PendingSendPackets []PendingSendPacket `protobuf:"bytes,1,rep,name=pending_send_packets,json=pendingSendPackets,proto3" json:"pending_send_packets"` } -func (m *GetAllPendingSendPacketsResponse) Reset() { *m = GetAllPendingSendPacketsResponse{} } -func (m *GetAllPendingSendPacketsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllPendingSendPacketsResponse) ProtoMessage() {} -func (*GetAllPendingSendPacketsResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllPendingSendPacketsResponse) Reset() { *m = QueryAllPendingSendPacketsResponse{} } +func (m *QueryAllPendingSendPacketsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingSendPacketsResponse) ProtoMessage() {} +func (*QueryAllPendingSendPacketsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f2e2dd1cb27aa65a, []int{5} } -func (m *GetAllPendingSendPacketsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPendingSendPacketsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAllPendingSendPacketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPendingSendPacketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAllPendingSendPacketsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPendingSendPacketsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -268,19 +268,19 @@ func (m *GetAllPendingSendPacketsResponse) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *GetAllPendingSendPacketsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllPendingSendPacketsResponse.Merge(m, src) +func (m *QueryAllPendingSendPacketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingSendPacketsResponse.Merge(m, src) } -func (m *GetAllPendingSendPacketsResponse) XXX_Size() int { +func (m *QueryAllPendingSendPacketsResponse) XXX_Size() int { return m.Size() } -func (m *GetAllPendingSendPacketsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllPendingSendPacketsResponse.DiscardUnknown(m) +func (m *QueryAllPendingSendPacketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingSendPacketsResponse.DiscardUnknown(m) } -var xxx_messageInfo_GetAllPendingSendPacketsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPendingSendPacketsResponse proto.InternalMessageInfo -func (m *GetAllPendingSendPacketsResponse) GetPendingSendPackets() []PendingSendPacket { +func (m *QueryAllPendingSendPacketsResponse) GetPendingSendPackets() []PendingSendPacket { if m != nil { return m.PendingSendPackets } @@ -292,8 +292,8 @@ func init() { proto.RegisterType((*ListLimitParamsResponse)(nil), "dydxprotocol.ratelimit.ListLimitParamsResponse") proto.RegisterType((*QueryCapacityByDenomRequest)(nil), "dydxprotocol.ratelimit.QueryCapacityByDenomRequest") proto.RegisterType((*QueryCapacityByDenomResponse)(nil), "dydxprotocol.ratelimit.QueryCapacityByDenomResponse") - proto.RegisterType((*GetAllPendingSendPacketsRequest)(nil), "dydxprotocol.ratelimit.GetAllPendingSendPacketsRequest") - proto.RegisterType((*GetAllPendingSendPacketsResponse)(nil), "dydxprotocol.ratelimit.GetAllPendingSendPacketsResponse") + proto.RegisterType((*QueryAllPendingSendPacketsRequest)(nil), "dydxprotocol.ratelimit.QueryAllPendingSendPacketsRequest") + proto.RegisterType((*QueryAllPendingSendPacketsResponse)(nil), "dydxprotocol.ratelimit.QueryAllPendingSendPacketsResponse") } func init() { @@ -301,40 +301,40 @@ func init() { } var fileDescriptor_f2e2dd1cb27aa65a = []byte{ - // 525 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xee, 0xe8, 0xae, 0xe0, 0x78, 0x58, 0x1c, 0xeb, 0x5a, 0xe2, 0x92, 0xad, 0x11, 0x71, 0x17, - 0x34, 0x91, 0x6d, 0xd1, 0x05, 0x41, 0xb0, 0x0a, 0x5e, 0xf6, 0x50, 0x2b, 0x7b, 0xf1, 0x12, 0xa6, - 0xc9, 0x90, 0x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x45, 0x2b, - 0x90, 0x2e, 0xac, 0x35, 0x4c, 0x7c, 0x63, 0x4c, 0xf4, 0x0d, 0xc0, 0x56, 0xdd, 0xc5, 0xd1, 0xa3, - 0x3a, 0x22, 0xff, 0xf0, 0x91, 0xb5, 0xbf, 0x7a, 0x61, 0xbe, 0xc5, 0x13, 0xb3, 0xc5, 0x3e, 0x7a, - 0xb8, 0x64, 0x8b, 0x88, 0x68, 0x1f, 0x33, 0xe6, 0x57, 0xb8, 0xb0, 0x77, 0x78, 0x3a, 0xb1, 0xc1, - 0xd9, 0xc4, 0x06, 0xbf, 0x26, 0x36, 0xf8, 0x38, 0xb5, 0x1b, 0x67, 0x53, 0xbb, 0xf1, 0x63, 0x6a, - 0x37, 0x5e, 0x3f, 0x8e, 0xa8, 0x3e, 0x1a, 0x0f, 0xdd, 0x40, 0x8c, 0xe6, 0x7b, 0xdf, 0x0f, 0x8e, - 0x30, 0xe5, 0x5e, 0x11, 0x39, 0x29, 0x0d, 0xd3, 0x89, 0x24, 0x6a, 0x78, 0xc9, 0xe4, 0x3a, 0x7f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x8f, 0x9b, 0x63, 0x7d, 0x05, 0x00, 0x00, + // 526 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0x6b, 0xd8, 0x90, 0x30, 0x87, 0x09, 0xd3, 0x8d, 0x2a, 0x4c, 0x61, 0x64, 0x42, 0x6c, + 0x12, 0x24, 0x68, 0xad, 0x10, 0x3f, 0x24, 0x24, 0x0a, 0xc7, 0x1d, 0x4a, 0xd1, 0x2e, 0x5c, 0x22, + 0x37, 0xb1, 0x32, 0x0b, 0xd7, 0xf6, 0x62, 0x17, 0x2d, 0x47, 0xb8, 0x70, 0x45, 0xe2, 0x9f, 0xe0, + 0xcc, 0x89, 0x3f,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8, + 0x51, 0x23, 0x45, 0x93, 0x91, 0xac, 0xc7, 0xff, 0x13, 0x9a, 0xb7, 0xf1, 0xd4, 0xb4, 0xf1, 0x10, + 0x3d, 0x68, 0x68, 0x23, 0x22, 0xda, 0xc7, 0x8c, 0xf9, 0x15, 0x36, 0xec, 0x1f, 0x9c, 0x4c, 0x6d, + 0x70, 0x3a, 0xb5, 0xc1, 0xaf, 0xa9, 0x0d, 0x3e, 0xce, 0xec, 0xd6, 0xe9, 0xcc, 0x6e, 0xfd, 0x98, + 0xd9, 0xad, 0xd7, 0x4f, 0x22, 0xaa, 0x0f, 0x27, 0x23, 0x37, 0x10, 0xe3, 0xc5, 0xdc, 0xf7, 0x82, + 0x43, 0x4c, 0xb9, 0x57, 0xdc, 0x1c, 0x97, 0x8a, 0xe9, 0x44, 0x12, 0x35, 0xba, 0x64, 0xde, 0xba, + 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x02, 0x33, 0xb1, 0x82, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -354,7 +354,7 @@ type QueryClient interface { // Query capacity by denom. CapacityByDenom(ctx context.Context, in *QueryCapacityByDenomRequest, opts ...grpc.CallOption) (*QueryCapacityByDenomResponse, error) // Get all pending send packets - GetAllPendingSendPackets(ctx context.Context, in *GetAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*GetAllPendingSendPacketsResponse, error) + AllPendingSendPackets(ctx context.Context, in *QueryAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*QueryAllPendingSendPacketsResponse, error) } type queryClient struct { @@ -383,9 +383,9 @@ func (c *queryClient) CapacityByDenom(ctx context.Context, in *QueryCapacityByDe return out, nil } -func (c *queryClient) GetAllPendingSendPackets(ctx context.Context, in *GetAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*GetAllPendingSendPacketsResponse, error) { - out := new(GetAllPendingSendPacketsResponse) - err := c.cc.Invoke(ctx, "/dydxprotocol.ratelimit.Query/GetAllPendingSendPackets", in, out, opts...) +func (c *queryClient) AllPendingSendPackets(ctx context.Context, in *QueryAllPendingSendPacketsRequest, opts ...grpc.CallOption) (*QueryAllPendingSendPacketsResponse, error) { + out := new(QueryAllPendingSendPacketsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ratelimit.Query/AllPendingSendPackets", in, out, opts...) if err != nil { return nil, err } @@ -399,7 +399,7 @@ type QueryServer interface { // Query capacity by denom. CapacityByDenom(context.Context, *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) // Get all pending send packets - GetAllPendingSendPackets(context.Context, *GetAllPendingSendPacketsRequest) (*GetAllPendingSendPacketsResponse, error) + AllPendingSendPackets(context.Context, *QueryAllPendingSendPacketsRequest) (*QueryAllPendingSendPacketsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -412,8 +412,8 @@ func (*UnimplementedQueryServer) ListLimitParams(ctx context.Context, req *ListL func (*UnimplementedQueryServer) CapacityByDenom(ctx context.Context, req *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CapacityByDenom not implemented") } -func (*UnimplementedQueryServer) GetAllPendingSendPackets(ctx context.Context, req *GetAllPendingSendPacketsRequest) (*GetAllPendingSendPacketsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllPendingSendPackets not implemented") +func (*UnimplementedQueryServer) AllPendingSendPackets(ctx context.Context, req *QueryAllPendingSendPacketsRequest) (*QueryAllPendingSendPacketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllPendingSendPackets not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -456,20 +456,20 @@ func _Query_CapacityByDenom_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Query_GetAllPendingSendPackets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllPendingSendPacketsRequest) +func _Query_AllPendingSendPackets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllPendingSendPacketsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetAllPendingSendPackets(ctx, in) + return srv.(QueryServer).AllPendingSendPackets(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/dydxprotocol.ratelimit.Query/GetAllPendingSendPackets", + FullMethod: "/dydxprotocol.ratelimit.Query/AllPendingSendPackets", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllPendingSendPackets(ctx, req.(*GetAllPendingSendPacketsRequest)) + return srv.(QueryServer).AllPendingSendPackets(ctx, req.(*QueryAllPendingSendPacketsRequest)) } return interceptor(ctx, in, info, handler) } @@ -487,8 +487,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_CapacityByDenom_Handler, }, { - MethodName: "GetAllPendingSendPackets", - Handler: _Query_GetAllPendingSendPackets_Handler, + MethodName: "AllPendingSendPackets", + Handler: _Query_AllPendingSendPackets_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -622,7 +622,7 @@ func (m *QueryCapacityByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *GetAllPendingSendPacketsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPendingSendPacketsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -632,12 +632,12 @@ func (m *GetAllPendingSendPacketsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAllPendingSendPacketsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPendingSendPacketsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAllPendingSendPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPendingSendPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -645,7 +645,7 @@ func (m *GetAllPendingSendPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } -func (m *GetAllPendingSendPacketsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllPendingSendPacketsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -655,12 +655,12 @@ func (m *GetAllPendingSendPacketsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAllPendingSendPacketsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllPendingSendPacketsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAllPendingSendPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllPendingSendPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -745,7 +745,7 @@ func (m *QueryCapacityByDenomResponse) Size() (n int) { return n } -func (m *GetAllPendingSendPacketsRequest) Size() (n int) { +func (m *QueryAllPendingSendPacketsRequest) Size() (n int) { if m == nil { return 0 } @@ -754,7 +754,7 @@ func (m *GetAllPendingSendPacketsRequest) Size() (n int) { return n } -func (m *GetAllPendingSendPacketsResponse) Size() (n int) { +func (m *QueryAllPendingSendPacketsResponse) Size() (n int) { if m == nil { return 0 } @@ -1075,7 +1075,7 @@ func (m *QueryCapacityByDenomResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetAllPendingSendPacketsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllPendingSendPacketsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1098,10 +1098,10 @@ func (m *GetAllPendingSendPacketsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAllPendingSendPacketsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPendingSendPacketsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllPendingSendPacketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPendingSendPacketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1125,7 +1125,7 @@ func (m *GetAllPendingSendPacketsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetAllPendingSendPacketsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllPendingSendPacketsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1148,10 +1148,10 @@ func (m *GetAllPendingSendPacketsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAllPendingSendPacketsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPendingSendPacketsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllPendingSendPacketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPendingSendPacketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/protocol/x/ratelimit/types/query.pb.gw.go b/protocol/x/ratelimit/types/query.pb.gw.go index d691bab0a4..c925078c29 100644 --- a/protocol/x/ratelimit/types/query.pb.gw.go +++ b/protocol/x/ratelimit/types/query.pb.gw.go @@ -87,20 +87,20 @@ func local_request_Query_CapacityByDenom_0(ctx context.Context, marshaler runtim } -func request_Query_GetAllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllPendingSendPacketsRequest +func request_Query_AllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingSendPacketsRequest var metadata runtime.ServerMetadata - msg, err := client.GetAllPendingSendPackets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.AllPendingSendPackets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetAllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllPendingSendPacketsRequest +func local_request_Query_AllPendingSendPackets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingSendPacketsRequest var metadata runtime.ServerMetadata - msg, err := server.GetAllPendingSendPackets(ctx, &protoReq) + msg, err := server.AllPendingSendPackets(ctx, &protoReq) return msg, metadata, err } @@ -157,7 +157,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetAllPendingSendPackets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AllPendingSendPackets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -168,7 +168,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetAllPendingSendPackets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AllPendingSendPackets_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -176,7 +176,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetAllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -261,7 +261,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetAllPendingSendPackets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AllPendingSendPackets_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) @@ -270,14 +270,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetAllPendingSendPackets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_AllPendingSendPackets_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_GetAllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AllPendingSendPackets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -289,7 +289,7 @@ var ( pattern_Query_CapacityByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "capacity_by_denom"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GetAllPendingSendPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "get_all_pending_send_packet"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AllPendingSendPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dydxprotocol", "v4", "ratelimit", "get_all_pending_send_packet"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -297,5 +297,5 @@ var ( forward_Query_CapacityByDenom_0 = runtime.ForwardResponseMessage - forward_Query_GetAllPendingSendPackets_0 = runtime.ForwardResponseMessage + forward_Query_AllPendingSendPackets_0 = runtime.ForwardResponseMessage ) From 34c1fc9351c9f2ba9faf9de494108753b50528d4 Mon Sep 17 00:00:00 2001 From: affan Date: Tue, 19 Mar 2024 17:05:43 -0400 Subject: [PATCH 10/12] add error handling --- protocol/x/ratelimit/keeper/grpc_query.go | 7 ++++++- protocol/x/ratelimit/types/keys.go | 6 ++++-- protocol/x/ratelimit/types/keys_test.go | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/protocol/x/ratelimit/keeper/grpc_query.go b/protocol/x/ratelimit/keeper/grpc_query.go index 76eed9fe29..42cf8c6ea3 100644 --- a/protocol/x/ratelimit/keeper/grpc_query.go +++ b/protocol/x/ratelimit/keeper/grpc_query.go @@ -5,6 +5,7 @@ import ( "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/lib/log" "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -63,7 +64,11 @@ func (k Keeper) AllPendingSendPackets( iterator := store.Iterator(nil, nil) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - channelId, sequence := types.SplitPendingSendPacketKey(iterator.Key()) + channelId, sequence, err := types.SplitPendingSendPacketKey(iterator.Key()) + if err != nil { + log.ErrorLog(sdkCtx, "unexpected PendingSendPacket key format", err) + return nil, err + } pendingPackets = append(pendingPackets, types.PendingSendPacket{ ChannelId: channelId, Sequence: sequence, diff --git a/protocol/x/ratelimit/types/keys.go b/protocol/x/ratelimit/types/keys.go index b3c4a227de..1059432e90 100644 --- a/protocol/x/ratelimit/types/keys.go +++ b/protocol/x/ratelimit/types/keys.go @@ -32,10 +32,12 @@ func GetPendingSendPacketKey(channelId string, sequenceNumber uint64) []byte { return []byte(fmt.Sprintf("%s_%d", channelId, sequenceNumber)) } -func SplitPendingSendPacketKey(key []byte) (channelId string, sequenceNumber uint64) { +func SplitPendingSendPacketKey(key []byte) (channelId string, sequenceNumber uint64, err error) { + err = nil parts := bytes.Split(key, []byte("_")) if len(parts) != 2 { - panic(fmt.Sprintf("unexpected key format: %s", key)) + err = fmt.Errorf("unexpected PendingSendPacket key format: %s", key) + return } channelId = string(parts[0]) // convert parts[1] to uint64 parts[1] is is a byte array with numeric characters of variable length diff --git a/protocol/x/ratelimit/types/keys_test.go b/protocol/x/ratelimit/types/keys_test.go index 5c6229d900..25b0edebec 100644 --- a/protocol/x/ratelimit/types/keys_test.go +++ b/protocol/x/ratelimit/types/keys_test.go @@ -20,10 +20,10 @@ func TestStateKeys(t *testing.T) { func TestSplitPendingSendPacketKey(t *testing.T) { channelId := "channel-0" sequenceNumber := uint64(2) - channelIdReceived, sequenceNumberReceived := types.SplitPendingSendPacketKey( + channelIdReceived, sequenceNumberReceived, err := types.SplitPendingSendPacketKey( types.GetPendingSendPacketKey(channelId, sequenceNumber), ) - + require.NoError(t, err) require.Equal(t, channelId, channelIdReceived) require.Equal(t, sequenceNumber, sequenceNumberReceived) } From 9f768061d699c6606f4ef56b504546d5134730e1 Mon Sep 17 00:00:00 2001 From: affan Date: Thu, 21 Mar 2024 10:27:17 -0400 Subject: [PATCH 11/12] indexer protos --- .../src/codegen/dydxprotocol/bundle.ts | 276 +++++++++--------- .../ratelimit/pending_send_packet.ts | 75 +++++ .../dydxprotocol/ratelimit/query.lcd.ts | 10 +- .../dydxprotocol/ratelimit/query.rpc.Query.ts | 16 +- .../codegen/dydxprotocol/ratelimit/query.ts | 108 +++++++ .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 22 +- 7 files changed, 359 insertions(+), 152 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/pending_send_packet.ts diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 499e146f14..4cf72f481d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -67,99 +67,100 @@ import * as _70 from "./prices/tx"; import * as _71 from "./ratelimit/capacity"; import * as _72 from "./ratelimit/genesis"; import * as _73 from "./ratelimit/limit_params"; -import * as _74 from "./ratelimit/query"; -import * as _75 from "./ratelimit/tx"; -import * as _76 from "./rewards/genesis"; -import * as _77 from "./rewards/params"; -import * as _78 from "./rewards/query"; -import * as _79 from "./rewards/reward_share"; -import * as _80 from "./rewards/tx"; -import * as _81 from "./sending/genesis"; -import * as _82 from "./sending/query"; -import * as _83 from "./sending/transfer"; -import * as _84 from "./sending/tx"; -import * as _85 from "./stats/genesis"; -import * as _86 from "./stats/params"; -import * as _87 from "./stats/query"; -import * as _88 from "./stats/stats"; -import * as _89 from "./stats/tx"; -import * as _90 from "./subaccounts/asset_position"; -import * as _91 from "./subaccounts/genesis"; -import * as _92 from "./subaccounts/perpetual_position"; -import * as _93 from "./subaccounts/query"; -import * as _94 from "./subaccounts/subaccount"; -import * as _95 from "./vault/genesis"; -import * as _96 from "./vault/query"; -import * as _97 from "./vault/tx"; -import * as _98 from "./vault/vault"; -import * as _99 from "./vest/genesis"; -import * as _100 from "./vest/query"; -import * as _101 from "./vest/tx"; -import * as _102 from "./vest/vest_entry"; -import * as _110 from "./assets/query.lcd"; -import * as _111 from "./blocktime/query.lcd"; -import * as _112 from "./bridge/query.lcd"; -import * as _113 from "./clob/query.lcd"; -import * as _114 from "./delaymsg/query.lcd"; -import * as _115 from "./epochs/query.lcd"; -import * as _116 from "./feetiers/query.lcd"; -import * as _117 from "./perpetuals/query.lcd"; -import * as _118 from "./prices/query.lcd"; -import * as _119 from "./ratelimit/query.lcd"; -import * as _120 from "./rewards/query.lcd"; -import * as _121 from "./stats/query.lcd"; -import * as _122 from "./subaccounts/query.lcd"; -import * as _123 from "./vest/query.lcd"; -import * as _124 from "./assets/query.rpc.Query"; -import * as _125 from "./blocktime/query.rpc.Query"; -import * as _126 from "./bridge/query.rpc.Query"; -import * as _127 from "./clob/query.rpc.Query"; -import * as _128 from "./delaymsg/query.rpc.Query"; -import * as _129 from "./epochs/query.rpc.Query"; -import * as _130 from "./feetiers/query.rpc.Query"; -import * as _131 from "./govplus/query.rpc.Query"; -import * as _132 from "./perpetuals/query.rpc.Query"; -import * as _133 from "./prices/query.rpc.Query"; -import * as _134 from "./ratelimit/query.rpc.Query"; -import * as _135 from "./rewards/query.rpc.Query"; -import * as _136 from "./sending/query.rpc.Query"; -import * as _137 from "./stats/query.rpc.Query"; -import * as _138 from "./subaccounts/query.rpc.Query"; -import * as _139 from "./vault/query.rpc.Query"; -import * as _140 from "./vest/query.rpc.Query"; -import * as _141 from "./blocktime/tx.rpc.msg"; -import * as _142 from "./bridge/tx.rpc.msg"; -import * as _143 from "./clob/tx.rpc.msg"; -import * as _144 from "./delaymsg/tx.rpc.msg"; -import * as _145 from "./feetiers/tx.rpc.msg"; -import * as _146 from "./govplus/tx.rpc.msg"; -import * as _147 from "./perpetuals/tx.rpc.msg"; -import * as _148 from "./prices/tx.rpc.msg"; -import * as _149 from "./ratelimit/tx.rpc.msg"; -import * as _150 from "./rewards/tx.rpc.msg"; -import * as _151 from "./sending/tx.rpc.msg"; -import * as _152 from "./stats/tx.rpc.msg"; -import * as _153 from "./vault/tx.rpc.msg"; -import * as _154 from "./vest/tx.rpc.msg"; -import * as _155 from "./lcd"; -import * as _156 from "./rpc.query"; -import * as _157 from "./rpc.tx"; +import * as _74 from "./ratelimit/pending_send_packet"; +import * as _75 from "./ratelimit/query"; +import * as _76 from "./ratelimit/tx"; +import * as _77 from "./rewards/genesis"; +import * as _78 from "./rewards/params"; +import * as _79 from "./rewards/query"; +import * as _80 from "./rewards/reward_share"; +import * as _81 from "./rewards/tx"; +import * as _82 from "./sending/genesis"; +import * as _83 from "./sending/query"; +import * as _84 from "./sending/transfer"; +import * as _85 from "./sending/tx"; +import * as _86 from "./stats/genesis"; +import * as _87 from "./stats/params"; +import * as _88 from "./stats/query"; +import * as _89 from "./stats/stats"; +import * as _90 from "./stats/tx"; +import * as _91 from "./subaccounts/asset_position"; +import * as _92 from "./subaccounts/genesis"; +import * as _93 from "./subaccounts/perpetual_position"; +import * as _94 from "./subaccounts/query"; +import * as _95 from "./subaccounts/subaccount"; +import * as _96 from "./vault/genesis"; +import * as _97 from "./vault/query"; +import * as _98 from "./vault/tx"; +import * as _99 from "./vault/vault"; +import * as _100 from "./vest/genesis"; +import * as _101 from "./vest/query"; +import * as _102 from "./vest/tx"; +import * as _103 from "./vest/vest_entry"; +import * as _111 from "./assets/query.lcd"; +import * as _112 from "./blocktime/query.lcd"; +import * as _113 from "./bridge/query.lcd"; +import * as _114 from "./clob/query.lcd"; +import * as _115 from "./delaymsg/query.lcd"; +import * as _116 from "./epochs/query.lcd"; +import * as _117 from "./feetiers/query.lcd"; +import * as _118 from "./perpetuals/query.lcd"; +import * as _119 from "./prices/query.lcd"; +import * as _120 from "./ratelimit/query.lcd"; +import * as _121 from "./rewards/query.lcd"; +import * as _122 from "./stats/query.lcd"; +import * as _123 from "./subaccounts/query.lcd"; +import * as _124 from "./vest/query.lcd"; +import * as _125 from "./assets/query.rpc.Query"; +import * as _126 from "./blocktime/query.rpc.Query"; +import * as _127 from "./bridge/query.rpc.Query"; +import * as _128 from "./clob/query.rpc.Query"; +import * as _129 from "./delaymsg/query.rpc.Query"; +import * as _130 from "./epochs/query.rpc.Query"; +import * as _131 from "./feetiers/query.rpc.Query"; +import * as _132 from "./govplus/query.rpc.Query"; +import * as _133 from "./perpetuals/query.rpc.Query"; +import * as _134 from "./prices/query.rpc.Query"; +import * as _135 from "./ratelimit/query.rpc.Query"; +import * as _136 from "./rewards/query.rpc.Query"; +import * as _137 from "./sending/query.rpc.Query"; +import * as _138 from "./stats/query.rpc.Query"; +import * as _139 from "./subaccounts/query.rpc.Query"; +import * as _140 from "./vault/query.rpc.Query"; +import * as _141 from "./vest/query.rpc.Query"; +import * as _142 from "./blocktime/tx.rpc.msg"; +import * as _143 from "./bridge/tx.rpc.msg"; +import * as _144 from "./clob/tx.rpc.msg"; +import * as _145 from "./delaymsg/tx.rpc.msg"; +import * as _146 from "./feetiers/tx.rpc.msg"; +import * as _147 from "./govplus/tx.rpc.msg"; +import * as _148 from "./perpetuals/tx.rpc.msg"; +import * as _149 from "./prices/tx.rpc.msg"; +import * as _150 from "./ratelimit/tx.rpc.msg"; +import * as _151 from "./rewards/tx.rpc.msg"; +import * as _152 from "./sending/tx.rpc.msg"; +import * as _153 from "./stats/tx.rpc.msg"; +import * as _154 from "./vault/tx.rpc.msg"; +import * as _155 from "./vest/tx.rpc.msg"; +import * as _156 from "./lcd"; +import * as _157 from "./rpc.query"; +import * as _158 from "./rpc.tx"; export namespace dydxprotocol { export const assets = { ..._5, ..._6, ..._7, ..._8, - ..._110, - ..._124 + ..._111, + ..._125 }; export const blocktime = { ..._9, ..._10, ..._11, ..._12, ..._13, - ..._111, - ..._125, - ..._141 + ..._112, + ..._126, + ..._142 }; export const bridge = { ..._14, ..._15, @@ -167,9 +168,9 @@ export namespace dydxprotocol { ..._17, ..._18, ..._19, - ..._112, - ..._126, - ..._142 + ..._113, + ..._127, + ..._143 }; export const clob = { ..._20, ..._21, @@ -185,9 +186,9 @@ export namespace dydxprotocol { ..._31, ..._32, ..._33, - ..._113, - ..._127, - ..._143 + ..._114, + ..._128, + ..._144 }; export namespace daemons { export const bridge = { ..._34 @@ -202,29 +203,29 @@ export namespace dydxprotocol { ..._39, ..._40, ..._41, - ..._114, - ..._128, - ..._144 + ..._115, + ..._129, + ..._145 }; export const epochs = { ..._42, ..._43, ..._44, - ..._115, - ..._129 + ..._116, + ..._130 }; export const feetiers = { ..._45, ..._46, ..._47, ..._48, - ..._116, - ..._130, - ..._145 + ..._117, + ..._131, + ..._146 }; export const govplus = { ..._49, ..._50, ..._51, - ..._131, - ..._146 + ..._132, + ..._147 }; export namespace indexer { export const events = { ..._52 @@ -251,78 +252,79 @@ export namespace dydxprotocol { ..._63, ..._64, ..._65, - ..._117, - ..._132, - ..._147 + ..._118, + ..._133, + ..._148 }; export const prices = { ..._66, ..._67, ..._68, ..._69, ..._70, - ..._118, - ..._133, - ..._148 + ..._119, + ..._134, + ..._149 }; export const ratelimit = { ..._71, ..._72, ..._73, ..._74, ..._75, - ..._119, - ..._134, - ..._149 + ..._76, + ..._120, + ..._135, + ..._150 }; - export const rewards = { ..._76, - ..._77, + export const rewards = { ..._77, ..._78, ..._79, ..._80, - ..._120, - ..._135, - ..._150 + ..._81, + ..._121, + ..._136, + ..._151 }; - export const sending = { ..._81, - ..._82, + export const sending = { ..._82, ..._83, ..._84, - ..._136, - ..._151 + ..._85, + ..._137, + ..._152 }; - export const stats = { ..._85, - ..._86, + export const stats = { ..._86, ..._87, ..._88, ..._89, - ..._121, - ..._137, - ..._152 + ..._90, + ..._122, + ..._138, + ..._153 }; - export const subaccounts = { ..._90, - ..._91, + export const subaccounts = { ..._91, ..._92, ..._93, ..._94, - ..._122, - ..._138 + ..._95, + ..._123, + ..._139 }; - export const vault = { ..._95, - ..._96, + export const vault = { ..._96, ..._97, ..._98, - ..._139, - ..._153 + ..._99, + ..._140, + ..._154 }; - export const vest = { ..._99, - ..._100, + export const vest = { ..._100, ..._101, ..._102, - ..._123, - ..._140, - ..._154 + ..._103, + ..._124, + ..._141, + ..._155 }; - export const ClientFactory = { ..._155, - ..._156, - ..._157 + export const ClientFactory = { ..._156, + ..._157, + ..._158 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/pending_send_packet.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/pending_send_packet.ts new file mode 100644 index 0000000000..e2b8b10de9 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/pending_send_packet.ts @@ -0,0 +1,75 @@ +import * as _m0 from "protobufjs/minimal"; +import { Long, DeepPartial } from "../../helpers"; +/** + * PendingSendPacket contains the channel_id and sequence pair to identify a + * pending packet + */ + +export interface PendingSendPacket { + channelId: string; + sequence: Long; +} +/** + * PendingSendPacket contains the channel_id and sequence pair to identify a + * pending packet + */ + +export interface PendingSendPacketSDKType { + channel_id: string; + sequence: Long; +} + +function createBasePendingSendPacket(): PendingSendPacket { + return { + channelId: "", + sequence: Long.UZERO + }; +} + +export const PendingSendPacket = { + encode(message: PendingSendPacket, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + + if (!message.sequence.isZero()) { + writer.uint32(16).uint64(message.sequence); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PendingSendPacket { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePendingSendPacket(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + + case 2: + message.sequence = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): PendingSendPacket { + const message = createBasePendingSendPacket(); + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.lcd.ts index 88809acdff..24d3f27edc 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@osmonauts/lcd"; -import { ListLimitParamsRequest, ListLimitParamsResponseSDKType, QueryCapacityByDenomRequest, QueryCapacityByDenomResponseSDKType } from "./query"; +import { ListLimitParamsRequest, ListLimitParamsResponseSDKType, QueryCapacityByDenomRequest, QueryCapacityByDenomResponseSDKType, QueryAllPendingSendPacketsRequest, QueryAllPendingSendPacketsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; @@ -11,6 +11,7 @@ export class LCDQueryClient { this.req = requestClient; this.listLimitParams = this.listLimitParams.bind(this); this.capacityByDenom = this.capacityByDenom.bind(this); + this.allPendingSendPackets = this.allPendingSendPackets.bind(this); } /* List all limit params. */ @@ -34,5 +35,12 @@ export class LCDQueryClient { const endpoint = `dydxprotocol/v4/ratelimit/capacity_by_denom`; return await this.req.get(endpoint, options); } + /* Get all pending send packets */ + + + async allPendingSendPackets(_params: QueryAllPendingSendPacketsRequest = {}): Promise { + const endpoint = `dydxprotocol/v4/ratelimit/get_all_pending_send_packet`; + return await this.req.get(endpoint); + } } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.ts index c617aa46f4..70cf931a86 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ListLimitParamsRequest, ListLimitParamsResponse, QueryCapacityByDenomRequest, QueryCapacityByDenomResponse } from "./query"; +import { ListLimitParamsRequest, ListLimitParamsResponse, QueryCapacityByDenomRequest, QueryCapacityByDenomResponse, QueryAllPendingSendPacketsRequest, QueryAllPendingSendPacketsResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { @@ -10,6 +10,9 @@ export interface Query { /** Query capacity by denom. */ capacityByDenom(request: QueryCapacityByDenomRequest): Promise; + /** Get all pending send packets */ + + allPendingSendPackets(request?: QueryAllPendingSendPacketsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -18,6 +21,7 @@ export class QueryClientImpl implements Query { this.rpc = rpc; this.listLimitParams = this.listLimitParams.bind(this); this.capacityByDenom = this.capacityByDenom.bind(this); + this.allPendingSendPackets = this.allPendingSendPackets.bind(this); } listLimitParams(request: ListLimitParamsRequest = {}): Promise { @@ -32,6 +36,12 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryCapacityByDenomResponse.decode(new _m0.Reader(data))); } + allPendingSendPackets(request: QueryAllPendingSendPacketsRequest = {}): Promise { + const data = QueryAllPendingSendPacketsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.ratelimit.Query", "AllPendingSendPackets", data); + return promise.then(data => QueryAllPendingSendPacketsResponse.decode(new _m0.Reader(data))); + } + } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -43,6 +53,10 @@ export const createRpcQueryExtension = (base: QueryClient) => { capacityByDenom(request: QueryCapacityByDenomRequest): Promise { return queryService.capacityByDenom(request); + }, + + allPendingSendPackets(request?: QueryAllPendingSendPacketsRequest): Promise { + return queryService.allPendingSendPackets(request); } }; diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.ts index 8274347939..32846a6805 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ratelimit/query.ts @@ -1,5 +1,6 @@ import { LimitParams, LimitParamsSDKType } from "./limit_params"; import { LimiterCapacity, LimiterCapacitySDKType } from "./capacity"; +import { PendingSendPacket, PendingSendPacketSDKType } from "./pending_send_packet"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** ListLimitParamsRequest is a request type of the ListLimitParams RPC method. */ @@ -58,6 +59,34 @@ export interface QueryCapacityByDenomResponse { export interface QueryCapacityByDenomResponseSDKType { limiter_capacity_list: LimiterCapacitySDKType[]; } +/** + * QueryAllPendingSendPacketsRequest is a request type for the + * AllPendingSendPackets RPC + */ + +export interface QueryAllPendingSendPacketsRequest {} +/** + * QueryAllPendingSendPacketsRequest is a request type for the + * AllPendingSendPackets RPC + */ + +export interface QueryAllPendingSendPacketsRequestSDKType {} +/** + * QueryAllPendingSendPacketsResponse is a response type of the + * AllPendingSendPackets RPC + */ + +export interface QueryAllPendingSendPacketsResponse { + pendingSendPackets: PendingSendPacket[]; +} +/** + * QueryAllPendingSendPacketsResponse is a response type of the + * AllPendingSendPackets RPC + */ + +export interface QueryAllPendingSendPacketsResponseSDKType { + pending_send_packets: PendingSendPacketSDKType[]; +} function createBaseListLimitParamsRequest(): ListLimitParamsRequest { return {}; @@ -226,4 +255,83 @@ export const QueryCapacityByDenomResponse = { return message; } +}; + +function createBaseQueryAllPendingSendPacketsRequest(): QueryAllPendingSendPacketsRequest { + return {}; +} + +export const QueryAllPendingSendPacketsRequest = { + encode(_: QueryAllPendingSendPacketsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPendingSendPacketsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllPendingSendPacketsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): QueryAllPendingSendPacketsRequest { + const message = createBaseQueryAllPendingSendPacketsRequest(); + return message; + } + +}; + +function createBaseQueryAllPendingSendPacketsResponse(): QueryAllPendingSendPacketsResponse { + return { + pendingSendPackets: [] + }; +} + +export const QueryAllPendingSendPacketsResponse = { + encode(message: QueryAllPendingSendPacketsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.pendingSendPackets) { + PendingSendPacket.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllPendingSendPacketsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllPendingSendPacketsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.pendingSendPackets.push(PendingSendPacket.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryAllPendingSendPacketsResponse { + const message = createBaseQueryAllPendingSendPacketsResponse(); + message.pendingSendPackets = object.pendingSendPackets?.map(e => PendingSendPacket.fromPartial(e)) || []; + return message; + } + }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index c3b6b38b3f..1a8dc184de 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _103 from "./gogo"; -export const gogoproto = { ..._103 +import * as _104 from "./gogo"; +export const gogoproto = { ..._104 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index 8878e6797b..3ae0e3f38d 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _104 from "./api/annotations"; -import * as _105 from "./api/http"; -import * as _106 from "./protobuf/descriptor"; -import * as _107 from "./protobuf/duration"; -import * as _108 from "./protobuf/timestamp"; -import * as _109 from "./protobuf/any"; +import * as _105 from "./api/annotations"; +import * as _106 from "./api/http"; +import * as _107 from "./protobuf/descriptor"; +import * as _108 from "./protobuf/duration"; +import * as _109 from "./protobuf/timestamp"; +import * as _110 from "./protobuf/any"; export namespace google { - export const api = { ..._104, - ..._105 + export const api = { ..._105, + ..._106 }; - export const protobuf = { ..._106, - ..._107, + export const protobuf = { ..._107, ..._108, - ..._109 + ..._109, + ..._110 }; } \ No newline at end of file From d76e6668d3594170e3e1d4436053af8ce0681987 Mon Sep 17 00:00:00 2001 From: affan Date: Fri, 22 Mar 2024 10:36:23 -0400 Subject: [PATCH 12/12] nit --- protocol/x/ratelimit/types/keys.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/protocol/x/ratelimit/types/keys.go b/protocol/x/ratelimit/types/keys.go index 1059432e90..356e6005ff 100644 --- a/protocol/x/ratelimit/types/keys.go +++ b/protocol/x/ratelimit/types/keys.go @@ -32,17 +32,17 @@ func GetPendingSendPacketKey(channelId string, sequenceNumber uint64) []byte { return []byte(fmt.Sprintf("%s_%d", channelId, sequenceNumber)) } -func SplitPendingSendPacketKey(key []byte) (channelId string, sequenceNumber uint64, err error) { - err = nil +func SplitPendingSendPacketKey(key []byte) (string, uint64, error) { + err := error(nil) parts := bytes.Split(key, []byte("_")) if len(parts) != 2 { err = fmt.Errorf("unexpected PendingSendPacket key format: %s", key) - return + return "", 0, err } - channelId = string(parts[0]) - // convert parts[1] to uint64 parts[1] is is a byte array with numeric characters of variable length + channelId := string(parts[0]) + // convert parts[1] to uint64 parts[1] is a byte array with numeric characters of variable length sequenceNumberInt, _ := strconv.Atoi(string(parts[1])) - sequenceNumber = uint64(sequenceNumberInt) - return + sequenceNumber := uint64(sequenceNumberInt) + return channelId, sequenceNumber, err }