From bda8ec4e1d45875949ecd4a693e96a253ca22b2f Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 30 Jul 2024 11:34:04 -0400 Subject: [PATCH 01/37] first --- proto/dydxprotocol/clob/query.proto | 40 + protocol/x/clob/types/query.pb.go | 1366 +++++++++++++++++++++++---- 2 files changed, 1221 insertions(+), 185 deletions(-) diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index cca523bcc6..64a66caf62 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -182,6 +182,7 @@ message StreamUpdate { oneof update_message { StreamOrderbookUpdate orderbook_update = 1; StreamOrderbookFill order_fill = 2; + StreamSubaccountUpdate subaccount_update = 5; } // Block height of the update. @@ -191,6 +192,45 @@ message StreamUpdate { uint32 exec_mode = 4; } +// SubaccountId provides information on a subaccount. +message SubaccountId { + // The address of the wallet that owns this subaccount. + string owner = 1; + // < 128 Since 128 should be enough to start and it fits within + // 1 Byte (1 Bit needed to indicate that the first byte is the last). + uint32 number = 2; +} + +// SubaccountPerpetualPosition provides information on a subaccount's updated +// perpetual positions. +message SubaccountPerpetualPosition { + // The `Id` of the `Perpetual`. + uint32 perpetual_id = 1; + // The size of the position in base quantums. + uint64 quantums = 2; +} + +// SubaccountAssetPosition provides information on a subaccount's updated asset +// positions. +message SubaccountAssetPosition { + // The `Id` of the `Asset`. + uint32 asset_id = 1; + // The absolute size of the position in base quantums. + uint64 quantums = 2; +} + +// StreamSubaccountUpdate provides information on a subaccount update. Used in +// the full node GRPC stream. +message StreamSubaccountUpdate { + SubaccountId subaccount_id = 1; + // updated_perpetual_positions will each be for unique perpetuals. + repeated SubaccountPerpetualPosition + updated_perpetual_positions = 2; + // updated_asset_positions will each be for unique assets. + repeated SubaccountAssetPosition + updated_asset_positions = 3; +} + // StreamOrderbookUpdate provides information on an orderbook update. Used in // the full node GRPC stream. message StreamOrderbookUpdate { diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index b4c4596eae..83ade9b1d7 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -869,6 +869,7 @@ type StreamUpdate struct { // // *StreamUpdate_OrderbookUpdate // *StreamUpdate_OrderFill + // *StreamUpdate_SubaccountUpdate UpdateMessage isStreamUpdate_UpdateMessage `protobuf_oneof:"update_message"` // Block height of the update. BlockHeight uint32 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` @@ -921,9 +922,13 @@ type StreamUpdate_OrderbookUpdate struct { type StreamUpdate_OrderFill struct { OrderFill *StreamOrderbookFill `protobuf:"bytes,2,opt,name=order_fill,json=orderFill,proto3,oneof" json:"order_fill,omitempty"` } +type StreamUpdate_SubaccountUpdate struct { + SubaccountUpdate *StreamSubaccountUpdate `protobuf:"bytes,5,opt,name=subaccount_update,json=subaccountUpdate,proto3,oneof" json:"subaccount_update,omitempty"` +} -func (*StreamUpdate_OrderbookUpdate) isStreamUpdate_UpdateMessage() {} -func (*StreamUpdate_OrderFill) isStreamUpdate_UpdateMessage() {} +func (*StreamUpdate_OrderbookUpdate) isStreamUpdate_UpdateMessage() {} +func (*StreamUpdate_OrderFill) isStreamUpdate_UpdateMessage() {} +func (*StreamUpdate_SubaccountUpdate) isStreamUpdate_UpdateMessage() {} func (m *StreamUpdate) GetUpdateMessage() isStreamUpdate_UpdateMessage { if m != nil { @@ -946,6 +951,13 @@ func (m *StreamUpdate) GetOrderFill() *StreamOrderbookFill { return nil } +func (m *StreamUpdate) GetSubaccountUpdate() *StreamSubaccountUpdate { + if x, ok := m.GetUpdateMessage().(*StreamUpdate_SubaccountUpdate); ok { + return x.SubaccountUpdate + } + return nil +} + func (m *StreamUpdate) GetBlockHeight() uint32 { if m != nil { return m.BlockHeight @@ -965,7 +977,240 @@ func (*StreamUpdate) XXX_OneofWrappers() []interface{} { return []interface{}{ (*StreamUpdate_OrderbookUpdate)(nil), (*StreamUpdate_OrderFill)(nil), + (*StreamUpdate_SubaccountUpdate)(nil), + } +} + +// SubaccountId provides information on a subaccount. +type SubaccountId struct { + // The address of the wallet that owns this subaccount. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // < 128 Since 128 should be enough to start and it fits within + // 1 Byte (1 Bit needed to indicate that the first byte is the last). + Number uint32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` +} + +func (m *SubaccountId) Reset() { *m = SubaccountId{} } +func (m *SubaccountId) String() string { return proto.CompactTextString(m) } +func (*SubaccountId) ProtoMessage() {} +func (*SubaccountId) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{17} +} +func (m *SubaccountId) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubaccountId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubaccountId.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 *SubaccountId) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubaccountId.Merge(m, src) +} +func (m *SubaccountId) XXX_Size() int { + return m.Size() +} +func (m *SubaccountId) XXX_DiscardUnknown() { + xxx_messageInfo_SubaccountId.DiscardUnknown(m) +} + +var xxx_messageInfo_SubaccountId proto.InternalMessageInfo + +func (m *SubaccountId) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *SubaccountId) GetNumber() uint32 { + if m != nil { + return m.Number + } + return 0 +} + +// SubaccountPerpetualPosition provides information on a subaccount's updated +// perpetual positions. +type SubaccountPerpetualPosition struct { + // The `Id` of the `Perpetual`. + PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"` + // The size of the position in base quantums. + Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` +} + +func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetualPosition{} } +func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } +func (*SubaccountPerpetualPosition) ProtoMessage() {} +func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{18} +} +func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubaccountPerpetualPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubaccountPerpetualPosition.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 *SubaccountPerpetualPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubaccountPerpetualPosition.Merge(m, src) +} +func (m *SubaccountPerpetualPosition) XXX_Size() int { + return m.Size() +} +func (m *SubaccountPerpetualPosition) XXX_DiscardUnknown() { + xxx_messageInfo_SubaccountPerpetualPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_SubaccountPerpetualPosition proto.InternalMessageInfo + +func (m *SubaccountPerpetualPosition) GetPerpetualId() uint32 { + if m != nil { + return m.PerpetualId + } + return 0 +} + +func (m *SubaccountPerpetualPosition) GetQuantums() uint64 { + if m != nil { + return m.Quantums + } + return 0 +} + +// SubaccountAssetPosition provides information on a subaccount's updated asset +// positions. +type SubaccountAssetPosition struct { + // The `Id` of the `Asset`. + AssetId uint32 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // The absolute size of the position in base quantums. + Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` +} + +func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition{} } +func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } +func (*SubaccountAssetPosition) ProtoMessage() {} +func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{19} +} +func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubaccountAssetPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubaccountAssetPosition.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 *SubaccountAssetPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubaccountAssetPosition.Merge(m, src) +} +func (m *SubaccountAssetPosition) XXX_Size() int { + return m.Size() +} +func (m *SubaccountAssetPosition) XXX_DiscardUnknown() { + xxx_messageInfo_SubaccountAssetPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_SubaccountAssetPosition proto.InternalMessageInfo + +func (m *SubaccountAssetPosition) GetAssetId() uint32 { + if m != nil { + return m.AssetId + } + return 0 +} + +func (m *SubaccountAssetPosition) GetQuantums() uint64 { + if m != nil { + return m.Quantums + } + return 0 +} + +// StreamSubaccountUpdate provides information on a subaccount update. Used in +// the full node GRPC stream. +type StreamSubaccountUpdate struct { + SubaccountId *SubaccountId `protobuf:"bytes,1,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` + // updated_perpetual_positions will each be for unique perpetuals. + UpdatedPerpetualPositions []*SubaccountPerpetualPosition `protobuf:"bytes,2,rep,name=updated_perpetual_positions,json=updatedPerpetualPositions,proto3" json:"updated_perpetual_positions,omitempty"` + // updated_asset_positions will each be for unique assets. + UpdatedAssetPositions []*SubaccountAssetPosition `protobuf:"bytes,3,rep,name=updated_asset_positions,json=updatedAssetPositions,proto3" json:"updated_asset_positions,omitempty"` +} + +func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} } +func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } +func (*StreamSubaccountUpdate) ProtoMessage() {} +func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{20} +} +func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamSubaccountUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamSubaccountUpdate.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 *StreamSubaccountUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamSubaccountUpdate.Merge(m, src) +} +func (m *StreamSubaccountUpdate) XXX_Size() int { + return m.Size() +} +func (m *StreamSubaccountUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_StreamSubaccountUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamSubaccountUpdate proto.InternalMessageInfo + +func (m *StreamSubaccountUpdate) GetSubaccountId() *SubaccountId { + if m != nil { + return m.SubaccountId + } + return nil +} + +func (m *StreamSubaccountUpdate) GetUpdatedPerpetualPositions() []*SubaccountPerpetualPosition { + if m != nil { + return m.UpdatedPerpetualPositions + } + return nil +} + +func (m *StreamSubaccountUpdate) GetUpdatedAssetPositions() []*SubaccountAssetPosition { + if m != nil { + return m.UpdatedAssetPositions } + return nil } // StreamOrderbookUpdate provides information on an orderbook update. Used in @@ -985,7 +1230,7 @@ func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdate) ProtoMessage() {} func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{17} + return fileDescriptor_3365c195b25c5bc0, []int{21} } func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1045,7 +1290,7 @@ func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookFill) ProtoMessage() {} func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{18} + return fileDescriptor_3365c195b25c5bc0, []int{22} } func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1114,6 +1359,10 @@ func init() { proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") proto.RegisterType((*StreamOrderbookUpdatesResponse)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesResponse") proto.RegisterType((*StreamUpdate)(nil), "dydxprotocol.clob.StreamUpdate") + proto.RegisterType((*SubaccountId)(nil), "dydxprotocol.clob.SubaccountId") + proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.clob.SubaccountPerpetualPosition") + proto.RegisterType((*SubaccountAssetPosition)(nil), "dydxprotocol.clob.SubaccountAssetPosition") + proto.RegisterType((*StreamSubaccountUpdate)(nil), "dydxprotocol.clob.StreamSubaccountUpdate") proto.RegisterType((*StreamOrderbookUpdate)(nil), "dydxprotocol.clob.StreamOrderbookUpdate") proto.RegisterType((*StreamOrderbookFill)(nil), "dydxprotocol.clob.StreamOrderbookFill") } @@ -1121,95 +1370,108 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6f, 0xdc, 0xc4, - 0x17, 0x5f, 0x27, 0xf9, 0xb6, 0x9b, 0x97, 0xfe, 0xfa, 0x4e, 0x9a, 0x76, 0xeb, 0xa4, 0x9b, 0xd4, - 0xd0, 0x74, 0x93, 0xd2, 0x75, 0x93, 0x56, 0x55, 0x69, 0x50, 0x51,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, 0x7e, 0x17, 0x45, 0x97, 0xf7, 0xda, 0xd1, 0x92, 0x9e, 0xad, - 0x2e, 0xec, 0xc3, 0x42, 0x00, 0xb8, 0xac, 0xac, 0xac, 0x3f, 0x7f, 0x59, 0x55, 0x5e, 0xbc, 0xac, - 0x2a, 0x7f, 0xbf, 0xac, 0x2a, 0x5f, 0xbf, 0xaa, 0x96, 0x5e, 0xbc, 0xaa, 0x96, 0xfe, 0x78, 0x55, - 0x2d, 0x7d, 0x70, 0xcd, 0x71, 0xd9, 0x46, 0xbb, 0x51, 0xb7, 0xa8, 0x9f, 0x4e, 0x5e, 0xe7, 0xea, - 0x25, 0xde, 0x50, 0xf4, 0xae, 0x64, 0x4b, 0x24, 0x94, 0x6d, 0xb7, 0x48, 0xd4, 0x38, 0xc4, 0xc5, - 0x57, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xd1, 0xc6, 0xcc, 0x0a, 0xf6, 0x10, 0x00, 0x00, + // 1603 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xcd, 0x4f, 0xdc, 0x46, + 0x1b, 0xc7, 0x40, 0x92, 0xe5, 0x01, 0x12, 0x32, 0x84, 0x00, 0x0b, 0x59, 0x88, 0xdf, 0x37, 0x04, + 0xc8, 0x9b, 0x75, 0x20, 0x51, 0x94, 0x37, 0x44, 0x79, 0x05, 0xbc, 0x4d, 0x82, 0x14, 0x9a, 0xad, + 0xf3, 0x51, 0xd4, 0x46, 0xb2, 0x66, 0xed, 0xd9, 0xc5, 0x8a, 0xed, 0x59, 0xec, 0xf1, 0x16, 0x54, + 0x55, 0x95, 0x7a, 0xe8, 0xa5, 0xad, 0x54, 0xa9, 0x87, 0x1e, 0x2a, 0xf5, 0xd2, 0x73, 0x2f, 0x95, + 0x7a, 0xac, 0xda, 0xde, 0x72, 0x8c, 0xd4, 0x4b, 0x55, 0x55, 0x55, 0x95,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aa, 0xd0, 0xf7, 0xe2, 0x55, 0xa1, + 0xef, 0xd7, 0x57, 0x85, 0xbe, 0x77, 0xae, 0x57, 0x6d, 0xb6, 0x1b, 0x96, 0x8b, 0x26, 0x75, 0xdb, + 0x83, 0x57, 0xbf, 0x76, 0x99, 0x5f, 0x28, 0x5a, 0x83, 0xb2, 0x2f, 0x02, 0xca, 0x0e, 0x6a, 0x24, + 0x28, 0x1f, 0xe7, 0xe4, 0xab, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x79, 0x17, 0x6c, 0x73, + 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2205,6 +2467,15 @@ func (m *StreamUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.UpdateMessage != nil { + { + size := m.UpdateMessage.Size() + i -= size + if _, err := m.UpdateMessage.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } if m.ExecMode != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ExecMode)) i-- @@ -2215,15 +2486,6 @@ func (m *StreamUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.UpdateMessage != nil { - { - size := m.UpdateMessage.Size() - i -= size - if _, err := m.UpdateMessage.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } return len(dAtA) - i, nil } @@ -2269,7 +2531,28 @@ func (m *StreamUpdate_OrderFill) MarshalToSizedBuffer(dAtA []byte) (int, error) } return len(dAtA) - i, nil } -func (m *StreamOrderbookUpdate) Marshal() (dAtA []byte, err error) { +func (m *StreamUpdate_SubaccountUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamUpdate_SubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.SubaccountUpdate != nil { + { + size, err := m.SubaccountUpdate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + return len(dAtA) - i, nil +} +func (m *SubaccountId) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2279,44 +2562,32 @@ func (m *StreamOrderbookUpdate) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StreamOrderbookUpdate) MarshalTo(dAtA []byte) (int, error) { +func (m *SubaccountId) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StreamOrderbookUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SubaccountId) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Snapshot { - i-- - if m.Snapshot { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if m.Number != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Number)) i-- dAtA[i] = 0x10 } - if len(m.Updates) > 0 { - for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *StreamOrderbookFill) Marshal() (dAtA []byte, err error) { +func (m *SubaccountPerpetualPosition) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2326,82 +2597,258 @@ func (m *StreamOrderbookFill) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StreamOrderbookFill) MarshalTo(dAtA []byte) (int, error) { +func (m *SubaccountPerpetualPosition) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *StreamOrderbookFill) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SubaccountPerpetualPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.FillAmounts) > 0 { - dAtA16 := make([]byte, len(m.FillAmounts)*10) - var j15 int - for _, num := range m.FillAmounts { - for num >= 1<<7 { - dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j15++ - } - dAtA16[j15] = uint8(num) - j15++ - } - i -= j15 - copy(dAtA[i:], dAtA16[:j15]) - i = encodeVarintQuery(dAtA, i, uint64(j15)) + if m.Quantums != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Quantums)) i-- - dAtA[i] = 0x1a - } - if len(m.Orders) > 0 { - for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } + dAtA[i] = 0x10 } - if m.ClobMatch != nil { - { - size, err := m.ClobMatch.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if m.PerpetualId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PerpetualId)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *SubaccountAssetPosition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryGetClobPairRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovQuery(uint64(m.Id)) + +func (m *SubaccountAssetPosition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubaccountAssetPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Quantums != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Quantums)) + i-- + dAtA[i] = 0x10 + } + if m.AssetId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AssetId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StreamSubaccountUpdate) 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 *StreamSubaccountUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamSubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UpdatedAssetPositions) > 0 { + for iNdEx := len(m.UpdatedAssetPositions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UpdatedAssetPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.UpdatedPerpetualPositions) > 0 { + for iNdEx := len(m.UpdatedPerpetualPositions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UpdatedPerpetualPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.SubaccountId != nil { + { + size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StreamOrderbookUpdate) 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 *StreamOrderbookUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamOrderbookUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Snapshot { + i-- + if m.Snapshot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Updates) > 0 { + for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StreamOrderbookFill) 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 *StreamOrderbookFill) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamOrderbookFill) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FillAmounts) > 0 { + dAtA18 := make([]byte, len(m.FillAmounts)*10) + var j17 int + for _, num := range m.FillAmounts { + for num >= 1<<7 { + dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j17++ + } + dAtA18[j17] = uint8(num) + j17++ + } + i -= j17 + copy(dAtA[i:], dAtA18[:j17]) + i = encodeVarintQuery(dAtA, i, uint64(j17)) + i-- + dAtA[i] = 0x1a + } + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ClobMatch != nil { + { + size, err := m.ClobMatch.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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryGetClobPairRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovQuery(uint64(m.Id)) } return n } @@ -2660,6 +3107,89 @@ func (m *StreamUpdate_OrderFill) Size() (n int) { } return n } +func (m *StreamUpdate_SubaccountUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SubaccountUpdate != nil { + l = m.SubaccountUpdate.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} +func (m *SubaccountId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Number != 0 { + n += 1 + sovQuery(uint64(m.Number)) + } + return n +} + +func (m *SubaccountPerpetualPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PerpetualId != 0 { + n += 1 + sovQuery(uint64(m.PerpetualId)) + } + if m.Quantums != 0 { + n += 1 + sovQuery(uint64(m.Quantums)) + } + return n +} + +func (m *SubaccountAssetPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AssetId != 0 { + n += 1 + sovQuery(uint64(m.AssetId)) + } + if m.Quantums != 0 { + n += 1 + sovQuery(uint64(m.Quantums)) + } + return n +} + +func (m *StreamSubaccountUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SubaccountId != nil { + l = m.SubaccountId.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.UpdatedPerpetualPositions) > 0 { + for _, e := range m.UpdatedPerpetualPositions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.UpdatedAssetPositions) > 0 { + for _, e := range m.UpdatedAssetPositions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func (m *StreamOrderbookUpdate) Size() (n int) { if m == nil { return 0 @@ -4324,6 +4854,472 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountUpdate", 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 + } + v := &StreamSubaccountUpdate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.UpdateMessage = &StreamUpdate_SubaccountUpdate{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubaccountId) 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: SubaccountId: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubaccountId: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *SubaccountPerpetualPosition) 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: SubaccountPerpetualPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubaccountPerpetualPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PerpetualId", wireType) + } + m.PerpetualId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PerpetualId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) + } + m.Quantums = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Quantums |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *SubaccountAssetPosition) 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: SubaccountAssetPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubaccountAssetPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + } + m.AssetId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AssetId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) + } + m.Quantums = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Quantums |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *StreamSubaccountUpdate) 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: StreamSubaccountUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamSubaccountUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubaccountId == nil { + m.SubaccountId = &SubaccountId{} + } + if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedPerpetualPositions", 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.UpdatedPerpetualPositions = append(m.UpdatedPerpetualPositions, &SubaccountPerpetualPosition{}) + if err := m.UpdatedPerpetualPositions[len(m.UpdatedPerpetualPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAssetPositions", 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.UpdatedAssetPositions = append(m.UpdatedAssetPositions, &SubaccountAssetPosition{}) + if err := m.UpdatedAssetPositions[len(m.UpdatedAssetPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From af1eb90932c7ecabe281df3d8c62dc36fd6cb7a3 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 30 Jul 2024 15:34:05 -0400 Subject: [PATCH 02/37] test --- proto/dydxprotocol/clob/query.proto | 19 + .../streaming/full_node_streaming_manager.go | 14 +- protocol/x/clob/types/query.pb.go | 656 +++++++++++++++--- protocol/x/subaccounts/keeper/keeper.go | 8 + 4 files changed, 581 insertions(+), 116 deletions(-) diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 64a66caf62..72e6552b47 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -64,6 +64,11 @@ service Query { // such as order placements, updates, and fills. rpc StreamOrderbookUpdates(StreamOrderbookUpdatesRequest) returns (stream StreamOrderbookUpdatesResponse); + + // Streams subaccount updates. Updates contain subaccount data + // such as perpetual and asset positions. + rpc StreamSubaccountUpdates(StreamSubaccountUpdatesRequest) + returns (stream StreamSubaccountUpdatesResponse); } // QueryGetClobPairRequest is request type for the ClobPair method. @@ -174,6 +179,20 @@ message StreamOrderbookUpdatesResponse { repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ]; } +// StreamSubaccountUpdatesRequest is a request message for the +// StreamSubaccountUpdates method. +message StreamSubaccountUpdatesRequest { + // Subaccount ids to stream subaccount updates for. + repeated SubaccountId subaccount_ids = 1; +} + +// StreamSubaccountUpdatesResponse is a response message for the +// StreamSubaccountUpdates method. +message StreamSubaccountUpdatesResponse { + // Batch of updates for the clob pair. + repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ]; +} + // StreamUpdate is an update that will be pushed through the // GRPC stream. message StreamUpdate { diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 5b018a1e33..43e5db42ce 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -22,8 +22,8 @@ type FullNodeStreamingManagerImpl struct { logger log.Logger // orderbookSubscriptions maps subscription IDs to their respective orderbook subscriptions. - orderbookSubscriptions map[uint32]*OrderbookSubscription - nextSubscriptionId uint32 + orderbookSubscriptions map[uint32]*OrderbookSubscription + nextOrderbookSubscriptionId uint32 // stream will batch and flush out messages every 10 ms. ticker *time.Ticker @@ -62,9 +62,9 @@ func NewFullNodeStreamingManager( ) *FullNodeStreamingManagerImpl { logger = logger.With(log.ModuleKey, "full-node-streaming") fullNodeStreamingManager := &FullNodeStreamingManagerImpl{ - logger: logger, - orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), - nextSubscriptionId: 0, + logger: logger, + orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), + nextOrderbookSubscriptionId: 0, ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), done: make(chan bool), @@ -129,7 +129,7 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.Lock() subscription := &OrderbookSubscription{ - subscriptionId: sm.nextSubscriptionId, + subscriptionId: sm.nextOrderbookSubscriptionId, clobPairIds: clobPairIds, messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), @@ -143,7 +143,7 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( ), ) sm.orderbookSubscriptions[subscription.subscriptionId] = subscription - sm.nextSubscriptionId++ + sm.nextOrderbookSubscriptionId++ sm.EmitMetrics() sm.Unlock() diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 83ade9b1d7..7a70309e76 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -859,6 +859,100 @@ func (m *StreamOrderbookUpdatesResponse) GetUpdates() []StreamUpdate { return nil } +// StreamSubaccountUpdatesRequest is a request message for the +// StreamSubaccountUpdates method. +type StreamSubaccountUpdatesRequest struct { + // Subaccount ids to stream subaccount updates for. + SubaccountIds []*SubaccountId `protobuf:"bytes,1,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` +} + +func (m *StreamSubaccountUpdatesRequest) Reset() { *m = StreamSubaccountUpdatesRequest{} } +func (m *StreamSubaccountUpdatesRequest) String() string { return proto.CompactTextString(m) } +func (*StreamSubaccountUpdatesRequest) ProtoMessage() {} +func (*StreamSubaccountUpdatesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{16} +} +func (m *StreamSubaccountUpdatesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamSubaccountUpdatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamSubaccountUpdatesRequest.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 *StreamSubaccountUpdatesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamSubaccountUpdatesRequest.Merge(m, src) +} +func (m *StreamSubaccountUpdatesRequest) XXX_Size() int { + return m.Size() +} +func (m *StreamSubaccountUpdatesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StreamSubaccountUpdatesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamSubaccountUpdatesRequest proto.InternalMessageInfo + +func (m *StreamSubaccountUpdatesRequest) GetSubaccountIds() []*SubaccountId { + if m != nil { + return m.SubaccountIds + } + return nil +} + +// StreamSubaccountUpdatesResponse is a response message for the +// StreamSubaccountUpdates method. +type StreamSubaccountUpdatesResponse struct { + // Batch of updates for the clob pair. + Updates []StreamUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` +} + +func (m *StreamSubaccountUpdatesResponse) Reset() { *m = StreamSubaccountUpdatesResponse{} } +func (m *StreamSubaccountUpdatesResponse) String() string { return proto.CompactTextString(m) } +func (*StreamSubaccountUpdatesResponse) ProtoMessage() {} +func (*StreamSubaccountUpdatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3365c195b25c5bc0, []int{17} +} +func (m *StreamSubaccountUpdatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamSubaccountUpdatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamSubaccountUpdatesResponse.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 *StreamSubaccountUpdatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamSubaccountUpdatesResponse.Merge(m, src) +} +func (m *StreamSubaccountUpdatesResponse) XXX_Size() int { + return m.Size() +} +func (m *StreamSubaccountUpdatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StreamSubaccountUpdatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamSubaccountUpdatesResponse proto.InternalMessageInfo + +func (m *StreamSubaccountUpdatesResponse) GetUpdates() []StreamUpdate { + if m != nil { + return m.Updates + } + return nil +} + // StreamUpdate is an update that will be pushed through the // GRPC stream. type StreamUpdate struct { @@ -881,7 +975,7 @@ func (m *StreamUpdate) Reset() { *m = StreamUpdate{} } func (m *StreamUpdate) String() string { return proto.CompactTextString(m) } func (*StreamUpdate) ProtoMessage() {} func (*StreamUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{16} + return fileDescriptor_3365c195b25c5bc0, []int{18} } func (m *StreamUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -994,7 +1088,7 @@ func (m *SubaccountId) Reset() { *m = SubaccountId{} } func (m *SubaccountId) String() string { return proto.CompactTextString(m) } func (*SubaccountId) ProtoMessage() {} func (*SubaccountId) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{17} + return fileDescriptor_3365c195b25c5bc0, []int{19} } func (m *SubaccountId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1050,7 +1144,7 @@ func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetual func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountPerpetualPosition) ProtoMessage() {} func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{18} + return fileDescriptor_3365c195b25c5bc0, []int{20} } func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1106,7 +1200,7 @@ func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountAssetPosition) ProtoMessage() {} func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{19} + return fileDescriptor_3365c195b25c5bc0, []int{21} } func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1163,7 +1257,7 @@ func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } func (*StreamSubaccountUpdate) ProtoMessage() {} func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{20} + return fileDescriptor_3365c195b25c5bc0, []int{22} } func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1230,7 +1324,7 @@ func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdate) ProtoMessage() {} func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{21} + return fileDescriptor_3365c195b25c5bc0, []int{23} } func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1290,7 +1384,7 @@ func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookFill) ProtoMessage() {} func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{22} + return fileDescriptor_3365c195b25c5bc0, []int{24} } func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1358,6 +1452,8 @@ func init() { proto.RegisterType((*QueryLiquidationsConfigurationResponse)(nil), "dydxprotocol.clob.QueryLiquidationsConfigurationResponse") proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") proto.RegisterType((*StreamOrderbookUpdatesResponse)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesResponse") + proto.RegisterType((*StreamSubaccountUpdatesRequest)(nil), "dydxprotocol.clob.StreamSubaccountUpdatesRequest") + proto.RegisterType((*StreamSubaccountUpdatesResponse)(nil), "dydxprotocol.clob.StreamSubaccountUpdatesResponse") proto.RegisterType((*StreamUpdate)(nil), "dydxprotocol.clob.StreamUpdate") proto.RegisterType((*SubaccountId)(nil), "dydxprotocol.clob.SubaccountId") proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.clob.SubaccountPerpetualPosition") @@ -1370,108 +1466,111 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1603 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xcd, 0x4f, 0xdc, 0x46, - 0x1b, 0xc7, 0x40, 0x92, 0xe5, 0x01, 0x12, 0x32, 0x84, 0x00, 0x0b, 0x59, 0x88, 0xdf, 0x37, 0x04, - 0xc8, 0x9b, 0x75, 0x20, 0x51, 0x94, 0x37, 0x44, 0x79, 0x05, 0xbc, 0x4d, 0x82, 0x14, 0x9a, 0xad, - 0xf3, 0x51, 0xd4, 0x46, 0xb2, 0x66, 0xed, 0xd9, 0xc5, 0x8a, 0xed, 0x59, 0xec, 0xf1, 0x16, 0x54, - 0x55, 0x95, 0x7a, 0xe8, 0xa5, 0xad, 0x54, 0xa9, 0x87, 0x1e, 0x2a, 0xf5, 0xd2, 0x73, 0x2f, 0x95, - 0x7a, 0xac, 0xda, 0xde, 0x72, 0x8c, 0xd4, 0x4b, 0x55, 0x55, 0x55, 0x95, 0xf4, 0xdc, 0xbf, 0xa1, - 0xf2, 0xcc, 0x78, 0xbf, 0x6c, 0xef, 0x12, 0x2e, 0xe0, 0x79, 0xe6, 0xf9, 0xf8, 0x3d, 0x1f, 0xf3, - 0xcc, 0x33, 0x0b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bf, 0x76, 0x99, 0x5f, 0x28, 0x5a, 0x83, 0xb2, 0x2f, 0x02, 0xca, 0x0e, 0x6a, 0x24, - 0x28, 0x1f, 0xe7, 0xe4, 0xab, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x79, 0x17, 0x6c, 0x73, - 0x13, 0x00, 0x00, + // 1654 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x4f, 0x1c, 0x47, + 0x16, 0x9f, 0x06, 0x6c, 0x0f, 0x6f, 0x00, 0xe3, 0xc2, 0x18, 0x18, 0xf0, 0x80, 0x7b, 0xd7, 0x18, + 0xf0, 0x7a, 0xda, 0x60, 0xcb, 0xf2, 0x1a, 0xcb, 0x2b, 0x60, 0xd7, 0x06, 0xc9, 0xac, 0x67, 0xdb, + 0x1f, 0x8b, 0x76, 0x2d, 0xb5, 0x6a, 0xba, 0x8b, 0xa1, 0xe5, 0xee, 0xae, 0xa1, 0x3f, 0x66, 0x41, + 0xab, 0x28, 0x92, 0x0f, 0xb9, 0x24, 0x91, 0x22, 0xe5, 0x90, 0x43, 0x8e, 0x3e, 0xe7, 0x12, 0x29, + 0xc7, 0x28, 0xc9, 0xcd, 0x47, 0x4b, 0xb9, 0x44, 0x51, 0x14, 0x45, 0x76, 0xce, 0xf9, 0x1b, 0xa2, + 0xae, 0xaa, 0x9e, 0x99, 0x9e, 0xee, 0x9e, 0x01, 0x94, 0x0b, 0x4c, 0xbd, 0x7a, 0x1f, 0xbf, 0xf7, + 0x51, 0xf5, 0x5e, 0x35, 0x5c, 0x34, 0x0e, 0x8d, 0x83, 0xba, 0x4b, 0x7d, 0xaa, 0x53, 0x4b, 0xd1, + 0x2d, 0x5a, 0x55, 0xf6, 0x03, 0xe2, 0x1e, 0x96, 0x19, 0x0d, 0x9d, 0x6b, 0xdf, 0x2e, 0x87, 0xdb, + 0xc5, 0xf3, 0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5d, 0x53, 0xf7, + 0x9a, 0x5e, 0x25, 0x95, 0xc7, 0x00, 0x6f, 0x73, 0x76, 0x75, 0xac, 0xd1, 0x6e, 0x92, 0x13, 0xe5, + 0xdf, 0x24, 0x98, 0xcb, 0x76, 0x4f, 0x24, 0xa3, 0x06, 0x67, 0x5c, 0xe2, 0x05, 0x96, 0xef, 0x89, + 0x54, 0x3c, 0xe8, 0x65, 0x33, 0x45, 0x4b, 0xc8, 0xb0, 0xe6, 0x18, 0xcf, 0xa8, 0x15, 0xd8, 0xa4, + 0x42, 0xdc, 0x30, 0x75, 0x22, 0x6d, 0x91, 0xf6, 0x22, 0x86, 0xb1, 0x14, 0x2e, 0x34, 0x07, 0x43, + 0xcd, 0x62, 0xd0, 0x9a, 0xf5, 0x0f, 0x51, 0xb2, 0xb7, 0x0c, 0x34, 0x0a, 0xfd, 0x36, 0x69, 0xb0, + 0x88, 0xf4, 0xa9, 0xe1, 0x4f, 0x74, 0x01, 0x4e, 0x37, 0x98, 0x92, 0xc9, 0xfe, 0x39, 0x69, 0x61, + 0x40, 0x15, 0x2b, 0x79, 0x09, 0x16, 0x58, 0xd1, 0xfd, 0x83, 0xdd, 0x26, 0x4f, 0x4c, 0xe2, 0x3e, + 0x0c, 0xef, 0x92, 0x0d, 0x76, 0xba, 0x03, 0xb7, 0x3d, 0xaf, 0xf2, 0xe7, 0x12, 0x2c, 0x1e, 0x81, + 0x59, 0x44, 0xc9, 0x81, 0xc9, 0xac, 0x2b, 0x4a, 0xd4, 0x81, 0x92, 0x12, 0xb6, 0x6e, 0xaa, 0x45, + 0x78, 0xc6, 0x49, 0x1a, 0x8f, 0xbc, 0x08, 0x57, 0x18, 0xb8, 0xf5, 0xb0, 0x68, 0x54, 0xec, 0x93, + 0x6c, 0x47, 0x3e, 0x93, 0x84, 0xd7, 0x5d, 0x79, 0x85, 0x1f, 0x2f, 0x60, 0x22, 0xe3, 0xfa, 0x16, + 0x6e, 0x94, 0x53, 0xdc, 0xe8, 0xa2, 0x58, 0x78, 0xc1, 0x8b, 0xbb, 0x83, 0x45, 0xde, 0x81, 0x29, + 0x06, 0xec, 0xb1, 0x8f, 0x7d, 0xb2, 0x1b, 0x58, 0x8f, 0xc2, 0x2b, 0x3b, 0x3a, 0x57, 0xab, 0x90, + 0x67, 0x57, 0x78, 0x94, 0xf3, 0xc2, 0x4a, 0x31, 0xc5, 0x34, 0x13, 0xd9, 0x32, 0xa2, 0x5a, 0xa2, + 0x7c, 0x29, 0x7f, 0x25, 0x41, 0x31, 0x4d, 0xb5, 0xf0, 0x72, 0x07, 0xce, 0x72, 0xdd, 0x75, 0x0b, + 0xeb, 0xc4, 0x26, 0x8e, 0x2f, 0x4c, 0x2c, 0xa6, 0x98, 0x78, 0x48, 0x9d, 0xda, 0x13, 0xe2, 0xda, + 0x4c, 0x45, 0x25, 0x12, 0x10, 0x16, 0x47, 0x68, 0x8c, 0x8a, 0x66, 0xa1, 0xb0, 0x6b, 0x5a, 0x96, + 0x86, 0x6d, 0x1a, 0x38, 0x3e, 0xab, 0xc9, 0x01, 0x15, 0x42, 0xd2, 0x1a, 0xa3, 0xa0, 0x19, 0x18, + 0xf4, 0x5d, 0xb3, 0x56, 0x23, 0x2e, 0x31, 0x58, 0x75, 0xe6, 0xd5, 0x16, 0x41, 0xbe, 0x02, 0x97, + 0x19, 0xec, 0x87, 0x6d, 0xcd, 0x27, 0x35, 0xa9, 0x1f, 0x48, 0x30, 0xdf, 0x8b, 0x53, 0x38, 0xfb, + 0x1c, 0xc6, 0x52, 0x7a, 0x99, 0x70, 0xf8, 0x72, 0x9a, 0xc3, 0x09, 0x95, 0xc2, 0x59, 0x64, 0x25, + 0x76, 0xe4, 0x35, 0xb8, 0xf8, 0xd8, 0x77, 0x09, 0xe6, 0xe1, 0xa9, 0x52, 0xfa, 0xe2, 0x29, 0xef, + 0x67, 0x51, 0x1e, 0x93, 0xe7, 0xb7, 0x3f, 0x7e, 0x7e, 0x65, 0x0c, 0xa5, 0x2c, 0x15,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, 0x5d, 0x29, 0xf7, 0x9f, 0x5b, 0x35, 0xd3, 0xdf, 0x0b, 0xaa, 0x65, + 0x9d, 0xda, 0xf1, 0x0c, 0x36, 0x6e, 0x5e, 0x63, 0x5d, 0x4d, 0x69, 0x52, 0x0e, 0x78, 0x56, 0xfd, + 0xc3, 0x3a, 0xf1, 0xaa, 0xa7, 0x19, 0xf9, 0xc6, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x53, 0xd9, + 0x69, 0x7e, 0xc6, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1503,6 +1602,9 @@ type QueryClient interface { // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) + // Streams subaccount updates. Updates contain subaccount data + // such as perpetual and asset positions. + StreamSubaccountUpdates(ctx context.Context, in *StreamSubaccountUpdatesRequest, opts ...grpc.CallOption) (Query_StreamSubaccountUpdatesClient, error) } type queryClient struct { @@ -1608,6 +1710,38 @@ func (x *queryStreamOrderbookUpdatesClient) Recv() (*StreamOrderbookUpdatesRespo return m, nil } +func (c *queryClient) StreamSubaccountUpdates(ctx context.Context, in *StreamSubaccountUpdatesRequest, opts ...grpc.CallOption) (Query_StreamSubaccountUpdatesClient, error) { + stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[1], "/dydxprotocol.clob.Query/StreamSubaccountUpdates", opts...) + if err != nil { + return nil, err + } + x := &queryStreamSubaccountUpdatesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Query_StreamSubaccountUpdatesClient interface { + Recv() (*StreamSubaccountUpdatesResponse, error) + grpc.ClientStream +} + +type queryStreamSubaccountUpdatesClient struct { + grpc.ClientStream +} + +func (x *queryStreamSubaccountUpdatesClient) Recv() (*StreamSubaccountUpdatesResponse, error) { + m := new(StreamSubaccountUpdatesResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Queries a ClobPair by id. @@ -1627,6 +1761,9 @@ type QueryServer interface { // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. StreamOrderbookUpdates(*StreamOrderbookUpdatesRequest, Query_StreamOrderbookUpdatesServer) error + // Streams subaccount updates. Updates contain subaccount data + // such as perpetual and asset positions. + StreamSubaccountUpdates(*StreamSubaccountUpdatesRequest, Query_StreamSubaccountUpdatesServer) error } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1657,6 +1794,9 @@ func (*UnimplementedQueryServer) StatefulOrder(ctx context.Context, req *QuerySt func (*UnimplementedQueryServer) StreamOrderbookUpdates(req *StreamOrderbookUpdatesRequest, srv Query_StreamOrderbookUpdatesServer) error { return status.Errorf(codes.Unimplemented, "method StreamOrderbookUpdates not implemented") } +func (*UnimplementedQueryServer) StreamSubaccountUpdates(req *StreamSubaccountUpdatesRequest, srv Query_StreamSubaccountUpdatesServer) error { + return status.Errorf(codes.Unimplemented, "method StreamSubaccountUpdates not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1809,6 +1949,27 @@ func (x *queryStreamOrderbookUpdatesServer) Send(m *StreamOrderbookUpdatesRespon return x.ServerStream.SendMsg(m) } +func _Query_StreamSubaccountUpdates_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(StreamSubaccountUpdatesRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(QueryServer).StreamSubaccountUpdates(m, &queryStreamSubaccountUpdatesServer{stream}) +} + +type Query_StreamSubaccountUpdatesServer interface { + Send(*StreamSubaccountUpdatesResponse) error + grpc.ServerStream +} + +type queryStreamSubaccountUpdatesServer struct { + grpc.ServerStream +} + +func (x *queryStreamSubaccountUpdatesServer) Send(m *StreamSubaccountUpdatesResponse) error { + return x.ServerStream.SendMsg(m) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.clob.Query", HandlerType: (*QueryServer)(nil), @@ -1848,6 +2009,11 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_StreamOrderbookUpdates_Handler, ServerStreams: true, }, + { + StreamName: "StreamSubaccountUpdates", + Handler: _Query_StreamSubaccountUpdates_Handler, + ServerStreams: true, + }, }, Metadata: "dydxprotocol/clob/query.proto", } @@ -2447,6 +2613,80 @@ func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *StreamSubaccountUpdatesRequest) 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 *StreamSubaccountUpdatesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamSubaccountUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SubaccountIds) > 0 { + for iNdEx := len(m.SubaccountIds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SubaccountIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StreamSubaccountUpdatesResponse) 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 *StreamSubaccountUpdatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamSubaccountUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Updates) > 0 { + for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *StreamUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3065,6 +3305,36 @@ func (m *StreamOrderbookUpdatesResponse) Size() (n int) { return n } +func (m *StreamSubaccountUpdatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SubaccountIds) > 0 { + for _, e := range m.SubaccountIds { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *StreamSubaccountUpdatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Updates) > 0 { + for _, e := range m.Updates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func (m *StreamUpdate) Size() (n int) { if m == nil { return 0 @@ -4717,6 +4987,174 @@ func (m *StreamOrderbookUpdatesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *StreamSubaccountUpdatesRequest) 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: StreamSubaccountUpdatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamSubaccountUpdatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountIds", 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.SubaccountIds = append(m.SubaccountIds, &SubaccountId{}) + if err := m.SubaccountIds[len(m.SubaccountIds)-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 (m *StreamSubaccountUpdatesResponse) 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: StreamSubaccountUpdatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamSubaccountUpdatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Updates", 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.Updates = append(m.Updates, StreamUpdate{}) + if err := m.Updates[len(m.Updates)-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 (m *StreamUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/subaccounts/keeper/keeper.go b/protocol/x/subaccounts/keeper/keeper.go index 084f848a80..25a834ffa1 100644 --- a/protocol/x/subaccounts/keeper/keeper.go +++ b/protocol/x/subaccounts/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + streamingtypes "github.com/dydxprotocol/v4-chain/protocol/streaming/types" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -21,6 +22,7 @@ type ( blocktimeKeeper types.BlocktimeKeeper revShareKeeper types.RevShareKeeper indexerEventManager indexer_manager.IndexerEventManager + streamingManager streamingtypes.FullNodeStreamingManager } ) @@ -33,6 +35,7 @@ func NewKeeper( blocktimeKeeper types.BlocktimeKeeper, revShareKeeper types.RevShareKeeper, indexerEventManager indexer_manager.IndexerEventManager, + streamingManager streamingtypes.FullNodeStreamingManager, ) *Keeper { return &Keeper{ cdc: cdc, @@ -43,6 +46,7 @@ func NewKeeper( blocktimeKeeper: blocktimeKeeper, revShareKeeper: revShareKeeper, indexerEventManager: indexerEventManager, + streamingManager: streamingManager, } } @@ -50,6 +54,10 @@ func (k Keeper) GetIndexerEventManager() indexer_manager.IndexerEventManager { return k.indexerEventManager } +func (k Keeper) GetFullNodeStreamingManager() streamingtypes.FullNodeStreamingManager { + return k.streamingManager +} + func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With(log.ModuleKey, fmt.Sprintf("x/%s", types.ModuleName)) } From 2c10c1d7b4a49be51ab01050215eded567d34540 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 2 Aug 2024 15:24:29 -0400 Subject: [PATCH 03/37] test --- proto/dydxprotocol/clob/query.proto | 20 +- .../x/clob/keeper/grpc_stream_orderbook.go | 54 +- protocol/x/clob/types/query.pb.go | 633 ++++-------------- 3 files changed, 174 insertions(+), 533 deletions(-) diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 72e6552b47..d59501bd7b 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -62,13 +62,8 @@ service Query { // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - rpc StreamOrderbookUpdates(StreamOrderbookUpdatesRequest) + rpc StreamOrderbookUpdates(stream StreamOrderbookUpdatesRequest) returns (stream StreamOrderbookUpdatesResponse); - - // Streams subaccount updates. Updates contain subaccount data - // such as perpetual and asset positions. - rpc StreamSubaccountUpdates(StreamSubaccountUpdatesRequest) - returns (stream StreamSubaccountUpdatesResponse); } // QueryGetClobPairRequest is request type for the ClobPair method. @@ -177,20 +172,9 @@ message StreamOrderbookUpdatesRequest { message StreamOrderbookUpdatesResponse { // Batch of updates for the clob pair. repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ]; -} -// StreamSubaccountUpdatesRequest is a request message for the -// StreamSubaccountUpdates method. -message StreamSubaccountUpdatesRequest { // Subaccount ids to stream subaccount updates for. - repeated SubaccountId subaccount_ids = 1; -} - -// StreamSubaccountUpdatesResponse is a response message for the -// StreamSubaccountUpdates method. -message StreamSubaccountUpdatesResponse { - // Batch of updates for the clob pair. - repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ]; + repeated SubaccountId subaccount_ids = 2 [ (gogoproto.nullable) = true ]; } // StreamUpdate is an update that will be pushed through the diff --git a/protocol/x/clob/keeper/grpc_stream_orderbook.go b/protocol/x/clob/keeper/grpc_stream_orderbook.go index 8e72a8640d..f2959105cc 100644 --- a/protocol/x/clob/keeper/grpc_stream_orderbook.go +++ b/protocol/x/clob/keeper/grpc_stream_orderbook.go @@ -1,23 +1,49 @@ package keeper import ( + "fmt" "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + "io" ) -func (k Keeper) StreamOrderbookUpdates( - req *types.StreamOrderbookUpdatesRequest, - stream types.Query_StreamOrderbookUpdatesServer, -) error { - err := k.GetFullNodeStreamingManager().Subscribe( - req.GetClobPairId(), - stream, - ) - if err != nil { - return err - } +func (k Keeper) StreamOrderbookUpdates(stream types.Query_StreamOrderbookUpdatesServer) error { + // A channel to handle incoming requests + reqChan := make(chan *types.StreamOrderbookUpdatesRequest) + + // Goroutine to handle receiving requests from the client + go func() { + defer close(reqChan) + for { + req, err := stream.Recv() + if err == io.EOF { + // Client closed the stream + return + } + if err != nil { + panic(fmt.Sprintf("Error receiving request in orderbook GRPC stream: %v", err)) + } + reqChan <- req + } + }() - // Keep this scope alive because once this scope exits - the stream is closed + // Context to handle stream lifecycle ctx := stream.Context() - <-ctx.Done() - return nil + + for { + select { + case req := <-reqChan: + // Handle the incoming request and subscribe + err := k.GetFullNodeStreamingManager().Subscribe( + req.GetClobPairId(), + stream, + ) + if err != nil { + return err + } + + case <-ctx.Done(): + // Stream context is done, exit the function + return nil + } + } } diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 7a70309e76..a83256fedb 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -817,6 +817,8 @@ func (m *StreamOrderbookUpdatesRequest) GetClobPairId() []uint32 { type StreamOrderbookUpdatesResponse struct { // Batch of updates for the clob pair. Updates []StreamUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` + // Subaccount ids to stream subaccount updates for. + SubaccountIds []*SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` } func (m *StreamOrderbookUpdatesResponse) Reset() { *m = StreamOrderbookUpdatesResponse{} } @@ -859,100 +861,13 @@ func (m *StreamOrderbookUpdatesResponse) GetUpdates() []StreamUpdate { return nil } -// StreamSubaccountUpdatesRequest is a request message for the -// StreamSubaccountUpdates method. -type StreamSubaccountUpdatesRequest struct { - // Subaccount ids to stream subaccount updates for. - SubaccountIds []*SubaccountId `protobuf:"bytes,1,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` -} - -func (m *StreamSubaccountUpdatesRequest) Reset() { *m = StreamSubaccountUpdatesRequest{} } -func (m *StreamSubaccountUpdatesRequest) String() string { return proto.CompactTextString(m) } -func (*StreamSubaccountUpdatesRequest) ProtoMessage() {} -func (*StreamSubaccountUpdatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{16} -} -func (m *StreamSubaccountUpdatesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StreamSubaccountUpdatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StreamSubaccountUpdatesRequest.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 *StreamSubaccountUpdatesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamSubaccountUpdatesRequest.Merge(m, src) -} -func (m *StreamSubaccountUpdatesRequest) XXX_Size() int { - return m.Size() -} -func (m *StreamSubaccountUpdatesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StreamSubaccountUpdatesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamSubaccountUpdatesRequest proto.InternalMessageInfo - -func (m *StreamSubaccountUpdatesRequest) GetSubaccountIds() []*SubaccountId { +func (m *StreamOrderbookUpdatesResponse) GetSubaccountIds() []*SubaccountId { if m != nil { return m.SubaccountIds } return nil } -// StreamSubaccountUpdatesResponse is a response message for the -// StreamSubaccountUpdates method. -type StreamSubaccountUpdatesResponse struct { - // Batch of updates for the clob pair. - Updates []StreamUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` -} - -func (m *StreamSubaccountUpdatesResponse) Reset() { *m = StreamSubaccountUpdatesResponse{} } -func (m *StreamSubaccountUpdatesResponse) String() string { return proto.CompactTextString(m) } -func (*StreamSubaccountUpdatesResponse) ProtoMessage() {} -func (*StreamSubaccountUpdatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{17} -} -func (m *StreamSubaccountUpdatesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StreamSubaccountUpdatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StreamSubaccountUpdatesResponse.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 *StreamSubaccountUpdatesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamSubaccountUpdatesResponse.Merge(m, src) -} -func (m *StreamSubaccountUpdatesResponse) XXX_Size() int { - return m.Size() -} -func (m *StreamSubaccountUpdatesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StreamSubaccountUpdatesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamSubaccountUpdatesResponse proto.InternalMessageInfo - -func (m *StreamSubaccountUpdatesResponse) GetUpdates() []StreamUpdate { - if m != nil { - return m.Updates - } - return nil -} - // StreamUpdate is an update that will be pushed through the // GRPC stream. type StreamUpdate struct { @@ -975,7 +890,7 @@ func (m *StreamUpdate) Reset() { *m = StreamUpdate{} } func (m *StreamUpdate) String() string { return proto.CompactTextString(m) } func (*StreamUpdate) ProtoMessage() {} func (*StreamUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{18} + return fileDescriptor_3365c195b25c5bc0, []int{16} } func (m *StreamUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1088,7 +1003,7 @@ func (m *SubaccountId) Reset() { *m = SubaccountId{} } func (m *SubaccountId) String() string { return proto.CompactTextString(m) } func (*SubaccountId) ProtoMessage() {} func (*SubaccountId) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{19} + return fileDescriptor_3365c195b25c5bc0, []int{17} } func (m *SubaccountId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1144,7 +1059,7 @@ func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetual func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountPerpetualPosition) ProtoMessage() {} func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{20} + return fileDescriptor_3365c195b25c5bc0, []int{18} } func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1200,7 +1115,7 @@ func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountAssetPosition) ProtoMessage() {} func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{21} + return fileDescriptor_3365c195b25c5bc0, []int{19} } func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1257,7 +1172,7 @@ func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } func (*StreamSubaccountUpdate) ProtoMessage() {} func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{22} + return fileDescriptor_3365c195b25c5bc0, []int{20} } func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1324,7 +1239,7 @@ func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdate) ProtoMessage() {} func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{23} + return fileDescriptor_3365c195b25c5bc0, []int{21} } func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1384,7 +1299,7 @@ func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookFill) ProtoMessage() {} func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{24} + return fileDescriptor_3365c195b25c5bc0, []int{22} } func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1452,8 +1367,6 @@ func init() { proto.RegisterType((*QueryLiquidationsConfigurationResponse)(nil), "dydxprotocol.clob.QueryLiquidationsConfigurationResponse") proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") proto.RegisterType((*StreamOrderbookUpdatesResponse)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesResponse") - proto.RegisterType((*StreamSubaccountUpdatesRequest)(nil), "dydxprotocol.clob.StreamSubaccountUpdatesRequest") - proto.RegisterType((*StreamSubaccountUpdatesResponse)(nil), "dydxprotocol.clob.StreamSubaccountUpdatesResponse") proto.RegisterType((*StreamUpdate)(nil), "dydxprotocol.clob.StreamUpdate") proto.RegisterType((*SubaccountId)(nil), "dydxprotocol.clob.SubaccountId") proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.clob.SubaccountPerpetualPosition") @@ -1466,111 +1379,109 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x4f, 0x1c, 0x47, - 0x16, 0x9f, 0x06, 0x6c, 0x0f, 0x6f, 0x00, 0xe3, 0xc2, 0x18, 0x18, 0xf0, 0x80, 0x7b, 0xd7, 0x18, - 0xf0, 0x7a, 0xda, 0x60, 0xcb, 0xf2, 0x1a, 0xcb, 0x2b, 0x60, 0xd7, 0x06, 0xc9, 0xac, 0x67, 0xdb, - 0x1f, 0x8b, 0x76, 0x2d, 0xb5, 0x6a, 0xba, 0x8b, 0xa1, 0xe5, 0xee, 0xae, 0xa1, 0x3f, 0x66, 0x41, - 0xab, 0x28, 0x92, 0x0f, 0xb9, 0x24, 0x91, 0x22, 0xe5, 0x90, 0x43, 0x8e, 0x3e, 0xe7, 0x12, 0x29, - 0xc7, 0x28, 0xc9, 0xcd, 0x47, 0x4b, 0xb9, 0x44, 0x51, 0x14, 0x45, 0x76, 0xce, 0xf9, 0x1b, 0xa2, - 0xae, 0xaa, 0x9e, 0x99, 0x9e, 0xee, 0x9e, 0x01, 0x94, 0x0b, 0x4c, 0xbd, 0x7a, 0x1f, 0xbf, 0xf7, - 0x51, 0xf5, 0x5e, 0x35, 0x5c, 0x34, 0x0e, 0x8d, 0x83, 0xba, 0x4b, 0x7d, 0xaa, 0x53, 0x4b, 0xd1, - 0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cf, 0x33, 0x2d, 0x15, 0xa1, 0x44, - 0x50, 0xd1, 0x7f, 0x61, 0xbc, 0x11, 0x31, 0x6b, 0x36, 0x69, 0x68, 0x36, 0xf1, 0x5d, 0x53, 0xf7, - 0x9a, 0x5e, 0x25, 0x95, 0xc7, 0x00, 0x6f, 0x73, 0x76, 0x75, 0xac, 0xd1, 0x6e, 0x92, 0x13, 0xe5, - 0xdf, 0x24, 0x98, 0xcb, 0x76, 0x4f, 0x24, 0xa3, 0x06, 0x67, 0x5c, 0xe2, 0x05, 0x96, 0xef, 0x89, - 0x54, 0x3c, 0xe8, 0x65, 0x33, 0x45, 0x4b, 0xc8, 0xb0, 0xe6, 0x18, 0xcf, 0xa8, 0x15, 0xd8, 0xa4, - 0x42, 0xdc, 0x30, 0x75, 0x22, 0x6d, 0x91, 0xf6, 0x22, 0x86, 0xb1, 0x14, 0x2e, 0x34, 0x07, 0x43, - 0xcd, 0x62, 0xd0, 0x9a, 0xf5, 0x0f, 0x51, 0xb2, 0xb7, 0x0c, 0x34, 0x0a, 0xfd, 0x36, 0x69, 0xb0, - 0x88, 0xf4, 0xa9, 0xe1, 0x4f, 0x74, 0x01, 0x4e, 0x37, 0x98, 0x92, 0xc9, 0xfe, 0x39, 0x69, 0x61, - 0x40, 0x15, 0x2b, 0x79, 0x09, 0x16, 0x58, 0xd1, 0xfd, 0x83, 0xdd, 0x26, 0x4f, 0x4c, 0xe2, 0x3e, - 0x0c, 0xef, 0x92, 0x0d, 0x76, 0xba, 0x03, 0xb7, 0x3d, 0xaf, 0xf2, 0xe7, 0x12, 0x2c, 0x1e, 0x81, - 0x59, 0x44, 0xc9, 0x81, 0xc9, 0xac, 0x2b, 0x4a, 0xd4, 0x81, 0x92, 0x12, 0xb6, 0x6e, 0xaa, 0x45, - 0x78, 0xc6, 0x49, 0x1a, 0x8f, 0xbc, 0x08, 0x57, 0x18, 0xb8, 0xf5, 0xb0, 0x68, 0x54, 0xec, 0x93, - 0x6c, 0x47, 0x3e, 0x93, 0x84, 0xd7, 0x5d, 0x79, 0x85, 0x1f, 0x2f, 0x60, 0x22, 0xe3, 0xfa, 0x16, - 0x6e, 0x94, 0x53, 0xdc, 0xe8, 0xa2, 0x58, 0x78, 0xc1, 0x8b, 0xbb, 0x83, 0x45, 0xde, 0x81, 0x29, - 0x06, 0xec, 0xb1, 0x8f, 0x7d, 0xb2, 0x1b, 0x58, 0x8f, 0xc2, 0x2b, 0x3b, 0x3a, 0x57, 0xab, 0x90, - 0x67, 0x57, 0x78, 0x94, 0xf3, 0xc2, 0x4a, 0x31, 0xc5, 0x34, 0x13, 0xd9, 0x32, 0xa2, 0x5a, 0xa2, - 0x7c, 0x29, 0x7f, 0x25, 0x41, 0x31, 0x4d, 0xb5, 0xf0, 0x72, 0x07, 0xce, 0x72, 0xdd, 0x75, 0x0b, - 0xeb, 0xc4, 0x26, 0x8e, 0x2f, 0x4c, 0x2c, 0xa6, 0x98, 0x78, 0x48, 0x9d, 0xda, 0x13, 0xe2, 0xda, - 0x4c, 0x45, 0x25, 0x12, 0x10, 0x16, 0x47, 0x68, 0x8c, 0x8a, 0x66, 0xa1, 0xb0, 0x6b, 0x5a, 0x96, - 0x86, 0x6d, 0x1a, 0x38, 0x3e, 0xab, 0xc9, 0x01, 0x15, 0x42, 0xd2, 0x1a, 0xa3, 0xa0, 0x19, 0x18, - 0xf4, 0x5d, 0xb3, 0x56, 0x23, 0x2e, 0x31, 0x58, 0x75, 0xe6, 0xd5, 0x16, 0x41, 0xbe, 0x02, 0x97, - 0x19, 0xec, 0x87, 0x6d, 0xcd, 0x27, 0x35, 0xa9, 0x1f, 0x48, 0x30, 0xdf, 0x8b, 0x53, 0x38, 0xfb, - 0x1c, 0xc6, 0x52, 0x7a, 0x99, 0x70, 0xf8, 0x72, 0x9a, 0xc3, 0x09, 0x95, 0xc2, 0x59, 0x64, 0x25, - 0x76, 0xe4, 0x35, 0xb8, 0xf8, 0xd8, 0x77, 0x09, 0xe6, 0xe1, 0xa9, 0x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49, 0x7a, 0xf3, 0xb6, 0x24, 0xfd, 0xf2, 0xb6, 0x24, 0x7d, 0xf2, 0xae, 0x94, 0x7b, - 0xf3, 0xae, 0x94, 0xfb, 0xe1, 0x5d, 0x29, 0xf7, 0x9f, 0x5b, 0x35, 0xd3, 0xdf, 0x0b, 0xaa, 0x65, - 0x9d, 0xda, 0xf1, 0x0c, 0x36, 0x6e, 0x5e, 0x63, 0x5d, 0x4d, 0x69, 0x52, 0x0e, 0x78, 0x56, 0xfd, - 0xc3, 0x3a, 0xf1, 0xaa, 0xa7, 0x19, 0xf9, 0xc6, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x53, 0xd9, - 0x69, 0x7e, 0xc6, 0x14, 0x00, 0x00, + // 1626 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xcf, 0x6f, 0xdc, 0xc4, + 0x17, 0x8f, 0x93, 0xb4, 0xdd, 0xbc, 0xfc, 0x68, 0x3a, 0x69, 0x9a, 0x64, 0x93, 0x6e, 0x52, 0x7f, + 0xbf, 0x4d, 0x93, 0xf4, 0xdb, 0x75, 0x93, 0x56, 0x55, 0xbf, 0x4d, 0x55, 0x94, 0x04, 0xfa, 0x43, + 0x4a, 0xe8, 0xe2, 0xfe, 0x20, 0x82, 0x4a, 0x96, 0xd7, 0x9e, 0x6c, 0xac, 0xda, 0x9e, 0x8d, 0x3d, + 0x5e, 0x12, 0x21, 0x0e, 0x70, 0xe0, 0x02, 0x48, 0x48, 0x1c, 0x38, 0x70, 0x42, 0x9c, 0x11, 0x12, + 0x12, 0x47, 0x04, 0xdc, 0x7a, 0xac, 0xc4, 0x05, 0x21, 0x84, 0x50, 0xcb, 0x99, 0xbf, 0x01, 0x79, + 0x66, 0xbc, 0x6b, 0xaf, 0xed, 0xdd, 0x34, 0x97, 0xc4, 0xf3, 0xe6, 0xbd, 0x37, 0x9f, 0xf7, 0xe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0xf3, 0xfc, 0x65, 0xa9, 0xe7, 0xb7, 0x97, 0xa5, 0x9e, 0x77, 0xae, 0xd5, 0x2c, + 0xba, 0x1b, 0x54, 0xcb, 0x06, 0x71, 0x92, 0xf9, 0x6b, 0x5c, 0xbd, 0xc4, 0xee, 0x14, 0xa5, 0x29, + 0xd9, 0xe7, 0x39, 0xa5, 0x07, 0x75, 0xec, 0x57, 0x8f, 0x33, 0xf1, 0x95, 0x7f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0xbe, 0x6e, 0x63, 0x0a, 0xc5, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1601,10 +1512,7 @@ type QueryClient interface { StatefulOrder(ctx context.Context, in *QueryStatefulOrderRequest, opts ...grpc.CallOption) (*QueryStatefulOrderResponse, error) // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) - // Streams subaccount updates. Updates contain subaccount data - // such as perpetual and asset positions. - StreamSubaccountUpdates(ctx context.Context, in *StreamSubaccountUpdatesRequest, opts ...grpc.CallOption) (Query_StreamSubaccountUpdatesClient, error) + StreamOrderbookUpdates(ctx context.Context, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) } type queryClient struct { @@ -1678,22 +1586,17 @@ func (c *queryClient) StatefulOrder(ctx context.Context, in *QueryStatefulOrderR return out, nil } -func (c *queryClient) StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) { +func (c *queryClient) StreamOrderbookUpdates(ctx context.Context, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) { stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[0], "/dydxprotocol.clob.Query/StreamOrderbookUpdates", opts...) if err != nil { return nil, err } x := &queryStreamOrderbookUpdatesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } return x, nil } type Query_StreamOrderbookUpdatesClient interface { + Send(*StreamOrderbookUpdatesRequest) error Recv() (*StreamOrderbookUpdatesResponse, error) grpc.ClientStream } @@ -1702,40 +1605,12 @@ type queryStreamOrderbookUpdatesClient struct { grpc.ClientStream } -func (x *queryStreamOrderbookUpdatesClient) Recv() (*StreamOrderbookUpdatesResponse, error) { - m := new(StreamOrderbookUpdatesResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *queryClient) StreamSubaccountUpdates(ctx context.Context, in *StreamSubaccountUpdatesRequest, opts ...grpc.CallOption) (Query_StreamSubaccountUpdatesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[1], "/dydxprotocol.clob.Query/StreamSubaccountUpdates", opts...) - if err != nil { - return nil, err - } - x := &queryStreamSubaccountUpdatesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Query_StreamSubaccountUpdatesClient interface { - Recv() (*StreamSubaccountUpdatesResponse, error) - grpc.ClientStream -} - -type queryStreamSubaccountUpdatesClient struct { - grpc.ClientStream +func (x *queryStreamOrderbookUpdatesClient) Send(m *StreamOrderbookUpdatesRequest) error { + return x.ClientStream.SendMsg(m) } -func (x *queryStreamSubaccountUpdatesClient) Recv() (*StreamSubaccountUpdatesResponse, error) { - m := new(StreamSubaccountUpdatesResponse) +func (x *queryStreamOrderbookUpdatesClient) Recv() (*StreamOrderbookUpdatesResponse, error) { + m := new(StreamOrderbookUpdatesResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -1760,10 +1635,7 @@ type QueryServer interface { StatefulOrder(context.Context, *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - StreamOrderbookUpdates(*StreamOrderbookUpdatesRequest, Query_StreamOrderbookUpdatesServer) error - // Streams subaccount updates. Updates contain subaccount data - // such as perpetual and asset positions. - StreamSubaccountUpdates(*StreamSubaccountUpdatesRequest, Query_StreamSubaccountUpdatesServer) error + StreamOrderbookUpdates(Query_StreamOrderbookUpdatesServer) error } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1791,12 +1663,9 @@ func (*UnimplementedQueryServer) LiquidationsConfiguration(ctx context.Context, func (*UnimplementedQueryServer) StatefulOrder(ctx context.Context, req *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StatefulOrder not implemented") } -func (*UnimplementedQueryServer) StreamOrderbookUpdates(req *StreamOrderbookUpdatesRequest, srv Query_StreamOrderbookUpdatesServer) error { +func (*UnimplementedQueryServer) StreamOrderbookUpdates(srv Query_StreamOrderbookUpdatesServer) error { return status.Errorf(codes.Unimplemented, "method StreamOrderbookUpdates not implemented") } -func (*UnimplementedQueryServer) StreamSubaccountUpdates(req *StreamSubaccountUpdatesRequest, srv Query_StreamSubaccountUpdatesServer) error { - return status.Errorf(codes.Unimplemented, "method StreamSubaccountUpdates not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1929,15 +1798,12 @@ func _Query_StatefulOrder_Handler(srv interface{}, ctx context.Context, dec func } func _Query_StreamOrderbookUpdates_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(StreamOrderbookUpdatesRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(QueryServer).StreamOrderbookUpdates(m, &queryStreamOrderbookUpdatesServer{stream}) + return srv.(QueryServer).StreamOrderbookUpdates(&queryStreamOrderbookUpdatesServer{stream}) } type Query_StreamOrderbookUpdatesServer interface { Send(*StreamOrderbookUpdatesResponse) error + Recv() (*StreamOrderbookUpdatesRequest, error) grpc.ServerStream } @@ -1949,25 +1815,12 @@ func (x *queryStreamOrderbookUpdatesServer) Send(m *StreamOrderbookUpdatesRespon return x.ServerStream.SendMsg(m) } -func _Query_StreamSubaccountUpdates_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(StreamSubaccountUpdatesRequest) - if err := stream.RecvMsg(m); err != nil { - return err +func (x *queryStreamOrderbookUpdatesServer) Recv() (*StreamOrderbookUpdatesRequest, error) { + m := new(StreamOrderbookUpdatesRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err } - return srv.(QueryServer).StreamSubaccountUpdates(m, &queryStreamSubaccountUpdatesServer{stream}) -} - -type Query_StreamSubaccountUpdatesServer interface { - Send(*StreamSubaccountUpdatesResponse) error - grpc.ServerStream -} - -type queryStreamSubaccountUpdatesServer struct { - grpc.ServerStream -} - -func (x *queryStreamSubaccountUpdatesServer) Send(m *StreamSubaccountUpdatesResponse) error { - return x.ServerStream.SendMsg(m) + return m, nil } var _Query_serviceDesc = grpc.ServiceDesc{ @@ -2008,11 +1861,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ StreamName: "StreamOrderbookUpdates", Handler: _Query_StreamOrderbookUpdates_Handler, ServerStreams: true, - }, - { - StreamName: "StreamSubaccountUpdates", - Handler: _Query_StreamSubaccountUpdates_Handler, - ServerStreams: true, + ClientStreams: true, }, }, Metadata: "dydxprotocol/clob/query.proto", @@ -2592,43 +2441,6 @@ func (m *StreamOrderbookUpdatesResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Updates) > 0 { - for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *StreamSubaccountUpdatesRequest) 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 *StreamSubaccountUpdatesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StreamSubaccountUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2644,32 +2456,9 @@ func (m *StreamSubaccountUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } - return len(dAtA) - i, nil -} - -func (m *StreamSubaccountUpdatesResponse) 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 *StreamSubaccountUpdatesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StreamSubaccountUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l if len(m.Updates) > 0 { for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { { @@ -3302,15 +3091,6 @@ func (m *StreamOrderbookUpdatesResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } - return n -} - -func (m *StreamSubaccountUpdatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l if len(m.SubaccountIds) > 0 { for _, e := range m.SubaccountIds { l = e.Size() @@ -3320,21 +3100,6 @@ func (m *StreamSubaccountUpdatesRequest) Size() (n int) { return n } -func (m *StreamSubaccountUpdatesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Updates) > 0 { - for _, e := range m.Updates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - func (m *StreamUpdate) Size() (n int) { if m == nil { return 0 @@ -4966,57 +4731,7 @@ func (m *StreamOrderbookUpdatesResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StreamSubaccountUpdatesRequest) 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: StreamSubaccountUpdatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamSubaccountUpdatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SubaccountIds", wireType) } @@ -5071,90 +4786,6 @@ func (m *StreamSubaccountUpdatesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *StreamSubaccountUpdatesResponse) 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: StreamSubaccountUpdatesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamSubaccountUpdatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Updates", 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.Updates = append(m.Updates, StreamUpdate{}) - if err := m.Updates[len(m.Updates)-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 (m *StreamUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 20e627f8ad7a90024110dceea2c7f7aecb230f23 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 2 Aug 2024 15:25:14 -0400 Subject: [PATCH 04/37] revert --- .../streaming/full_node_streaming_manager.go | 19 ++++++++++--------- protocol/x/subaccounts/keeper/keeper.go | 8 -------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 43e5db42ce..1d035ed6b3 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -22,8 +22,8 @@ type FullNodeStreamingManagerImpl struct { logger log.Logger // orderbookSubscriptions maps subscription IDs to their respective orderbook subscriptions. - orderbookSubscriptions map[uint32]*OrderbookSubscription - nextOrderbookSubscriptionId uint32 + orderbookSubscriptions map[uint32]*OrderbookSubscription + nextSubscriptionId uint32 // stream will batch and flush out messages every 10 ms. ticker *time.Ticker @@ -62,9 +62,9 @@ func NewFullNodeStreamingManager( ) *FullNodeStreamingManagerImpl { logger = logger.With(log.ModuleKey, "full-node-streaming") fullNodeStreamingManager := &FullNodeStreamingManagerImpl{ - logger: logger, - orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), - nextOrderbookSubscriptionId: 0, + logger: logger, + orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), + nextSubscriptionId: 0, ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), done: make(chan bool), @@ -129,7 +129,7 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.Lock() subscription := &OrderbookSubscription{ - subscriptionId: sm.nextOrderbookSubscriptionId, + subscriptionId: sm.nextSubscriptionId, clobPairIds: clobPairIds, messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), @@ -143,7 +143,7 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( ), ) sm.orderbookSubscriptions[subscription.subscriptionId] = subscription - sm.nextOrderbookSubscriptionId++ + sm.nextSubscriptionId++ sm.EmitMetrics() sm.Unlock() @@ -168,7 +168,8 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( ), "err", err, ) - delete(sm.orderbookSubscriptions, subscription.subscriptionId) + // Break out of the loop, stopping this goroutine. + // The channel will fill up and the main thread will prune the subscription. break } } @@ -370,7 +371,7 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( metrics.IncrCounter( metrics.GrpcAddUpdateToBufferCount, - 1, + float32(numUpdatesToAdd), ) for clobPairId, streamUpdates := range updatesByClobPairId { diff --git a/protocol/x/subaccounts/keeper/keeper.go b/protocol/x/subaccounts/keeper/keeper.go index 25a834ffa1..084f848a80 100644 --- a/protocol/x/subaccounts/keeper/keeper.go +++ b/protocol/x/subaccounts/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - streamingtypes "github.com/dydxprotocol/v4-chain/protocol/streaming/types" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -22,7 +21,6 @@ type ( blocktimeKeeper types.BlocktimeKeeper revShareKeeper types.RevShareKeeper indexerEventManager indexer_manager.IndexerEventManager - streamingManager streamingtypes.FullNodeStreamingManager } ) @@ -35,7 +33,6 @@ func NewKeeper( blocktimeKeeper types.BlocktimeKeeper, revShareKeeper types.RevShareKeeper, indexerEventManager indexer_manager.IndexerEventManager, - streamingManager streamingtypes.FullNodeStreamingManager, ) *Keeper { return &Keeper{ cdc: cdc, @@ -46,7 +43,6 @@ func NewKeeper( blocktimeKeeper: blocktimeKeeper, revShareKeeper: revShareKeeper, indexerEventManager: indexerEventManager, - streamingManager: streamingManager, } } @@ -54,10 +50,6 @@ func (k Keeper) GetIndexerEventManager() indexer_manager.IndexerEventManager { return k.indexerEventManager } -func (k Keeper) GetFullNodeStreamingManager() streamingtypes.FullNodeStreamingManager { - return k.streamingManager -} - func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With(log.ModuleKey, fmt.Sprintf("x/%s", types.ModuleName)) } From cd6572a61a7e9e2111fc91951cdfe0827e948cf8 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 2 Aug 2024 15:39:54 -0400 Subject: [PATCH 05/37] update proto --- proto/dydxprotocol/clob/query.proto | 11 +- protocol/x/clob/types/query.pb.go | 391 ++++++++++++++++------------ 2 files changed, 226 insertions(+), 176 deletions(-) diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index d3b54ea312..5195c15f6d 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -165,6 +165,9 @@ message QueryLiquidationsConfigurationResponse { message StreamOrderbookUpdatesRequest { // Clob pair ids to stream orderbook updates for. repeated uint32 clob_pair_id = 1; + + // Subaccount ids to stream subaccount updates for. + repeated SubaccountId subaccount_ids = 2; } // StreamOrderbookUpdatesResponse is a response message for the @@ -172,9 +175,6 @@ message StreamOrderbookUpdatesRequest { message StreamOrderbookUpdatesResponse { // Batch of updates for the clob pair. repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ]; - - // Subaccount ids to stream subaccount updates for. - repeated SubaccountId subaccount_ids = 2 [ (gogoproto.nullable) = true ]; } // StreamUpdate is an update that will be pushed through the @@ -232,6 +232,11 @@ message StreamSubaccountUpdate { // updated_asset_positions will each be for unique assets. repeated SubaccountAssetPosition updated_asset_positions = 3; + // Snapshot indicates if the response is from a snapshot of the subaccount. + // All updates should be ignored until snapshot is received. + // If the snapshot is true, then all previous entries should be + // discarded and the subaccount should be resynced. + bool snapshot = 4; } // StreamOrderbookUpdate provides information on an orderbook update. Used in diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 216f5f30a5..46d7473782 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -770,6 +770,8 @@ func (m *QueryLiquidationsConfigurationResponse) GetLiquidationsConfig() Liquida type StreamOrderbookUpdatesRequest struct { // Clob pair ids to stream orderbook updates for. ClobPairId []uint32 `protobuf:"varint,1,rep,packed,name=clob_pair_id,json=clobPairId,proto3" json:"clob_pair_id,omitempty"` + // Subaccount ids to stream subaccount updates for. + SubaccountIds []*SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` } func (m *StreamOrderbookUpdatesRequest) Reset() { *m = StreamOrderbookUpdatesRequest{} } @@ -812,13 +814,18 @@ func (m *StreamOrderbookUpdatesRequest) GetClobPairId() []uint32 { return nil } +func (m *StreamOrderbookUpdatesRequest) GetSubaccountIds() []*SubaccountId { + if m != nil { + return m.SubaccountIds + } + return nil +} + // StreamOrderbookUpdatesResponse is a response message for the // StreamOrderbookUpdates method. type StreamOrderbookUpdatesResponse struct { // Batch of updates for the clob pair. Updates []StreamUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` - // Subaccount ids to stream subaccount updates for. - SubaccountIds []*SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` } func (m *StreamOrderbookUpdatesResponse) Reset() { *m = StreamOrderbookUpdatesResponse{} } @@ -861,13 +868,6 @@ func (m *StreamOrderbookUpdatesResponse) GetUpdates() []StreamUpdate { return nil } -func (m *StreamOrderbookUpdatesResponse) GetSubaccountIds() []*SubaccountId { - if m != nil { - return m.SubaccountIds - } - return nil -} - // StreamUpdate is an update that will be pushed through the // GRPC stream. type StreamUpdate struct { @@ -1166,6 +1166,11 @@ type StreamSubaccountUpdate struct { UpdatedPerpetualPositions []*SubaccountPerpetualPosition `protobuf:"bytes,2,rep,name=updated_perpetual_positions,json=updatedPerpetualPositions,proto3" json:"updated_perpetual_positions,omitempty"` // updated_asset_positions will each be for unique assets. UpdatedAssetPositions []*SubaccountAssetPosition `protobuf:"bytes,3,rep,name=updated_asset_positions,json=updatedAssetPositions,proto3" json:"updated_asset_positions,omitempty"` + // Snapshot indicates if the response is from a snapshot of the subaccount. + // All updates should be ignored until snapshot is received. + // If the snapshot is true, then all previous entries should be + // discarded and the subaccount should be resynced. + Snapshot bool `protobuf:"varint,4,opt,name=snapshot,proto3" json:"snapshot,omitempty"` } func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} } @@ -1222,6 +1227,13 @@ func (m *StreamSubaccountUpdate) GetUpdatedAssetPositions() []*SubaccountAssetPo return nil } +func (m *StreamSubaccountUpdate) GetSnapshot() bool { + if m != nil { + return m.Snapshot + } + return false +} + // StreamOrderbookUpdate provides information on an orderbook update. Used in // the full node GRPC stream. type StreamOrderbookUpdate struct { @@ -1554,118 +1566,118 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1769 bytes of a gzipped FileDescriptorProto + // 1776 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x41, 0x6f, 0x1c, 0x49, 0x15, 0x9e, 0x1e, 0x3b, 0xc9, 0xf8, 0x8d, 0x9d, 0x75, 0x2a, 0x71, 0xe2, 0x8c, 0x9d, 0xb1, 0xd3, - 0x10, 0xc7, 0xf6, 0x92, 0x69, 0xdb, 0xbb, 0x5a, 0x2d, 0xf1, 0x6a, 0x91, 0xed, 0x25, 0x71, 0x24, - 0x9b, 0x9d, 0xed, 0x78, 0xb3, 0x16, 0x44, 0x6a, 0xd5, 0x74, 0x97, 0xc7, 0x2d, 0x77, 0x77, 0x8d, - 0xbb, 0xab, 0x07, 0x5b, 0x88, 0x03, 0x1c, 0xf6, 0x02, 0x48, 0x48, 0x1c, 0x38, 0x70, 0x42, 0x9c, - 0x11, 0x08, 0x89, 0x23, 0x02, 0x6e, 0x7b, 0x8c, 0xc4, 0x05, 0x21, 0x84, 0x50, 0xc2, 0x99, 0xdf, - 0xb0, 0xea, 0xaa, 0xea, 0x99, 0xee, 0xe9, 0xee, 0x19, 0xc7, 0x17, 0x7b, 0xea, 0xd5, 0x7b, 0x5f, - 0x7d, 0xef, 0xd5, 0xab, 0x57, 0xf5, 0x1a, 0xee, 0x59, 0xe7, 0xd6, 0x59, 0xc7, 0xa7, 0x8c, 0x9a, - 0xd4, 0xd1, 0x4c, 0x87, 0xb6, 0xb4, 0xd3, 0x90, 0xf8, 0xe7, 0x0d, 0x2e, 0x43, 0x37, 0x92, 0xd3, - 0x8d, 0x68, 0xba, 0x76, 0xab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, 0x3b, 0x39, 0xee, 0x28, 0x6a, 0xab, 0x6f, + 0x61, 0x21, 0x18, 0x2c, 0x2b, 0x4f, 0x94, 0xcd, 0xe6, 0x57, 0xaf, 0xeb, 0xca, 0xab, 0xd7, 0x75, + 0xe5, 0xbf, 0xaf, 0xeb, 0xca, 0xaf, 0xde, 0xd4, 0x4b, 0xaf, 0xde, 0xd4, 0x4b, 0xff, 0x7c, 0x53, + 0x2f, 0x7d, 0xff, 0x83, 0xb6, 0xcd, 0x8e, 0xc3, 0x56, 0xc3, 0xa4, 0x6e, 0x3a, 0x7e, 0xdd, 0xf7, + 0x1f, 0xf3, 0xf7, 0x80, 0xd6, 0x93, 0x9c, 0x89, 0x98, 0xb2, 0xf3, 0x0e, 0x09, 0x5a, 0x57, 0xb9, + 0xf8, 0xbd, 0xaf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x53, 0x79, 0xa1, 0x69, 0x97, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2588,6 +2600,20 @@ func (m *StreamOrderbookUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.SubaccountIds) > 0 { + for iNdEx := len(m.SubaccountIds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SubaccountIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } if len(m.ClobPairId) > 0 { dAtA12 := make([]byte, len(m.ClobPairId)*10) var j11 int @@ -2629,20 +2655,6 @@ func (m *StreamOrderbookUpdatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.SubaccountIds) > 0 { - for iNdEx := len(m.SubaccountIds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SubaccountIds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } if len(m.Updates) > 0 { for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { { @@ -2886,6 +2898,16 @@ func (m *StreamSubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Snapshot { + i-- + if m.Snapshot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(m.UpdatedAssetPositions) > 0 { for iNdEx := len(m.UpdatedAssetPositions) - 1; iNdEx >= 0; iNdEx-- { { @@ -3384,6 +3406,12 @@ func (m *StreamOrderbookUpdatesRequest) Size() (n int) { } n += 1 + sovQuery(uint64(l)) + l } + if len(m.SubaccountIds) > 0 { + for _, e := range m.SubaccountIds { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } return n } @@ -3399,12 +3427,6 @@ func (m *StreamOrderbookUpdatesResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } - if len(m.SubaccountIds) > 0 { - for _, e := range m.SubaccountIds { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } return n } @@ -3530,6 +3552,9 @@ func (m *StreamSubaccountUpdate) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Snapshot { + n += 2 + } return n } @@ -5013,6 +5038,40 @@ func (m *StreamOrderbookUpdatesRequest) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field ClobPairId", wireType) } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountIds", 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.SubaccountIds = append(m.SubaccountIds, &SubaccountId{}) + if err := m.SubaccountIds[len(m.SubaccountIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5097,40 +5156,6 @@ func (m *StreamOrderbookUpdatesResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubaccountIds", 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.SubaccountIds = append(m.SubaccountIds, &SubaccountId{}) - if err := m.SubaccountIds[len(m.SubaccountIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5755,6 +5780,26 @@ func (m *StreamSubaccountUpdate) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Snapshot = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From dc2bc8ec5d7e3ef2d3f53606b72c5075768dd8ef Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 2 Aug 2024 15:57:07 -0400 Subject: [PATCH 06/37] lint --- proto/dydxprotocol/clob/order.proto | 10 ++++++---- proto/dydxprotocol/clob/query.proto | 19 +++++++++---------- protocol/x/clob/types/order.pb.go | 10 ++++++---- protocol/x/clob/types/query.pb.go | 13 +++++++------ 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/proto/dydxprotocol/clob/order.proto b/proto/dydxprotocol/clob/order.proto index 4357913474..7045122ace 100644 --- a/proto/dydxprotocol/clob/order.proto +++ b/proto/dydxprotocol/clob/order.proto @@ -229,16 +229,18 @@ message TransactionOrdering { uint32 transaction_index = 2; } -// StreamLiquidationOrder represents an protocol-generated IOC liquidation order. -// Used in full node streaming. +// StreamLiquidationOrder represents an protocol-generated IOC liquidation +// order. Used in full node streaming. message StreamLiquidationOrder { // Information about this liquidation order. PerpetualLiquidationInfo liquidation_info = 1; - // CLOB pair ID of the CLOB pair the liquidation order will be matched against. + // CLOB pair ID of the CLOB pair the liquidation order will be matched + // against. uint32 clob_pair_id = 2; - // True if this is a buy order liquidating a short position, false if vice versa. + // True if this is a buy order liquidating a short position, false if vice + // versa. bool is_buy = 3; // The number of base quantums for this liquidation order. diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 5195c15f6d..3ec62d14b2 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -227,11 +227,9 @@ message SubaccountAssetPosition { message StreamSubaccountUpdate { SubaccountId subaccount_id = 1; // updated_perpetual_positions will each be for unique perpetuals. - repeated SubaccountPerpetualPosition - updated_perpetual_positions = 2; + repeated SubaccountPerpetualPosition updated_perpetual_positions = 2; // updated_asset_positions will each be for unique assets. - repeated SubaccountAssetPosition - updated_asset_positions = 3; + repeated SubaccountAssetPosition updated_asset_positions = 3; // Snapshot indicates if the response is from a snapshot of the subaccount. // All updates should be ignored until snapshot is received. // If the snapshot is true, then all previous entries should be @@ -289,17 +287,18 @@ message StreamTakerOrder { // after it is attempted to be matched on the orderbook. // It is intended to be used only in full node streaming. message StreamTakerOrderStatus { - // The state of the taker order after attempting to match it against the orderbook. - // Possible enum values can be found here: + // The state of the taker order after attempting to match it against the + // orderbook. Possible enum values can be found here: // https://github.com/dydxprotocol/v4-chain/blob/main/protocol/x/clob/types/orderbook.go#L105 uint32 order_status = 1; // The amount of remaining (non-matched) base quantums of this taker order. uint64 remaining_quantums = 2; - // The amount of base quantums that were *optimistically* filled for this taker order - // when the order is matched against the orderbook. Note that if any quantums of this order - // were optimistically filled or filled in state before this invocation of the matching loop, - // this value will not include them. + // The amount of base quantums that were *optimistically* filled for this + // taker order when the order is matched against the orderbook. Note that if + // any quantums of this order were optimistically filled or filled in state + // before this invocation of the matching loop, this value will not include + // them. uint64 optimistically_filled_quantums = 3; } diff --git a/protocol/x/clob/types/order.pb.go b/protocol/x/clob/types/order.pb.go index ad17410e45..cad93b7f8c 100644 --- a/protocol/x/clob/types/order.pb.go +++ b/protocol/x/clob/types/order.pb.go @@ -807,14 +807,16 @@ func (m *TransactionOrdering) GetTransactionIndex() uint32 { return 0 } -// StreamLiquidationOrder represents an protocol-generated IOC liquidation order. -// Used in full node streaming. +// StreamLiquidationOrder represents an protocol-generated IOC liquidation +// order. Used in full node streaming. type StreamLiquidationOrder struct { // Information about this liquidation order. LiquidationInfo *PerpetualLiquidationInfo `protobuf:"bytes,1,opt,name=liquidation_info,json=liquidationInfo,proto3" json:"liquidation_info,omitempty"` - // CLOB pair ID of the CLOB pair the liquidation order will be matched against. + // CLOB pair ID of the CLOB pair the liquidation order will be matched + // against. ClobPairId uint32 `protobuf:"varint,2,opt,name=clob_pair_id,json=clobPairId,proto3" json:"clob_pair_id,omitempty"` - // True if this is a buy order liquidating a short position, false if vice versa. + // True if this is a buy order liquidating a short position, false if vice + // versa. IsBuy bool `protobuf:"varint,3,opt,name=is_buy,json=isBuy,proto3" json:"is_buy,omitempty"` // The number of base quantums for this liquidation order. Quantums uint64 `protobuf:"varint,4,opt,name=quantums,proto3" json:"quantums,omitempty"` diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 46d7473782..0201e676a3 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -1467,16 +1467,17 @@ func (*StreamTakerOrder) XXX_OneofWrappers() []interface{} { // after it is attempted to be matched on the orderbook. // It is intended to be used only in full node streaming. type StreamTakerOrderStatus struct { - // The state of the taker order after attempting to match it against the orderbook. - // Possible enum values can be found here: + // The state of the taker order after attempting to match it against the + // orderbook. Possible enum values can be found here: // https://github.com/dydxprotocol/v4-chain/blob/main/protocol/x/clob/types/orderbook.go#L105 OrderStatus uint32 `protobuf:"varint,1,opt,name=order_status,json=orderStatus,proto3" json:"order_status,omitempty"` // The amount of remaining (non-matched) base quantums of this taker order. RemainingQuantums uint64 `protobuf:"varint,2,opt,name=remaining_quantums,json=remainingQuantums,proto3" json:"remaining_quantums,omitempty"` - // The amount of base quantums that were *optimistically* filled for this taker order - // when the order is matched against the orderbook. Note that if any quantums of this order - // were optimistically filled or filled in state before this invocation of the matching loop, - // this value will not include them. + // The amount of base quantums that were *optimistically* filled for this + // taker order when the order is matched against the orderbook. Note that if + // any quantums of this order were optimistically filled or filled in state + // before this invocation of the matching loop, this value will not include + // them. OptimisticallyFilledQuantums uint64 `protobuf:"varint,3,opt,name=optimistically_filled_quantums,json=optimisticallyFilledQuantums,proto3" json:"optimistically_filled_quantums,omitempty"` } From 3c7a63b4400bcfc35e6a42fb5cbd802fcbdbf344 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 5 Aug 2024 16:30:23 -0400 Subject: [PATCH 07/37] rm global cache --- .../streaming/full_node_streaming_manager.go | 102 +++++++++++------- 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 1d035ed6b3..e712d63fff 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -29,9 +29,12 @@ type FullNodeStreamingManagerImpl struct { ticker *time.Ticker done chan bool - // map of clob pair id to stream updates. - streamUpdateCache map[uint32][]clobtypes.StreamUpdate - numUpdatesInCache uint32 + // list of stream updates. + streamUpdateCache []clobtypes.StreamUpdate + // list of subscription ids for each stream update. + streamUpdateSubscriptionCache [][]uint32 + clobPairIdToSubscriptionIdMapping map[uint32][]uint32 + numUpdatesInCache uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -66,10 +69,12 @@ func NewFullNodeStreamingManager( orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), nextSubscriptionId: 0, - ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), - done: make(chan bool), - streamUpdateCache: make(map[uint32][]clobtypes.StreamUpdate), - numUpdatesInCache: 0, + ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), + done: make(chan bool), + streamUpdateCache: make([]clobtypes.StreamUpdate, 0), + streamUpdateSubscriptionCache: make([][]uint32, 0), + clobPairIdToSubscriptionIdMapping: make(map[uint32][]uint32), + numUpdatesInCache: 0, maxUpdatesInCache: maxUpdatesInCache, maxSubscriptionChannelSize: maxSubscriptionChannelSize, @@ -134,6 +139,18 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), } + for _, clobPairId := range clobPairIds { + // if clobPairId exists in the map, append the subscription id to the slice + // otherwise, create a new slice with the subscription id + if _, ok := sm.clobPairIdToSubscriptionIdMapping[clobPairId]; ok { + sm.clobPairIdToSubscriptionIdMapping[clobPairId] = append( + sm.clobPairIdToSubscriptionIdMapping[clobPairId], + sm.nextSubscriptionId, + ) + } else { + sm.clobPairIdToSubscriptionIdMapping[clobPairId] = []uint32{sm.nextSubscriptionId} + } + } sm.logger.Info( fmt.Sprintf( @@ -295,27 +312,28 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( } // Unmarshal each per-clob pair message to v1 updates. - updatesByClobPairId := make(map[uint32][]clobtypes.StreamUpdate) + updatesByClobPairId := make([]clobtypes.StreamUpdate, 0) + clobPairIds := make([]uint32, 0) for clobPairId, update := range updates { v1updates, err := streaming_util.GetOffchainUpdatesV1(update) if err != nil { panic(err) } - updatesByClobPairId[clobPairId] = []clobtypes.StreamUpdate{ - { - UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ - OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ - Updates: v1updates, - Snapshot: false, - }, + streamUpdate := clobtypes.StreamUpdate{ + UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ + OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ + Updates: v1updates, + Snapshot: false, }, - BlockHeight: blockHeight, - ExecMode: uint32(execMode), }, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), } + updatesByClobPairId = append(updatesByClobPairId, streamUpdate) + clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(updatesByClobPairId, uint32(len(updates))) + sm.AddUpdatesToCache(updatesByClobPairId, clobPairIds, uint32(len(updates))) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -333,7 +351,8 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( ) // Group fills by clob pair id. - updatesByClobPairId := make(map[uint32][]clobtypes.StreamUpdate) + updatesByClobPairId := make([]clobtypes.StreamUpdate, 0) + clobPairIds := make([]uint32, 0) for _, orderbookFill := range orderbookFills { // If this is a deleveraging fill, fetch the clob pair id from the deleveraged // perpetual id. @@ -346,9 +365,6 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( } else { clobPairId = orderbookFill.Orders[0].OrderId.ClobPairId } - if _, ok := updatesByClobPairId[clobPairId]; !ok { - updatesByClobPairId[clobPairId] = []clobtypes.StreamUpdate{} - } streamUpdate := clobtypes.StreamUpdate{ UpdateMessage: &clobtypes.StreamUpdate_OrderFill{ OrderFill: &orderbookFill, @@ -356,14 +372,16 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } - updatesByClobPairId[clobPairId] = append(updatesByClobPairId[clobPairId], streamUpdate) + updatesByClobPairId = append(updatesByClobPairId, streamUpdate) + clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(updatesByClobPairId, uint32(len(orderbookFills))) + sm.AddUpdatesToCache(updatesByClobPairId, clobPairIds, uint32(len(orderbookFills))) } func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( - updatesByClobPairId map[uint32][]clobtypes.StreamUpdate, + updates []clobtypes.StreamUpdate, + clobPairIds []uint32, numUpdatesToAdd uint32, ) { sm.Lock() @@ -374,8 +392,9 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( float32(numUpdatesToAdd), ) - for clobPairId, streamUpdates := range updatesByClobPairId { - sm.streamUpdateCache[clobPairId] = append(sm.streamUpdateCache[clobPairId], streamUpdates...) + sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) + for _, clobPairId := range clobPairIds { + sm.streamUpdateSubscriptionCache = append(sm.streamUpdateSubscriptionCache, sm.clobPairIdToSubscriptionIdMapping[clobPairId]) } sm.numUpdatesInCache += numUpdatesToAdd @@ -398,8 +417,8 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdates() { sm.FlushStreamUpdatesWithLock() } -// FlushStreamUpdatesWithLock takes in a map of clob pair id to stream updates and emits them to subscribers. -// Note this method requires the lock and assumes that the lock has already been +// FlushStreamUpdatesWithLock takes in a list of stream updates and their corresponding subscription IDs, +// and emits them to subscribers. Note this method requires the lock and assumes that the lock has already been // acquired by the caller. func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { defer metrics.ModuleMeasureSince( @@ -408,24 +427,28 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { time.Now(), ) - // Non-blocking send updates through subscriber's buffered channel. - // If the buffer is full, drop the subscription. + // Map to collect updates for each subscription. + subscriptionUpdates := make(map[uint32][]clobtypes.StreamUpdate) idsToRemove := make([]uint32, 0) - for id, subscription := range sm.orderbookSubscriptions { - streamUpdatesForSubscription := make([]clobtypes.StreamUpdate, 0) - for _, clobPairId := range subscription.clobPairIds { - if update, ok := sm.streamUpdateCache[clobPairId]; ok { - streamUpdatesForSubscription = append(streamUpdatesForSubscription, update...) - } + + // Collect updates for each subscription. + for i, update := range sm.streamUpdateCache { + subscriptionIds := sm.streamUpdateSubscriptionCache[i] + for _, id := range subscriptionIds { + subscriptionUpdates[id] = append(subscriptionUpdates[id], update) } + } - if len(streamUpdatesForSubscription) > 0 { + // Non-blocking send updates through subscriber's buffered channel. + // If the buffer is full, drop the subscription. + for id, updates := range subscriptionUpdates { + if subscription, ok := sm.orderbookSubscriptions[id]; ok { metrics.IncrCounter( metrics.GrpcAddToSubscriptionChannelCount, 1, ) select { - case subscription.updatesChannel <- streamUpdatesForSubscription: + case subscription.updatesChannel <- updates: default: idsToRemove = append(idsToRemove, id) } @@ -433,6 +456,7 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { } clear(sm.streamUpdateCache) + clear(sm.streamUpdateSubscriptionCache) sm.numUpdatesInCache = 0 for _, id := range idsToRemove { From af79f20e054f10ccdbd36be36d7cf53bc19a06e0 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 5 Aug 2024 16:42:00 -0400 Subject: [PATCH 08/37] dev5 --- .github/workflows/protocol-build-and-push.yml | 180 ------------------ 1 file changed, 180 deletions(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index fc26dd6e69..119c084695 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -8,150 +8,6 @@ on: # yamllint disable-line rule:truthy - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: - build-and-push-dev: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev2: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV2 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV2 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev2-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev3: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev3-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev4: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev4-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - build-and-push-dev5: runs-on: ubuntu-latest defaults: @@ -187,39 +43,3 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-staging: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: staging-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-staging/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags From 96cb02276a8bc3f7e2125c3a2347da9fce706949 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 5 Aug 2024 16:48:15 -0400 Subject: [PATCH 09/37] add branch --- .github/workflows/protocol-build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index 119c084695..919654e7ae 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -4,6 +4,7 @@ on: # yamllint disable-line rule:truthy push: branches: - main + - 'wl/rm_global_cache' - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x From 57e54fae6669488f706d46eca232de6dbf1b316d Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 11:28:59 -0400 Subject: [PATCH 10/37] dev2 --- .github/workflows/protocol-build-and-push.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index 919654e7ae..2c2c5bdef8 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -9,6 +9,42 @@ on: # yamllint disable-line rule:truthy - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: + build-and-push-dev2: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV2 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV2 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev2-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev5: runs-on: ubuntu-latest defaults: From ce156190b9d7629f8df7abc87d33f89e52402def Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 12:14:35 -0400 Subject: [PATCH 11/37] lint --- .../streaming/full_node_streaming_manager.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index e712d63fff..f44ccfbdd0 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -142,14 +142,13 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( for _, clobPairId := range clobPairIds { // if clobPairId exists in the map, append the subscription id to the slice // otherwise, create a new slice with the subscription id - if _, ok := sm.clobPairIdToSubscriptionIdMapping[clobPairId]; ok { - sm.clobPairIdToSubscriptionIdMapping[clobPairId] = append( - sm.clobPairIdToSubscriptionIdMapping[clobPairId], - sm.nextSubscriptionId, - ) - } else { - sm.clobPairIdToSubscriptionIdMapping[clobPairId] = []uint32{sm.nextSubscriptionId} + if _, ok := sm.clobPairIdToSubscriptionIdMapping[clobPairId]; !ok { + sm.clobPairIdToSubscriptionIdMapping[clobPairId] = []uint32{} } + sm.clobPairIdToSubscriptionIdMapping[clobPairId] = append( + sm.clobPairIdToSubscriptionIdMapping[clobPairId], + sm.nextSubscriptionId, + ) } sm.logger.Info( @@ -394,7 +393,10 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) for _, clobPairId := range clobPairIds { - sm.streamUpdateSubscriptionCache = append(sm.streamUpdateSubscriptionCache, sm.clobPairIdToSubscriptionIdMapping[clobPairId]) + sm.streamUpdateSubscriptionCache = append( + sm.streamUpdateSubscriptionCache, + sm.clobPairIdToSubscriptionIdMapping[clobPairId], + ) } sm.numUpdatesInCache += numUpdatesToAdd From e6fcbf521055ab696df4f94095f72977f588f8a7 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 12:15:03 -0400 Subject: [PATCH 12/37] revert ghwf --- .github/workflows/protocol-build-and-push.yml | 145 +++++++++++++++++- 1 file changed, 144 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index 2c2c5bdef8..fc26dd6e69 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -4,11 +4,46 @@ on: # yamllint disable-line rule:truthy push: branches: - main - - 'wl/rm_global_cache' - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: + build-and-push-dev: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev2: runs-on: ubuntu-latest defaults: @@ -45,6 +80,78 @@ jobs: -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev3: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev3-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev4: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev4-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev5: runs-on: ubuntu-latest defaults: @@ -80,3 +187,39 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-staging: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: staging-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-staging/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags From 13572399e30941d5e4c7cff6ed61e639610ea1ed Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 12:21:49 -0400 Subject: [PATCH 13/37] fix --- proto/dydxprotocol/clob/query.proto | 16 +- .../x/clob/keeper/grpc_stream_orderbook.go | 54 +- protocol/x/clob/types/query.pb.go | 500 +++++------------- 3 files changed, 161 insertions(+), 409 deletions(-) diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 3ec62d14b2..8439b04346 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -12,6 +12,7 @@ import "dydxprotocol/clob/matches.proto"; import "dydxprotocol/clob/liquidations_config.proto"; import "dydxprotocol/clob/mev.proto"; import "dydxprotocol/indexer/off_chain_updates/off_chain_updates.proto"; +import "dydxprotocol/subaccounts/subaccount.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"; @@ -62,7 +63,7 @@ service Query { // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - rpc StreamOrderbookUpdates(stream StreamOrderbookUpdatesRequest) + rpc StreamOrderbookUpdates(StreamOrderbookUpdatesRequest) returns (stream StreamOrderbookUpdatesResponse); } @@ -167,7 +168,7 @@ message StreamOrderbookUpdatesRequest { repeated uint32 clob_pair_id = 1; // Subaccount ids to stream subaccount updates for. - repeated SubaccountId subaccount_ids = 2; + repeated dydxprotocol.subaccounts.SubaccountId subaccount_ids = 2; } // StreamOrderbookUpdatesResponse is a response message for the @@ -195,15 +196,6 @@ message StreamUpdate { uint32 exec_mode = 4; } -// SubaccountId provides information on a subaccount. -message SubaccountId { - // The address of the wallet that owns this subaccount. - string owner = 1; - // < 128 Since 128 should be enough to start and it fits within - // 1 Byte (1 Bit needed to indicate that the first byte is the last). - uint32 number = 2; -} - // SubaccountPerpetualPosition provides information on a subaccount's updated // perpetual positions. message SubaccountPerpetualPosition { @@ -225,7 +217,7 @@ message SubaccountAssetPosition { // StreamSubaccountUpdate provides information on a subaccount update. Used in // the full node GRPC stream. message StreamSubaccountUpdate { - SubaccountId subaccount_id = 1; + dydxprotocol.subaccounts.SubaccountId subaccount_id = 1; // updated_perpetual_positions will each be for unique perpetuals. repeated SubaccountPerpetualPosition updated_perpetual_positions = 2; // updated_asset_positions will each be for unique assets. diff --git a/protocol/x/clob/keeper/grpc_stream_orderbook.go b/protocol/x/clob/keeper/grpc_stream_orderbook.go index f2959105cc..8e72a8640d 100644 --- a/protocol/x/clob/keeper/grpc_stream_orderbook.go +++ b/protocol/x/clob/keeper/grpc_stream_orderbook.go @@ -1,49 +1,23 @@ package keeper import ( - "fmt" "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" - "io" ) -func (k Keeper) StreamOrderbookUpdates(stream types.Query_StreamOrderbookUpdatesServer) error { - // A channel to handle incoming requests - reqChan := make(chan *types.StreamOrderbookUpdatesRequest) - - // Goroutine to handle receiving requests from the client - go func() { - defer close(reqChan) - for { - req, err := stream.Recv() - if err == io.EOF { - // Client closed the stream - return - } - if err != nil { - panic(fmt.Sprintf("Error receiving request in orderbook GRPC stream: %v", err)) - } - reqChan <- req - } - }() +func (k Keeper) StreamOrderbookUpdates( + req *types.StreamOrderbookUpdatesRequest, + stream types.Query_StreamOrderbookUpdatesServer, +) error { + err := k.GetFullNodeStreamingManager().Subscribe( + req.GetClobPairId(), + stream, + ) + if err != nil { + return err + } - // Context to handle stream lifecycle + // Keep this scope alive because once this scope exits - the stream is closed ctx := stream.Context() - - for { - select { - case req := <-reqChan: - // Handle the incoming request and subscribe - err := k.GetFullNodeStreamingManager().Subscribe( - req.GetClobPairId(), - stream, - ) - if err != nil { - return err - } - - case <-ctx.Done(): - // Stream context is done, exit the function - return nil - } - } + <-ctx.Done() + return nil } diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 0201e676a3..787f53d817 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -11,7 +11,8 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + types1 "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + types "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -771,7 +772,7 @@ type StreamOrderbookUpdatesRequest struct { // Clob pair ids to stream orderbook updates for. ClobPairId []uint32 `protobuf:"varint,1,rep,packed,name=clob_pair_id,json=clobPairId,proto3" json:"clob_pair_id,omitempty"` // Subaccount ids to stream subaccount updates for. - SubaccountIds []*SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` + SubaccountIds []*types.SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` } func (m *StreamOrderbookUpdatesRequest) Reset() { *m = StreamOrderbookUpdatesRequest{} } @@ -814,7 +815,7 @@ func (m *StreamOrderbookUpdatesRequest) GetClobPairId() []uint32 { return nil } -func (m *StreamOrderbookUpdatesRequest) GetSubaccountIds() []*SubaccountId { +func (m *StreamOrderbookUpdatesRequest) GetSubaccountIds() []*types.SubaccountId { if m != nil { return m.SubaccountIds } @@ -990,62 +991,6 @@ func (*StreamUpdate) XXX_OneofWrappers() []interface{} { } } -// SubaccountId provides information on a subaccount. -type SubaccountId struct { - // The address of the wallet that owns this subaccount. - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - // < 128 Since 128 should be enough to start and it fits within - // 1 Byte (1 Bit needed to indicate that the first byte is the last). - Number uint32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` -} - -func (m *SubaccountId) Reset() { *m = SubaccountId{} } -func (m *SubaccountId) String() string { return proto.CompactTextString(m) } -func (*SubaccountId) ProtoMessage() {} -func (*SubaccountId) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{17} -} -func (m *SubaccountId) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SubaccountId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SubaccountId.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 *SubaccountId) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubaccountId.Merge(m, src) -} -func (m *SubaccountId) XXX_Size() int { - return m.Size() -} -func (m *SubaccountId) XXX_DiscardUnknown() { - xxx_messageInfo_SubaccountId.DiscardUnknown(m) -} - -var xxx_messageInfo_SubaccountId proto.InternalMessageInfo - -func (m *SubaccountId) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *SubaccountId) GetNumber() uint32 { - if m != nil { - return m.Number - } - return 0 -} - // SubaccountPerpetualPosition provides information on a subaccount's updated // perpetual positions. type SubaccountPerpetualPosition struct { @@ -1059,7 +1004,7 @@ func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetual func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountPerpetualPosition) ProtoMessage() {} func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{18} + return fileDescriptor_3365c195b25c5bc0, []int{17} } func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1115,7 +1060,7 @@ func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } func (*SubaccountAssetPosition) ProtoMessage() {} func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{19} + return fileDescriptor_3365c195b25c5bc0, []int{18} } func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1161,7 +1106,7 @@ func (m *SubaccountAssetPosition) GetQuantums() uint64 { // StreamSubaccountUpdate provides information on a subaccount update. Used in // the full node GRPC stream. type StreamSubaccountUpdate struct { - SubaccountId *SubaccountId `protobuf:"bytes,1,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` + SubaccountId *types.SubaccountId `protobuf:"bytes,1,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` // updated_perpetual_positions will each be for unique perpetuals. UpdatedPerpetualPositions []*SubaccountPerpetualPosition `protobuf:"bytes,2,rep,name=updated_perpetual_positions,json=updatedPerpetualPositions,proto3" json:"updated_perpetual_positions,omitempty"` // updated_asset_positions will each be for unique assets. @@ -1177,7 +1122,7 @@ func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } func (*StreamSubaccountUpdate) ProtoMessage() {} func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{20} + return fileDescriptor_3365c195b25c5bc0, []int{19} } func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1206,7 +1151,7 @@ func (m *StreamSubaccountUpdate) XXX_DiscardUnknown() { var xxx_messageInfo_StreamSubaccountUpdate proto.InternalMessageInfo -func (m *StreamSubaccountUpdate) GetSubaccountId() *SubaccountId { +func (m *StreamSubaccountUpdate) GetSubaccountId() *types.SubaccountId { if m != nil { return m.SubaccountId } @@ -1239,7 +1184,7 @@ func (m *StreamSubaccountUpdate) GetSnapshot() bool { type StreamOrderbookUpdate struct { // Orderbook updates for the clob pair. Can contain order place, removals, // or updates. - Updates []types.OffChainUpdateV1 `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` + Updates []types1.OffChainUpdateV1 `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates"` // Snapshot indicates if the response is from a snapshot of the orderbook. // All updates should be ignored until snapshot is recieved. // If the snapshot is true, then all previous entries should be @@ -1251,7 +1196,7 @@ func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdate) ProtoMessage() {} func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{21} + return fileDescriptor_3365c195b25c5bc0, []int{20} } func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1280,7 +1225,7 @@ func (m *StreamOrderbookUpdate) XXX_DiscardUnknown() { var xxx_messageInfo_StreamOrderbookUpdate proto.InternalMessageInfo -func (m *StreamOrderbookUpdate) GetUpdates() []types.OffChainUpdateV1 { +func (m *StreamOrderbookUpdate) GetUpdates() []types1.OffChainUpdateV1 { if m != nil { return m.Updates } @@ -1311,7 +1256,7 @@ func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookFill) ProtoMessage() {} func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{22} + return fileDescriptor_3365c195b25c5bc0, []int{21} } func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1382,7 +1327,7 @@ func (m *StreamTakerOrder) Reset() { *m = StreamTakerOrder{} } func (m *StreamTakerOrder) String() string { return proto.CompactTextString(m) } func (*StreamTakerOrder) ProtoMessage() {} func (*StreamTakerOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{23} + return fileDescriptor_3365c195b25c5bc0, []int{22} } func (m *StreamTakerOrder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1485,7 +1430,7 @@ func (m *StreamTakerOrderStatus) Reset() { *m = StreamTakerOrderStatus{} func (m *StreamTakerOrderStatus) String() string { return proto.CompactTextString(m) } func (*StreamTakerOrderStatus) ProtoMessage() {} func (*StreamTakerOrderStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{24} + return fileDescriptor_3365c195b25c5bc0, []int{23} } func (m *StreamTakerOrderStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1554,7 +1499,6 @@ func init() { proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") proto.RegisterType((*StreamOrderbookUpdatesResponse)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesResponse") proto.RegisterType((*StreamUpdate)(nil), "dydxprotocol.clob.StreamUpdate") - proto.RegisterType((*SubaccountId)(nil), "dydxprotocol.clob.SubaccountId") proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.clob.SubaccountPerpetualPosition") proto.RegisterType((*SubaccountAssetPosition)(nil), "dydxprotocol.clob.SubaccountAssetPosition") proto.RegisterType((*StreamSubaccountUpdate)(nil), "dydxprotocol.clob.StreamSubaccountUpdate") @@ -1567,118 +1511,117 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1776 bytes of a gzipped FileDescriptorProto + // 1757 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x41, 0x6f, 0x1c, 0x49, - 0x15, 0x9e, 0x1e, 0x3b, 0xc9, 0xf8, 0x8d, 0x9d, 0x75, 0x2a, 0x71, 0xe2, 0x8c, 0x9d, 0xb1, 0xd3, - 0x10, 0xc7, 0xce, 0x92, 0xe9, 0xd8, 0xbb, 0x5a, 0x2d, 0xf1, 0x6a, 0x91, 0xed, 0xc5, 0xb1, 0xa5, - 0x98, 0x9d, 0x6d, 0x7b, 0xb3, 0x16, 0x44, 0x6a, 0xd5, 0x74, 0x97, 0xc7, 0x2d, 0x77, 0x77, 0x8d, - 0xbb, 0xab, 0x07, 0x5b, 0x88, 0x03, 0x1c, 0x56, 0x42, 0x80, 0x84, 0xc4, 0x81, 0x03, 0x27, 0xc4, - 0x19, 0x89, 0x0b, 0x47, 0x04, 0xdc, 0xf6, 0x84, 0x22, 0x71, 0x41, 0x08, 0x21, 0x94, 0x70, 0xe6, - 0x37, 0xac, 0xba, 0xaa, 0x7a, 0xa6, 0x7b, 0xba, 0x7b, 0xc6, 0xf1, 0xc5, 0x9e, 0x7a, 0xf5, 0xde, - 0x57, 0xdf, 0x7b, 0xf5, 0xea, 0x55, 0xbd, 0x86, 0x7b, 0xd6, 0xb9, 0x75, 0xd6, 0xf1,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, 0x48, 0x1d, 0x34, 0x72, 0x45, 0xa6, 0xcd, 0xfa, 0xf0, + 0xa4, 0x61, 0xfa, 0x17, 0x55, 0x98, 0x95, 0x7c, 0x77, 0xf1, 0x21, 0x09, 0x05, 0x0a, 0xba, 0x0f, + 0xe7, 0x04, 0x82, 0xe2, 0x59, 0xea, 0x6e, 0xb3, 0x62, 0x4a, 0xc5, 0xb8, 0x75, 0xa4, 0xfa, 0xbe, + 0x25, 0xad, 0xab, 0x13, 0x5a, 0x47, 0xea, 0x0c, 0x49, 0xe0, 0x66, 0xbd, 0x11, 0x19, 0xfa, 0x1c, + 0x10, 0x8f, 0x99, 0x49, 0x4c, 0x8b, 0x71, 0xcc, 0x23, 0x26, 0x1a, 0xc8, 0x38, 0xe8, 0x61, 0x30, + 0x3b, 0xc2, 0xc0, 0x9c, 0xe5, 0x23, 0x92, 0x8d, 0x19, 0xa8, 0xa7, 0x80, 0xf5, 0x3f, 0x6a, 0xc9, + 0x06, 0x1d, 0xb5, 0x8d, 0xd3, 0x98, 0x71, 0xae, 0x9a, 0x09, 0x4d, 0xa9, 0xdc, 0x03, 0x14, 0x12, + 0x1f, 0xbb, 0x81, 0x1b, 0x74, 0xad, 0x91, 0x26, 0x70, 0x65, 0x30, 0xf3, 0xa9, 0x9a, 0x40, 0xdf, + 0x83, 0x26, 0xed, 0x71, 0xd7, 0x77, 0x19, 0x77, 0x6d, 0xec, 0x79, 0x27, 0xa2, 0x77, 0x13, 0x67, + 0x68, 0x2a, 0xef, 0xa4, 0x8b, 0x59, 0xad, 0xa7, 0x42, 0x29, 0x41, 0x79, 0xf8, 0x3b, 0x80, 0x73, + 0xe2, 0x7c, 0x47, 0xbf, 0xd0, 0xa0, 0x96, 0xbc, 0x74, 0x50, 0xd1, 0x8e, 0x2b, 0x79, 0x2e, 0x36, + 0x56, 0xcb, 0x74, 0x47, 0xdf, 0x8b, 0xfa, 0xda, 0xcf, 0xff, 0xfe, 0xbf, 0x5f, 0x57, 0xbf, 0x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, 0x56, 0xe3, 0xde, 0x29, 0xb5, 0x15, 0xbb, 0x0a, 0xfa, 0x59, 0xd2, + 0x51, 0x47, 0xef, 0xd8, 0xe8, 0xfe, 0x69, 0xef, 0xbb, 0xc9, 0x03, 0xa1, 0xf1, 0xe0, 0x2d, 0x2c, + 0x24, 0x81, 0xfb, 0xda, 0x46, 0xfb, 0xab, 0xd7, 0x4d, 0xed, 0xd5, 0xeb, 0xa6, 0xf6, 0xdf, 0xd7, + 0x4d, 0xed, 0xcb, 0x37, 0xcd, 0xca, 0xab, 0x37, 0xcd, 0xca, 0x3f, 0xdf, 0x34, 0x2b, 0x3f, 0xfa, + 0xb0, 0xeb, 0xf2, 0x83, 0xa8, 0xd3, 0xb2, 0xa9, 0x9f, 0x4d, 0x5e, 0xff, 0x83, 0x7b, 0xe2, 0x32, + 0x60, 0x0c, 0x24, 0xc7, 0x32, 0xa1, 0xfc, 0xa4, 0x47, 0x58, 0xe7, 0xbc, 0x10, 0xbf, 0xff, 0x75, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x22, 0x40, 0x60, 0x8f, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1709,7 +1652,7 @@ type QueryClient interface { StatefulOrder(ctx context.Context, in *QueryStatefulOrderRequest, opts ...grpc.CallOption) (*QueryStatefulOrderResponse, error) // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - StreamOrderbookUpdates(ctx context.Context, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) + StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) } type queryClient struct { @@ -1783,17 +1726,22 @@ func (c *queryClient) StatefulOrder(ctx context.Context, in *QueryStatefulOrderR return out, nil } -func (c *queryClient) StreamOrderbookUpdates(ctx context.Context, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) { +func (c *queryClient) StreamOrderbookUpdates(ctx context.Context, in *StreamOrderbookUpdatesRequest, opts ...grpc.CallOption) (Query_StreamOrderbookUpdatesClient, error) { stream, err := c.cc.NewStream(ctx, &_Query_serviceDesc.Streams[0], "/dydxprotocol.clob.Query/StreamOrderbookUpdates", opts...) if err != nil { return nil, err } x := &queryStreamOrderbookUpdatesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } type Query_StreamOrderbookUpdatesClient interface { - Send(*StreamOrderbookUpdatesRequest) error Recv() (*StreamOrderbookUpdatesResponse, error) grpc.ClientStream } @@ -1802,10 +1750,6 @@ type queryStreamOrderbookUpdatesClient struct { grpc.ClientStream } -func (x *queryStreamOrderbookUpdatesClient) Send(m *StreamOrderbookUpdatesRequest) error { - return x.ClientStream.SendMsg(m) -} - func (x *queryStreamOrderbookUpdatesClient) Recv() (*StreamOrderbookUpdatesResponse, error) { m := new(StreamOrderbookUpdatesResponse) if err := x.ClientStream.RecvMsg(m); err != nil { @@ -1832,7 +1776,7 @@ type QueryServer interface { StatefulOrder(context.Context, *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) // Streams orderbook updates. Updates contain orderbook data // such as order placements, updates, and fills. - StreamOrderbookUpdates(Query_StreamOrderbookUpdatesServer) error + StreamOrderbookUpdates(*StreamOrderbookUpdatesRequest, Query_StreamOrderbookUpdatesServer) error } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1860,7 +1804,7 @@ func (*UnimplementedQueryServer) LiquidationsConfiguration(ctx context.Context, func (*UnimplementedQueryServer) StatefulOrder(ctx context.Context, req *QueryStatefulOrderRequest) (*QueryStatefulOrderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StatefulOrder not implemented") } -func (*UnimplementedQueryServer) StreamOrderbookUpdates(srv Query_StreamOrderbookUpdatesServer) error { +func (*UnimplementedQueryServer) StreamOrderbookUpdates(req *StreamOrderbookUpdatesRequest, srv Query_StreamOrderbookUpdatesServer) error { return status.Errorf(codes.Unimplemented, "method StreamOrderbookUpdates not implemented") } @@ -1995,12 +1939,15 @@ func _Query_StatefulOrder_Handler(srv interface{}, ctx context.Context, dec func } func _Query_StreamOrderbookUpdates_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(QueryServer).StreamOrderbookUpdates(&queryStreamOrderbookUpdatesServer{stream}) + m := new(StreamOrderbookUpdatesRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(QueryServer).StreamOrderbookUpdates(m, &queryStreamOrderbookUpdatesServer{stream}) } type Query_StreamOrderbookUpdatesServer interface { Send(*StreamOrderbookUpdatesResponse) error - Recv() (*StreamOrderbookUpdatesRequest, error) grpc.ServerStream } @@ -2012,14 +1959,6 @@ func (x *queryStreamOrderbookUpdatesServer) Send(m *StreamOrderbookUpdatesRespon return x.ServerStream.SendMsg(m) } -func (x *queryStreamOrderbookUpdatesServer) Recv() (*StreamOrderbookUpdatesRequest, error) { - m := new(StreamOrderbookUpdatesRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.clob.Query", HandlerType: (*QueryServer)(nil), @@ -2058,7 +1997,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ StreamName: "StreamOrderbookUpdates", Handler: _Query_StreamOrderbookUpdates_Handler, ServerStreams: true, - ClientStreams: true, }, }, Metadata: "dydxprotocol/clob/query.proto", @@ -2778,41 +2716,6 @@ func (m *StreamUpdate_SubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } -func (m *SubaccountId) 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 *SubaccountId) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SubaccountId) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Number != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x10 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *SubaccountPerpetualPosition) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3485,22 +3388,6 @@ func (m *StreamUpdate_SubaccountUpdate) Size() (n int) { } return n } -func (m *SubaccountId) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Number != 0 { - n += 1 + sovQuery(uint64(m.Number)) - } - return n -} - func (m *SubaccountPerpetualPosition) Size() (n int) { if m == nil { return 0 @@ -5068,7 +4955,7 @@ func (m *StreamOrderbookUpdatesRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SubaccountIds = append(m.SubaccountIds, &SubaccountId{}) + m.SubaccountIds = append(m.SubaccountIds, &types.SubaccountId{}) if err := m.SubaccountIds[len(m.SubaccountIds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5371,107 +5258,6 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { } return nil } -func (m *SubaccountId) 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: SubaccountId: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubaccountId: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) - } - m.Number = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Number |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *SubaccountPerpetualPosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5707,7 +5493,7 @@ func (m *StreamSubaccountUpdate) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.SubaccountId == nil { - m.SubaccountId = &SubaccountId{} + m.SubaccountId = &types.SubaccountId{} } if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5880,7 +5666,7 @@ func (m *StreamOrderbookUpdate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Updates = append(m.Updates, types.OffChainUpdateV1{}) + m.Updates = append(m.Updates, types1.OffChainUpdateV1{}) if err := m.Updates[len(m.Updates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 7d08ac23775c14d826174131b136f0a404c0b25c Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 13:00:52 -0400 Subject: [PATCH 14/37] add indexer proto --- .../src/codegen/dydxprotocol/clob/query.ts | 309 +++++++++++++++++- 1 file changed, 308 insertions(+), 1 deletion(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts index 4097359e36..f60003d2f2 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -1,6 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; import { ValidatorMevMatches, ValidatorMevMatchesSDKType, MevNodeToNodeMetrics, MevNodeToNodeMetricsSDKType } from "./mev"; import { OrderId, OrderIdSDKType, LongTermOrderPlacement, LongTermOrderPlacementSDKType, Order, OrderSDKType, StreamLiquidationOrder, StreamLiquidationOrderSDKType } from "./order"; +import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; import { ClobPair, ClobPairSDKType } from "./clob_pair"; import { EquityTierLimitConfiguration, EquityTierLimitConfigurationSDKType } from "./equity_tier_limit_config"; import { BlockRateLimitConfiguration, BlockRateLimitConfigurationSDKType } from "./block_rate_limit_config"; @@ -251,6 +252,9 @@ export interface QueryLiquidationsConfigurationResponseSDKType { export interface StreamOrderbookUpdatesRequest { /** Clob pair ids to stream orderbook updates for. */ clobPairId: number[]; + /** Subaccount ids to stream subaccount updates for. */ + + subaccountIds: SubaccountId[]; } /** * StreamOrderbookUpdatesRequest is a request message for the @@ -260,6 +264,9 @@ export interface StreamOrderbookUpdatesRequest { export interface StreamOrderbookUpdatesRequestSDKType { /** Clob pair ids to stream orderbook updates for. */ clob_pair_id: number[]; + /** Subaccount ids to stream subaccount updates for. */ + + subaccount_ids: SubaccountIdSDKType[]; } /** * StreamOrderbookUpdatesResponse is a response message for the @@ -288,6 +295,7 @@ export interface StreamUpdate { orderbookUpdate?: StreamOrderbookUpdate; orderFill?: StreamOrderbookFill; takerOrder?: StreamTakerOrder; + subaccountUpdate?: StreamSubaccountUpdate; /** Block height of the update. */ blockHeight: number; @@ -304,6 +312,7 @@ export interface StreamUpdateSDKType { orderbook_update?: StreamOrderbookUpdateSDKType; order_fill?: StreamOrderbookFillSDKType; taker_order?: StreamTakerOrderSDKType; + subaccount_update?: StreamSubaccountUpdateSDKType; /** Block height of the update. */ block_height: number; @@ -311,6 +320,98 @@ export interface StreamUpdateSDKType { exec_mode: number; } +/** + * SubaccountPerpetualPosition provides information on a subaccount's updated + * perpetual positions. + */ + +export interface SubaccountPerpetualPosition { + /** The `Id` of the `Perpetual`. */ + perpetualId: number; + /** The size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountPerpetualPosition provides information on a subaccount's updated + * perpetual positions. + */ + +export interface SubaccountPerpetualPositionSDKType { + /** The `Id` of the `Perpetual`. */ + perpetual_id: number; + /** The size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountAssetPosition provides information on a subaccount's updated asset + * positions. + */ + +export interface SubaccountAssetPosition { + /** The `Id` of the `Asset`. */ + assetId: number; + /** The absolute size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountAssetPosition provides information on a subaccount's updated asset + * positions. + */ + +export interface SubaccountAssetPositionSDKType { + /** The `Id` of the `Asset`. */ + asset_id: number; + /** The absolute size of the position in base quantums. */ + + quantums: Long; +} +/** + * StreamSubaccountUpdate provides information on a subaccount update. Used in + * the full node GRPC stream. + */ + +export interface StreamSubaccountUpdate { + subaccountId?: SubaccountId; + /** updated_perpetual_positions will each be for unique perpetuals. */ + + updatedPerpetualPositions: SubaccountPerpetualPosition[]; + /** updated_asset_positions will each be for unique assets. */ + + updatedAssetPositions: SubaccountAssetPosition[]; + /** + * Snapshot indicates if the response is from a snapshot of the subaccount. + * All updates should be ignored until snapshot is received. + * If the snapshot is true, then all previous entries should be + * discarded and the subaccount should be resynced. + */ + + snapshot: boolean; +} +/** + * StreamSubaccountUpdate provides information on a subaccount update. Used in + * the full node GRPC stream. + */ + +export interface StreamSubaccountUpdateSDKType { + subaccount_id?: SubaccountIdSDKType; + /** updated_perpetual_positions will each be for unique perpetuals. */ + + updated_perpetual_positions: SubaccountPerpetualPositionSDKType[]; + /** updated_asset_positions will each be for unique assets. */ + + updated_asset_positions: SubaccountAssetPositionSDKType[]; + /** + * Snapshot indicates if the response is from a snapshot of the subaccount. + * All updates should be ignored until snapshot is received. + * If the snapshot is true, then all previous entries should be + * discarded and the subaccount should be resynced. + */ + + snapshot: boolean; +} /** * StreamOrderbookUpdate provides information on an orderbook update. Used in * the full node GRPC stream. @@ -1182,7 +1283,8 @@ export const QueryLiquidationsConfigurationResponse = { function createBaseStreamOrderbookUpdatesRequest(): StreamOrderbookUpdatesRequest { return { - clobPairId: [] + clobPairId: [], + subaccountIds: [] }; } @@ -1195,6 +1297,11 @@ export const StreamOrderbookUpdatesRequest = { } writer.ldelim(); + + for (const v of message.subaccountIds) { + SubaccountId.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; }, @@ -1220,6 +1327,10 @@ export const StreamOrderbookUpdatesRequest = { break; + case 2: + message.subaccountIds.push(SubaccountId.decode(reader, reader.uint32())); + break; + default: reader.skipType(tag & 7); break; @@ -1232,6 +1343,7 @@ export const StreamOrderbookUpdatesRequest = { fromPartial(object: DeepPartial): StreamOrderbookUpdatesRequest { const message = createBaseStreamOrderbookUpdatesRequest(); message.clobPairId = object.clobPairId?.map(e => e) || []; + message.subaccountIds = object.subaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; return message; } @@ -1287,6 +1399,7 @@ function createBaseStreamUpdate(): StreamUpdate { orderbookUpdate: undefined, orderFill: undefined, takerOrder: undefined, + subaccountUpdate: undefined, blockHeight: 0, execMode: 0 }; @@ -1306,6 +1419,10 @@ export const StreamUpdate = { StreamTakerOrder.encode(message.takerOrder, writer.uint32(26).fork()).ldelim(); } + if (message.subaccountUpdate !== undefined) { + StreamSubaccountUpdate.encode(message.subaccountUpdate, writer.uint32(50).fork()).ldelim(); + } + if (message.blockHeight !== 0) { writer.uint32(32).uint32(message.blockHeight); } @@ -1338,6 +1455,10 @@ export const StreamUpdate = { message.takerOrder = StreamTakerOrder.decode(reader, reader.uint32()); break; + case 6: + message.subaccountUpdate = StreamSubaccountUpdate.decode(reader, reader.uint32()); + break; + case 4: message.blockHeight = reader.uint32(); break; @@ -1360,6 +1481,7 @@ export const StreamUpdate = { message.orderbookUpdate = object.orderbookUpdate !== undefined && object.orderbookUpdate !== null ? StreamOrderbookUpdate.fromPartial(object.orderbookUpdate) : undefined; message.orderFill = object.orderFill !== undefined && object.orderFill !== null ? StreamOrderbookFill.fromPartial(object.orderFill) : undefined; message.takerOrder = object.takerOrder !== undefined && object.takerOrder !== null ? StreamTakerOrder.fromPartial(object.takerOrder) : undefined; + message.subaccountUpdate = object.subaccountUpdate !== undefined && object.subaccountUpdate !== null ? StreamSubaccountUpdate.fromPartial(object.subaccountUpdate) : undefined; message.blockHeight = object.blockHeight ?? 0; message.execMode = object.execMode ?? 0; return message; @@ -1367,6 +1489,191 @@ export const StreamUpdate = { }; +function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition { + return { + perpetualId: 0, + quantums: Long.UZERO + }; +} + +export const SubaccountPerpetualPosition = { + encode(message: SubaccountPerpetualPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.perpetualId !== 0) { + writer.uint32(8).uint32(message.perpetualId); + } + + if (!message.quantums.isZero()) { + writer.uint32(16).uint64(message.quantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountPerpetualPosition { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubaccountPerpetualPosition(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.perpetualId = reader.uint32(); + break; + + case 2: + message.quantums = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): SubaccountPerpetualPosition { + const message = createBaseSubaccountPerpetualPosition(); + message.perpetualId = object.perpetualId ?? 0; + message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; + return message; + } + +}; + +function createBaseSubaccountAssetPosition(): SubaccountAssetPosition { + return { + assetId: 0, + quantums: Long.UZERO + }; +} + +export const SubaccountAssetPosition = { + encode(message: SubaccountAssetPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.assetId !== 0) { + writer.uint32(8).uint32(message.assetId); + } + + if (!message.quantums.isZero()) { + writer.uint32(16).uint64(message.quantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountAssetPosition { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubaccountAssetPosition(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.assetId = reader.uint32(); + break; + + case 2: + message.quantums = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): SubaccountAssetPosition { + const message = createBaseSubaccountAssetPosition(); + message.assetId = object.assetId ?? 0; + message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; + return message; + } + +}; + +function createBaseStreamSubaccountUpdate(): StreamSubaccountUpdate { + return { + subaccountId: undefined, + updatedPerpetualPositions: [], + updatedAssetPositions: [], + snapshot: false + }; +} + +export const StreamSubaccountUpdate = { + encode(message: StreamSubaccountUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subaccountId !== undefined) { + SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim(); + } + + for (const v of message.updatedPerpetualPositions) { + SubaccountPerpetualPosition.encode(v!, writer.uint32(18).fork()).ldelim(); + } + + for (const v of message.updatedAssetPositions) { + SubaccountAssetPosition.encode(v!, writer.uint32(26).fork()).ldelim(); + } + + if (message.snapshot === true) { + writer.uint32(32).bool(message.snapshot); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StreamSubaccountUpdate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamSubaccountUpdate(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.subaccountId = SubaccountId.decode(reader, reader.uint32()); + break; + + case 2: + message.updatedPerpetualPositions.push(SubaccountPerpetualPosition.decode(reader, reader.uint32())); + break; + + case 3: + message.updatedAssetPositions.push(SubaccountAssetPosition.decode(reader, reader.uint32())); + break; + + case 4: + message.snapshot = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): StreamSubaccountUpdate { + const message = createBaseStreamSubaccountUpdate(); + message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; + message.updatedPerpetualPositions = object.updatedPerpetualPositions?.map(e => SubaccountPerpetualPosition.fromPartial(e)) || []; + message.updatedAssetPositions = object.updatedAssetPositions?.map(e => SubaccountAssetPosition.fromPartial(e)) || []; + message.snapshot = object.snapshot ?? false; + return message; + } + +}; + function createBaseStreamOrderbookUpdate(): StreamOrderbookUpdate { return { updates: [], From 8d333b8bed0429016c09e3c3893720515789e762 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 14:23:32 -0400 Subject: [PATCH 15/37] address cmts --- .../streaming/full_node_streaming_manager.go | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index f44ccfbdd0..57ea542e38 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -32,9 +32,9 @@ type FullNodeStreamingManagerImpl struct { // list of stream updates. streamUpdateCache []clobtypes.StreamUpdate // list of subscription ids for each stream update. - streamUpdateSubscriptionCache [][]uint32 + streamUpdateSubscriptionCache [][]uint32 + // map from clob pair id to subscription ids. clobPairIdToSubscriptionIdMapping map[uint32][]uint32 - numUpdatesInCache uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -74,7 +74,6 @@ func NewFullNodeStreamingManager( streamUpdateCache: make([]clobtypes.StreamUpdate, 0), streamUpdateSubscriptionCache: make([][]uint32, 0), clobPairIdToSubscriptionIdMapping: make(map[uint32][]uint32), - numUpdatesInCache: 0, maxUpdatesInCache: maxUpdatesInCache, maxSubscriptionChannelSize: maxSubscriptionChannelSize, @@ -106,7 +105,7 @@ func (sm *FullNodeStreamingManagerImpl) Enabled() bool { func (sm *FullNodeStreamingManagerImpl) EmitMetrics() { metrics.SetGauge( metrics.GrpcStreamNumUpdatesBuffered, - float32(sm.numUpdatesInCache), + float32(len(sm.streamUpdateCache)), ) metrics.SetGauge( metrics.GrpcStreamSubscriberCount, @@ -210,6 +209,22 @@ func (sm *FullNodeStreamingManagerImpl) removeSubscription( } close(subscription.updatesChannel) delete(sm.orderbookSubscriptions, subscriptionIdToRemove) + + // Iterate over the clobPairIdToSubscriptionIdMapping to remove the subscriptionIdToRemove + for pairId, subscriptionIds := range sm.clobPairIdToSubscriptionIdMapping { + for i, id := range subscriptionIds { + if id == subscriptionIdToRemove { + // Remove the subscription ID from the slice + sm.clobPairIdToSubscriptionIdMapping[pairId] = append(subscriptionIds[:i], subscriptionIds[i+1:]...) + break + } + } + // If the list is empty after removal, delete the key from the map + if len(sm.clobPairIdToSubscriptionIdMapping[pairId]) == 0 { + delete(sm.clobPairIdToSubscriptionIdMapping, pairId) + } + } + sm.logger.Info( fmt.Sprintf("Removed streaming subscription id %+v", subscriptionIdToRemove), ) @@ -311,7 +326,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( } // Unmarshal each per-clob pair message to v1 updates. - updatesByClobPairId := make([]clobtypes.StreamUpdate, 0) + streamUpdates := make([]clobtypes.StreamUpdate, 0) clobPairIds := make([]uint32, 0) for clobPairId, update := range updates { v1updates, err := streaming_util.GetOffchainUpdatesV1(update) @@ -328,11 +343,11 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } - updatesByClobPairId = append(updatesByClobPairId, streamUpdate) + streamUpdates = append(streamUpdates, streamUpdate) clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(updatesByClobPairId, clobPairIds, uint32(len(updates))) + sm.AddUpdatesToCache(streamUpdates, clobPairIds, uint32(len(updates))) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -350,7 +365,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( ) // Group fills by clob pair id. - updatesByClobPairId := make([]clobtypes.StreamUpdate, 0) + streamUpdates := make([]clobtypes.StreamUpdate, 0) clobPairIds := make([]uint32, 0) for _, orderbookFill := range orderbookFills { // If this is a deleveraging fill, fetch the clob pair id from the deleveraged @@ -371,11 +386,11 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } - updatesByClobPairId = append(updatesByClobPairId, streamUpdate) + streamUpdates = append(streamUpdates, streamUpdate) clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(updatesByClobPairId, clobPairIds, uint32(len(orderbookFills))) + sm.AddUpdatesToCache(streamUpdates, clobPairIds, uint32(len(orderbookFills))) } func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( @@ -398,17 +413,15 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( sm.clobPairIdToSubscriptionIdMapping[clobPairId], ) } - sm.numUpdatesInCache += numUpdatesToAdd // Remove all subscriptions and wipe the buffer if buffer overflows. - if sm.numUpdatesInCache > sm.maxUpdatesInCache { + if len(sm.streamUpdateCache) > int(sm.maxUpdatesInCache) { sm.logger.Error("Streaming buffer full capacity. Dropping messages and all subscriptions. " + "Disconnect all clients and increase buffer size via the grpc-stream-buffer-size flag.") for id := range sm.orderbookSubscriptions { sm.removeSubscription(id) } clear(sm.streamUpdateCache) - sm.numUpdatesInCache = 0 } sm.EmitMetrics() } @@ -459,7 +472,6 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { clear(sm.streamUpdateCache) clear(sm.streamUpdateSubscriptionCache) - sm.numUpdatesInCache = 0 for _, id := range idsToRemove { sm.logger.Error( From 390b1180388504484f7944da93a19e57219816dd Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 14:29:38 -0400 Subject: [PATCH 16/37] add cmts --- .../src/codegen/dydxprotocol/clob/query.ts | 18 +- proto/dydxprotocol/clob/query.proto | 9 +- protocol/x/clob/types/query.pb.go | 161 +++++++++--------- 3 files changed, 100 insertions(+), 88 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts index f60003d2f2..3eb7ca7df2 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -386,6 +386,9 @@ export interface StreamSubaccountUpdate { * All updates should be ignored until snapshot is received. * If the snapshot is true, then all previous entries should be * discarded and the subaccount should be resynced. + * For a snapshot subaccount update, the `updated_perpetual_positions` and + * `updated_asset_positions` fields will contain the full state of the + * subaccount. */ snapshot: boolean; @@ -408,6 +411,9 @@ export interface StreamSubaccountUpdateSDKType { * All updates should be ignored until snapshot is received. * If the snapshot is true, then all previous entries should be * discarded and the subaccount should be resynced. + * For a snapshot subaccount update, the `updated_perpetual_positions` and + * `updated_asset_positions` fields will contain the full state of the + * subaccount. */ snapshot: boolean; @@ -1420,15 +1426,15 @@ export const StreamUpdate = { } if (message.subaccountUpdate !== undefined) { - StreamSubaccountUpdate.encode(message.subaccountUpdate, writer.uint32(50).fork()).ldelim(); + StreamSubaccountUpdate.encode(message.subaccountUpdate, writer.uint32(34).fork()).ldelim(); } if (message.blockHeight !== 0) { - writer.uint32(32).uint32(message.blockHeight); + writer.uint32(40).uint32(message.blockHeight); } if (message.execMode !== 0) { - writer.uint32(40).uint32(message.execMode); + writer.uint32(48).uint32(message.execMode); } return writer; @@ -1455,15 +1461,15 @@ export const StreamUpdate = { message.takerOrder = StreamTakerOrder.decode(reader, reader.uint32()); break; - case 6: + case 4: message.subaccountUpdate = StreamSubaccountUpdate.decode(reader, reader.uint32()); break; - case 4: + case 5: message.blockHeight = reader.uint32(); break; - case 5: + case 6: message.execMode = reader.uint32(); break; diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 74529c579c..34f9899801 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -187,14 +187,14 @@ message StreamUpdate { StreamOrderbookUpdate orderbook_update = 1; StreamOrderbookFill order_fill = 2; StreamTakerOrder taker_order = 3; - StreamSubaccountUpdate subaccount_update = 6; + StreamSubaccountUpdate subaccount_update = 4; } // Block height of the update. - uint32 block_height = 4; + uint32 block_height = 5; // Exec mode of the update. - uint32 exec_mode = 5; + uint32 exec_mode = 6; } // SubaccountPerpetualPosition provides information on a subaccount's updated @@ -227,6 +227,9 @@ message StreamSubaccountUpdate { // All updates should be ignored until snapshot is received. // If the snapshot is true, then all previous entries should be // discarded and the subaccount should be resynced. + // For a snapshot subaccount update, the `updated_perpetual_positions` and + // `updated_asset_positions` fields will contain the full state of the + // subaccount. bool snapshot = 4; } diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 76a0f79e1d..260961811e 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -883,9 +883,9 @@ type StreamUpdate struct { // *StreamUpdate_SubaccountUpdate UpdateMessage isStreamUpdate_UpdateMessage `protobuf_oneof:"update_message"` // Block height of the update. - BlockHeight uint32 `protobuf:"varint,4,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + BlockHeight uint32 `protobuf:"varint,5,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // Exec mode of the update. - ExecMode uint32 `protobuf:"varint,5,opt,name=exec_mode,json=execMode,proto3" json:"exec_mode,omitempty"` + ExecMode uint32 `protobuf:"varint,6,opt,name=exec_mode,json=execMode,proto3" json:"exec_mode,omitempty"` } func (m *StreamUpdate) Reset() { *m = StreamUpdate{} } @@ -937,7 +937,7 @@ type StreamUpdate_TakerOrder struct { TakerOrder *StreamTakerOrder `protobuf:"bytes,3,opt,name=taker_order,json=takerOrder,proto3,oneof" json:"taker_order,omitempty"` } type StreamUpdate_SubaccountUpdate struct { - SubaccountUpdate *StreamSubaccountUpdate `protobuf:"bytes,6,opt,name=subaccount_update,json=subaccountUpdate,proto3,oneof" json:"subaccount_update,omitempty"` + SubaccountUpdate *StreamSubaccountUpdate `protobuf:"bytes,4,opt,name=subaccount_update,json=subaccountUpdate,proto3,oneof" json:"subaccount_update,omitempty"` } func (*StreamUpdate_OrderbookUpdate) isStreamUpdate_UpdateMessage() {} @@ -1128,6 +1128,9 @@ type StreamSubaccountUpdate struct { // All updates should be ignored until snapshot is received. // If the snapshot is true, then all previous entries should be // discarded and the subaccount should be resynced. + // For a snapshot subaccount update, the `updated_perpetual_positions` and + // `updated_asset_positions` fields will contain the full state of the + // subaccount. Snapshot bool `protobuf:"varint,4,opt,name=snapshot,proto3" json:"snapshot,omitempty"` } @@ -1589,9 +1592,9 @@ var fileDescriptor_3365c195b25c5bc0 = []byte{ 0xaa, 0xe7, 0xaf, 0x4e, 0x07, 0x7c, 0xe4, 0x7a, 0xde, 0x76, 0xc5, 0x3c, 0x2f, 0x6c, 0xe3, 0x01, 0x7a, 0x04, 0x75, 0x8e, 0x0f, 0x48, 0x68, 0x09, 0x91, 0x28, 0xbc, 0xfa, 0xc6, 0x7b, 0xa5, 0x48, 0xcf, 0x63, 0x5d, 0x01, 0xb7, 0x5d, 0x31, 0x81, 0x0f, 0x47, 0x68, 0x17, 0x2e, 0xa5, 0x96, 0x4a, - 0x05, 0x7a, 0xb6, 0x74, 0xef, 0x48, 0xb4, 0xd1, 0x62, 0x0d, 0x23, 0x9d, 0x67, 0x63, 0x32, 0x74, - 0x03, 0x2e, 0xc8, 0xce, 0xb3, 0x4f, 0xdc, 0xde, 0x3e, 0x6f, 0xcc, 0x8a, 0x3e, 0x5f, 0x17, 0xb2, - 0x6d, 0x21, 0x42, 0x8b, 0x70, 0x9e, 0x1c, 0x11, 0xdb, 0xf2, 0xa9, 0x43, 0x1a, 0x67, 0xc4, 0x7c, + 0x05, 0x3a, 0x5b, 0xba, 0x77, 0x24, 0xda, 0x68, 0xb1, 0x86, 0x91, 0xce, 0xb3, 0x31, 0x19, 0xba, + 0x01, 0x17, 0x64, 0xe7, 0xd9, 0x27, 0x6e, 0x6f, 0x9f, 0x37, 0xce, 0x88, 0x3e, 0x5f, 0x17, 0xb2, + 0x6d, 0x21, 0x42, 0x8b, 0x70, 0x9e, 0x1c, 0x11, 0xdb, 0xf2, 0xa9, 0x43, 0x1a, 0x67, 0xc5, 0x7c, 0x2d, 0x16, 0xec, 0x50, 0x87, 0x6c, 0xcd, 0xc3, 0x45, 0x49, 0xc7, 0xf2, 0x09, 0x63, 0xb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 0x45, 0x8f, 0xb6, 0xe6, 0x9d, 0x13, 0x6a, 0x2b, - 0x76, 0x15, 0xf4, 0xd3, 0xa4, 0xa3, 0x8e, 0xdf, 0xd5, 0xd1, 0xdd, 0x93, 0xde, 0x9b, 0x93, 0x87, - 0x46, 0xf3, 0xde, 0x5b, 0x58, 0x48, 0x02, 0x77, 0xb5, 0xad, 0xce, 0xd7, 0xaf, 0x5b, 0xda, 0xab, - 0xd7, 0x2d, 0xed, 0x3f, 0xaf, 0x5b, 0xda, 0x57, 0x6f, 0x5a, 0x95, 0x57, 0x6f, 0x5a, 0x95, 0x7f, - 0xbe, 0x69, 0x55, 0x7e, 0xf8, 0x51, 0xcf, 0xe5, 0xfb, 0x51, 0xb7, 0x6d, 0x53, 0x3f, 0x9b, 0xbc, - 0xc1, 0x87, 0x77, 0xc4, 0x65, 0xc0, 0x18, 0x4a, 0x8e, 0x64, 0x42, 0xf9, 0x71, 0x9f, 0xb0, 0xee, - 0x59, 0x21, 0xfe, 0xe0, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x39, 0x80, 0xc0, 0x4b, 0xd7, 0x15, + 0xa0, 0xa0, 0x32, 0x52, 0x16, 0xe7, 0x95, 0x05, 0xb8, 0xcf, 0xf6, 0x29, 0x17, 0xe5, 0x58, 0x33, + 0x87, 0x63, 0xfd, 0x97, 0x1a, 0x2c, 0x14, 0xee, 0x38, 0xb4, 0x3b, 0xde, 0x07, 0x3e, 0xce, 0x32, + 0x51, 0x37, 0xfd, 0x76, 0xfe, 0x5e, 0xff, 0xe9, 0xde, 0xde, 0xc3, 0x58, 0x20, 0x81, 0x5e, 0xdc, + 0x1b, 0x6b, 0x10, 0x19, 0x3e, 0xd5, 0x31, 0x3e, 0x7f, 0xd0, 0xe0, 0x72, 0xc1, 0x86, 0x45, 0x0f, + 0x40, 0x34, 0x45, 0x79, 0x7f, 0x54, 0x2b, 0xbc, 0x54, 0x72, 0xef, 0x15, 0xf7, 0x43, 0x53, 0x5c, + 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38, 0xd1, 0xc7, 0x30, 0x14, + 0xc0, 0x5c, 0xe6, 0xc9, 0x84, 0xbe, 0x59, 0xe6, 0xbb, 0xe8, 0xd1, 0xd6, 0xbc, 0x73, 0x42, 0x6d, + 0xc5, 0xae, 0x82, 0x7e, 0x9a, 0x74, 0xd4, 0xf1, 0xbb, 0x3a, 0xba, 0x7b, 0xd2, 0x7b, 0x73, 0xf2, + 0xd0, 0x68, 0xde, 0x7b, 0x0b, 0x0b, 0x49, 0xe0, 0xae, 0xb6, 0xd5, 0xf9, 0xfa, 0x75, 0x4b, 0x7b, + 0xf5, 0xba, 0xa5, 0xfd, 0xe7, 0x75, 0x4b, 0xfb, 0xea, 0x4d, 0xab, 0xf2, 0xea, 0x4d, 0xab, 0xf2, + 0xcf, 0x37, 0xad, 0xca, 0x0f, 0x3f, 0xea, 0xb9, 0x7c, 0x3f, 0xea, 0xb6, 0x6d, 0xea, 0x67, 0x93, + 0x37, 0xf8, 0xf0, 0x8e, 0xb8, 0x0c, 0x18, 0x43, 0xc9, 0x91, 0x4c, 0x28, 0x3f, 0xee, 0x13, 0xd6, + 0x3d, 0x2b, 0xc4, 0x1f, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x19, 0x57, 0xae, 0xd7, 0x15, 0x00, 0x00, } @@ -2646,6 +2649,16 @@ func (m *StreamUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ExecMode != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ExecMode)) + i-- + dAtA[i] = 0x30 + } + if m.BlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x28 + } if m.UpdateMessage != nil { { size := m.UpdateMessage.Size() @@ -2655,16 +2668,6 @@ func (m *StreamUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } } - if m.ExecMode != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ExecMode)) - i-- - dAtA[i] = 0x28 - } - if m.BlockHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x20 - } return len(dAtA) - i, nil } @@ -2748,7 +2751,7 @@ func (m *StreamUpdate_SubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x22 } return len(dAtA) - i, nil } @@ -5248,10 +5251,10 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { m.UpdateMessage = &StreamUpdate_TakerOrder{v} iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountUpdate", wireType) } - m.BlockHeight = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5261,16 +5264,32 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockHeight |= uint32(b&0x7F) << shift + 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 + } + v := &StreamSubaccountUpdate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.UpdateMessage = &StreamUpdate_SubaccountUpdate{v} + iNdEx = postIndex case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecMode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) } - m.ExecMode = 0 + m.BlockHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5280,16 +5299,16 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ExecMode |= uint32(b&0x7F) << shift + m.BlockHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubaccountUpdate", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecMode", wireType) } - var msglen int + m.ExecMode = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5299,27 +5318,11 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ExecMode |= uint32(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 - } - v := &StreamSubaccountUpdate{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.UpdateMessage = &StreamUpdate_SubaccountUpdate{v} - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 318e9ac238950e9c84efc118e8071f91437c8073 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 14:38:20 -0400 Subject: [PATCH 17/37] t --- protocol/streaming/full_node_streaming_manager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 57ea542e38..03e8836a39 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -35,6 +35,8 @@ type FullNodeStreamingManagerImpl struct { streamUpdateSubscriptionCache [][]uint32 // map from clob pair id to subscription ids. clobPairIdToSubscriptionIdMapping map[uint32][]uint32 + // map from subaccount id to subscription ids. + subaccountIdToSubscriptionIdMapping map[uint32][]uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -50,6 +52,9 @@ type OrderbookSubscription struct { // Clob pair ids to subscribe to. clobPairIds []uint32 + // Subaccount ids to subscribe to. + subaccountIds[] + // Stream messageSender types.OutgoingMessageSender From 71c0f085544748135cebb49f3aac6d27df30bc20 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 15:22:52 -0400 Subject: [PATCH 18/37] latest --- .../src/codegen/dydxprotocol/bundle.ts | 248 ++-- .../src/codegen/dydxprotocol/clob/query.ts | 284 +---- .../dydxprotocol/subaccounts/streaming.ts | 286 +++++ .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 22 +- proto/dydxprotocol/clob/query.proto | 39 +- .../dydxprotocol/subaccounts/streaming.proto | 42 + protocol/app/app.go | 1 + protocol/lib/metrics/metric_keys.go | 1 + .../streaming/full_node_streaming_manager.go | 117 +- protocol/streaming/noop_streaming_manager.go | 9 + protocol/streaming/types/interface.go | 7 + protocol/testutil/keeper/subaccounts.go | 2 + .../x/clob/keeper/grpc_stream_orderbook.go | 1 + protocol/x/clob/types/query.pb.go | 1051 +++-------------- protocol/x/subaccounts/keeper/keeper.go | 4 + protocol/x/subaccounts/keeper/subaccount.go | 20 + protocol/x/subaccounts/types/streaming.pb.go | 900 ++++++++++++++ protocol/x/subaccounts/types/types.go | 4 + 19 files changed, 1675 insertions(+), 1367 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts create mode 100644 proto/dydxprotocol/subaccounts/streaming.proto create mode 100644 protocol/x/subaccounts/types/streaming.pb.go diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 21e5cb3e3c..fe4846372f 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -98,71 +98,72 @@ import * as _101 from "./subaccounts/asset_position"; import * as _102 from "./subaccounts/genesis"; import * as _103 from "./subaccounts/perpetual_position"; import * as _104 from "./subaccounts/query"; -import * as _105 from "./subaccounts/subaccount"; -import * as _106 from "./vault/genesis"; -import * as _107 from "./vault/params"; -import * as _108 from "./vault/query"; -import * as _109 from "./vault/share"; -import * as _110 from "./vault/tx"; -import * as _111 from "./vault/vault"; -import * as _112 from "./vest/genesis"; -import * as _113 from "./vest/query"; -import * as _114 from "./vest/tx"; -import * as _115 from "./vest/vest_entry"; -import * as _123 from "./assets/query.lcd"; -import * as _124 from "./blocktime/query.lcd"; -import * as _125 from "./bridge/query.lcd"; -import * as _126 from "./clob/query.lcd"; -import * as _127 from "./delaymsg/query.lcd"; -import * as _128 from "./epochs/query.lcd"; -import * as _129 from "./feetiers/query.lcd"; -import * as _130 from "./perpetuals/query.lcd"; -import * as _131 from "./prices/query.lcd"; -import * as _132 from "./ratelimit/query.lcd"; -import * as _133 from "./revshare/query.lcd"; -import * as _134 from "./rewards/query.lcd"; -import * as _135 from "./stats/query.lcd"; -import * as _136 from "./subaccounts/query.lcd"; -import * as _137 from "./vault/query.lcd"; -import * as _138 from "./vest/query.lcd"; -import * as _139 from "./assets/query.rpc.Query"; -import * as _140 from "./blocktime/query.rpc.Query"; -import * as _141 from "./bridge/query.rpc.Query"; -import * as _142 from "./clob/query.rpc.Query"; -import * as _143 from "./delaymsg/query.rpc.Query"; -import * as _144 from "./epochs/query.rpc.Query"; -import * as _145 from "./feetiers/query.rpc.Query"; -import * as _146 from "./govplus/query.rpc.Query"; -import * as _147 from "./listing/query.rpc.Query"; -import * as _148 from "./perpetuals/query.rpc.Query"; -import * as _149 from "./prices/query.rpc.Query"; -import * as _150 from "./ratelimit/query.rpc.Query"; -import * as _151 from "./revshare/query.rpc.Query"; -import * as _152 from "./rewards/query.rpc.Query"; -import * as _153 from "./sending/query.rpc.Query"; -import * as _154 from "./stats/query.rpc.Query"; -import * as _155 from "./subaccounts/query.rpc.Query"; -import * as _156 from "./vault/query.rpc.Query"; -import * as _157 from "./vest/query.rpc.Query"; -import * as _158 from "./blocktime/tx.rpc.msg"; -import * as _159 from "./bridge/tx.rpc.msg"; -import * as _160 from "./clob/tx.rpc.msg"; -import * as _161 from "./delaymsg/tx.rpc.msg"; -import * as _162 from "./feetiers/tx.rpc.msg"; -import * as _163 from "./govplus/tx.rpc.msg"; -import * as _164 from "./listing/tx.rpc.msg"; -import * as _165 from "./perpetuals/tx.rpc.msg"; -import * as _166 from "./prices/tx.rpc.msg"; -import * as _167 from "./ratelimit/tx.rpc.msg"; -import * as _168 from "./revshare/tx.rpc.msg"; -import * as _169 from "./rewards/tx.rpc.msg"; -import * as _170 from "./sending/tx.rpc.msg"; -import * as _171 from "./stats/tx.rpc.msg"; -import * as _172 from "./vault/tx.rpc.msg"; -import * as _173 from "./vest/tx.rpc.msg"; -import * as _174 from "./lcd"; -import * as _175 from "./rpc.query"; -import * as _176 from "./rpc.tx"; +import * as _105 from "./subaccounts/streaming"; +import * as _106 from "./subaccounts/subaccount"; +import * as _107 from "./vault/genesis"; +import * as _108 from "./vault/params"; +import * as _109 from "./vault/query"; +import * as _110 from "./vault/share"; +import * as _111 from "./vault/tx"; +import * as _112 from "./vault/vault"; +import * as _113 from "./vest/genesis"; +import * as _114 from "./vest/query"; +import * as _115 from "./vest/tx"; +import * as _116 from "./vest/vest_entry"; +import * as _124 from "./assets/query.lcd"; +import * as _125 from "./blocktime/query.lcd"; +import * as _126 from "./bridge/query.lcd"; +import * as _127 from "./clob/query.lcd"; +import * as _128 from "./delaymsg/query.lcd"; +import * as _129 from "./epochs/query.lcd"; +import * as _130 from "./feetiers/query.lcd"; +import * as _131 from "./perpetuals/query.lcd"; +import * as _132 from "./prices/query.lcd"; +import * as _133 from "./ratelimit/query.lcd"; +import * as _134 from "./revshare/query.lcd"; +import * as _135 from "./rewards/query.lcd"; +import * as _136 from "./stats/query.lcd"; +import * as _137 from "./subaccounts/query.lcd"; +import * as _138 from "./vault/query.lcd"; +import * as _139 from "./vest/query.lcd"; +import * as _140 from "./assets/query.rpc.Query"; +import * as _141 from "./blocktime/query.rpc.Query"; +import * as _142 from "./bridge/query.rpc.Query"; +import * as _143 from "./clob/query.rpc.Query"; +import * as _144 from "./delaymsg/query.rpc.Query"; +import * as _145 from "./epochs/query.rpc.Query"; +import * as _146 from "./feetiers/query.rpc.Query"; +import * as _147 from "./govplus/query.rpc.Query"; +import * as _148 from "./listing/query.rpc.Query"; +import * as _149 from "./perpetuals/query.rpc.Query"; +import * as _150 from "./prices/query.rpc.Query"; +import * as _151 from "./ratelimit/query.rpc.Query"; +import * as _152 from "./revshare/query.rpc.Query"; +import * as _153 from "./rewards/query.rpc.Query"; +import * as _154 from "./sending/query.rpc.Query"; +import * as _155 from "./stats/query.rpc.Query"; +import * as _156 from "./subaccounts/query.rpc.Query"; +import * as _157 from "./vault/query.rpc.Query"; +import * as _158 from "./vest/query.rpc.Query"; +import * as _159 from "./blocktime/tx.rpc.msg"; +import * as _160 from "./bridge/tx.rpc.msg"; +import * as _161 from "./clob/tx.rpc.msg"; +import * as _162 from "./delaymsg/tx.rpc.msg"; +import * as _163 from "./feetiers/tx.rpc.msg"; +import * as _164 from "./govplus/tx.rpc.msg"; +import * as _165 from "./listing/tx.rpc.msg"; +import * as _166 from "./perpetuals/tx.rpc.msg"; +import * as _167 from "./prices/tx.rpc.msg"; +import * as _168 from "./ratelimit/tx.rpc.msg"; +import * as _169 from "./revshare/tx.rpc.msg"; +import * as _170 from "./rewards/tx.rpc.msg"; +import * as _171 from "./sending/tx.rpc.msg"; +import * as _172 from "./stats/tx.rpc.msg"; +import * as _173 from "./vault/tx.rpc.msg"; +import * as _174 from "./vest/tx.rpc.msg"; +import * as _175 from "./lcd"; +import * as _176 from "./rpc.query"; +import * as _177 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, ..._6 @@ -171,17 +172,17 @@ export namespace dydxprotocol { ..._8, ..._9, ..._10, - ..._123, - ..._139 + ..._124, + ..._140 }; export const blocktime = { ..._11, ..._12, ..._13, ..._14, ..._15, - ..._124, - ..._140, - ..._158 + ..._125, + ..._141, + ..._159 }; export const bridge = { ..._16, ..._17, @@ -189,9 +190,9 @@ export namespace dydxprotocol { ..._19, ..._20, ..._21, - ..._125, - ..._141, - ..._159 + ..._126, + ..._142, + ..._160 }; export const clob = { ..._22, ..._23, @@ -207,9 +208,9 @@ export namespace dydxprotocol { ..._33, ..._34, ..._35, - ..._126, - ..._142, - ..._160 + ..._127, + ..._143, + ..._161 }; export namespace daemons { export const bridge = { ..._36 @@ -224,29 +225,29 @@ export namespace dydxprotocol { ..._41, ..._42, ..._43, - ..._127, - ..._143, - ..._161 + ..._128, + ..._144, + ..._162 }; export const epochs = { ..._44, ..._45, ..._46, - ..._128, - ..._144 + ..._129, + ..._145 }; export const feetiers = { ..._47, ..._48, ..._49, ..._50, - ..._129, - ..._145, - ..._162 + ..._130, + ..._146, + ..._163 }; export const govplus = { ..._51, ..._52, ..._53, - ..._146, - ..._163 + ..._147, + ..._164 }; export namespace indexer { export const events = { ..._54 @@ -271,26 +272,26 @@ export namespace dydxprotocol { export const listing = { ..._63, ..._64, ..._65, - ..._147, - ..._164 + ..._148, + ..._165 }; export const perpetuals = { ..._66, ..._67, ..._68, ..._69, ..._70, - ..._130, - ..._148, - ..._165 + ..._131, + ..._149, + ..._166 }; export const prices = { ..._71, ..._72, ..._73, ..._74, ..._75, - ..._131, - ..._149, - ..._166 + ..._132, + ..._150, + ..._167 }; export const ratelimit = { ..._76, ..._77, @@ -298,72 +299,73 @@ export namespace dydxprotocol { ..._79, ..._80, ..._81, - ..._132, - ..._150, - ..._167 + ..._133, + ..._151, + ..._168 }; export const revshare = { ..._82, ..._83, ..._84, ..._85, ..._86, - ..._133, - ..._151, - ..._168 + ..._134, + ..._152, + ..._169 }; export const rewards = { ..._87, ..._88, ..._89, ..._90, ..._91, - ..._134, - ..._152, - ..._169 + ..._135, + ..._153, + ..._170 }; export const sending = { ..._92, ..._93, ..._94, ..._95, - ..._153, - ..._170 + ..._154, + ..._171 }; export const stats = { ..._96, ..._97, ..._98, ..._99, ..._100, - ..._135, - ..._154, - ..._171 + ..._136, + ..._155, + ..._172 }; export const subaccounts = { ..._101, ..._102, ..._103, ..._104, ..._105, - ..._136, - ..._155 + ..._106, + ..._137, + ..._156 }; - export const vault = { ..._106, - ..._107, + export const vault = { ..._107, ..._108, ..._109, ..._110, ..._111, - ..._137, - ..._156, - ..._172 - }; - export const vest = { ..._112, - ..._113, - ..._114, - ..._115, + ..._112, ..._138, ..._157, ..._173 }; - export const ClientFactory = { ..._174, - ..._175, - ..._176 + export const vest = { ..._113, + ..._114, + ..._115, + ..._116, + ..._139, + ..._158, + ..._174 + }; + export const ClientFactory = { ..._175, + ..._176, + ..._177 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts index 3eb7ca7df2..27872be567 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -6,6 +6,7 @@ import { ClobPair, ClobPairSDKType } from "./clob_pair"; import { EquityTierLimitConfiguration, EquityTierLimitConfigurationSDKType } from "./equity_tier_limit_config"; import { BlockRateLimitConfiguration, BlockRateLimitConfigurationSDKType } from "./block_rate_limit_config"; import { LiquidationsConfig, LiquidationsConfigSDKType } from "./liquidations_config"; +import { StreamSubaccountUpdate, StreamSubaccountUpdateSDKType } from "../subaccounts/streaming"; import { OffChainUpdateV1, OffChainUpdateV1SDKType } from "../indexer/off_chain_updates/off_chain_updates"; import { ClobMatch, ClobMatchSDKType } from "./matches"; import * as _m0 from "protobufjs/minimal"; @@ -320,104 +321,6 @@ export interface StreamUpdateSDKType { exec_mode: number; } -/** - * SubaccountPerpetualPosition provides information on a subaccount's updated - * perpetual positions. - */ - -export interface SubaccountPerpetualPosition { - /** The `Id` of the `Perpetual`. */ - perpetualId: number; - /** The size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountPerpetualPosition provides information on a subaccount's updated - * perpetual positions. - */ - -export interface SubaccountPerpetualPositionSDKType { - /** The `Id` of the `Perpetual`. */ - perpetual_id: number; - /** The size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountAssetPosition provides information on a subaccount's updated asset - * positions. - */ - -export interface SubaccountAssetPosition { - /** The `Id` of the `Asset`. */ - assetId: number; - /** The absolute size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountAssetPosition provides information on a subaccount's updated asset - * positions. - */ - -export interface SubaccountAssetPositionSDKType { - /** The `Id` of the `Asset`. */ - asset_id: number; - /** The absolute size of the position in base quantums. */ - - quantums: Long; -} -/** - * StreamSubaccountUpdate provides information on a subaccount update. Used in - * the full node GRPC stream. - */ - -export interface StreamSubaccountUpdate { - subaccountId?: SubaccountId; - /** updated_perpetual_positions will each be for unique perpetuals. */ - - updatedPerpetualPositions: SubaccountPerpetualPosition[]; - /** updated_asset_positions will each be for unique assets. */ - - updatedAssetPositions: SubaccountAssetPosition[]; - /** - * Snapshot indicates if the response is from a snapshot of the subaccount. - * All updates should be ignored until snapshot is received. - * If the snapshot is true, then all previous entries should be - * discarded and the subaccount should be resynced. - * For a snapshot subaccount update, the `updated_perpetual_positions` and - * `updated_asset_positions` fields will contain the full state of the - * subaccount. - */ - - snapshot: boolean; -} -/** - * StreamSubaccountUpdate provides information on a subaccount update. Used in - * the full node GRPC stream. - */ - -export interface StreamSubaccountUpdateSDKType { - subaccount_id?: SubaccountIdSDKType; - /** updated_perpetual_positions will each be for unique perpetuals. */ - - updated_perpetual_positions: SubaccountPerpetualPositionSDKType[]; - /** updated_asset_positions will each be for unique assets. */ - - updated_asset_positions: SubaccountAssetPositionSDKType[]; - /** - * Snapshot indicates if the response is from a snapshot of the subaccount. - * All updates should be ignored until snapshot is received. - * If the snapshot is true, then all previous entries should be - * discarded and the subaccount should be resynced. - * For a snapshot subaccount update, the `updated_perpetual_positions` and - * `updated_asset_positions` fields will contain the full state of the - * subaccount. - */ - - snapshot: boolean; -} /** * StreamOrderbookUpdate provides information on an orderbook update. Used in * the full node GRPC stream. @@ -1495,191 +1398,6 @@ export const StreamUpdate = { }; -function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition { - return { - perpetualId: 0, - quantums: Long.UZERO - }; -} - -export const SubaccountPerpetualPosition = { - encode(message: SubaccountPerpetualPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.perpetualId !== 0) { - writer.uint32(8).uint32(message.perpetualId); - } - - if (!message.quantums.isZero()) { - writer.uint32(16).uint64(message.quantums); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountPerpetualPosition { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSubaccountPerpetualPosition(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.perpetualId = reader.uint32(); - break; - - case 2: - message.quantums = (reader.uint64() as Long); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): SubaccountPerpetualPosition { - const message = createBaseSubaccountPerpetualPosition(); - message.perpetualId = object.perpetualId ?? 0; - message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; - return message; - } - -}; - -function createBaseSubaccountAssetPosition(): SubaccountAssetPosition { - return { - assetId: 0, - quantums: Long.UZERO - }; -} - -export const SubaccountAssetPosition = { - encode(message: SubaccountAssetPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.assetId !== 0) { - writer.uint32(8).uint32(message.assetId); - } - - if (!message.quantums.isZero()) { - writer.uint32(16).uint64(message.quantums); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountAssetPosition { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSubaccountAssetPosition(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.assetId = reader.uint32(); - break; - - case 2: - message.quantums = (reader.uint64() as Long); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): SubaccountAssetPosition { - const message = createBaseSubaccountAssetPosition(); - message.assetId = object.assetId ?? 0; - message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; - return message; - } - -}; - -function createBaseStreamSubaccountUpdate(): StreamSubaccountUpdate { - return { - subaccountId: undefined, - updatedPerpetualPositions: [], - updatedAssetPositions: [], - snapshot: false - }; -} - -export const StreamSubaccountUpdate = { - encode(message: StreamSubaccountUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subaccountId !== undefined) { - SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim(); - } - - for (const v of message.updatedPerpetualPositions) { - SubaccountPerpetualPosition.encode(v!, writer.uint32(18).fork()).ldelim(); - } - - for (const v of message.updatedAssetPositions) { - SubaccountAssetPosition.encode(v!, writer.uint32(26).fork()).ldelim(); - } - - if (message.snapshot === true) { - writer.uint32(32).bool(message.snapshot); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StreamSubaccountUpdate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStreamSubaccountUpdate(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.subaccountId = SubaccountId.decode(reader, reader.uint32()); - break; - - case 2: - message.updatedPerpetualPositions.push(SubaccountPerpetualPosition.decode(reader, reader.uint32())); - break; - - case 3: - message.updatedAssetPositions.push(SubaccountAssetPosition.decode(reader, reader.uint32())); - break; - - case 4: - message.snapshot = reader.bool(); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): StreamSubaccountUpdate { - const message = createBaseStreamSubaccountUpdate(); - message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; - message.updatedPerpetualPositions = object.updatedPerpetualPositions?.map(e => SubaccountPerpetualPosition.fromPartial(e)) || []; - message.updatedAssetPositions = object.updatedAssetPositions?.map(e => SubaccountAssetPosition.fromPartial(e)) || []; - message.snapshot = object.snapshot ?? false; - return message; - } - -}; - function createBaseStreamOrderbookUpdate(): StreamOrderbookUpdate { return { updates: [], diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts new file mode 100644 index 0000000000..fd54ef914b --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/streaming.ts @@ -0,0 +1,286 @@ +import { SubaccountId, SubaccountIdSDKType } from "./subaccount"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial, Long } from "../../helpers"; +/** + * StreamSubaccountUpdate provides information on a subaccount update. Used in + * the full node GRPC stream. + */ + +export interface StreamSubaccountUpdate { + subaccountId?: SubaccountId; + /** updated_perpetual_positions will each be for unique perpetuals. */ + + updatedPerpetualPositions: SubaccountPerpetualPosition[]; + /** updated_asset_positions will each be for unique assets. */ + + updatedAssetPositions: SubaccountAssetPosition[]; + /** + * Snapshot indicates if the response is from a snapshot of the subaccount. + * All updates should be ignored until snapshot is received. + * If the snapshot is true, then all previous entries should be + * discarded and the subaccount should be resynced. + * For a snapshot subaccount update, the `updated_perpetual_positions` and + * `updated_asset_positions` fields will contain the full state of the + * subaccount. + */ + + snapshot: boolean; +} +/** + * StreamSubaccountUpdate provides information on a subaccount update. Used in + * the full node GRPC stream. + */ + +export interface StreamSubaccountUpdateSDKType { + subaccount_id?: SubaccountIdSDKType; + /** updated_perpetual_positions will each be for unique perpetuals. */ + + updated_perpetual_positions: SubaccountPerpetualPositionSDKType[]; + /** updated_asset_positions will each be for unique assets. */ + + updated_asset_positions: SubaccountAssetPositionSDKType[]; + /** + * Snapshot indicates if the response is from a snapshot of the subaccount. + * All updates should be ignored until snapshot is received. + * If the snapshot is true, then all previous entries should be + * discarded and the subaccount should be resynced. + * For a snapshot subaccount update, the `updated_perpetual_positions` and + * `updated_asset_positions` fields will contain the full state of the + * subaccount. + */ + + snapshot: boolean; +} +/** + * SubaccountPerpetualPosition provides information on a subaccount's updated + * perpetual positions. + */ + +export interface SubaccountPerpetualPosition { + /** The `Id` of the `Perpetual`. */ + perpetualId: number; + /** The size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountPerpetualPosition provides information on a subaccount's updated + * perpetual positions. + */ + +export interface SubaccountPerpetualPositionSDKType { + /** The `Id` of the `Perpetual`. */ + perpetual_id: number; + /** The size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountAssetPosition provides information on a subaccount's updated asset + * positions. + */ + +export interface SubaccountAssetPosition { + /** The `Id` of the `Asset`. */ + assetId: number; + /** The absolute size of the position in base quantums. */ + + quantums: Long; +} +/** + * SubaccountAssetPosition provides information on a subaccount's updated asset + * positions. + */ + +export interface SubaccountAssetPositionSDKType { + /** The `Id` of the `Asset`. */ + asset_id: number; + /** The absolute size of the position in base quantums. */ + + quantums: Long; +} + +function createBaseStreamSubaccountUpdate(): StreamSubaccountUpdate { + return { + subaccountId: undefined, + updatedPerpetualPositions: [], + updatedAssetPositions: [], + snapshot: false + }; +} + +export const StreamSubaccountUpdate = { + encode(message: StreamSubaccountUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.subaccountId !== undefined) { + SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim(); + } + + for (const v of message.updatedPerpetualPositions) { + SubaccountPerpetualPosition.encode(v!, writer.uint32(18).fork()).ldelim(); + } + + for (const v of message.updatedAssetPositions) { + SubaccountAssetPosition.encode(v!, writer.uint32(26).fork()).ldelim(); + } + + if (message.snapshot === true) { + writer.uint32(32).bool(message.snapshot); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StreamSubaccountUpdate { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamSubaccountUpdate(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.subaccountId = SubaccountId.decode(reader, reader.uint32()); + break; + + case 2: + message.updatedPerpetualPositions.push(SubaccountPerpetualPosition.decode(reader, reader.uint32())); + break; + + case 3: + message.updatedAssetPositions.push(SubaccountAssetPosition.decode(reader, reader.uint32())); + break; + + case 4: + message.snapshot = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): StreamSubaccountUpdate { + const message = createBaseStreamSubaccountUpdate(); + message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; + message.updatedPerpetualPositions = object.updatedPerpetualPositions?.map(e => SubaccountPerpetualPosition.fromPartial(e)) || []; + message.updatedAssetPositions = object.updatedAssetPositions?.map(e => SubaccountAssetPosition.fromPartial(e)) || []; + message.snapshot = object.snapshot ?? false; + return message; + } + +}; + +function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition { + return { + perpetualId: 0, + quantums: Long.UZERO + }; +} + +export const SubaccountPerpetualPosition = { + encode(message: SubaccountPerpetualPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.perpetualId !== 0) { + writer.uint32(8).uint32(message.perpetualId); + } + + if (!message.quantums.isZero()) { + writer.uint32(16).uint64(message.quantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountPerpetualPosition { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubaccountPerpetualPosition(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.perpetualId = reader.uint32(); + break; + + case 2: + message.quantums = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): SubaccountPerpetualPosition { + const message = createBaseSubaccountPerpetualPosition(); + message.perpetualId = object.perpetualId ?? 0; + message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; + return message; + } + +}; + +function createBaseSubaccountAssetPosition(): SubaccountAssetPosition { + return { + assetId: 0, + quantums: Long.UZERO + }; +} + +export const SubaccountAssetPosition = { + encode(message: SubaccountAssetPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.assetId !== 0) { + writer.uint32(8).uint32(message.assetId); + } + + if (!message.quantums.isZero()) { + writer.uint32(16).uint64(message.quantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountAssetPosition { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubaccountAssetPosition(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.assetId = reader.uint32(); + break; + + case 2: + message.quantums = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): SubaccountAssetPosition { + const message = createBaseSubaccountAssetPosition(); + message.assetId = object.assetId ?? 0; + message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; + 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 709b81ce7c..cdc090d0d6 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 _116 from "./gogo"; -export const gogoproto = { ..._116 +import * as _117 from "./gogo"; +export const gogoproto = { ..._117 }; \ 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 2cbfe8f57c..7103f2f637 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 _117 from "./api/annotations"; -import * as _118 from "./api/http"; -import * as _119 from "./protobuf/descriptor"; -import * as _120 from "./protobuf/duration"; -import * as _121 from "./protobuf/timestamp"; -import * as _122 from "./protobuf/any"; +import * as _118 from "./api/annotations"; +import * as _119 from "./api/http"; +import * as _120 from "./protobuf/descriptor"; +import * as _121 from "./protobuf/duration"; +import * as _122 from "./protobuf/timestamp"; +import * as _123 from "./protobuf/any"; export namespace google { - export const api = { ..._117, - ..._118 + export const api = { ..._118, + ..._119 }; - export const protobuf = { ..._119, - ..._120, + export const protobuf = { ..._120, ..._121, - ..._122 + ..._122, + ..._123 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 34f9899801..b0342bc3c6 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -12,6 +12,7 @@ import "dydxprotocol/clob/matches.proto"; import "dydxprotocol/clob/liquidations_config.proto"; import "dydxprotocol/clob/mev.proto"; import "dydxprotocol/indexer/off_chain_updates/off_chain_updates.proto"; +import "dydxprotocol/subaccounts/streaming.proto"; import "dydxprotocol/subaccounts/subaccount.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"; @@ -187,7 +188,7 @@ message StreamUpdate { StreamOrderbookUpdate orderbook_update = 1; StreamOrderbookFill order_fill = 2; StreamTakerOrder taker_order = 3; - StreamSubaccountUpdate subaccount_update = 4; + dydxprotocol.subaccounts.StreamSubaccountUpdate subaccount_update = 4; } // Block height of the update. @@ -197,42 +198,6 @@ message StreamUpdate { uint32 exec_mode = 6; } -// SubaccountPerpetualPosition provides information on a subaccount's updated -// perpetual positions. -message SubaccountPerpetualPosition { - // The `Id` of the `Perpetual`. - uint32 perpetual_id = 1; - // The size of the position in base quantums. - uint64 quantums = 2; -} - -// SubaccountAssetPosition provides information on a subaccount's updated asset -// positions. -message SubaccountAssetPosition { - // The `Id` of the `Asset`. - uint32 asset_id = 1; - // The absolute size of the position in base quantums. - uint64 quantums = 2; -} - -// StreamSubaccountUpdate provides information on a subaccount update. Used in -// the full node GRPC stream. -message StreamSubaccountUpdate { - dydxprotocol.subaccounts.SubaccountId subaccount_id = 1; - // updated_perpetual_positions will each be for unique perpetuals. - repeated SubaccountPerpetualPosition updated_perpetual_positions = 2; - // updated_asset_positions will each be for unique assets. - repeated SubaccountAssetPosition updated_asset_positions = 3; - // Snapshot indicates if the response is from a snapshot of the subaccount. - // All updates should be ignored until snapshot is received. - // If the snapshot is true, then all previous entries should be - // discarded and the subaccount should be resynced. - // For a snapshot subaccount update, the `updated_perpetual_positions` and - // `updated_asset_positions` fields will contain the full state of the - // subaccount. - bool snapshot = 4; -} - // StreamOrderbookUpdate provides information on an orderbook update. Used in // the full node GRPC stream. message StreamOrderbookUpdate { diff --git a/proto/dydxprotocol/subaccounts/streaming.proto b/proto/dydxprotocol/subaccounts/streaming.proto new file mode 100644 index 0000000000..13b71ee1ae --- /dev/null +++ b/proto/dydxprotocol/subaccounts/streaming.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package dydxprotocol.subaccounts; + +import "dydxprotocol/subaccounts/subaccount.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"; + +// StreamSubaccountUpdate provides information on a subaccount update. Used in +// the full node GRPC stream. +message StreamSubaccountUpdate { + SubaccountId subaccount_id = 1; + // updated_perpetual_positions will each be for unique perpetuals. + repeated SubaccountPerpetualPosition updated_perpetual_positions = 2; + // updated_asset_positions will each be for unique assets. + repeated SubaccountAssetPosition updated_asset_positions = 3; + // Snapshot indicates if the response is from a snapshot of the subaccount. + // All updates should be ignored until snapshot is received. + // If the snapshot is true, then all previous entries should be + // discarded and the subaccount should be resynced. + // For a snapshot subaccount update, the `updated_perpetual_positions` and + // `updated_asset_positions` fields will contain the full state of the + // subaccount. + bool snapshot = 4; +} + +// SubaccountPerpetualPosition provides information on a subaccount's updated +// perpetual positions. +message SubaccountPerpetualPosition { + // The `Id` of the `Perpetual`. + uint32 perpetual_id = 1; + // The size of the position in base quantums. + uint64 quantums = 2; +} + +// SubaccountAssetPosition provides information on a subaccount's updated asset +// positions. +message SubaccountAssetPosition { + // The `Id` of the `Asset`. + uint32 asset_id = 1; + // The absolute size of the position in base quantums. + uint64 quantums = 2; +} diff --git a/protocol/app/app.go b/protocol/app/app.go index e6f30878f7..54df039796 100644 --- a/protocol/app/app.go +++ b/protocol/app/app.go @@ -1058,6 +1058,7 @@ func New( app.BlockTimeKeeper, app.RevShareKeeper, app.IndexerEventManager, + app.FullNodeStreamingManager, ) subaccountsModule := subaccountsmodule.NewAppModule( appCodec, diff --git a/protocol/lib/metrics/metric_keys.go b/protocol/lib/metrics/metric_keys.go index 0c549c2dfa..59c5427d3e 100644 --- a/protocol/lib/metrics/metric_keys.go +++ b/protocol/lib/metrics/metric_keys.go @@ -70,6 +70,7 @@ const ( GrpcSendOrderbookUpdatesLatency = "grpc_send_orderbook_updates_latency" GrpcSendOrderbookSnapshotLatency = "grpc_send_orderbook_snapshot_latency" GrpcSendOrderbookFillsLatency = "grpc_send_orderbook_fills_latency" + GrpcSendSubaccountUpdatesLatency = "grpc_send_subaccount_updates_latency" GrpcAddUpdateToBufferCount = "grpc_add_update_to_buffer_count" GrpcAddToSubscriptionChannelCount = "grpc_add_to_subscription_channel_count" GrpcSendResponseToSubscriberCount = "grpc_send_response_to_subscriber_count" diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 03e8836a39..a0041ffcbe 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -2,6 +2,7 @@ package streaming import ( "fmt" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" "sync" "time" @@ -36,7 +37,7 @@ type FullNodeStreamingManagerImpl struct { // map from clob pair id to subscription ids. clobPairIdToSubscriptionIdMapping map[uint32][]uint32 // map from subaccount id to subscription ids. - subaccountIdToSubscriptionIdMapping map[uint32][]uint32 + subaccountIdToSubscriptionIdMapping map[*satypes.SubaccountId][]uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -53,7 +54,7 @@ type OrderbookSubscription struct { clobPairIds []uint32 // Subaccount ids to subscribe to. - subaccountIds[] + subaccountIds []*satypes.SubaccountId // Stream messageSender types.OutgoingMessageSender @@ -74,11 +75,12 @@ func NewFullNodeStreamingManager( orderbookSubscriptions: make(map[uint32]*OrderbookSubscription), nextSubscriptionId: 0, - ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), - done: make(chan bool), - streamUpdateCache: make([]clobtypes.StreamUpdate, 0), - streamUpdateSubscriptionCache: make([][]uint32, 0), - clobPairIdToSubscriptionIdMapping: make(map[uint32][]uint32), + ticker: time.NewTicker(time.Duration(flushIntervalMs) * time.Millisecond), + done: make(chan bool), + streamUpdateCache: make([]clobtypes.StreamUpdate, 0), + streamUpdateSubscriptionCache: make([][]uint32, 0), + clobPairIdToSubscriptionIdMapping: make(map[uint32][]uint32), + subaccountIdToSubscriptionIdMapping: make(map[*satypes.SubaccountId][]uint32), maxUpdatesInCache: maxUpdatesInCache, maxSubscriptionChannelSize: maxSubscriptionChannelSize, @@ -127,6 +129,7 @@ func (sm *FullNodeStreamingManagerImpl) EmitMetrics() { // Subscribe subscribes to the orderbook updates stream. func (sm *FullNodeStreamingManagerImpl) Subscribe( clobPairIds []uint32, + subaccountIds []*satypes.SubaccountId, messageSender types.OutgoingMessageSender, ) ( err error, @@ -140,6 +143,7 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( subscription := &OrderbookSubscription{ subscriptionId: sm.nextSubscriptionId, clobPairIds: clobPairIds, + subaccountIds: subaccountIds, messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), } @@ -154,12 +158,24 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.nextSubscriptionId, ) } + for _, subaccountId := range subaccountIds { + // if subaccountId exists in the map, append the subscription id to the slice + // otherwise, create a new slice with the subscription id + if _, ok := sm.subaccountIdToSubscriptionIdMapping[subaccountId]; !ok { + sm.subaccountIdToSubscriptionIdMapping[subaccountId] = []uint32{} + } + sm.subaccountIdToSubscriptionIdMapping[subaccountId] = append( + sm.subaccountIdToSubscriptionIdMapping[subaccountId], + sm.nextSubscriptionId, + ) + } sm.logger.Info( fmt.Sprintf( - "New subscription id %+v for clob pair ids: %+v", + "New subscription id %+v for clob pair ids: %+v and subaccount ids: %+v", subscription.subscriptionId, clobPairIds, + subaccountIds, ), ) sm.orderbookSubscriptions[subscription.subscriptionId] = subscription @@ -230,6 +246,21 @@ func (sm *FullNodeStreamingManagerImpl) removeSubscription( } } + // Iterate over the subaccountIdToSubscriptionIdMapping to remove the subscriptionIdToRemove + for subaccountId, subscriptionIds := range sm.subaccountIdToSubscriptionIdMapping { + for i, id := range subscriptionIds { + if id == subscriptionIdToRemove { + // Remove the subscription ID from the slice + sm.subaccountIdToSubscriptionIdMapping[subaccountId] = append(subscriptionIds[:i], subscriptionIds[i+1:]...) + break + } + } + // If the list is empty after removal, delete the key from the map + if len(sm.subaccountIdToSubscriptionIdMapping[subaccountId]) == 0 { + delete(sm.subaccountIdToSubscriptionIdMapping, subaccountId) + } + } + sm.logger.Info( fmt.Sprintf("Removed streaming subscription id %+v", subscriptionIdToRemove), ) @@ -352,7 +383,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(streamUpdates, clobPairIds, uint32(len(updates))) + sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds, uint32(len(updates))) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -395,10 +426,41 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(streamUpdates, clobPairIds, uint32(len(orderbookFills))) + sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds, uint32(len(orderbookFills))) +} + +// SendSubaccountUpdates groups subaccount updates by their subaccount ids and +// sends messages to the subscribers. +func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( + subaccountUpdates []satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, +) { + defer metrics.ModuleMeasureSince( + metrics.FullNodeGrpc, + metrics.GrpcSendSubaccountUpdatesLatency, + time.Now(), + ) + + // Group subaccount updates by subaccount id. + streamUpdates := make([]clobtypes.StreamUpdate, 0) + subaccountIds := make([]*satypes.SubaccountId, 0) + for _, subaccountUpdate := range subaccountUpdates { + streamUpdate := clobtypes.StreamUpdate{ + UpdateMessage: &clobtypes.StreamUpdate_SubaccountUpdate{ + SubaccountUpdate: &subaccountUpdate, + }, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + } + streamUpdates = append(streamUpdates, streamUpdate) + subaccountIds = append(subaccountIds, subaccountUpdate.SubaccountId) + } + + sm.AddSubaccountUpdatesToCache(streamUpdates, subaccountIds, uint32(len(subaccountUpdates))) } -func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( +func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( updates []clobtypes.StreamUpdate, clobPairIds []uint32, numUpdatesToAdd uint32, @@ -431,6 +493,39 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( sm.EmitMetrics() } +func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( + updates []clobtypes.StreamUpdate, + subaccountIds []*satypes.SubaccountId, + numUpdatesToAdd uint32, +) { + sm.Lock() + defer sm.Unlock() + + metrics.IncrCounter( + metrics.GrpcAddUpdateToBufferCount, + float32(numUpdatesToAdd), + ) + + sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) + for _, subaccountId := range subaccountIds { + sm.streamUpdateSubscriptionCache = append( + sm.streamUpdateSubscriptionCache, + sm.subaccountIdToSubscriptionIdMapping[subaccountId], + ) + } + + // Remove all subscriptions and wipe the buffer if buffer overflows. + if len(sm.streamUpdateCache) > int(sm.maxUpdatesInCache) { + sm.logger.Error("Streaming buffer full capacity. Dropping messages and all subscriptions. " + + "Disconnect all clients and increase buffer size via the grpc-stream-buffer-size flag.") + for id := range sm.orderbookSubscriptions { + sm.removeSubscription(id) + } + clear(sm.streamUpdateCache) + } + sm.EmitMetrics() +} + func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdates() { sm.Lock() defer sm.Unlock() diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 2334142223..2fedbaebb9 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/streaming/types" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" ) var _ types.FullNodeStreamingManager = (*NoopGrpcStreamingManager)(nil) @@ -20,6 +21,7 @@ func (sm *NoopGrpcStreamingManager) Enabled() bool { func (sm *NoopGrpcStreamingManager) Subscribe( _ []uint32, + _ []*satypes.SubaccountId, _ types.OutgoingMessageSender, ) ( err error, @@ -42,6 +44,13 @@ func (sm *NoopGrpcStreamingManager) SendOrderbookFillUpdates( ) { } +func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( + subaccountUpdates []satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, +) { +} + func (sm *NoopGrpcStreamingManager) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, blockHeight uint32, diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index d357dddc39..901257de37 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" ) type FullNodeStreamingManager interface { @@ -12,6 +13,7 @@ type FullNodeStreamingManager interface { // Subscribe to streams Subscribe( clobPairIds []uint32, + subaccountIds []*satypes.SubaccountId, srv OutgoingMessageSender, ) ( err error, @@ -34,6 +36,11 @@ type FullNodeStreamingManager interface { execMode sdk.ExecMode, perpetualIdToClobPairId map[uint32][]clobtypes.ClobPairId, ) + SendSubaccountUpdates( + subaccountUpdates []satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, + ) } type OutgoingMessageSender interface { diff --git a/protocol/testutil/keeper/subaccounts.go b/protocol/testutil/keeper/subaccounts.go index 10a6060d0a..a51a5f1c36 100644 --- a/protocol/testutil/keeper/subaccounts.go +++ b/protocol/testutil/keeper/subaccounts.go @@ -1,6 +1,7 @@ package keeper import ( + "github.com/dydxprotocol/v4-chain/protocol/streaming" "testing" revsharekeeper "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" @@ -128,6 +129,7 @@ func createSubaccountsKeeper( btk, rsk, mockIndexerEventsManager, + streaming.NewNoopGrpcStreamingManager(), ) return k, storeKey diff --git a/protocol/x/clob/keeper/grpc_stream_orderbook.go b/protocol/x/clob/keeper/grpc_stream_orderbook.go index 8e72a8640d..caca5fbfbe 100644 --- a/protocol/x/clob/keeper/grpc_stream_orderbook.go +++ b/protocol/x/clob/keeper/grpc_stream_orderbook.go @@ -10,6 +10,7 @@ func (k Keeper) StreamOrderbookUpdates( ) error { err := k.GetFullNodeStreamingManager().Subscribe( req.GetClobPairId(), + req.GetSubaccountIds(), stream, ) if err != nil { diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index 260961811e..d0d00fd50a 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -937,7 +937,7 @@ type StreamUpdate_TakerOrder struct { TakerOrder *StreamTakerOrder `protobuf:"bytes,3,opt,name=taker_order,json=takerOrder,proto3,oneof" json:"taker_order,omitempty"` } type StreamUpdate_SubaccountUpdate struct { - SubaccountUpdate *StreamSubaccountUpdate `protobuf:"bytes,4,opt,name=subaccount_update,json=subaccountUpdate,proto3,oneof" json:"subaccount_update,omitempty"` + SubaccountUpdate *types.StreamSubaccountUpdate `protobuf:"bytes,4,opt,name=subaccount_update,json=subaccountUpdate,proto3,oneof" json:"subaccount_update,omitempty"` } func (*StreamUpdate_OrderbookUpdate) isStreamUpdate_UpdateMessage() {} @@ -973,7 +973,7 @@ func (m *StreamUpdate) GetTakerOrder() *StreamTakerOrder { return nil } -func (m *StreamUpdate) GetSubaccountUpdate() *StreamSubaccountUpdate { +func (m *StreamUpdate) GetSubaccountUpdate() *types.StreamSubaccountUpdate { if x, ok := m.GetUpdateMessage().(*StreamUpdate_SubaccountUpdate); ok { return x.SubaccountUpdate } @@ -1004,197 +1004,6 @@ func (*StreamUpdate) XXX_OneofWrappers() []interface{} { } } -// SubaccountPerpetualPosition provides information on a subaccount's updated -// perpetual positions. -type SubaccountPerpetualPosition struct { - // The `Id` of the `Perpetual`. - PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"` - // The size of the position in base quantums. - Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` -} - -func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetualPosition{} } -func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } -func (*SubaccountPerpetualPosition) ProtoMessage() {} -func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{17} -} -func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SubaccountPerpetualPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SubaccountPerpetualPosition.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 *SubaccountPerpetualPosition) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubaccountPerpetualPosition.Merge(m, src) -} -func (m *SubaccountPerpetualPosition) XXX_Size() int { - return m.Size() -} -func (m *SubaccountPerpetualPosition) XXX_DiscardUnknown() { - xxx_messageInfo_SubaccountPerpetualPosition.DiscardUnknown(m) -} - -var xxx_messageInfo_SubaccountPerpetualPosition proto.InternalMessageInfo - -func (m *SubaccountPerpetualPosition) GetPerpetualId() uint32 { - if m != nil { - return m.PerpetualId - } - return 0 -} - -func (m *SubaccountPerpetualPosition) GetQuantums() uint64 { - if m != nil { - return m.Quantums - } - return 0 -} - -// SubaccountAssetPosition provides information on a subaccount's updated asset -// positions. -type SubaccountAssetPosition struct { - // The `Id` of the `Asset`. - AssetId uint32 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` - // The absolute size of the position in base quantums. - Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` -} - -func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition{} } -func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } -func (*SubaccountAssetPosition) ProtoMessage() {} -func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{18} -} -func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SubaccountAssetPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SubaccountAssetPosition.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 *SubaccountAssetPosition) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubaccountAssetPosition.Merge(m, src) -} -func (m *SubaccountAssetPosition) XXX_Size() int { - return m.Size() -} -func (m *SubaccountAssetPosition) XXX_DiscardUnknown() { - xxx_messageInfo_SubaccountAssetPosition.DiscardUnknown(m) -} - -var xxx_messageInfo_SubaccountAssetPosition proto.InternalMessageInfo - -func (m *SubaccountAssetPosition) GetAssetId() uint32 { - if m != nil { - return m.AssetId - } - return 0 -} - -func (m *SubaccountAssetPosition) GetQuantums() uint64 { - if m != nil { - return m.Quantums - } - return 0 -} - -// StreamSubaccountUpdate provides information on a subaccount update. Used in -// the full node GRPC stream. -type StreamSubaccountUpdate struct { - SubaccountId *types.SubaccountId `protobuf:"bytes,1,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` - // updated_perpetual_positions will each be for unique perpetuals. - UpdatedPerpetualPositions []*SubaccountPerpetualPosition `protobuf:"bytes,2,rep,name=updated_perpetual_positions,json=updatedPerpetualPositions,proto3" json:"updated_perpetual_positions,omitempty"` - // updated_asset_positions will each be for unique assets. - UpdatedAssetPositions []*SubaccountAssetPosition `protobuf:"bytes,3,rep,name=updated_asset_positions,json=updatedAssetPositions,proto3" json:"updated_asset_positions,omitempty"` - // Snapshot indicates if the response is from a snapshot of the subaccount. - // All updates should be ignored until snapshot is received. - // If the snapshot is true, then all previous entries should be - // discarded and the subaccount should be resynced. - // For a snapshot subaccount update, the `updated_perpetual_positions` and - // `updated_asset_positions` fields will contain the full state of the - // subaccount. - Snapshot bool `protobuf:"varint,4,opt,name=snapshot,proto3" json:"snapshot,omitempty"` -} - -func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} } -func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } -func (*StreamSubaccountUpdate) ProtoMessage() {} -func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{19} -} -func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StreamSubaccountUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StreamSubaccountUpdate.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 *StreamSubaccountUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamSubaccountUpdate.Merge(m, src) -} -func (m *StreamSubaccountUpdate) XXX_Size() int { - return m.Size() -} -func (m *StreamSubaccountUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_StreamSubaccountUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamSubaccountUpdate proto.InternalMessageInfo - -func (m *StreamSubaccountUpdate) GetSubaccountId() *types.SubaccountId { - if m != nil { - return m.SubaccountId - } - return nil -} - -func (m *StreamSubaccountUpdate) GetUpdatedPerpetualPositions() []*SubaccountPerpetualPosition { - if m != nil { - return m.UpdatedPerpetualPositions - } - return nil -} - -func (m *StreamSubaccountUpdate) GetUpdatedAssetPositions() []*SubaccountAssetPosition { - if m != nil { - return m.UpdatedAssetPositions - } - return nil -} - -func (m *StreamSubaccountUpdate) GetSnapshot() bool { - if m != nil { - return m.Snapshot - } - return false -} - // StreamOrderbookUpdate provides information on an orderbook update. Used in // the full node GRPC stream. type StreamOrderbookUpdate struct { @@ -1212,7 +1021,7 @@ func (m *StreamOrderbookUpdate) Reset() { *m = StreamOrderbookUpdate{} } func (m *StreamOrderbookUpdate) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookUpdate) ProtoMessage() {} func (*StreamOrderbookUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{20} + return fileDescriptor_3365c195b25c5bc0, []int{17} } func (m *StreamOrderbookUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1272,7 +1081,7 @@ func (m *StreamOrderbookFill) Reset() { *m = StreamOrderbookFill{} } func (m *StreamOrderbookFill) String() string { return proto.CompactTextString(m) } func (*StreamOrderbookFill) ProtoMessage() {} func (*StreamOrderbookFill) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{21} + return fileDescriptor_3365c195b25c5bc0, []int{18} } func (m *StreamOrderbookFill) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1343,7 +1152,7 @@ func (m *StreamTakerOrder) Reset() { *m = StreamTakerOrder{} } func (m *StreamTakerOrder) String() string { return proto.CompactTextString(m) } func (*StreamTakerOrder) ProtoMessage() {} func (*StreamTakerOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{22} + return fileDescriptor_3365c195b25c5bc0, []int{19} } func (m *StreamTakerOrder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1446,7 +1255,7 @@ func (m *StreamTakerOrderStatus) Reset() { *m = StreamTakerOrderStatus{} func (m *StreamTakerOrderStatus) String() string { return proto.CompactTextString(m) } func (*StreamTakerOrderStatus) ProtoMessage() {} func (*StreamTakerOrderStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_3365c195b25c5bc0, []int{23} + return fileDescriptor_3365c195b25c5bc0, []int{20} } func (m *StreamTakerOrderStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1515,9 +1324,6 @@ func init() { proto.RegisterType((*StreamOrderbookUpdatesRequest)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesRequest") proto.RegisterType((*StreamOrderbookUpdatesResponse)(nil), "dydxprotocol.clob.StreamOrderbookUpdatesResponse") proto.RegisterType((*StreamUpdate)(nil), "dydxprotocol.clob.StreamUpdate") - proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.clob.SubaccountPerpetualPosition") - proto.RegisterType((*SubaccountAssetPosition)(nil), "dydxprotocol.clob.SubaccountAssetPosition") - proto.RegisterType((*StreamSubaccountUpdate)(nil), "dydxprotocol.clob.StreamSubaccountUpdate") proto.RegisterType((*StreamOrderbookUpdate)(nil), "dydxprotocol.clob.StreamOrderbookUpdate") proto.RegisterType((*StreamOrderbookFill)(nil), "dydxprotocol.clob.StreamOrderbookFill") proto.RegisterType((*StreamTakerOrder)(nil), "dydxprotocol.clob.StreamTakerOrder") @@ -1527,119 +1333,111 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1778 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x41, 0x6f, 0x1c, 0x49, - 0x15, 0x9e, 0x1e, 0x3b, 0xc9, 0xe4, 0x4d, 0x9c, 0x75, 0x2a, 0xeb, 0x64, 0x32, 0x76, 0xc6, 0x4e, - 0x2f, 0x71, 0xec, 0x2c, 0x99, 0x4e, 0xbc, 0xab, 0xd5, 0x92, 0xa0, 0x45, 0x76, 0x20, 0x71, 0x44, - 0xcc, 0xce, 0x76, 0xb2, 0x59, 0x0b, 0x22, 0xb5, 0x6a, 0xba, 0xcb, 0xe3, 0x96, 0xbb, 0xbb, 0xc6, - 0x5d, 0xd5, 0x23, 0x5b, 0x08, 0x21, 0x71, 0xd8, 0x0b, 0x20, 0xad, 0xc4, 0x81, 0x03, 0x12, 0x07, - 0x38, 0x23, 0x71, 0xe1, 0x88, 0x80, 0xdb, 0x1e, 0x23, 0x21, 0x24, 0x0e, 0x08, 0xa1, 0x84, 0x33, - 0xbf, 0x01, 0x75, 0x55, 0xf5, 0x4c, 0xf7, 0x74, 0xf7, 0x8c, 0xe3, 0x8b, 0x3d, 0xf5, 0xea, 0xbd, -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 0x17, 0x2e, 0xa5, 0x96, 0x4a, - 0x05, 0x3a, 0x5b, 0xba, 0x77, 0x24, 0xda, 0x68, 0xb1, 0x86, 0x91, 0xce, 0xb3, 0x31, 0x19, 0xba, - 0x01, 0x17, 0x64, 0xe7, 0xd9, 0x27, 0x6e, 0x6f, 0x9f, 0x37, 0xce, 0x88, 0x3e, 0x5f, 0x17, 0xb2, - 0x6d, 0x21, 0x42, 0x8b, 0x70, 0x9e, 0x1c, 0x11, 0xdb, 0xf2, 0xa9, 0x43, 0x1a, 0x67, 0xc5, 0x7c, - 0x2d, 0x16, 0xec, 0x50, 0x87, 0x6c, 0xcd, 0xc3, 0x45, 0x49, 0xc7, 0xf2, 0x09, 0x63, 0xb8, 0x47, - 0xf4, 0x97, 0xb0, 0x38, 0xf2, 0xdc, 0x21, 0x61, 0x9f, 0xf0, 0x08, 0x7b, 0x1d, 0xca, 0xdc, 0xb8, - 0x80, 0x63, 0x87, 0xfd, 0x44, 0x38, 0x3a, 0x58, 0xea, 0x43, 0xd9, 0x13, 0x07, 0x35, 0xa1, 0x76, - 0x18, 0xe1, 0x80, 0x47, 0x3e, 0x53, 0x5b, 0x79, 0x38, 0xd6, 0x3b, 0x70, 0x75, 0x84, 0xbe, 0xc9, - 0x18, 0xe1, 0x43, 0xe4, 0x6b, 0x50, 0xc3, 0xb1, 0x60, 0x84, 0x7a, 0x4e, 0x8c, 0xa7, 0x20, 0xfe, - 0xa3, 0x0a, 0x57, 0x8a, 0x13, 0x86, 0xbe, 0x0f, 0x73, 0x99, 0x1d, 0x52, 0x7c, 0xb7, 0x28, 0xdd, - 0x20, 0x17, 0xd2, 0x1b, 0x04, 0x05, 0xb0, 0x28, 0x33, 0xe5, 0x58, 0xa3, 0x04, 0xf4, 0x15, 0xf9, - 0x64, 0xef, 0x15, 0xf5, 0xf9, 0x09, 0xd9, 0x34, 0xaf, 0x29, 0xc8, 0xdc, 0x0c, 0x43, 0x5d, 0xb8, - 0x9a, 0xf8, 0x93, 0x69, 0x19, 0xf9, 0x9a, 0x11, 0xbe, 0x6e, 0x4f, 0xf4, 0x95, 0xc9, 0xad, 0xb9, - 0xa0, 0xa0, 0x32, 0x52, 0x16, 0xe7, 0x95, 0x05, 0xb8, 0xcf, 0xf6, 0x29, 0x17, 0xe5, 0x58, 0x33, - 0x87, 0x63, 0xfd, 0x97, 0x1a, 0x2c, 0x14, 0xee, 0x38, 0xb4, 0x3b, 0xde, 0x07, 0x3e, 0xce, 0x32, - 0x51, 0x37, 0xfd, 0x76, 0xfe, 0x5e, 0xff, 0xe9, 0xde, 0xde, 0xc3, 0x58, 0x20, 0x81, 0x5e, 0xdc, - 0x1b, 0x6b, 0x10, 0x19, 0x3e, 0xd5, 0x31, 0x3e, 0x7f, 0xd0, 0xe0, 0x72, 0xc1, 0x86, 0x45, 0x0f, - 0x40, 0x34, 0x45, 0x79, 0x7f, 0x54, 0x2b, 0xbc, 0x54, 0x72, 0xef, 0x15, 0xf7, 0x43, 0x53, 0x5c, - 0x93, 0xc5, 0x4f, 0xf4, 0x11, 0x9c, 0x15, 0x5b, 0x3b, 0x59, 0xbf, 0x46, 0xd9, 0x61, 0xa9, 0x98, - 0x2a, 0xed, 0x78, 0x17, 0xa4, 0x0e, 0x2c, 0xb9, 0x22, 0xb3, 0x66, 0x7d, 0x74, 0x62, 0x31, 0xfd, - 0xcb, 0x2a, 0xcc, 0x8f, 0xb7, 0x05, 0x74, 0x17, 0xce, 0xc8, 0x56, 0x22, 0x79, 0x96, 0xba, 0xdb, - 0xae, 0x98, 0x52, 0x31, 0x6e, 0x1d, 0xa9, 0xf3, 0x43, 0x35, 0xa2, 0xea, 0x94, 0xd6, 0x91, 0x3a, - 0x8b, 0x12, 0xb8, 0x79, 0x6f, 0x4c, 0x86, 0xbe, 0x00, 0x94, 0x6a, 0x6e, 0x16, 0xe3, 0x98, 0x47, - 0x4c, 0xf5, 0xb8, 0xf5, 0x13, 0xf4, 0xb8, 0x67, 0xc2, 0xc0, 0x9c, 0xe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 0x0c, 0x18, 0x43, 0xc9, 0x91, 0x4c, 0x28, 0x3f, 0xee, 0x13, 0xd6, - 0x3d, 0x2b, 0xc4, 0x1f, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x19, 0x57, 0xae, 0xd7, 0x15, - 0x00, 0x00, + // 1656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x41, 0x4f, 0xdc, 0x46, + 0x14, 0x5e, 0xb3, 0x84, 0xc0, 0xdb, 0x40, 0x60, 0x08, 0xc9, 0x66, 0x21, 0x0b, 0x71, 0x1a, 0xb2, + 0x90, 0x66, 0x0d, 0x24, 0x8a, 0xd2, 0x50, 0xa5, 0x02, 0x5a, 0x42, 0xa4, 0xd0, 0x10, 0x43, 0x12, + 0xd4, 0x46, 0xb2, 0xbc, 0xf6, 0xb0, 0x58, 0xd8, 0x9e, 0xc5, 0x1e, 0xaf, 0x40, 0x55, 0x55, 0xa9, + 0x87, 0x5c, 0xda, 0x4a, 0x91, 0x7a, 0xe8, 0xa1, 0x52, 0x2f, 0x3d, 0xf5, 0x50, 0xa9, 0x97, 0x1e, + 0xab, 0xb6, 0xb7, 0x1c, 0x23, 0xf5, 0xd2, 0x43, 0x55, 0x55, 0x49, 0xcf, 0xfd, 0x0d, 0x95, 0x67, + 0xc6, 0x8b, 0x77, 0xd7, 0x5e, 0x08, 0x17, 0xb0, 0xdf, 0xbc, 0xf7, 0xe6, 0x7b, 0xef, 0x7d, 0xf3, + 0xe6, 0x79, 0xe1, 0x82, 0xb9, 0x6f, 0xee, 0xd5, 0x3c, 0x42, 0x89, 0x41, 0x6c, 0xc5, 0xb0, 0x49, + 0x45, 0xd9, 0x0d, 0xb0, 0xb7, 0x5f, 0x66, 0x32, 0x34, 0x14, 0x5f, 0x2e, 0x87, 0xcb, 0x85, 0x33, + 0x55, 0x52, 0x25, 0x4c, 0xa4, 0x84,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x6b, 0xab, 0x67, 0x98, 0x97, 0x35, 0xe1, 0x44, 0x48, 0xd1, 0xc7, 0x30, 0x52, 0x8f, 0x94, + 0x35, 0x07, 0xd7, 0x35, 0x07, 0x53, 0xcf, 0x32, 0xfc, 0x46, 0x54, 0xed, 0xce, 0x9b, 0x00, 0xaf, + 0x72, 0x75, 0x75, 0xb8, 0x1e, 0xdf, 0x92, 0x0b, 0xe5, 0xff, 0x24, 0x98, 0x48, 0x0f, 0x4f, 0x14, + 0xa3, 0x0a, 0x27, 0x3d, 0xec, 0x07, 0x36, 0xf5, 0x45, 0x29, 0xee, 0x1e, 0xb6, 0x67, 0x82, 0x97, + 0x50, 0x61, 0xc1, 0x35, 0x1f, 0x13, 0x3b, 0x70, 0xf0, 0x1a, 0xf6, 0xc2, 0xd2, 0x89, 0xb2, 0x45, + 0xde, 0x0b, 0x3a, 0x0c, 0x27, 0x68, 0xa1, 0x09, 0x38, 0xd5, 0x20, 0x83, 0xd6, 0xe0, 0x3f, 0x44, + 0xc5, 0xbe, 0x67, 0xa2, 0x41, 0xc8, 0x3a, 0xb8, 0xce, 0x32, 0xd2, 0xa5, 0x86, 0x8f, 0xe8, 0x2c, + 0xf4, 0xd4, 0x99, 0x93, 0x7c, 0x76, 0x42, 0x2a, 0x75, 0xab, 0xe2, 0x4d, 0x9e, 0x86, 0x12, 0x23, + 0xdd, 0x07, 0xac, 0x45, 0x6d, 0x58, 0xd8, 0xbb, 0x1f, 0x36, 0xa8, 0x25, 0xd6, 0x32, 0x02, 0x2f, + 0x5e, 0x57, 0xf9, 0x5b, 0x09, 0xa6, 0x8e, 0xa0, 0x2c, 0xb2, 0xe4, 0x42, 0x3e, 0xad, 0xef, 0x09, + 0x1e, 0x28, 0x09, 0x69, 0xeb, 0xe4, 0x5a, 0xa4, 0x67, 0x04, 0x27, 0xe9, 0xc8, 0x53, 0x70, 0x85, + 0x81, 0x5b, 0x0c, 0x49, 0xa3, 0xea, 0x14, 0xa7, 0x07, 0xf2, 0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, 0x17, 0x33, 0x1f, 0xdd, 0xac, 0x5a, 0x74, 0x3b, + 0xa8, 0x94, 0x0d, 0xe2, 0x34, 0x27, 0xaf, 0x7e, 0xe3, 0x1a, 0x1b, 0x06, 0x94, 0x86, 0x64, 0x8f, + 0x27, 0x94, 0xee, 0xd7, 0xb0, 0x5f, 0xe9, 0x61, 0xe2, 0xeb, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, + 0x4d, 0x56, 0xef, 0xe3, 0x00, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2755,145 +2553,6 @@ func (m *StreamUpdate_SubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } -func (m *SubaccountPerpetualPosition) 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 *SubaccountPerpetualPosition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SubaccountPerpetualPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Quantums != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Quantums)) - i-- - dAtA[i] = 0x10 - } - if m.PerpetualId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.PerpetualId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SubaccountAssetPosition) 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 *SubaccountAssetPosition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SubaccountAssetPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Quantums != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Quantums)) - i-- - dAtA[i] = 0x10 - } - if m.AssetId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.AssetId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StreamSubaccountUpdate) 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 *StreamSubaccountUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StreamSubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Snapshot { - i-- - if m.Snapshot { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.UpdatedAssetPositions) > 0 { - for iNdEx := len(m.UpdatedAssetPositions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UpdatedAssetPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.UpdatedPerpetualPositions) > 0 { - for iNdEx := len(m.UpdatedPerpetualPositions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UpdatedPerpetualPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.SubaccountId != nil { - { - size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *StreamOrderbookUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2962,20 +2621,20 @@ func (m *StreamOrderbookFill) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.FillAmounts) > 0 { - dAtA19 := make([]byte, len(m.FillAmounts)*10) - var j18 int + dAtA18 := make([]byte, len(m.FillAmounts)*10) + var j17 int for _, num := range m.FillAmounts { for num >= 1<<7 { - dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) + dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j18++ + j17++ } - dAtA19[j18] = uint8(num) - j18++ + dAtA18[j17] = uint8(num) + j17++ } - i -= j18 - copy(dAtA[i:], dAtA19[:j18]) - i = encodeVarintQuery(dAtA, i, uint64(j18)) + i -= j17 + copy(dAtA[i:], dAtA18[:j17]) + i = encodeVarintQuery(dAtA, i, uint64(j17)) i-- dAtA[i] = 0x1a } @@ -3439,119 +3098,61 @@ func (m *StreamUpdate_SubaccountUpdate) Size() (n int) { } return n } -func (m *SubaccountPerpetualPosition) Size() (n int) { +func (m *StreamOrderbookUpdate) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.PerpetualId != 0 { - n += 1 + sovQuery(uint64(m.PerpetualId)) + if len(m.Updates) > 0 { + for _, e := range m.Updates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } - if m.Quantums != 0 { - n += 1 + sovQuery(uint64(m.Quantums)) + if m.Snapshot { + n += 2 } return n } -func (m *SubaccountAssetPosition) Size() (n int) { +func (m *StreamOrderbookFill) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.AssetId != 0 { - n += 1 + sovQuery(uint64(m.AssetId)) + if m.ClobMatch != nil { + l = m.ClobMatch.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } - if m.Quantums != 0 { - n += 1 + sovQuery(uint64(m.Quantums)) + if len(m.FillAmounts) > 0 { + l = 0 + for _, e := range m.FillAmounts { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l } return n } -func (m *StreamSubaccountUpdate) Size() (n int) { +func (m *StreamTakerOrder) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.SubaccountId != nil { - l = m.SubaccountId.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.UpdatedPerpetualPositions) > 0 { - for _, e := range m.UpdatedPerpetualPositions { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.UpdatedAssetPositions) > 0 { - for _, e := range m.UpdatedAssetPositions { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Snapshot { - n += 2 - } - return n -} - -func (m *StreamOrderbookUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Updates) > 0 { - for _, e := range m.Updates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Snapshot { - n += 2 - } - return n -} - -func (m *StreamOrderbookFill) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClobMatch != nil { - l = m.ClobMatch.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Orders) > 0 { - for _, e := range m.Orders { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.FillAmounts) > 0 { - l = 0 - for _, e := range m.FillAmounts { - l += sovQuery(uint64(e)) - } - n += 1 + sovQuery(uint64(l)) + l - } - return n -} - -func (m *StreamTakerOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TakerOrder != nil { - n += m.TakerOrder.Size() - } - if m.TakerOrderStatus != nil { - l = m.TakerOrderStatus.Size() + if m.TakerOrder != nil { + n += m.TakerOrder.Size() + } + if m.TakerOrderStatus != nil { + l = m.TakerOrderStatus.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -5279,7 +4880,7 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &StreamSubaccountUpdate{} + v := &types.StreamSubaccountUpdate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5344,356 +4945,6 @@ func (m *StreamUpdate) Unmarshal(dAtA []byte) error { } return nil } -func (m *SubaccountPerpetualPosition) 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: SubaccountPerpetualPosition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubaccountPerpetualPosition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PerpetualId", wireType) - } - m.PerpetualId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PerpetualId |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) - } - m.Quantums = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Quantums |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *SubaccountAssetPosition) 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: SubaccountAssetPosition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubaccountAssetPosition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) - } - m.AssetId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AssetId |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) - } - m.Quantums = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Quantums |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *StreamSubaccountUpdate) 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: StreamSubaccountUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamSubaccountUpdate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubaccountId", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SubaccountId == nil { - m.SubaccountId = &types.SubaccountId{} - } - if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdatedPerpetualPositions", 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.UpdatedPerpetualPositions = append(m.UpdatedPerpetualPositions, &SubaccountPerpetualPosition{}) - if err := m.UpdatedPerpetualPositions[len(m.UpdatedPerpetualPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAssetPositions", 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.UpdatedAssetPositions = append(m.UpdatedAssetPositions, &SubaccountAssetPosition{}) - if err := m.UpdatedAssetPositions[len(m.UpdatedAssetPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Snapshot = bool(v != 0) - 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 *StreamOrderbookUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/subaccounts/keeper/keeper.go b/protocol/x/subaccounts/keeper/keeper.go index 084f848a80..1d82f9d1ea 100644 --- a/protocol/x/subaccounts/keeper/keeper.go +++ b/protocol/x/subaccounts/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + streamingtypes "github.com/dydxprotocol/v4-chain/protocol/streaming/types" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -21,6 +22,7 @@ type ( blocktimeKeeper types.BlocktimeKeeper revShareKeeper types.RevShareKeeper indexerEventManager indexer_manager.IndexerEventManager + streamingManager streamingtypes.FullNodeStreamingManager } ) @@ -33,6 +35,7 @@ func NewKeeper( blocktimeKeeper types.BlocktimeKeeper, revShareKeeper types.RevShareKeeper, indexerEventManager indexer_manager.IndexerEventManager, + streamingManager streamingtypes.FullNodeStreamingManager, ) *Keeper { return &Keeper{ cdc: cdc, @@ -43,6 +46,7 @@ func NewKeeper( blocktimeKeeper: blocktimeKeeper, revShareKeeper: revShareKeeper, indexerEventManager: indexerEventManager, + streamingManager: streamingManager, } } diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index dc860954d8..d66cca3675 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -3,6 +3,7 @@ package keeper import ( "errors" "fmt" + streamingtypes "github.com/dydxprotocol/v4-chain/protocol/streaming/types" "math/big" "math/rand" "time" @@ -735,3 +736,22 @@ func (k Keeper) GetAllRelevantPerpetuals( return perpInfos, nil } + +func (k Keeper) GetFullNodeStreamingManager() streamingtypes.FullNodeStreamingManager { + return k.streamingManager +} + +// SendSubaccountUpdates sends the subaccount updates to the gRPC streaming manager. +func (k Keeper) SendSubaccountUpdates( + ctx sdk.Context, + subaccountUpdates []types.StreamSubaccountUpdate, +) { + if len(subaccountUpdates) == 0 { + return + } + k.GetFullNodeStreamingManager().SendSubaccountUpdates( + subaccountUpdates, + lib.MustConvertIntegerToUint32(ctx.BlockHeight()), + ctx.ExecMode(), + ) +} diff --git a/protocol/x/subaccounts/types/streaming.pb.go b/protocol/x/subaccounts/types/streaming.pb.go new file mode 100644 index 0000000000..2babfbf862 --- /dev/null +++ b/protocol/x/subaccounts/types/streaming.pb.go @@ -0,0 +1,900 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/subaccounts/streaming.proto + +package types + +import ( + fmt "fmt" + 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 + +// StreamSubaccountUpdate provides information on a subaccount update. Used in +// the full node GRPC stream. +type StreamSubaccountUpdate struct { + SubaccountId *SubaccountId `protobuf:"bytes,1,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` + // updated_perpetual_positions will each be for unique perpetuals. + UpdatedPerpetualPositions []*SubaccountPerpetualPosition `protobuf:"bytes,2,rep,name=updated_perpetual_positions,json=updatedPerpetualPositions,proto3" json:"updated_perpetual_positions,omitempty"` + // updated_asset_positions will each be for unique assets. + UpdatedAssetPositions []*SubaccountAssetPosition `protobuf:"bytes,3,rep,name=updated_asset_positions,json=updatedAssetPositions,proto3" json:"updated_asset_positions,omitempty"` + // Snapshot indicates if the response is from a snapshot of the subaccount. + // All updates should be ignored until snapshot is received. + // If the snapshot is true, then all previous entries should be + // discarded and the subaccount should be resynced. + // For a snapshot subaccount update, the `updated_perpetual_positions` and + // `updated_asset_positions` fields will contain the full state of the + // subaccount. + Snapshot bool `protobuf:"varint,4,opt,name=snapshot,proto3" json:"snapshot,omitempty"` +} + +func (m *StreamSubaccountUpdate) Reset() { *m = StreamSubaccountUpdate{} } +func (m *StreamSubaccountUpdate) String() string { return proto.CompactTextString(m) } +func (*StreamSubaccountUpdate) ProtoMessage() {} +func (*StreamSubaccountUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_e6cf3092946c3c13, []int{0} +} +func (m *StreamSubaccountUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StreamSubaccountUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StreamSubaccountUpdate.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 *StreamSubaccountUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamSubaccountUpdate.Merge(m, src) +} +func (m *StreamSubaccountUpdate) XXX_Size() int { + return m.Size() +} +func (m *StreamSubaccountUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_StreamSubaccountUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamSubaccountUpdate proto.InternalMessageInfo + +func (m *StreamSubaccountUpdate) GetSubaccountId() *SubaccountId { + if m != nil { + return m.SubaccountId + } + return nil +} + +func (m *StreamSubaccountUpdate) GetUpdatedPerpetualPositions() []*SubaccountPerpetualPosition { + if m != nil { + return m.UpdatedPerpetualPositions + } + return nil +} + +func (m *StreamSubaccountUpdate) GetUpdatedAssetPositions() []*SubaccountAssetPosition { + if m != nil { + return m.UpdatedAssetPositions + } + return nil +} + +func (m *StreamSubaccountUpdate) GetSnapshot() bool { + if m != nil { + return m.Snapshot + } + return false +} + +// SubaccountPerpetualPosition provides information on a subaccount's updated +// perpetual positions. +type SubaccountPerpetualPosition struct { + // The `Id` of the `Perpetual`. + PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"` + // The size of the position in base quantums. + Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` +} + +func (m *SubaccountPerpetualPosition) Reset() { *m = SubaccountPerpetualPosition{} } +func (m *SubaccountPerpetualPosition) String() string { return proto.CompactTextString(m) } +func (*SubaccountPerpetualPosition) ProtoMessage() {} +func (*SubaccountPerpetualPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_e6cf3092946c3c13, []int{1} +} +func (m *SubaccountPerpetualPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubaccountPerpetualPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubaccountPerpetualPosition.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 *SubaccountPerpetualPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubaccountPerpetualPosition.Merge(m, src) +} +func (m *SubaccountPerpetualPosition) XXX_Size() int { + return m.Size() +} +func (m *SubaccountPerpetualPosition) XXX_DiscardUnknown() { + xxx_messageInfo_SubaccountPerpetualPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_SubaccountPerpetualPosition proto.InternalMessageInfo + +func (m *SubaccountPerpetualPosition) GetPerpetualId() uint32 { + if m != nil { + return m.PerpetualId + } + return 0 +} + +func (m *SubaccountPerpetualPosition) GetQuantums() uint64 { + if m != nil { + return m.Quantums + } + return 0 +} + +// SubaccountAssetPosition provides information on a subaccount's updated asset +// positions. +type SubaccountAssetPosition struct { + // The `Id` of the `Asset`. + AssetId uint32 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // The absolute size of the position in base quantums. + Quantums uint64 `protobuf:"varint,2,opt,name=quantums,proto3" json:"quantums,omitempty"` +} + +func (m *SubaccountAssetPosition) Reset() { *m = SubaccountAssetPosition{} } +func (m *SubaccountAssetPosition) String() string { return proto.CompactTextString(m) } +func (*SubaccountAssetPosition) ProtoMessage() {} +func (*SubaccountAssetPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_e6cf3092946c3c13, []int{2} +} +func (m *SubaccountAssetPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubaccountAssetPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubaccountAssetPosition.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 *SubaccountAssetPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubaccountAssetPosition.Merge(m, src) +} +func (m *SubaccountAssetPosition) XXX_Size() int { + return m.Size() +} +func (m *SubaccountAssetPosition) XXX_DiscardUnknown() { + xxx_messageInfo_SubaccountAssetPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_SubaccountAssetPosition proto.InternalMessageInfo + +func (m *SubaccountAssetPosition) GetAssetId() uint32 { + if m != nil { + return m.AssetId + } + return 0 +} + +func (m *SubaccountAssetPosition) GetQuantums() uint64 { + if m != nil { + return m.Quantums + } + return 0 +} + +func init() { + proto.RegisterType((*StreamSubaccountUpdate)(nil), "dydxprotocol.subaccounts.StreamSubaccountUpdate") + proto.RegisterType((*SubaccountPerpetualPosition)(nil), "dydxprotocol.subaccounts.SubaccountPerpetualPosition") + proto.RegisterType((*SubaccountAssetPosition)(nil), "dydxprotocol.subaccounts.SubaccountAssetPosition") +} + +func init() { + proto.RegisterFile("dydxprotocol/subaccounts/streaming.proto", fileDescriptor_e6cf3092946c3c13) +} + +var fileDescriptor_e6cf3092946c3c13 = []byte{ + // 353 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6a, 0xea, 0x40, + 0x14, 0x86, 0x1d, 0x95, 0x7b, 0x65, 0xd4, 0xcd, 0xc0, 0xbd, 0x46, 0x85, 0x60, 0x5d, 0x94, 0x74, + 0xd1, 0x84, 0xda, 0x76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ab, 0x02, 0x69, 0xe0, 0x12, + 0x44, 0x54, 0xc2, 0x58, 0x28, 0xab, 0xd8, 0x42, 0x4e, 0xc9, 0x37, 0xba, 0xfd, 0x8a, 0x9b, 0x47, + 0x1e, 0x40, 0xce, 0x70, 0x65, 0xb7, 0x94, 0x74, 0xd1, 0x55, 0xbf, 0x6c, 0x6a, 0x5d, 0xb6, 0xa6, + 0xbf, 0x69, 0x1a, 0x29, 0x3d, 0x5d, 0x2f, 0x0b, 0x39, 0x45, 0xdf, 0xe8, 0x76, 0x0f, 0xd7, 0x0e, + 0xfc, 0x2b, 0xa9, 0xe3, 0xd2, 0xe6, 0xdd, 0x86, 0xfa, 0x37, 0xd1, 0xc7, 0x89, 0x0f, 0xcf, 0x9f, + 0x2b, 0x1b, 0x2d, 0x57, 0x36, 0xfa, 0x5e, 0xd9, 0xe8, 0x23, 0xb6, 0x73, 0xcb, 0xd8, 0xce, 0x7d, + 0xc5, 0x76, 0xee, 0xe5, 0x6e, 0xc4, 0xd5, 0x58, 0x0f, 0xdd, 0x40, 0x4c, 0xbd, 0xbd, 0x2b, 0x7b, + 0xbf, 0xb9, 0x0c, 0xc6, 0x94, 0x47, 0x9e, 0xa9, 0xcc, 0xf7, 0x2e, 0x4f, 0x2d, 0x64, 0x08, 0xc3, + 0x3f, 0x89, 0x7b, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x34, 0x6c, 0x66, 0xe6, 0x02, 0x00, + 0x00, +} + +func (m *StreamSubaccountUpdate) 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 *StreamSubaccountUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StreamSubaccountUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Snapshot { + i-- + if m.Snapshot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.UpdatedAssetPositions) > 0 { + for iNdEx := len(m.UpdatedAssetPositions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UpdatedAssetPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStreaming(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.UpdatedPerpetualPositions) > 0 { + for iNdEx := len(m.UpdatedPerpetualPositions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UpdatedPerpetualPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStreaming(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.SubaccountId != nil { + { + size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStreaming(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubaccountPerpetualPosition) 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 *SubaccountPerpetualPosition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubaccountPerpetualPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Quantums != 0 { + i = encodeVarintStreaming(dAtA, i, uint64(m.Quantums)) + i-- + dAtA[i] = 0x10 + } + if m.PerpetualId != 0 { + i = encodeVarintStreaming(dAtA, i, uint64(m.PerpetualId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SubaccountAssetPosition) 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 *SubaccountAssetPosition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubaccountAssetPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Quantums != 0 { + i = encodeVarintStreaming(dAtA, i, uint64(m.Quantums)) + i-- + dAtA[i] = 0x10 + } + if m.AssetId != 0 { + i = encodeVarintStreaming(dAtA, i, uint64(m.AssetId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStreaming(dAtA []byte, offset int, v uint64) int { + offset -= sovStreaming(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StreamSubaccountUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SubaccountId != nil { + l = m.SubaccountId.Size() + n += 1 + l + sovStreaming(uint64(l)) + } + if len(m.UpdatedPerpetualPositions) > 0 { + for _, e := range m.UpdatedPerpetualPositions { + l = e.Size() + n += 1 + l + sovStreaming(uint64(l)) + } + } + if len(m.UpdatedAssetPositions) > 0 { + for _, e := range m.UpdatedAssetPositions { + l = e.Size() + n += 1 + l + sovStreaming(uint64(l)) + } + } + if m.Snapshot { + n += 2 + } + return n +} + +func (m *SubaccountPerpetualPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PerpetualId != 0 { + n += 1 + sovStreaming(uint64(m.PerpetualId)) + } + if m.Quantums != 0 { + n += 1 + sovStreaming(uint64(m.Quantums)) + } + return n +} + +func (m *SubaccountAssetPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AssetId != 0 { + n += 1 + sovStreaming(uint64(m.AssetId)) + } + if m.Quantums != 0 { + n += 1 + sovStreaming(uint64(m.Quantums)) + } + return n +} + +func sovStreaming(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStreaming(x uint64) (n int) { + return sovStreaming(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StreamSubaccountUpdate) 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 ErrIntOverflowStreaming + } + 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: StreamSubaccountUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamSubaccountUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStreaming + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStreaming + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubaccountId == nil { + m.SubaccountId = &SubaccountId{} + } + if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedPerpetualPositions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStreaming + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStreaming + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpdatedPerpetualPositions = append(m.UpdatedPerpetualPositions, &SubaccountPerpetualPosition{}) + if err := m.UpdatedPerpetualPositions[len(m.UpdatedPerpetualPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAssetPositions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStreaming + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStreaming + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UpdatedAssetPositions = append(m.UpdatedAssetPositions, &SubaccountAssetPosition{}) + if err := m.UpdatedAssetPositions[len(m.UpdatedAssetPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Snapshot = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipStreaming(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStreaming + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubaccountPerpetualPosition) 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 ErrIntOverflowStreaming + } + 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: SubaccountPerpetualPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubaccountPerpetualPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PerpetualId", wireType) + } + m.PerpetualId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PerpetualId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) + } + m.Quantums = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Quantums |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStreaming(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStreaming + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubaccountAssetPosition) 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 ErrIntOverflowStreaming + } + 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: SubaccountAssetPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubaccountAssetPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + } + m.AssetId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AssetId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantums", wireType) + } + m.Quantums = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStreaming + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Quantums |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStreaming(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStreaming + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStreaming(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, ErrIntOverflowStreaming + } + 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, ErrIntOverflowStreaming + } + 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, ErrIntOverflowStreaming + } + 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, ErrInvalidLengthStreaming + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStreaming + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStreaming + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStreaming = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStreaming = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStreaming = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/subaccounts/types/types.go b/protocol/x/subaccounts/types/types.go index 0212e23791..dd8bd473bd 100644 --- a/protocol/x/subaccounts/types/types.go +++ b/protocol/x/subaccounts/types/types.go @@ -72,4 +72,8 @@ type SubaccountsKeeper interface { perpetualId uint32, blockHeight uint32, ) error + SendSubaccountUpdates( + ctx sdk.Context, + subaccountUpdates []StreamSubaccountUpdate, + ) } From 1ab0669ec383fdd5ad69d78053ddf5519fb96df7 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 15:49:29 -0400 Subject: [PATCH 19/37] add su update --- .../streaming/full_node_streaming_manager.go | 2 + protocol/x/subaccounts/keeper/subaccount.go | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index a0041ffcbe..fc0d897525 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -610,6 +610,8 @@ func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( allUpdates.Append(updatesByClobPairId[clobPairId]) } + // TODO(CT-1047): send subaccount snapshot + sm.SendSnapshot(allUpdates, subscriptionId, blockHeight, execMode) }, ) diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index d66cca3675..2440314ff1 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -254,6 +254,35 @@ func (k Keeper) getSettledUpdates( return settledUpdates, subaccountIdToFundingPayments, nil } +func GenerateStreamSubaccountUpdate( + settledUpdate types.SettledUpdate, +) types.StreamSubaccountUpdate { + // Convert AssetPositions from SettledSubaccount to SubaccountAssetPosition + updatedAssetPositions := make([]*types.SubaccountAssetPosition, len(settledUpdate.SettledSubaccount.AssetPositions)) + for i, ap := range settledUpdate.SettledSubaccount.AssetPositions { + updatedAssetPositions[i] = &types.SubaccountAssetPosition{ + AssetId: ap.AssetId, + Quantums: ap.Quantums.BigInt().Uint64(), + } + } + + // Convert PerpetualPositions from SettledSubaccount to SubaccountPerpetualPosition + updatedPerpetualPositions := make([]*types.SubaccountPerpetualPosition, len(settledUpdate.SettledSubaccount.PerpetualPositions)) + for i, pp := range settledUpdate.SettledSubaccount.PerpetualPositions { + updatedPerpetualPositions[i] = &types.SubaccountPerpetualPosition{ + PerpetualId: pp.PerpetualId, + Quantums: pp.Quantums.BigInt().Uint64(), + } + } + + return types.StreamSubaccountUpdate{ + SubaccountId: settledUpdate.SettledSubaccount.Id, + UpdatedAssetPositions: updatedAssetPositions, + UpdatedPerpetualPositions: updatedPerpetualPositions, + Snapshot: false, + } +} + // UpdateSubaccounts validates and applies all `updates` to the relevant subaccounts as long as this is a // valid state-transition for all subaccounts involved. All `updates` are made atomically, meaning that // all state-changes will either succeed or all will fail. @@ -370,6 +399,17 @@ func (k Keeper) UpdateSubaccounts( ), ) + // if GRPC streaming is on, emit a generated subaccount update to stream. + if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { + subaccountUpdate := GenerateStreamSubaccountUpdate(u) + k.SendSubaccountUpdates( + ctx, + []types.StreamSubaccountUpdate{ + subaccountUpdate, + }, + ) + } + // Emit an event indicating a funding payment was paid / received for each settled funding // payment. Note that `fundingPaid` is positive if the subaccount paid funding, // and negative if the subaccount received funding. From 079ffd538f8481e635c86a642998f06fc2c283cb Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 16:47:04 -0400 Subject: [PATCH 20/37] add snapshotting logic --- protocol/lib/metrics/metric_keys.go | 1 + .../streaming/full_node_streaming_manager.go | 70 ++++++++++++++++++- protocol/streaming/noop_streaming_manager.go | 1 + protocol/streaming/types/interface.go | 1 + protocol/x/clob/keeper/keeper.go | 28 ++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) diff --git a/protocol/lib/metrics/metric_keys.go b/protocol/lib/metrics/metric_keys.go index 59c5427d3e..088e742386 100644 --- a/protocol/lib/metrics/metric_keys.go +++ b/protocol/lib/metrics/metric_keys.go @@ -69,6 +69,7 @@ const ( FullNodeGrpc = "full_node_grpc" GrpcSendOrderbookUpdatesLatency = "grpc_send_orderbook_updates_latency" GrpcSendOrderbookSnapshotLatency = "grpc_send_orderbook_snapshot_latency" + GrpcSendSubaccountSnapshotLatency = "grpc_send_subaccount_snapshot_latency" GrpcSendOrderbookFillsLatency = "grpc_send_orderbook_fills_latency" GrpcSendSubaccountUpdatesLatency = "grpc_send_subaccount_updates_latency" GrpcAddUpdateToBufferCount = "grpc_add_update_to_buffer_count" diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index fc0d897525..c826b0ceed 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -338,6 +338,65 @@ func (sm *FullNodeStreamingManagerImpl) SendSnapshot( } } +// SendSubaccountSnapshot sends a subaccount snapshot to a particular subscriber +// without buffering. +// Note this method requires the lock and assumes that the lock has already been +// acquired by the caller. +func (sm *FullNodeStreamingManagerImpl) SendSubaccountSnapshot( + snapshot *satypes.StreamSubaccountUpdate, + subscriptionId uint32, + blockHeight uint32, + execMode sdk.ExecMode, +) { + defer metrics.ModuleMeasureSince( + metrics.FullNodeGrpc, + metrics.GrpcSendSubaccountSnapshotLatency, + time.Now(), + ) + + removeSubscription := false + subscription, ok := sm.orderbookSubscriptions[subscriptionId] + if !ok { + sm.logger.Error( + fmt.Sprintf( + "Streaming subscription id %+v not found. This should not happen.", + subscriptionId, + ), + ) + return + } + streamUpdates := []clobtypes.StreamUpdate{ + { + UpdateMessage: &clobtypes.StreamUpdate_SubaccountUpdate{ + SubaccountUpdate: snapshot, + }, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + }, + } + metrics.IncrCounter( + metrics.GrpcAddToSubscriptionChannelCount, + 1, + ) + select { + case subscription.updatesChannel <- streamUpdates: + default: + sm.logger.Error( + fmt.Sprintf( + "Streaming subscription id %+v channel full capacity. Dropping subscription connection.", + subscriptionId, + ), + ) + removeSubscription = true + } + + // Clean up subscriptions that have been closed. + // If a Send update has failed for any clob pair id, the whole subscription will be removed. + if removeSubscription { + sm.removeSubscription(subscriptionId) + } +} + // SendOrderbookUpdates groups updates by their clob pair ids and // sends messages to the subscribers. func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( @@ -588,6 +647,7 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, + getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) { @@ -610,9 +670,15 @@ func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( allUpdates.Append(updatesByClobPairId[clobPairId]) } - // TODO(CT-1047): send subaccount snapshot - sm.SendSnapshot(allUpdates, subscriptionId, blockHeight, execMode) + for _, subaccountId := range subscription.subaccountIds { + sm.SendSubaccountSnapshot( + getSubaccountSnapshot(subaccountId), + subscriptionId, + blockHeight, + execMode, + ) + } }, ) } diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 2fedbaebb9..6a3116c8f7 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -53,6 +53,7 @@ func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( func (sm *NoopGrpcStreamingManager) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, + getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) { diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index 901257de37..2715ac246b 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -22,6 +22,7 @@ type FullNodeStreamingManager interface { // L3+ Orderbook updates. InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, + getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) diff --git a/protocol/x/clob/keeper/keeper.go b/protocol/x/clob/keeper/keeper.go index 92921b9afb..ec1bfe8cc3 100644 --- a/protocol/x/clob/keeper/keeper.go +++ b/protocol/x/clob/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "errors" "fmt" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" "sync/atomic" "cosmossdk.io/log" @@ -262,6 +263,33 @@ func (k Keeper) InitializeNewStreams(ctx sdk.Context) { clobPairId, ) }, + func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate { + subaccount := k.subaccountsKeeper.GetSubaccount( + ctx, + *subaccountId, + ) + assetPositions := make([]*satypes.SubaccountAssetPosition, len(subaccount.AssetPositions)) + for i, ap := range subaccount.AssetPositions { + assetPositions[i] = &satypes.SubaccountAssetPosition{ + AssetId: ap.AssetId, + Quantums: ap.Quantums.BigInt().Uint64(), + } + } + perpetualPositions := make([]*satypes.SubaccountPerpetualPosition, len(subaccount.PerpetualPositions)) + for i, pp := range subaccount.PerpetualPositions { + perpetualPositions[i] = &satypes.SubaccountPerpetualPosition{ + PerpetualId: pp.PerpetualId, + Quantums: pp.Quantums.BigInt().Uint64(), + } + } + + return &satypes.StreamSubaccountUpdate{ + SubaccountId: subaccountId, + UpdatedAssetPositions: assetPositions, + UpdatedPerpetualPositions: perpetualPositions, + Snapshot: false, + } + }, lib.MustConvertIntegerToUint32(ctx.BlockHeight()), ctx.ExecMode(), ) From 3d5db4ecf10ddfe92384997928455c6d110a146a Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 16:53:47 -0400 Subject: [PATCH 21/37] updates --- .../src/codegen/dydxprotocol/clob/query.ts | 283 ------------------ 1 file changed, 283 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts index 60d0f764f4..27872be567 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -321,104 +321,6 @@ export interface StreamUpdateSDKType { exec_mode: number; } -/** - * SubaccountPerpetualPosition provides information on a subaccount's updated - * perpetual positions. - */ - -export interface SubaccountPerpetualPosition { - /** The `Id` of the `Perpetual`. */ - perpetualId: number; - /** The size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountPerpetualPosition provides information on a subaccount's updated - * perpetual positions. - */ - -export interface SubaccountPerpetualPositionSDKType { - /** The `Id` of the `Perpetual`. */ - perpetual_id: number; - /** The size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountAssetPosition provides information on a subaccount's updated asset - * positions. - */ - -export interface SubaccountAssetPosition { - /** The `Id` of the `Asset`. */ - assetId: number; - /** The absolute size of the position in base quantums. */ - - quantums: Long; -} -/** - * SubaccountAssetPosition provides information on a subaccount's updated asset - * positions. - */ - -export interface SubaccountAssetPositionSDKType { - /** The `Id` of the `Asset`. */ - asset_id: number; - /** The absolute size of the position in base quantums. */ - - quantums: Long; -} -/** - * StreamSubaccountUpdate provides information on a subaccount update. Used in - * the full node GRPC stream. - */ - -export interface StreamSubaccountUpdate { - subaccountId?: SubaccountId; - /** updated_perpetual_positions will each be for unique perpetuals. */ - - updatedPerpetualPositions: SubaccountPerpetualPosition[]; - /** updated_asset_positions will each be for unique assets. */ - - updatedAssetPositions: SubaccountAssetPosition[]; - /** - * Snapshot indicates if the response is from a snapshot of the subaccount. - * All updates should be ignored until snapshot is received. - * If the snapshot is true, then all previous entries should be - * discarded and the subaccount should be resynced. - * For a snapshot subaccount update, the `updated_perpetual_positions` and - * `updated_asset_positions` fields will contain the full state of the - * subaccount. - */ - - snapshot: boolean; -} -/** - * StreamSubaccountUpdate provides information on a subaccount update. Used in - * the full node GRPC stream. - */ - -export interface StreamSubaccountUpdateSDKType { - subaccount_id?: SubaccountIdSDKType; - /** updated_perpetual_positions will each be for unique perpetuals. */ - - updated_perpetual_positions: SubaccountPerpetualPositionSDKType[]; - /** updated_asset_positions will each be for unique assets. */ - - updated_asset_positions: SubaccountAssetPositionSDKType[]; - /** - * Snapshot indicates if the response is from a snapshot of the subaccount. - * All updates should be ignored until snapshot is received. - * If the snapshot is true, then all previous entries should be - * discarded and the subaccount should be resynced. - * For a snapshot subaccount update, the `updated_perpetual_positions` and - * `updated_asset_positions` fields will contain the full state of the - * subaccount. - */ - - snapshot: boolean; -} /** * StreamOrderbookUpdate provides information on an orderbook update. Used in * the full node GRPC stream. @@ -1496,191 +1398,6 @@ export const StreamUpdate = { }; -function createBaseSubaccountPerpetualPosition(): SubaccountPerpetualPosition { - return { - perpetualId: 0, - quantums: Long.UZERO - }; -} - -export const SubaccountPerpetualPosition = { - encode(message: SubaccountPerpetualPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.perpetualId !== 0) { - writer.uint32(8).uint32(message.perpetualId); - } - - if (!message.quantums.isZero()) { - writer.uint32(16).uint64(message.quantums); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountPerpetualPosition { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSubaccountPerpetualPosition(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.perpetualId = reader.uint32(); - break; - - case 2: - message.quantums = (reader.uint64() as Long); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): SubaccountPerpetualPosition { - const message = createBaseSubaccountPerpetualPosition(); - message.perpetualId = object.perpetualId ?? 0; - message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; - return message; - } - -}; - -function createBaseSubaccountAssetPosition(): SubaccountAssetPosition { - return { - assetId: 0, - quantums: Long.UZERO - }; -} - -export const SubaccountAssetPosition = { - encode(message: SubaccountAssetPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.assetId !== 0) { - writer.uint32(8).uint32(message.assetId); - } - - if (!message.quantums.isZero()) { - writer.uint32(16).uint64(message.quantums); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountAssetPosition { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSubaccountAssetPosition(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.assetId = reader.uint32(); - break; - - case 2: - message.quantums = (reader.uint64() as Long); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): SubaccountAssetPosition { - const message = createBaseSubaccountAssetPosition(); - message.assetId = object.assetId ?? 0; - message.quantums = object.quantums !== undefined && object.quantums !== null ? Long.fromValue(object.quantums) : Long.UZERO; - return message; - } - -}; - -function createBaseStreamSubaccountUpdate(): StreamSubaccountUpdate { - return { - subaccountId: undefined, - updatedPerpetualPositions: [], - updatedAssetPositions: [], - snapshot: false - }; -} - -export const StreamSubaccountUpdate = { - encode(message: StreamSubaccountUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subaccountId !== undefined) { - SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim(); - } - - for (const v of message.updatedPerpetualPositions) { - SubaccountPerpetualPosition.encode(v!, writer.uint32(18).fork()).ldelim(); - } - - for (const v of message.updatedAssetPositions) { - SubaccountAssetPosition.encode(v!, writer.uint32(26).fork()).ldelim(); - } - - if (message.snapshot === true) { - writer.uint32(32).bool(message.snapshot); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StreamSubaccountUpdate { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStreamSubaccountUpdate(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.subaccountId = SubaccountId.decode(reader, reader.uint32()); - break; - - case 2: - message.updatedPerpetualPositions.push(SubaccountPerpetualPosition.decode(reader, reader.uint32())); - break; - - case 3: - message.updatedAssetPositions.push(SubaccountAssetPosition.decode(reader, reader.uint32())); - break; - - case 4: - message.snapshot = reader.bool(); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): StreamSubaccountUpdate { - const message = createBaseStreamSubaccountUpdate(); - message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; - message.updatedPerpetualPositions = object.updatedPerpetualPositions?.map(e => SubaccountPerpetualPosition.fromPartial(e)) || []; - message.updatedAssetPositions = object.updatedAssetPositions?.map(e => SubaccountAssetPosition.fromPartial(e)) || []; - message.snapshot = object.snapshot ?? false; - return message; - } - -}; - function createBaseStreamOrderbookUpdate(): StreamOrderbookUpdate { return { updates: [], From ee5e8f792a3aa6f24b525649a306407c7a5da7af Mon Sep 17 00:00:00 2001 From: Will Liu Date: Tue, 6 Aug 2024 17:00:24 -0400 Subject: [PATCH 22/37] set Snapshot to true --- protocol/x/clob/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/x/clob/keeper/keeper.go b/protocol/x/clob/keeper/keeper.go index ec1bfe8cc3..8df1933b55 100644 --- a/protocol/x/clob/keeper/keeper.go +++ b/protocol/x/clob/keeper/keeper.go @@ -287,7 +287,7 @@ func (k Keeper) InitializeNewStreams(ctx sdk.Context) { SubaccountId: subaccountId, UpdatedAssetPositions: assetPositions, UpdatedPerpetualPositions: perpetualPositions, - Snapshot: false, + Snapshot: true, } }, lib.MustConvertIntegerToUint32(ctx.BlockHeight()), From 0a6bd3a3ef3678eac37474dbdb2394ea1e144375 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 10:39:49 -0400 Subject: [PATCH 23/37] add back todo --- protocol/streaming/full_node_streaming_manager.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index c826b0ceed..99d3452d5e 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -30,6 +30,9 @@ type FullNodeStreamingManagerImpl struct { ticker *time.Ticker done chan bool + // TODO: Consolidate the streamUpdateCache and streamUpdateSubscriptionCache into a single + // struct to avoid the need to maintain two separate slices for the same data. + // list of stream updates. streamUpdateCache []clobtypes.StreamUpdate // list of subscription ids for each stream update. From cd7472c9df8a1d4813132629451d9c2d68f1ba6e Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 10:47:10 -0400 Subject: [PATCH 24/37] add gh wf --- .github/workflows/protocol-build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index fc26dd6e69..639b09c612 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: + - 'lw/sa2' - main - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x From ef9a0eccd468e7c532140966dda90c91f2219dbb Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 15:39:46 -0400 Subject: [PATCH 25/37] add logs --- protocol/streaming/full_node_streaming_manager.go | 7 +++++++ protocol/x/subaccounts/keeper/subaccount.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 99d3452d5e..8bdc6e6694 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -515,6 +515,13 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } + sm.logger.Info( + fmt.Sprintf( + "Sending subaccount update for subaccount id %+v with stream update %+v", + subaccountUpdate.SubaccountId, + streamUpdate, + ), + ) streamUpdates = append(streamUpdates, streamUpdate) subaccountIds = append(subaccountIds, subaccountUpdate.SubaccountId) } diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 2440314ff1..07285262d8 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -21,6 +21,7 @@ import ( indexerevents "github.com/dydxprotocol/v4-chain/protocol/indexer/events" indexer_manager "github.com/dydxprotocol/v4-chain/protocol/indexer/indexer_manager" "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/lib/log" "github.com/dydxprotocol/v4-chain/protocol/lib/margin" "github.com/dydxprotocol/v4-chain/protocol/lib/metrics" perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types" @@ -401,7 +402,9 @@ func (k Keeper) UpdateSubaccounts( // if GRPC streaming is on, emit a generated subaccount update to stream. if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { + log.InfoLog(ctx, "Emitting subaccount update", "subaccountUpdate", u) subaccountUpdate := GenerateStreamSubaccountUpdate(u) + log.InfoLog(ctx, "Emitting subaccount update", "GenerateStreamSubaccountUpdate", subaccountUpdate) k.SendSubaccountUpdates( ctx, []types.StreamSubaccountUpdate{ From e4f254bb602b5f041561c44db65100d228a32687 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 15:49:25 -0400 Subject: [PATCH 26/37] latest --- .github/workflows/protocol-build-and-push.yml | 180 ------------------ 1 file changed, 180 deletions(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index 639b09c612..b17cd9a374 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -9,42 +9,6 @@ on: # yamllint disable-line rule:truthy - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: - build-and-push-dev: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - build-and-push-dev2: runs-on: ubuntu-latest defaults: @@ -80,147 +44,3 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev3: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev3-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev4: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev4-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev5: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV5 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV5 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev5-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-staging: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: staging-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-staging/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags From 3c024b0e0da3a4057cb53b2da34f912ab66d6951 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 15:58:36 -0400 Subject: [PATCH 27/37] add log --- protocol/streaming/full_node_streaming_manager.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 8bdc6e6694..1894792d4a 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -577,6 +577,13 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) for _, subaccountId := range subaccountIds { + sm.logger.Info( + fmt.Sprintf( + "Adding subaccount update for subaccount id %+v with subscription ids %+v", + subaccountId, + sm.subaccountIdToSubscriptionIdMapping[subaccountId], + ), + ) sm.streamUpdateSubscriptionCache = append( sm.streamUpdateSubscriptionCache, sm.subaccountIdToSubscriptionIdMapping[subaccountId], From 10e45126b99f871d9c08b42fada333bbf4d176cc Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 16:16:45 -0400 Subject: [PATCH 28/37] fix --- .../streaming/full_node_streaming_manager.go | 26 +++++++++++-------- protocol/streaming/noop_streaming_manager.go | 2 +- protocol/streaming/types/interface.go | 2 +- protocol/x/clob/keeper/keeper.go | 6 ++--- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 1894792d4a..3125c0752d 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -40,7 +40,7 @@ type FullNodeStreamingManagerImpl struct { // map from clob pair id to subscription ids. clobPairIdToSubscriptionIdMapping map[uint32][]uint32 // map from subaccount id to subscription ids. - subaccountIdToSubscriptionIdMapping map[*satypes.SubaccountId][]uint32 + subaccountIdToSubscriptionIdMapping map[satypes.SubaccountId][]uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -57,7 +57,7 @@ type OrderbookSubscription struct { clobPairIds []uint32 // Subaccount ids to subscribe to. - subaccountIds []*satypes.SubaccountId + subaccountIds []satypes.SubaccountId // Stream messageSender types.OutgoingMessageSender @@ -83,7 +83,7 @@ func NewFullNodeStreamingManager( streamUpdateCache: make([]clobtypes.StreamUpdate, 0), streamUpdateSubscriptionCache: make([][]uint32, 0), clobPairIdToSubscriptionIdMapping: make(map[uint32][]uint32), - subaccountIdToSubscriptionIdMapping: make(map[*satypes.SubaccountId][]uint32), + subaccountIdToSubscriptionIdMapping: make(map[satypes.SubaccountId][]uint32), maxUpdatesInCache: maxUpdatesInCache, maxSubscriptionChannelSize: maxSubscriptionChannelSize, @@ -143,10 +143,14 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( } sm.Lock() + sIds := make([]satypes.SubaccountId, len(subaccountIds)) + for i, subaccountId := range subaccountIds { + sIds[i] = *subaccountId + } subscription := &OrderbookSubscription{ subscriptionId: sm.nextSubscriptionId, clobPairIds: clobPairIds, - subaccountIds: subaccountIds, + subaccountIds: sIds, messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), } @@ -164,11 +168,11 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( for _, subaccountId := range subaccountIds { // if subaccountId exists in the map, append the subscription id to the slice // otherwise, create a new slice with the subscription id - if _, ok := sm.subaccountIdToSubscriptionIdMapping[subaccountId]; !ok { - sm.subaccountIdToSubscriptionIdMapping[subaccountId] = []uint32{} + if _, ok := sm.subaccountIdToSubscriptionIdMapping[*subaccountId]; !ok { + sm.subaccountIdToSubscriptionIdMapping[*subaccountId] = []uint32{} } - sm.subaccountIdToSubscriptionIdMapping[subaccountId] = append( - sm.subaccountIdToSubscriptionIdMapping[subaccountId], + sm.subaccountIdToSubscriptionIdMapping[*subaccountId] = append( + sm.subaccountIdToSubscriptionIdMapping[*subaccountId], sm.nextSubscriptionId, ) } @@ -581,12 +585,12 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( fmt.Sprintf( "Adding subaccount update for subaccount id %+v with subscription ids %+v", subaccountId, - sm.subaccountIdToSubscriptionIdMapping[subaccountId], + sm.subaccountIdToSubscriptionIdMapping[*subaccountId], ), ) sm.streamUpdateSubscriptionCache = append( sm.streamUpdateSubscriptionCache, - sm.subaccountIdToSubscriptionIdMapping[subaccountId], + sm.subaccountIdToSubscriptionIdMapping[*subaccountId], ) } @@ -664,7 +668,7 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, - getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, + getSubaccountSnapshot func(subaccountId satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) { diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 6a3116c8f7..6399faa9cf 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -53,7 +53,7 @@ func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( func (sm *NoopGrpcStreamingManager) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, - getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, + getSubaccountSnapshot func(subaccountId satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) { diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index 2715ac246b..b7f2065083 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -22,7 +22,7 @@ type FullNodeStreamingManager interface { // L3+ Orderbook updates. InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, - getSubaccountSnapshot func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate, + getSubaccountSnapshot func(subaccountId satypes.SubaccountId) *satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, ) diff --git a/protocol/x/clob/keeper/keeper.go b/protocol/x/clob/keeper/keeper.go index 8df1933b55..8d4a993c64 100644 --- a/protocol/x/clob/keeper/keeper.go +++ b/protocol/x/clob/keeper/keeper.go @@ -263,10 +263,10 @@ func (k Keeper) InitializeNewStreams(ctx sdk.Context) { clobPairId, ) }, - func(subaccountId *satypes.SubaccountId) *satypes.StreamSubaccountUpdate { + func(subaccountId satypes.SubaccountId) *satypes.StreamSubaccountUpdate { subaccount := k.subaccountsKeeper.GetSubaccount( ctx, - *subaccountId, + subaccountId, ) assetPositions := make([]*satypes.SubaccountAssetPosition, len(subaccount.AssetPositions)) for i, ap := range subaccount.AssetPositions { @@ -284,7 +284,7 @@ func (k Keeper) InitializeNewStreams(ctx sdk.Context) { } return &satypes.StreamSubaccountUpdate{ - SubaccountId: subaccountId, + SubaccountId: &subaccountId, UpdatedAssetPositions: assetPositions, UpdatedPerpetualPositions: perpetualPositions, Snapshot: true, From d555b9d8e6881eceef1969437d18f1412bd34928 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 16:40:52 -0400 Subject: [PATCH 29/37] rm logs --- .github/workflows/protocol-build-and-push.yml | 181 +++++++++++++++++- .../streaming/full_node_streaming_manager.go | 14 -- protocol/x/subaccounts/keeper/subaccount.go | 3 - 3 files changed, 180 insertions(+), 18 deletions(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index b17cd9a374..fc26dd6e69 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -3,12 +3,47 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: - - 'lw/sa2' - main - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: + build-and-push-dev: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev2: runs-on: ubuntu-latest defaults: @@ -44,3 +79,147 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev3: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev3-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev4: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev4-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev5: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV5 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV5 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev5-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-staging: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: staging-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-staging/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 3125c0752d..4afebccc69 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -519,13 +519,6 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } - sm.logger.Info( - fmt.Sprintf( - "Sending subaccount update for subaccount id %+v with stream update %+v", - subaccountUpdate.SubaccountId, - streamUpdate, - ), - ) streamUpdates = append(streamUpdates, streamUpdate) subaccountIds = append(subaccountIds, subaccountUpdate.SubaccountId) } @@ -581,13 +574,6 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) for _, subaccountId := range subaccountIds { - sm.logger.Info( - fmt.Sprintf( - "Adding subaccount update for subaccount id %+v with subscription ids %+v", - subaccountId, - sm.subaccountIdToSubscriptionIdMapping[*subaccountId], - ), - ) sm.streamUpdateSubscriptionCache = append( sm.streamUpdateSubscriptionCache, sm.subaccountIdToSubscriptionIdMapping[*subaccountId], diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 07285262d8..2440314ff1 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -21,7 +21,6 @@ import ( indexerevents "github.com/dydxprotocol/v4-chain/protocol/indexer/events" indexer_manager "github.com/dydxprotocol/v4-chain/protocol/indexer/indexer_manager" "github.com/dydxprotocol/v4-chain/protocol/lib" - "github.com/dydxprotocol/v4-chain/protocol/lib/log" "github.com/dydxprotocol/v4-chain/protocol/lib/margin" "github.com/dydxprotocol/v4-chain/protocol/lib/metrics" perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types" @@ -402,9 +401,7 @@ func (k Keeper) UpdateSubaccounts( // if GRPC streaming is on, emit a generated subaccount update to stream. if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { - log.InfoLog(ctx, "Emitting subaccount update", "subaccountUpdate", u) subaccountUpdate := GenerateStreamSubaccountUpdate(u) - log.InfoLog(ctx, "Emitting subaccount update", "GenerateStreamSubaccountUpdate", subaccountUpdate) k.SendSubaccountUpdates( ctx, []types.StreamSubaccountUpdate{ From 49a8dcc9e933cdc1b32437f757080532d69bb569 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 16:43:27 -0400 Subject: [PATCH 30/37] fix cmt --- protocol/streaming/full_node_streaming_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 4afebccc69..169d1139cb 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -398,7 +398,7 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountSnapshot( } // Clean up subscriptions that have been closed. - // If a Send update has failed for any clob pair id, the whole subscription will be removed. + // If a Send update has failed for any subaccount id, the whole subscription will be removed. if removeSubscription { sm.removeSubscription(subscriptionId) } From 8d97bdabfd85bd75350cea1cab539d3c00afe987 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Wed, 7 Aug 2024 17:02:49 -0400 Subject: [PATCH 31/37] fix event --- protocol/x/subaccounts/keeper/subaccount.go | 42 +++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 2440314ff1..74de41f7e9 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -256,29 +256,41 @@ func (k Keeper) getSettledUpdates( func GenerateStreamSubaccountUpdate( settledUpdate types.SettledUpdate, + fundingPayments map[uint32]dtypes.SerializableInt, ) types.StreamSubaccountUpdate { - // Convert AssetPositions from SettledSubaccount to SubaccountAssetPosition - updatedAssetPositions := make([]*types.SubaccountAssetPosition, len(settledUpdate.SettledSubaccount.AssetPositions)) - for i, ap := range settledUpdate.SettledSubaccount.AssetPositions { - updatedAssetPositions[i] = &types.SubaccountAssetPosition{ - AssetId: ap.AssetId, - Quantums: ap.Quantums.BigInt().Uint64(), + // Get updated perpetual positions + updatedPerpetualPositions := salib.GetUpdatedPerpetualPositions( + settledUpdate, + fundingPayments, + ) + // Convert updated perpetual positions to SubaccountPerpetualPosition type + perpetualPositions := make([]*types.SubaccountPerpetualPosition, len(updatedPerpetualPositions)) + for i, pp := range updatedPerpetualPositions { + perpetualPositions[i] = &types.SubaccountPerpetualPosition{ + PerpetualId: pp.PerpetualId, + Quantums: pp.Quantums.BigInt().Uint64(), } } - // Convert PerpetualPositions from SettledSubaccount to SubaccountPerpetualPosition - updatedPerpetualPositions := make([]*types.SubaccountPerpetualPosition, len(settledUpdate.SettledSubaccount.PerpetualPositions)) - for i, pp := range settledUpdate.SettledSubaccount.PerpetualPositions { - updatedPerpetualPositions[i] = &types.SubaccountPerpetualPosition{ - PerpetualId: pp.PerpetualId, - Quantums: pp.Quantums.BigInt().Uint64(), + updatedAssetPositions := salib.GetUpdatedAssetPositions(settledUpdate) + assetPositionsWithQuoteBalance := indexerevents.AddQuoteBalanceFromPerpetualPositions( + updatedPerpetualPositions, + updatedAssetPositions, + ) + + // Convert updated asset positions to SubaccountAssetPosition type + assetPositions := make([]*types.SubaccountAssetPosition, len(assetPositionsWithQuoteBalance)) + for i, ap := range assetPositionsWithQuoteBalance { + assetPositions[i] = &types.SubaccountAssetPosition{ + AssetId: ap.AssetId, + Quantums: ap.Quantums.BigInt().Uint64(), } } return types.StreamSubaccountUpdate{ SubaccountId: settledUpdate.SettledSubaccount.Id, - UpdatedAssetPositions: updatedAssetPositions, - UpdatedPerpetualPositions: updatedPerpetualPositions, + UpdatedAssetPositions: assetPositions, + UpdatedPerpetualPositions: perpetualPositions, Snapshot: false, } } @@ -401,7 +413,7 @@ func (k Keeper) UpdateSubaccounts( // if GRPC streaming is on, emit a generated subaccount update to stream. if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { - subaccountUpdate := GenerateStreamSubaccountUpdate(u) + subaccountUpdate := GenerateStreamSubaccountUpdate(u, fundingPayments) k.SendSubaccountUpdates( ctx, []types.StreamSubaccountUpdate{ From 898074b1ea8623e2a8a5a82df66cf6d8949b796b Mon Sep 17 00:00:00 2001 From: Will Liu Date: Thu, 8 Aug 2024 13:13:56 -0400 Subject: [PATCH 32/37] gh wf --- .github/workflows/protocol-build-and-push.yml | 181 +----------------- 1 file changed, 1 insertion(+), 180 deletions(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index fc26dd6e69..155e8e0507 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -3,47 +3,12 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: + - 'wl/sa2' - main - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: - build-and-push-dev: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - build-and-push-dev2: runs-on: ubuntu-latest defaults: @@ -79,147 +44,3 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev3: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev3-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev4: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev4-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-dev5: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV5 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV5 }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: dev5-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-dev/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags - - build-and-push-staging: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./protocol - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' # without this, ignite fails. - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, Tag, and Push the Image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: staging-validator - run: | - make localnet-build-amd64 - commit_hash=$(git rev-parse --short=7 HEAD) - docker build \ - --platform amd64 \ - -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ - -f testing/testnet-staging/Dockerfile . - docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags From 1fba8caf5b8a25d9c6750ba8af5d26a2b44c1c39 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 9 Aug 2024 15:03:17 -0400 Subject: [PATCH 33/37] merge fix --- .../streaming/full_node_streaming_manager.go | 45 +++++++++++++++---- protocol/streaming/noop_streaming_manager.go | 7 +++ protocol/streaming/types/interface.go | 5 +++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 99cf8c0a6c..f38cc5e97e 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -449,7 +449,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds, uint32(len(updates))) + sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -492,7 +492,35 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds, uint32(len(orderbookFills))) + sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds) +} + +// SendTakerOrderStatus sends out a taker order and its status to the full node streaming service. +func (sm *FullNodeStreamingManagerImpl) SendTakerOrderStatus( + streamTakerOrder clobtypes.StreamTakerOrder, + blockHeight uint32, + execMode sdk.ExecMode, +) { + clobPairId := uint32(0) + if liqOrder := streamTakerOrder.GetLiquidationOrder(); liqOrder != nil { + clobPairId = liqOrder.ClobPairId + } + if takerOrder := streamTakerOrder.GetOrder(); takerOrder != nil { + clobPairId = takerOrder.OrderId.ClobPairId + } + + sm.AddOrderbookUpdatesToCache( + []clobtypes.StreamUpdate{ + { + UpdateMessage: &clobtypes.StreamUpdate_TakerOrder{ + TakerOrder: &streamTakerOrder, + }, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + }, + }, + []uint32{clobPairId}, + ) } // SendSubaccountUpdates groups subaccount updates by their subaccount ids and @@ -536,14 +564,13 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( updates []clobtypes.StreamUpdate, clobPairIds []uint32, - numUpdatesToAdd uint32, ) { sm.Lock() defer sm.Unlock() metrics.IncrCounter( metrics.GrpcAddUpdateToBufferCount, - float32(numUpdatesToAdd), + float32(len(updates)), ) sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) @@ -561,7 +588,8 @@ func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( for id := range sm.orderbookSubscriptions { sm.removeSubscription(id) } - clear(sm.streamUpdateCache) + sm.streamUpdateCache = nil + sm.streamUpdateSubscriptionCache = nil } sm.EmitMetrics() } @@ -594,7 +622,8 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( for id := range sm.orderbookSubscriptions { sm.removeSubscription(id) } - clear(sm.streamUpdateCache) + sm.streamUpdateCache = nil + sm.streamUpdateSubscriptionCache = nil } sm.EmitMetrics() } @@ -643,8 +672,8 @@ func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdatesWithLock() { } } - clear(sm.streamUpdateCache) - clear(sm.streamUpdateSubscriptionCache) + sm.streamUpdateCache = nil + sm.streamUpdateSubscriptionCache = nil for _, id := range idsToRemove { sm.logger.Error( diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 6399faa9cf..e37f8ef006 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -44,6 +44,13 @@ func (sm *NoopGrpcStreamingManager) SendOrderbookFillUpdates( ) { } +func (sm *NoopGrpcStreamingManager) SendTakerOrderStatus( + takerOrder clobtypes.StreamTakerOrder, + blockHeight uint32, + execMode sdk.ExecMode, +) { +} + func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( subaccountUpdates []satypes.StreamSubaccountUpdate, blockHeight uint32, diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index b7f2065083..8fd3db2300 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -37,6 +37,11 @@ type FullNodeStreamingManager interface { execMode sdk.ExecMode, perpetualIdToClobPairId map[uint32][]clobtypes.ClobPairId, ) + SendTakerOrderStatus( + takerOrder clobtypes.StreamTakerOrder, + blockHeight uint32, + execMode sdk.ExecMode, + ) SendSubaccountUpdates( subaccountUpdates []satypes.StreamSubaccountUpdate, blockHeight uint32, From 84b2f057bd8888bc84ccaad1dd57464fe886ff6f Mon Sep 17 00:00:00 2001 From: Will Liu Date: Fri, 9 Aug 2024 15:09:16 -0400 Subject: [PATCH 34/37] add back cmt --- protocol/streaming/full_node_streaming_manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index f38cc5e97e..f092b85aaf 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -561,6 +561,8 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( sm.AddSubaccountUpdatesToCache(streamUpdates, subaccountIds, uint32(len(subaccountUpdates))) } +// AddOrderbookUpdatesToCache adds a series of updates to the full node streaming cache. +// Clob pair ids are the clob pair id each update is relevant to. func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( updates []clobtypes.StreamUpdate, clobPairIds []uint32, @@ -594,6 +596,8 @@ func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( sm.EmitMetrics() } +// AddSubaccountUpdatesToCache adds a series of updates to the full node streaming cache. +// Subaccount ids are the subaccount id each update is relevant to. func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( updates []clobtypes.StreamUpdate, subaccountIds []*satypes.SubaccountId, From 53bb1be674de66f23f57c4c0fbf935fbf3516991 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 12 Aug 2024 12:13:44 -0400 Subject: [PATCH 35/37] address cmts --- .../streaming/full_node_streaming_manager.go | 195 +++++++----------- protocol/streaming/noop_streaming_manager.go | 4 + protocol/streaming/types/interface.go | 1 + protocol/x/subaccounts/keeper/subaccount.go | 16 +- 4 files changed, 93 insertions(+), 123 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index f092b85aaf..214ac53460 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -165,14 +165,14 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.nextSubscriptionId, ) } - for _, subaccountId := range subaccountIds { + for _, subaccountId := range sIds { // if subaccountId exists in the map, append the subscription id to the slice // otherwise, create a new slice with the subscription id - if _, ok := sm.subaccountIdToSubscriptionIdMapping[*subaccountId]; !ok { - sm.subaccountIdToSubscriptionIdMapping[*subaccountId] = []uint32{} + if _, ok := sm.subaccountIdToSubscriptionIdMapping[subaccountId]; !ok { + sm.subaccountIdToSubscriptionIdMapping[subaccountId] = []uint32{} } - sm.subaccountIdToSubscriptionIdMapping[*subaccountId] = append( - sm.subaccountIdToSubscriptionIdMapping[*subaccountId], + sm.subaccountIdToSubscriptionIdMapping[subaccountId] = append( + sm.subaccountIdToSubscriptionIdMapping[subaccountId], sm.nextSubscriptionId, ) } @@ -277,90 +277,51 @@ func (sm *FullNodeStreamingManagerImpl) Stop() { sm.done <- true } -// SendSnapshot sends messages to a particular subscriber without buffering. -// Note this method requires the lock and assumes that the lock has already been -// acquired by the caller. -func (sm *FullNodeStreamingManagerImpl) SendSnapshot( +func (sm *FullNodeStreamingManagerImpl) getOrderbookStreamUpdate( offchainUpdates *clobtypes.OffchainUpdates, - subscriptionId uint32, blockHeight uint32, execMode sdk.ExecMode, -) { - defer metrics.ModuleMeasureSince( - metrics.FullNodeGrpc, - metrics.GrpcSendOrderbookSnapshotLatency, - time.Now(), - ) - +) []clobtypes.StreamUpdate { v1updates, err := streaming_util.GetOffchainUpdatesV1(offchainUpdates) if err != nil { panic(err) } - - removeSubscription := false - if len(v1updates) > 0 { - subscription, ok := sm.orderbookSubscriptions[subscriptionId] - if !ok { - sm.logger.Error( - fmt.Sprintf( - "Streaming subscription id %+v not found. This should not happen.", - subscriptionId, - ), - ) - return - } - streamUpdates := []clobtypes.StreamUpdate{ - { - UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ - OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ - Updates: v1updates, - Snapshot: true, - }, + return []clobtypes.StreamUpdate{ + { + UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ + OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ + Updates: v1updates, + Snapshot: true, }, - BlockHeight: blockHeight, - ExecMode: uint32(execMode), }, - } - metrics.IncrCounter( - metrics.GrpcAddToSubscriptionChannelCount, - 1, - ) - select { - case subscription.updatesChannel <- streamUpdates: - default: - sm.logger.Error( - fmt.Sprintf( - "Streaming subscription id %+v channel full capacity. Dropping subscription connection.", - subscriptionId, - ), - ) - removeSubscription = true - } + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + }, } +} - // Clean up subscriptions that have been closed. - // If a Send update has failed for any clob pair id, the whole subscription will be removed. - if removeSubscription { - sm.removeSubscription(subscriptionId) +func (sm *FullNodeStreamingManagerImpl) getSubaccountStreamUpdates( + saUpdates []*satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, +) []clobtypes.StreamUpdate { + streamUpdates := make([]clobtypes.StreamUpdate, 0) + for _, saUpdate := range saUpdates { + streamUpdates = append(streamUpdates, clobtypes.StreamUpdate{ + UpdateMessage: &clobtypes.StreamUpdate_SubaccountUpdate{ + SubaccountUpdate: saUpdate, + }, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + }) } + return streamUpdates } -// SendSubaccountSnapshot sends a subaccount snapshot to a particular subscriber -// without buffering. -// Note this method requires the lock and assumes that the lock has already been -// acquired by the caller. -func (sm *FullNodeStreamingManagerImpl) SendSubaccountSnapshot( - snapshot *satypes.StreamSubaccountUpdate, +func (sm *FullNodeStreamingManagerImpl) sendStreamUpdates( subscriptionId uint32, - blockHeight uint32, - execMode sdk.ExecMode, + streamUpdates []clobtypes.StreamUpdate, ) { - defer metrics.ModuleMeasureSince( - metrics.FullNodeGrpc, - metrics.GrpcSendSubaccountSnapshotLatency, - time.Now(), - ) - removeSubscription := false subscription, ok := sm.orderbookSubscriptions[subscriptionId] if !ok { @@ -372,19 +333,7 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountSnapshot( ) return } - streamUpdates := []clobtypes.StreamUpdate{ - { - UpdateMessage: &clobtypes.StreamUpdate_SubaccountUpdate{ - SubaccountUpdate: snapshot, - }, - BlockHeight: blockHeight, - ExecMode: uint32(execMode), - }, - } - metrics.IncrCounter( - metrics.GrpcAddToSubscriptionChannelCount, - 1, - ) + select { case subscription.updatesChannel <- streamUpdates: default: @@ -397,13 +346,40 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountSnapshot( removeSubscription = true } - // Clean up subscriptions that have been closed. - // If a Send update has failed for any subaccount id, the whole subscription will be removed. if removeSubscription { sm.removeSubscription(subscriptionId) } } +// SendCombinedSnapshot sends messages to a particular subscriber without buffering. +// Note this method requires the lock and assumes that the lock has already been +// acquired by the caller. +func (sm *FullNodeStreamingManagerImpl) SendCombinedSnapshot( + offchainUpdates *clobtypes.OffchainUpdates, + saUpdates []*satypes.StreamSubaccountUpdate, + subscriptionId uint32, + blockHeight uint32, + execMode sdk.ExecMode, +) { + defer metrics.ModuleMeasureSince( + metrics.FullNodeGrpc, + metrics.GrpcSendOrderbookSnapshotLatency, + time.Now(), + ) + + var streamUpdates []clobtypes.StreamUpdate + streamUpdates = append(streamUpdates, sm.getOrderbookStreamUpdate(offchainUpdates, blockHeight, execMode)...) + streamUpdates = append(streamUpdates, sm.getSubaccountStreamUpdates(saUpdates, blockHeight, execMode)...) + sm.sendStreamUpdates(subscriptionId, streamUpdates) +} + +// GetSubaccountIdToSubscriptionIdMapping returns the mapping of subaccount ids to subscription ids. +func (sm *FullNodeStreamingManagerImpl) GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 { + sm.Lock() + defer sm.Unlock() + return sm.subaccountIdToSubscriptionIdMapping +} + // SendOrderbookUpdates groups updates by their clob pair ids and // sends messages to the subscribers. func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( @@ -525,6 +501,7 @@ func (sm *FullNodeStreamingManagerImpl) SendTakerOrderStatus( // SendSubaccountUpdates groups subaccount updates by their subaccount ids and // sends messages to the subscribers. +// TODO(CT-1117): Aggregate subaccount updates by subaccount id. func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( subaccountUpdates []satypes.StreamSubaccountUpdate, blockHeight uint32, @@ -547,18 +524,11 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( BlockHeight: blockHeight, ExecMode: uint32(execMode), } - sm.logger.Info( - fmt.Sprintf( - "Sending subaccount update for subaccount id %+v with stream update %+v", - subaccountUpdate.SubaccountId, - streamUpdate, - ), - ) streamUpdates = append(streamUpdates, streamUpdate) subaccountIds = append(subaccountIds, subaccountUpdate.SubaccountId) } - sm.AddSubaccountUpdatesToCache(streamUpdates, subaccountIds, uint32(len(subaccountUpdates))) + sm.AddSubaccountUpdatesToCache(streamUpdates, subaccountIds) } // AddOrderbookUpdatesToCache adds a series of updates to the full node streaming cache. @@ -584,15 +554,7 @@ func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( } // Remove all subscriptions and wipe the buffer if buffer overflows. - if len(sm.streamUpdateCache) > int(sm.maxUpdatesInCache) { - sm.logger.Error("Streaming buffer full capacity. Dropping messages and all subscriptions. " + - "Disconnect all clients and increase buffer size via the grpc-stream-buffer-size flag.") - for id := range sm.orderbookSubscriptions { - sm.removeSubscription(id) - } - sm.streamUpdateCache = nil - sm.streamUpdateSubscriptionCache = nil - } + sm.FlushCacheIfFull() sm.EmitMetrics() } @@ -601,14 +563,13 @@ func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( updates []clobtypes.StreamUpdate, subaccountIds []*satypes.SubaccountId, - numUpdatesToAdd uint32, ) { sm.Lock() defer sm.Unlock() metrics.IncrCounter( metrics.GrpcAddUpdateToBufferCount, - float32(numUpdatesToAdd), + float32(len(updates)), ) sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) @@ -618,7 +579,14 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( sm.subaccountIdToSubscriptionIdMapping[*subaccountId], ) } + sm.FlushCacheIfFull() + sm.EmitMetrics() +} +// FlushCacheIfFull removes all subscriptions and wipes the buffer if buffer overflows. +// Note this method requires the lock and assumes that the lock has already been +// acquired by the caller. +func (sm *FullNodeStreamingManagerImpl) FlushCacheIfFull() { // Remove all subscriptions and wipe the buffer if buffer overflows. if len(sm.streamUpdateCache) > int(sm.maxUpdatesInCache) { sm.logger.Error("Streaming buffer full capacity. Dropping messages and all subscriptions. " + @@ -629,7 +597,6 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( sm.streamUpdateCache = nil sm.streamUpdateSubscriptionCache = nil } - sm.EmitMetrics() } func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdates() { @@ -716,16 +683,12 @@ func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( } allUpdates.Append(updatesByClobPairId[clobPairId]) } - - sm.SendSnapshot(allUpdates, subscriptionId, blockHeight, execMode) + saUpdates := []*satypes.StreamSubaccountUpdate{} for _, subaccountId := range subscription.subaccountIds { - sm.SendSubaccountSnapshot( - getSubaccountSnapshot(subaccountId), - subscriptionId, - blockHeight, - execMode, - ) + saUpdates = append(saUpdates, getSubaccountSnapshot(subaccountId)) } + + sm.SendCombinedSnapshot(allUpdates, saUpdates, subscriptionId, blockHeight, execMode) }, ) } diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index e37f8ef006..216bf3aeb3 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -58,6 +58,10 @@ func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( ) { } +func (sm *NoopGrpcStreamingManager) GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 { + return nil +} + func (sm *NoopGrpcStreamingManager) InitializeNewStreams( getOrderbookSnapshot func(clobPairId clobtypes.ClobPairId) *clobtypes.OffchainUpdates, getSubaccountSnapshot func(subaccountId satypes.SubaccountId) *satypes.StreamSubaccountUpdate, diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index 8fd3db2300..809789ddf0 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -47,6 +47,7 @@ type FullNodeStreamingManager interface { blockHeight uint32, execMode sdk.ExecMode, ) + GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 } type OutgoingMessageSender interface { diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 74de41f7e9..4dd52ab85f 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -413,13 +413,15 @@ func (k Keeper) UpdateSubaccounts( // if GRPC streaming is on, emit a generated subaccount update to stream. if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { - subaccountUpdate := GenerateStreamSubaccountUpdate(u, fundingPayments) - k.SendSubaccountUpdates( - ctx, - []types.StreamSubaccountUpdate{ - subaccountUpdate, - }, - ) + if _, exists := streamingManager.GetSubaccountIdToSubscriptionIdMapping()[*u.SettledSubaccount.Id]; exists { + subaccountUpdate := GenerateStreamSubaccountUpdate(u, fundingPayments) + k.SendSubaccountUpdates( + ctx, + []types.StreamSubaccountUpdate{ + subaccountUpdate, + }, + ) + } } // Emit an event indicating a funding payment was paid / received for each settled funding From 320b3b07c808fa2fe2b4ee95728dbcf7303c0bcc Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 12 Aug 2024 13:43:54 -0400 Subject: [PATCH 36/37] address cmts --- .../streaming/full_node_streaming_manager.go | 33 ++++++++++--------- protocol/streaming/noop_streaming_manager.go | 4 +-- protocol/streaming/types/interface.go | 2 +- protocol/x/subaccounts/keeper/subaccount.go | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 214ac53460..c53b76e2c0 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -277,7 +277,7 @@ func (sm *FullNodeStreamingManagerImpl) Stop() { sm.done <- true } -func (sm *FullNodeStreamingManagerImpl) getOrderbookStreamUpdate( +func toOrderbookStreamUpdate( offchainUpdates *clobtypes.OffchainUpdates, blockHeight uint32, execMode sdk.ExecMode, @@ -300,7 +300,7 @@ func (sm *FullNodeStreamingManagerImpl) getOrderbookStreamUpdate( } } -func (sm *FullNodeStreamingManagerImpl) getSubaccountStreamUpdates( +func toSubaccountStreamUpdates( saUpdates []*satypes.StreamSubaccountUpdate, blockHeight uint32, execMode sdk.ExecMode, @@ -368,16 +368,17 @@ func (sm *FullNodeStreamingManagerImpl) SendCombinedSnapshot( ) var streamUpdates []clobtypes.StreamUpdate - streamUpdates = append(streamUpdates, sm.getOrderbookStreamUpdate(offchainUpdates, blockHeight, execMode)...) - streamUpdates = append(streamUpdates, sm.getSubaccountStreamUpdates(saUpdates, blockHeight, execMode)...) + streamUpdates = append(streamUpdates, toOrderbookStreamUpdate(offchainUpdates, blockHeight, execMode)...) + streamUpdates = append(streamUpdates, toSubaccountStreamUpdates(saUpdates, blockHeight, execMode)...) sm.sendStreamUpdates(subscriptionId, streamUpdates) } -// GetSubaccountIdToSubscriptionIdMapping returns the mapping of subaccount ids to subscription ids. -func (sm *FullNodeStreamingManagerImpl) GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 { +// TracksSubaccountId checks if a subaccount id is being tracked by the streaming manager. +func (sm *FullNodeStreamingManagerImpl) TracksSubaccountId(subaccountId satypes.SubaccountId) bool { sm.Lock() defer sm.Unlock() - return sm.subaccountIdToSubscriptionIdMapping + _, exists := sm.subaccountIdToSubscriptionIdMapping[subaccountId] + return exists } // SendOrderbookUpdates groups updates by their clob pair ids and @@ -425,7 +426,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds) + sm.AddOrderUpdatesToCache(streamUpdates, clobPairIds) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -468,7 +469,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddOrderbookUpdatesToCache(streamUpdates, clobPairIds) + sm.AddOrderUpdatesToCache(streamUpdates, clobPairIds) } // SendTakerOrderStatus sends out a taker order and its status to the full node streaming service. @@ -485,7 +486,7 @@ func (sm *FullNodeStreamingManagerImpl) SendTakerOrderStatus( clobPairId = takerOrder.OrderId.ClobPairId } - sm.AddOrderbookUpdatesToCache( + sm.AddOrderUpdatesToCache( []clobtypes.StreamUpdate{ { UpdateMessage: &clobtypes.StreamUpdate_TakerOrder{ @@ -531,9 +532,9 @@ func (sm *FullNodeStreamingManagerImpl) SendSubaccountUpdates( sm.AddSubaccountUpdatesToCache(streamUpdates, subaccountIds) } -// AddOrderbookUpdatesToCache adds a series of updates to the full node streaming cache. +// AddOrderUpdatesToCache adds a series of updates to the full node streaming cache. // Clob pair ids are the clob pair id each update is relevant to. -func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( +func (sm *FullNodeStreamingManagerImpl) AddOrderUpdatesToCache( updates []clobtypes.StreamUpdate, clobPairIds []uint32, ) { @@ -554,7 +555,7 @@ func (sm *FullNodeStreamingManagerImpl) AddOrderbookUpdatesToCache( } // Remove all subscriptions and wipe the buffer if buffer overflows. - sm.FlushCacheIfFull() + sm.RemoveSubscriptionsAndClearBufferIfFull() sm.EmitMetrics() } @@ -579,14 +580,14 @@ func (sm *FullNodeStreamingManagerImpl) AddSubaccountUpdatesToCache( sm.subaccountIdToSubscriptionIdMapping[*subaccountId], ) } - sm.FlushCacheIfFull() + sm.RemoveSubscriptionsAndClearBufferIfFull() sm.EmitMetrics() } -// FlushCacheIfFull removes all subscriptions and wipes the buffer if buffer overflows. +// RemoveSubscriptionsAndClearBufferIfFull removes all subscriptions and wipes the buffer if buffer overflows. // Note this method requires the lock and assumes that the lock has already been // acquired by the caller. -func (sm *FullNodeStreamingManagerImpl) FlushCacheIfFull() { +func (sm *FullNodeStreamingManagerImpl) RemoveSubscriptionsAndClearBufferIfFull() { // Remove all subscriptions and wipe the buffer if buffer overflows. if len(sm.streamUpdateCache) > int(sm.maxUpdatesInCache) { sm.logger.Error("Streaming buffer full capacity. Dropping messages and all subscriptions. " + diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 216bf3aeb3..24810fefe2 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -58,8 +58,8 @@ func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( ) { } -func (sm *NoopGrpcStreamingManager) GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 { - return nil +func (sm *NoopGrpcStreamingManager) TracksSubaccountId(id satypes.SubaccountId) bool { + return false } func (sm *NoopGrpcStreamingManager) InitializeNewStreams( diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index 809789ddf0..7930853be6 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -47,7 +47,7 @@ type FullNodeStreamingManager interface { blockHeight uint32, execMode sdk.ExecMode, ) - GetSubaccountIdToSubscriptionIdMapping() map[satypes.SubaccountId][]uint32 + TracksSubaccountId(id satypes.SubaccountId) bool } type OutgoingMessageSender interface { diff --git a/protocol/x/subaccounts/keeper/subaccount.go b/protocol/x/subaccounts/keeper/subaccount.go index 4dd52ab85f..c32b8772d7 100644 --- a/protocol/x/subaccounts/keeper/subaccount.go +++ b/protocol/x/subaccounts/keeper/subaccount.go @@ -413,7 +413,7 @@ func (k Keeper) UpdateSubaccounts( // if GRPC streaming is on, emit a generated subaccount update to stream. if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { - if _, exists := streamingManager.GetSubaccountIdToSubscriptionIdMapping()[*u.SettledSubaccount.Id]; exists { + if k.GetFullNodeStreamingManager().TracksSubaccountId(*u.SettledSubaccount.Id) { subaccountUpdate := GenerateStreamSubaccountUpdate(u, fundingPayments) k.SendSubaccountUpdates( ctx, From 65b28cc8c2d7419001e50180fc04ff0a53b222de Mon Sep 17 00:00:00 2001 From: Will Liu Date: Mon, 12 Aug 2024 13:57:38 -0400 Subject: [PATCH 37/37] gh wf --- .github/workflows/protocol-build-and-push.yml | 181 +++++++++++++++++- 1 file changed, 180 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index 155e8e0507..fc26dd6e69 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -3,12 +3,47 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: - - 'wl/sa2' - main - 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x jobs: + build-and-push-dev: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + build-and-push-dev2: runs-on: ubuntu-latest defaults: @@ -44,3 +79,147 @@ jobs: -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ -f testing/testnet-dev/Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev3: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV3 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV3 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev3-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev4: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV4 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV4 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev4-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-dev5: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_DEV5 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_DEV5 }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: dev5-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-dev/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags + + build-and-push-staging: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./protocol + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' # without this, ignite fails. + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_VALIDATOR_STAGING }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_VALIDATOR_STAGING }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, Tag, and Push the Image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: staging-validator + run: | + make localnet-build-amd64 + commit_hash=$(git rev-parse --short=7 HEAD) + docker build \ + --platform amd64 \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$commit_hash \ + -f testing/testnet-staging/Dockerfile . + docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags