From dbbfa5e2a4800620240e380e1c09e0519af712a4 Mon Sep 17 00:00:00 2001 From: unbornaztecking Date: Wed, 26 Feb 2025 14:48:04 -0500 Subject: [PATCH] Full Node Streaming Order Filtering by Subaccount impl and tests --- .../src/codegen/dydxprotocol/clob/query.ts | 27 +- proto/dydxprotocol/clob/query.proto | 5 + .../streaming/full_node_streaming_manager.go | 105 +++- .../full_node_streaming_manager_test.go | 464 ++++++++++++++++++ protocol/streaming/noop_streaming_manager.go | 1 + protocol/streaming/types/interface.go | 1 + protocol/streaming/util/util.go | 23 + protocol/streaming/util/util_test.go | 123 +++++ protocol/streaming/ws/websocket_server.go | 25 + .../x/clob/keeper/grpc_stream_orderbook.go | 1 + protocol/x/clob/types/query.pb.go | 266 +++++----- 11 files changed, 909 insertions(+), 132 deletions(-) create mode 100644 protocol/streaming/full_node_streaming_manager_test.go create mode 100644 protocol/streaming/util/util_test.go 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 b6032561973..ef7bf909526 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/clob/query.ts @@ -278,6 +278,13 @@ export interface StreamOrderbookUpdatesRequest { /** Market ids for price updates. */ marketIds: number[]; + /** + * Filter order updates by subaccount IDs. + * If true, the orderbook updates only include orders from provided subaccount + * IDs. + */ + + filterOrdersBySubaccountId: boolean; } /** * StreamOrderbookUpdatesRequest is a request message for the @@ -293,6 +300,13 @@ export interface StreamOrderbookUpdatesRequestSDKType { /** Market ids for price updates. */ market_ids: number[]; + /** + * Filter order updates by subaccount IDs. + * If true, the orderbook updates only include orders from provided subaccount + * IDs. + */ + + filter_orders_by_subaccount_id: boolean; } /** * StreamOrderbookUpdatesResponse is a response message for the @@ -1298,7 +1312,8 @@ function createBaseStreamOrderbookUpdatesRequest(): StreamOrderbookUpdatesReques return { clobPairId: [], subaccountIds: [], - marketIds: [] + marketIds: [], + filterOrdersBySubaccountId: false }; } @@ -1323,6 +1338,11 @@ export const StreamOrderbookUpdatesRequest = { } writer.ldelim(); + + if (message.filterOrdersBySubaccountId === true) { + writer.uint32(32).bool(message.filterOrdersBySubaccountId); + } + return writer; }, @@ -1365,6 +1385,10 @@ export const StreamOrderbookUpdatesRequest = { break; + case 4: + message.filterOrdersBySubaccountId = reader.bool(); + break; + default: reader.skipType(tag & 7); break; @@ -1379,6 +1403,7 @@ export const StreamOrderbookUpdatesRequest = { message.clobPairId = object.clobPairId?.map(e => e) || []; message.subaccountIds = object.subaccountIds?.map(e => SubaccountId.fromPartial(e)) || []; message.marketIds = object.marketIds?.map(e => e) || []; + message.filterOrdersBySubaccountId = object.filterOrdersBySubaccountId ?? false; return message; } diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 5584a1e9506..7d6eeb1b612 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -186,6 +186,11 @@ message StreamOrderbookUpdatesRequest { // Market ids for price updates. repeated uint32 market_ids = 3; + + // Filter order updates by subaccount IDs. + // If true, the orderbook updates only include orders from provided subaccount + // IDs. + bool filter_orders_by_subaccount_id = 4; } // StreamOrderbookUpdatesResponse is a response message for the diff --git a/protocol/streaming/full_node_streaming_manager.go b/protocol/streaming/full_node_streaming_manager.go index 939c7d29791..900bfa726fb 100644 --- a/protocol/streaming/full_node_streaming_manager.go +++ b/protocol/streaming/full_node_streaming_manager.go @@ -2,27 +2,25 @@ package streaming import ( "fmt" + "slices" "sync" "sync/atomic" "time" - "github.com/dydxprotocol/v4-chain/protocol/lib" - pricestypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" - satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" - "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ante_types "github.com/dydxprotocol/v4-chain/protocol/app/ante/types" + "github.com/dydxprotocol/v4-chain/protocol/finalizeblock" + ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + "github.com/dydxprotocol/v4-chain/protocol/lib" "github.com/dydxprotocol/v4-chain/protocol/lib/metrics" "github.com/dydxprotocol/v4-chain/protocol/streaming/types" streaming_util "github.com/dydxprotocol/v4-chain/protocol/streaming/util" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" - - ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" - - "github.com/dydxprotocol/v4-chain/protocol/finalizeblock" + pricestypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" ) var _ types.FullNodeStreamingManager = (*FullNodeStreamingManagerImpl)(nil) @@ -96,6 +94,23 @@ type OrderbookSubscription struct { nextSnapshotBlock uint32 } +func (sm *FullNodeStreamingManagerImpl) NewOrderbookSubscription( + clobPairIds []uint32, + subaccountIds []satypes.SubaccountId, + marketIds []uint32, + messageSender types.OutgoingMessageSender, +) *OrderbookSubscription { + return &OrderbookSubscription{ + subscriptionId: sm.getNextAvailableSubscriptionId(), + initialized: &atomic.Bool{}, // False by default. + clobPairIds: clobPairIds, + subaccountIds: subaccountIds, + marketIds: marketIds, + messageSender: messageSender, + updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), + } +} + func (sub *OrderbookSubscription) IsInitialized() bool { return sub.initialized.Load() } @@ -187,11 +202,57 @@ func (sm *FullNodeStreamingManagerImpl) getNextAvailableSubscriptionId() uint32 return id } +func doFilterStreamUpdateBySubaccount( + orderBookUpdate *clobtypes.StreamUpdate_OrderbookUpdate, + subaccountIds []satypes.SubaccountId, +) (bool, error) { + for _, orderBookUpdate := range orderBookUpdate.OrderbookUpdate.Updates { + orderBookUpdateSubaccountId, err := streaming_util.GetOffChainUpdateV1SubaccountId(orderBookUpdate) + if err != nil { + return false, err + } else if slices.Contains(subaccountIds, orderBookUpdateSubaccountId) { + return true, nil + } + } + return false, nil +} + +// If UpdateMessage is not a StreamUpdate_OrderUpdate, filter it +// If a StreamUpdate_OrderUpdate contains updates for subscribed subaccounts, filter it +// If a StreamUpdate_OrderUpdate contains no updates for subscribed subaccounts, drop it +// If checking subaccount ids in a StreamUpdate_OrderUpdate results in an error, log error and drop it +func FilterStreamUpdateBySubaccount( + updates []clobtypes.StreamUpdate, + subaccountIds []satypes.SubaccountId, + logger log.Logger, +) []clobtypes.StreamUpdate { + // If reflection becomes too expensive, split updatesChannel by message type + filteredUpdates := []clobtypes.StreamUpdate{} + for _, update := range updates { + switch updateMessage := update.UpdateMessage.(type) { + case *clobtypes.StreamUpdate_OrderbookUpdate: + if updateMessage.OrderbookUpdate.Snapshot { + break + } + doFilter, err := doFilterStreamUpdateBySubaccount(updateMessage, subaccountIds) + if err != nil { + logger.Error(err.Error()) + } + if !doFilter { + continue + } + } + filteredUpdates = append(filteredUpdates, update) + } + return filteredUpdates +} + // Subscribe subscribes to the orderbook updates stream. func (sm *FullNodeStreamingManagerImpl) Subscribe( clobPairIds []uint32, subaccountIds []*satypes.SubaccountId, marketIds []uint32, + filterOrdersBySubAccountId bool, messageSender types.OutgoingMessageSender, ) ( err error, @@ -200,6 +261,10 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( if len(clobPairIds) == 0 && len(subaccountIds) == 0 && len(marketIds) == 0 { return types.ErrInvalidStreamingRequest } + if filterOrdersBySubAccountId && (len(subaccountIds) == 0) { + sm.logger.Error("filterOrdersBySubaccountId with no subaccountIds") + return types.ErrInvalidStreamingRequest + } sm.Lock() sIds := make([]satypes.SubaccountId, len(subaccountIds)) @@ -207,17 +272,8 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sIds[i] = *subaccountId } - subscriptionId := sm.getNextAvailableSubscriptionId() + subscription := sm.NewOrderbookSubscription(clobPairIds, sIds, marketIds, messageSender) - subscription := &OrderbookSubscription{ - subscriptionId: subscriptionId, - initialized: &atomic.Bool{}, // False by default. - clobPairIds: clobPairIds, - subaccountIds: sIds, - marketIds: marketIds, - 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 @@ -254,10 +310,11 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.logger.Info( fmt.Sprintf( - "New subscription id %+v for clob pair ids: %+v and subaccount ids: %+v", + "New subscription id %+v for clob pair ids: %+v and subaccount ids: %+v. filter orders by subaccount ids: %+v", subscription.subscriptionId, clobPairIds, subaccountIds, + filterOrdersBySubAccountId, ), ) sm.orderbookSubscriptions[subscription.subscriptionId] = subscription @@ -268,6 +325,12 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( // Use current goroutine to consistently poll subscription channel for updates // to send through stream. for updates := range subscription.updatesChannel { + if filterOrdersBySubAccountId { + updates = FilterStreamUpdateBySubaccount(updates, sIds, sm.logger) + } + if len(updates) == 0 { + continue + } metrics.IncrCounterWithLabels( metrics.GrpcSendResponseToSubscriberCount, 1, @@ -1080,12 +1143,12 @@ func (sm *FullNodeStreamingManagerImpl) StreamBatchUpdatesAfterFinalizeBlock( sm.FlushStreamUpdatesWithLock() // Cache updates to sync local ops queue - sycnLocalUpdates, syncLocalClobPairIds := getStreamUpdatesFromOffchainUpdates( + syncLocalUpdates, syncLocalClobPairIds := getStreamUpdatesFromOffchainUpdates( streaming_util.GetOffchainUpdatesV1(orderBookUpdatesToSyncLocalOpsQueue), lib.MustConvertIntegerToUint32(ctx.BlockHeight()), ctx.ExecMode(), ) - sm.cacheStreamUpdatesByClobPairWithLock(sycnLocalUpdates, syncLocalClobPairIds) + sm.cacheStreamUpdatesByClobPairWithLock(syncLocalUpdates, syncLocalClobPairIds) // Cache updates for finalized fills. fillStreamUpdates, fillClobPairIds := sm.getStreamUpdatesForOrderbookFills( diff --git a/protocol/streaming/full_node_streaming_manager_test.go b/protocol/streaming/full_node_streaming_manager_test.go new file mode 100644 index 00000000000..d180aa29d67 --- /dev/null +++ b/protocol/streaming/full_node_streaming_manager_test.go @@ -0,0 +1,464 @@ +package streaming_test + +import ( + "testing" + "time" + + sdktypes "github.com/cosmos/cosmos-sdk/types" + ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + v1types "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types" + sharedtypes "github.com/dydxprotocol/v4-chain/protocol/indexer/shared/types" + "github.com/dydxprotocol/v4-chain/protocol/mocks" + streaming "github.com/dydxprotocol/v4-chain/protocol/streaming" + clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + pricestypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +func OpenOrder( + order *v1types.IndexerOrder, + timestamp *time.Time, +) ocutypes.OffChainUpdateV1 { + return ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderPlace{ + OrderPlace: &ocutypes.OrderPlaceV1{ + Order: order, + PlacementStatus: ocutypes.OrderPlaceV1_ORDER_PLACEMENT_STATUS_OPENED, + TimeStamp: timestamp, + }, + }, + } +} + +func CancelOrder( + removedOrderId *v1types.IndexerOrderId, + timestamp *time.Time, +) ocutypes.OffChainUpdateV1 { + return ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderRemove{ + OrderRemove: &ocutypes.OrderRemoveV1{ + RemovedOrderId: removedOrderId, + Reason: sharedtypes.OrderRemovalReason(ocutypes.OrderRemoveV1_ORDER_REMOVAL_STATUS_CANCELED), + RemovalStatus: ocutypes.OrderRemoveV1_ORDER_REMOVAL_STATUS_CANCELED, + TimeStamp: timestamp, + }, + }, + } +} + +func ReplaceOrder( + oldOrderId *v1types.IndexerOrderId, + newOrder *v1types.IndexerOrder, + timestamp *time.Time, +) ocutypes.OffChainUpdateV1 { + return ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderReplace{ + OrderReplace: &ocutypes.OrderReplaceV1{ + OldOrderId: oldOrderId, + Order: newOrder, + PlacementStatus: ocutypes.OrderPlaceV1_ORDER_PLACEMENT_STATUS_OPENED, + TimeStamp: timestamp, + }, + }, + } +} + +func UpdateOrder(orderId *v1types.IndexerOrderId, totalFilledQuantums uint64) ocutypes.OffChainUpdateV1 { + return ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderUpdate{ + OrderUpdate: &ocutypes.OrderUpdateV1{ + OrderId: orderId, + TotalFilledQuantums: totalFilledQuantums, + }, + }, + } +} + +func toStreamUpdate(snapshot bool, offChainUpdates ...ocutypes.OffChainUpdateV1) clobtypes.StreamUpdate { + return clobtypes.StreamUpdate{ + BlockHeight: uint32(0), + ExecMode: uint32(sdktypes.ExecModeFinalize), + UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ + OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ + Updates: offChainUpdates, + Snapshot: snapshot, + }, + }, + } +} + +func NewStreamOrderbookFill( + blockHeight uint32, + execMode uint32, +) *clobtypes.StreamUpdate { + return &clobtypes.StreamUpdate{ + BlockHeight: blockHeight, + ExecMode: execMode, + UpdateMessage: &clobtypes.StreamUpdate_OrderFill{ + OrderFill: nil, + }, + } +} + +func NewStreamTakerOrder( + blockHeight uint32, + execMode uint32, + order *clobtypes.Order, + remainingQuantums uint64, + optimisticallyFilledQuantums uint64, +) *clobtypes.StreamUpdate { + return &clobtypes.StreamUpdate{ + BlockHeight: blockHeight, + ExecMode: execMode, + UpdateMessage: &clobtypes.StreamUpdate_TakerOrder{ + TakerOrder: &clobtypes.StreamTakerOrder{ + TakerOrder: &clobtypes.StreamTakerOrder_Order{ + Order: order, + }, + TakerOrderStatus: &clobtypes.StreamTakerOrderStatus{ + OrderStatus: uint32(clobtypes.Success), + RemainingQuantums: remainingQuantums, + OptimisticallyFilledQuantums: optimisticallyFilledQuantums, + }, + }, + }, + } +} + +func NewSubaccountUpdate( + blockHeight uint32, + execMode uint32, + subaccountId *satypes.SubaccountId, +) *clobtypes.StreamUpdate { + return &clobtypes.StreamUpdate{ + BlockHeight: blockHeight, + ExecMode: execMode, + UpdateMessage: &clobtypes.StreamUpdate_SubaccountUpdate{ + SubaccountUpdate: &satypes.StreamSubaccountUpdate{ + SubaccountId: subaccountId, + UpdatedPerpetualPositions: []*satypes.SubaccountPerpetualPosition{}, + UpdatedAssetPositions: []*satypes.SubaccountAssetPosition{}, + Snapshot: false, + }, + }, + } +} + +func NewPriceUpdate( + blockHeight uint32, + execMode uint32, +) *clobtypes.StreamUpdate { + return &clobtypes.StreamUpdate{ + BlockHeight: blockHeight, + ExecMode: execMode, + UpdateMessage: &clobtypes.StreamUpdate_PriceUpdate{ + PriceUpdate: &pricestypes.StreamPriceUpdate{ + MarketId: 1, + Price: pricestypes.MarketPrice{ + Id: 1, + Exponent: 6, + Price: 1, + }, + Snapshot: false, + }, + }, + } +} + +func NewIndexerOrderId(owner string, id uint32) v1types.IndexerOrderId { + return v1types.IndexerOrderId{ + SubaccountId: v1types.IndexerSubaccountId{ + Owner: owner, + Number: id, + }, + ClientId: 0, + OrderFlags: 0, + ClobPairId: 0, + } +} + +func NewOrderId(owner string, id uint32) clobtypes.OrderId { + return clobtypes.OrderId{ + SubaccountId: satypes.SubaccountId{ + Owner: owner, + Number: id, + }, + ClientId: 0, + OrderFlags: 0, + ClobPairId: 0, + } +} + +func NewIndexerOrder(id v1types.IndexerOrderId) v1types.IndexerOrder { + return v1types.IndexerOrder{ + OrderId: id, + Side: v1types.IndexerOrder_SIDE_BUY, + Quantums: uint64(1_000_000), + Subticks: 1, + GoodTilOneof: &v1types.IndexerOrder_GoodTilBlock{ + GoodTilBlock: 1_000_000_000, + }, + TimeInForce: 1_000_000_000, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: v1types.IndexerOrder_CONDITION_TYPE_UNSPECIFIED, + ConditionalOrderTriggerSubticks: 0, + } +} + +func NewOrder(id clobtypes.OrderId) *clobtypes.Order { + return &clobtypes.Order{ + OrderId: id, + Side: clobtypes.Order_SIDE_BUY, + Quantums: uint64(1_000_000), + Subticks: 1, + GoodTilOneof: &clobtypes.Order_GoodTilBlock{ + GoodTilBlock: 1_000_000_000, + }, + TimeInForce: 1_000_000_000, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: clobtypes.Order_CONDITION_TYPE_UNSPECIFIED, + ConditionalOrderTriggerSubticks: 0, + } +} + +func NewLogger() *mocks.Logger { + logger := mocks.Logger{} + logger.On("Info", mock.Anything, mock.Anything, mock.Anything) + logger.On("Error", mock.Anything, mock.Anything, mock.Anything) + return &logger +} + +type TestCase struct { + updates []clobtypes.StreamUpdate + subaccountIds []satypes.SubaccountId + filteredUpdates []clobtypes.StreamUpdate +} + +func TestFilterStreamUpdates(t *testing.T) { + logger := NewLogger() + + subaccountId := satypes.SubaccountId{Owner: "me", Number: 1337} + orderId := NewIndexerOrderId(subaccountId.Owner, subaccountId.Number) + order := NewIndexerOrder(orderId) + + otherSubaccountId := satypes.SubaccountId{Owner: "we", Number: 2600} + otherOrderId := NewIndexerOrderId(otherSubaccountId.Owner, otherSubaccountId.Number) + otherOrder := NewIndexerOrder(otherOrderId) + + neverInScopeSubaccountId := satypes.SubaccountId{Owner: "them", Number: 404} + + newOrderId := order.OrderId + newOrderId.ClientId += 1 + newOrder := NewIndexerOrder(newOrderId) + + otherNewOrderId := otherOrder.OrderId + otherNewOrderId.ClientId += 1 + otherNewOrder := NewIndexerOrder(otherNewOrderId) + + orderPlaceTime := time.Date(2024, 12, 25, 0, 0, 0, 0, time.UTC) + openOrder := OpenOrder(&order, &orderPlaceTime) + orderCancelTime := orderPlaceTime.Add(time.Second) + cancelOrder := CancelOrder(&orderId, &orderCancelTime) + orderReplaceTime := orderPlaceTime.Add(time.Minute) + replaceOrder := ReplaceOrder(&orderId, &newOrder, &orderReplaceTime) + updateOrder := UpdateOrder(&orderId, uint64(1988)) + + otherOpenOrder := OpenOrder(&otherOrder, &orderPlaceTime) + otherCancelOrder := CancelOrder(&otherOrderId, &orderCancelTime) + otherReplaceOrder := ReplaceOrder(&otherOrderId, &otherNewOrder, &orderReplaceTime) + otherUpdateOrder := UpdateOrder(&otherOrderId, uint64(1999)) + + baseStreamUpdate := toStreamUpdate(false, openOrder, cancelOrder, replaceOrder, updateOrder) + snapshotBaseStreamUpdate := toStreamUpdate(true, openOrder, cancelOrder, replaceOrder, updateOrder) + otherStreamUpdate := toStreamUpdate(false, otherOpenOrder, otherCancelOrder, otherReplaceOrder, otherUpdateOrder) + bothStreamUpdate := toStreamUpdate( + false, + openOrder, + cancelOrder, + replaceOrder, + updateOrder, + otherOpenOrder, + otherCancelOrder, + otherReplaceOrder, + otherUpdateOrder, + ) + + orderBookFillUpdate := NewStreamOrderbookFill(0, 0) + clobOrder := NewOrder(NewOrderId("foo", 23)) + takerOrderUpdate := NewStreamTakerOrder(0, 0, clobOrder, 0, 0) + subaccountUpdate := NewSubaccountUpdate( + 0, + 0, + (*satypes.SubaccountId)(&orderId.SubaccountId), + ) + priceUpdate := NewPriceUpdate(0, 0) + + tests := map[string]TestCase{ + "snapshotNotInScope": { + updates: []clobtypes.StreamUpdate{snapshotBaseStreamUpdate}, + subaccountIds: []satypes.SubaccountId{neverInScopeSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{snapshotBaseStreamUpdate}, + }, + "snapshotNoScope": { + updates: []clobtypes.StreamUpdate{snapshotBaseStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{snapshotBaseStreamUpdate}, + }, + "baseInScope": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate}, + }, + "baseNotInScope": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate}, + subaccountIds: []satypes.SubaccountId{neverInScopeSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "otherInScope": { + updates: []clobtypes.StreamUpdate{otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{otherSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{otherStreamUpdate}, + }, + "otherNotInScope": { + updates: []clobtypes.StreamUpdate{otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "bothInScope": { + updates: []clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId, otherSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{bothStreamUpdate}, + }, + "bothOtherInScope": { + updates: []clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []satypes.SubaccountId{otherSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{bothStreamUpdate}, + }, + "bothSequentiallyOtherInScope": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{otherSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{otherStreamUpdate}, + }, + "bothBaseInScope": { + updates: []clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{bothStreamUpdate}, + }, + "bothSequentiallyBaseInScope": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate}, + }, + "bothNoneInScopeWrongId": { + updates: []clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []satypes.SubaccountId{neverInScopeSubaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "bothNoneInScopeNoId": { + updates: []clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "noUpdates": { + updates: []clobtypes.StreamUpdate{}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "noUpdatesNoId": { + updates: []clobtypes.StreamUpdate{}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{}, + }, + "orderBookFillUpdates": { + updates: []clobtypes.StreamUpdate{*orderBookFillUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*orderBookFillUpdate}, + }, + "orderBookFillUpdatesDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*orderBookFillUpdate}, + }, + "orderBookFillUpdatesFilterUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + }, + "orderBookFillUpdatesFilterAndDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + }, + "takerOrderUpdates": { + updates: []clobtypes.StreamUpdate{*takerOrderUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*takerOrderUpdate}, + }, + "takerOrderUpdatesDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*takerOrderUpdate}, + }, + "takerOrderUpdatesFilterUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + }, + "takerOrderUpdatesFilterAndDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + }, + "subaccountUpdates": { + updates: []clobtypes.StreamUpdate{*subaccountUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*subaccountUpdate}, + }, + "subaccountUpdatesDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*subaccountUpdate}, + }, + "subaccountUpdatesFilterUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + }, + "subaccountUpdatesFilterAndDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + }, + "priceUpdates": { + updates: []clobtypes.StreamUpdate{*priceUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*priceUpdate}, + }, + "priceUpdatesDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{}, + filteredUpdates: []clobtypes.StreamUpdate{*priceUpdate}, + }, + "priceUpdatesFilterUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + }, + "priceUpdatesFilterAndDropUpdate": { + updates: []clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate, otherStreamUpdate}, + subaccountIds: []satypes.SubaccountId{subaccountId}, + filteredUpdates: []clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + }, + } + + for name, testCase := range tests { + t.Run(name, func(t *testing.T) { + filteredUpdates := streaming.FilterStreamUpdateBySubaccount(testCase.updates, testCase.subaccountIds, logger) + require.Equal(t, testCase.filteredUpdates, filteredUpdates) + }) + } +} diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index bb81af1b43a..fc743d3fe1e 100644 --- a/protocol/streaming/noop_streaming_manager.go +++ b/protocol/streaming/noop_streaming_manager.go @@ -24,6 +24,7 @@ func (sm *NoopGrpcStreamingManager) Subscribe( _ []uint32, _ []*satypes.SubaccountId, _ []uint32, + _ bool, _ types.OutgoingMessageSender, ) ( err error, diff --git a/protocol/streaming/types/interface.go b/protocol/streaming/types/interface.go index 41657e7301f..32ed36e76a5 100644 --- a/protocol/streaming/types/interface.go +++ b/protocol/streaming/types/interface.go @@ -16,6 +16,7 @@ type FullNodeStreamingManager interface { clobPairIds []uint32, subaccountIds []*satypes.SubaccountId, marketIds []uint32, + filterOrdersBySubaccountId bool, srv OutgoingMessageSender, ) ( err error, diff --git a/protocol/streaming/util/util.go b/protocol/streaming/util/util.go index bbf37e3340e..eb880c376ad 100644 --- a/protocol/streaming/util/util.go +++ b/protocol/streaming/util/util.go @@ -5,7 +5,9 @@ import ( "github.com/cosmos/gogoproto/proto" ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + v1types "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" ) // GetOffchainUpdatesV1 unmarshals messages in offchain updates to OffchainUpdateV1. @@ -21,3 +23,24 @@ func GetOffchainUpdatesV1(offchainUpdates *clobtypes.OffchainUpdates) []ocutypes } return v1updates } + +// Error expected if OffChainUpdateV1.UpdateMessage message type is extended to more order events +func GetOffChainUpdateV1SubaccountId(update ocutypes.OffChainUpdateV1) (satypes.SubaccountId, error) { + var orderSubaccountId v1types.IndexerSubaccountId + switch updateMessage := update.UpdateMessage.(type) { + case *ocutypes.OffChainUpdateV1_OrderPlace: + orderSubaccountId = updateMessage.OrderPlace.Order.OrderId.SubaccountId + case *ocutypes.OffChainUpdateV1_OrderRemove: + orderSubaccountId = updateMessage.OrderRemove.RemovedOrderId.SubaccountId + case *ocutypes.OffChainUpdateV1_OrderUpdate: + orderSubaccountId = updateMessage.OrderUpdate.OrderId.SubaccountId + case *ocutypes.OffChainUpdateV1_OrderReplace: + orderSubaccountId = updateMessage.OrderReplace.Order.OrderId.SubaccountId + default: + return satypes.SubaccountId{}, fmt.Errorf( + "UpdateMessage type not in {OrderPlace, OrderRemove, OrderUpdate, OrderReplace}: %+v", + updateMessage, + ) + } + return satypes.SubaccountId{Owner: orderSubaccountId.Owner, Number: orderSubaccountId.Number}, nil +} diff --git a/protocol/streaming/util/util_test.go b/protocol/streaming/util/util_test.go new file mode 100644 index 00000000000..96994ac6e18 --- /dev/null +++ b/protocol/streaming/util/util_test.go @@ -0,0 +1,123 @@ +package util_test + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + + ocutypes "github.com/dydxprotocol/v4-chain/protocol/indexer/off_chain_updates/types" + pv1types "github.com/dydxprotocol/v4-chain/protocol/indexer/protocol/v1/types" + stypes "github.com/dydxprotocol/v4-chain/protocol/indexer/shared/types" + "github.com/dydxprotocol/v4-chain/protocol/streaming/util" + satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" +) + +func _ToPtr[V any](v V) *V { + return &v +} + +func TestGetOffChainUpdateV1SubaccountId(t *testing.T) { + indexerSubaccountId := pv1types.IndexerSubaccountId{ + Owner: "dydx1gm0w9nymewm9z4u7wtyw6auru562xkhtftk80p", + Number: uint32(1337), + } + subaccountId := satypes.SubaccountId{ + Owner: "dydx1gm0w9nymewm9z4u7wtyw6auru562xkhtftk80p", + Number: uint32(1337), + } + orderId := pv1types.IndexerOrderId{ + SubaccountId: indexerSubaccountId, + ClientId: 0, + OrderFlags: 0, + ClobPairId: 0, + } + order := pv1types.IndexerOrder{ + OrderId: orderId, + Side: pv1types.IndexerOrder_SIDE_BUY, + Quantums: uint64(1_000_000), + Subticks: 1, + GoodTilOneof: &pv1types.IndexerOrder_GoodTilBlock{ + GoodTilBlock: 1_000_000_000, + }, + TimeInForce: 1_000_000_000, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: pv1types.IndexerOrder_CONDITION_TYPE_UNSPECIFIED, + ConditionalOrderTriggerSubticks: 0, + } + newOrder := order + newOrder.Quantums += 1_000_000 + + orderPlaceTime := time.Now() + fillQuantums := uint64(1988) + + tests := map[string]struct { + update ocutypes.OffChainUpdateV1 + id satypes.SubaccountId + err error + }{ + "OrderPlace": { + update: ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderPlace{ + OrderPlace: &ocutypes.OrderPlaceV1{ + Order: &order, + PlacementStatus: ocutypes.OrderPlaceV1_ORDER_PLACEMENT_STATUS_BEST_EFFORT_OPENED, + TimeStamp: _ToPtr(orderPlaceTime), + }, + }, + }, + id: subaccountId, + err: nil, + }, + "OrderRemove": { + update: ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderRemove{ + OrderRemove: &ocutypes.OrderRemoveV1{ + RemovedOrderId: &orderId, + Reason: stypes.OrderRemovalReason_ORDER_REMOVAL_REASON_USER_CANCELED, + RemovalStatus: ocutypes.OrderRemoveV1_ORDER_REMOVAL_STATUS_CANCELED, + TimeStamp: _ToPtr(orderPlaceTime.Add(1 * time.Second)), + }, + }, + }, + id: subaccountId, + err: nil, + }, + "OrderUpdate": { + update: ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderUpdate{ + OrderUpdate: &ocutypes.OrderUpdateV1{ + OrderId: &orderId, + TotalFilledQuantums: fillQuantums, + }, + }, + }, + id: subaccountId, + err: nil, + }, + "OrderReplace": { + update: ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderReplace{ + OrderReplace: &ocutypes.OrderReplaceV1{ + OldOrderId: &orderId, + Order: &newOrder, + PlacementStatus: ocutypes.OrderPlaceV1_ORDER_PLACEMENT_STATUS_OPENED, + TimeStamp: _ToPtr(orderPlaceTime.Add(3 * time.Second)), + }, + }, + }, + id: subaccountId, + err: nil, + }, + } + for name, testCase := range tests { + t.Run(name, func(t *testing.T) { + id, err := util.GetOffChainUpdateV1SubaccountId(testCase.update) + fmt.Println("expected", id) + require.Equal(t, testCase.err, err) + require.Equal(t, testCase.id, id) + }) + } +} diff --git a/protocol/streaming/ws/websocket_server.go b/protocol/streaming/ws/websocket_server.go index 33a7434e427..47dde15df8e 100644 --- a/protocol/streaming/ws/websocket_server.go +++ b/protocol/streaming/ws/websocket_server.go @@ -97,6 +97,16 @@ func (ws *WebsocketServer) Handler(w http.ResponseWriter, r *http.Request) { return } + // Parse filterOrdersBySubaccountId from query parameters + filterOrdersBySubaccountId, err := parseFilterOrdersBySubaccountId(r) + if err != nil { + ws.logger.Error("Error parsing filterOrdersBySubaccountId", "err", err) + if err := sendCloseWithReason(conn, websocket.CloseUnsupportedData, err.Error()); err != nil { + ws.logger.Error("Error sending close message", "err", err) + } + return + } + websocketMessageSender := &WebsocketMessageSender{ cdc: ws.cdc, conn: conn, @@ -110,6 +120,7 @@ func (ws *WebsocketServer) Handler(w http.ResponseWriter, r *http.Request) { clobPairIds, subaccountIds, marketIds, + filterOrdersBySubaccountId, websocketMessageSender, ) if err != nil { @@ -169,6 +180,20 @@ func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) { return subaccountIds, nil } +// parseFilterOrdersBySubaccountId is a helper function to parse the filterOrdersBySubaccountId flag +// from the query parameters. +func parseFilterOrdersBySubaccountId(r *http.Request) (bool, error) { + token := r.URL.Query().Get("filterOrdersBySubaccountId") + if token == "" { + return false, nil + } + value, err := strconv.ParseBool(token) + if err != nil { + return false, fmt.Errorf("invalid filterOrdersBySubaccountId: %s", token) + } + return value, nil +} + // parseUint32 is a helper function to parse the uint32 from the query parameters. func parseUint32(r *http.Request, queryParam string) ([]uint32, error) { param := r.URL.Query().Get(queryParam) diff --git a/protocol/x/clob/keeper/grpc_stream_orderbook.go b/protocol/x/clob/keeper/grpc_stream_orderbook.go index 029266901ac..0de49b3c815 100644 --- a/protocol/x/clob/keeper/grpc_stream_orderbook.go +++ b/protocol/x/clob/keeper/grpc_stream_orderbook.go @@ -12,6 +12,7 @@ func (k Keeper) StreamOrderbookUpdates( req.GetClobPairId(), req.GetSubaccountIds(), req.GetMarketIds(), + req.GetFilterOrdersBySubaccountId(), stream, ) if err != nil { diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index b2592069108..335430b2c04 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -858,6 +858,10 @@ type StreamOrderbookUpdatesRequest struct { SubaccountIds []*types.SubaccountId `protobuf:"bytes,2,rep,name=subaccount_ids,json=subaccountIds,proto3" json:"subaccount_ids,omitempty"` // Market ids for price updates. MarketIds []uint32 `protobuf:"varint,3,rep,packed,name=market_ids,json=marketIds,proto3" json:"market_ids,omitempty"` + // Filter order updates by subaccount IDs. + // If true, the orderbook updates only include orders from provided subaccount + // IDs. + FilterOrdersBySubaccountId bool `protobuf:"varint,4,opt,name=filter_orders_by_subaccount_id,json=filterOrdersBySubaccountId,proto3" json:"filter_orders_by_subaccount_id,omitempty"` } func (m *StreamOrderbookUpdatesRequest) Reset() { *m = StreamOrderbookUpdatesRequest{} } @@ -914,6 +918,13 @@ func (m *StreamOrderbookUpdatesRequest) GetMarketIds() []uint32 { return nil } +func (m *StreamOrderbookUpdatesRequest) GetFilterOrdersBySubaccountId() bool { + if m != nil { + return m.FilterOrdersBySubaccountId + } + return false +} + // StreamOrderbookUpdatesResponse is a response message for the // StreamOrderbookUpdates method. type StreamOrderbookUpdatesResponse struct { @@ -1440,118 +1451,120 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1770 bytes of a gzipped FileDescriptorProto + // 1798 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4d, 0x6c, 0xdc, 0xc6, 0x15, 0x5e, 0x4a, 0xb2, 0x2d, 0xbd, 0xb5, 0x14, 0x69, 0x1c, 0x3b, 0x9b, 0x95, 0xbc, 0x92, 0xe9, - 0x58, 0xd6, 0x3a, 0xf1, 0x52, 0x56, 0x82, 0x20, 0xb5, 0x8b, 0x14, 0x96, 0x5b, 0x59, 0x42, 0xad, - 0x44, 0xa1, 0x14, 0x47, 0x68, 0x03, 0x10, 0xb3, 0xe4, 0x68, 0x35, 0x10, 0xc9, 0x59, 0x91, 0xc3, - 0x85, 0x84, 0xa2, 0x28, 0xd0, 0x43, 0x2e, 0x6d, 0x81, 0x02, 0x3d, 0xf4, 0x50, 0xf4, 0xd4, 0x73, - 0xd1, 0x5e, 0x7a, 0xec, 0xdf, 0x2d, 0x47, 0x03, 0xbd, 0xf4, 0x50, 0x14, 0x85, 0xdd, 0x73, 0x8f, - 0x3d, 0x07, 0x9c, 0x19, 0xee, 0x92, 0x4b, 0x72, 0x25, 0xeb, 0x22, 0x71, 0xde, 0xbc, 0xf7, 0xcd, - 0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e, 0x88, 0xce, 0x49, 0x73, 0x20, 0xd0, - 0xef, 0xc2, 0x1d, 0x41, 0xfb, 0x59, 0xaa, 0xec, 0x15, 0x1e, 0xea, 0x57, 0x1a, 0x2c, 0x9f, 0xa5, - 0xa9, 0x9c, 0xfd, 0x12, 0xae, 0x15, 0x54, 0x51, 0xe5, 0xf0, 0x9d, 0x22, 0x87, 0x73, 0x90, 0xca, - 0x59, 0xe4, 0xe6, 0x66, 0xf4, 0x05, 0xb5, 0xd1, 0x9f, 0x90, 0x93, 0x7e, 0xc1, 0xda, 0x72, 0x12, - 0x9a, 0x9b, 0x30, 0x5f, 0x38, 0xab, 0xa8, 0x35, 0x61, 0xce, 0x27, 0x27, 0xdc, 0x2a, 0xb8, 0xe0, - 0x33, 0x7e, 0xc6, 0x44, 0xff, 0x83, 0x06, 0x37, 0x77, 0x45, 0xad, 0x14, 0xe7, 0xd0, 0x66, 0xec, - 0xe8, 0x73, 0x59, 0xb2, 0x93, 0x80, 0xc9, 0x27, 0x8a, 0xf1, 0xa1, 0x44, 0xb1, 0x0d, 0x33, 0x83, - 0xa2, 0x6c, 0x51, 0x27, 0xce, 0xa2, 0xe3, 0xf9, 0x14, 0x9d, 0x2a, 0xe2, 0xad, 0xdd, 0xfe, 0xf7, - 0x96, 0x63, 0x4e, 0x87, 0xa9, 0x51, 0x88, 0x6e, 0x02, 0x78, 0x38, 0x38, 0x22, 0x12, 0x6a, 0x5c, - 0x2c, 0x37, 0x25, 0x25, 0x5b, 0x4e, 0xa8, 0x63, 0x68, 0x94, 0x11, 0x56, 0xee, 0x7f, 0x07, 0xae, - 0xa8, 0xb6, 0x43, 0xa5, 0xd6, 0xc5, 0x82, 0xd3, 0x90, 0x18, 0xd2, 0x34, 0x09, 0x73, 0x65, 0xa5, - 0xff, 0x7f, 0x1c, 0xae, 0xa6, 0xe7, 0xd1, 0x2d, 0xb8, 0x2a, 0xaf, 0xef, 0x21, 0xa1, 0x9d, 0x43, - 0xae, 0xf6, 0xb2, 0x2a, 0x64, 0x9b, 0x42, 0x84, 0xe6, 0x61, 0x8a, 0x9c, 0x10, 0xdb, 0xf2, 0x98, - 0x43, 0x44, 0x7c, 0x4e, 0x9b, 0x93, 0xb1, 0x60, 0x9b, 0x39, 0x04, 0x7d, 0x0e, 0xb3, 0x2c, 0x61, - 0xab, 0x5a, 0x22, 0x11, 0xa4, 0xd5, 0xb5, 0x95, 0x52, 0x6a, 0x43, 0xee, 0x6d, 0x56, 0xcc, 0x37, - 0x58, 0x56, 0x14, 0x17, 0x64, 0x79, 0xdf, 0xe2, 0x8b, 0x50, 0x9b, 0x28, 0xad, 0x8b, 0x43, 0x80, - 0x1b, 0xd4, 0x75, 0x37, 0x2b, 0xe6, 0x94, 0xb0, 0x8d, 0x07, 0x68, 0x03, 0xaa, 0x1c, 0x1f, 0x91, - 0xc0, 0x12, 0xa2, 0xda, 0x25, 0x81, 0x74, 0xbb, 0x14, 0x69, 0x2f, 0xd6, 0x15, 0x70, 0x9b, 0x15, - 0x13, 0x78, 0x7f, 0x84, 0x2c, 0x98, 0x4b, 0x45, 0x82, 0x72, 0xf4, 0xb2, 0x40, 0x5b, 0x1d, 0x11, - 0x0c, 0x02, 0x74, 0x10, 0x12, 0x7d, 0x87, 0x67, 0xc3, 0x21, 0x19, 0xfa, 0x3e, 0x5c, 0x15, 0x0d, - 0x5e, 0x82, 0x7d, 0xa5, 0xc8, 0x67, 0xd9, 0x02, 0x2a, 0xd8, 0x9d, 0x78, 0xd0, 0x47, 0xac, 0x76, - 0x07, 0xc3, 0xf5, 0x59, 0x98, 0x91, 0x30, 0x96, 0x47, 0xc2, 0x10, 0x77, 0x88, 0xfe, 0x0b, 0x0d, - 0xae, 0x17, 0xee, 0x3e, 0xaa, 0xc3, 0x64, 0xe8, 0xe3, 0x6e, 0x78, 0xc8, 0xe4, 0xe9, 0x4f, 0x9a, - 0xfd, 0x31, 0xda, 0x1f, 0xc4, 0x9b, 0x0c, 0xfc, 0x8f, 0xb2, 0x7c,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, 0x44, 0x6d, 0x97, 0xd9, 0x87, + 0x56, 0x80, 0x39, 0xb1, 0x5c, 0xea, 0x51, 0x6e, 0xd9, 0xcc, 0xef, 0xd0, 0xae, 0x12, 0xb8, 0x91, + 0x17, 0x88, 0xff, 0x58, 0x3d, 0x4c, 0x03, 0xc5, 0xb2, 0x9e, 0x67, 0x21, 0x47, 0x11, 0xe5, 0x27, + 0x16, 0xa7, 0x24, 0x28, 0x52, 0x5a, 0xe0, 0x17, 0x16, 0x38, 0x24, 0x51, 0xb8, 0x9c, 0xdf, 0xf6, + 0x30, 0xb7, 0x0f, 0x48, 0x62, 0xf1, 0xbb, 0x79, 0x06, 0x97, 0x1e, 0x45, 0xd4, 0x91, 0x7e, 0xc9, + 0x1e, 0xb6, 0x58, 0xa0, 0x8d, 0xf4, 0xd5, 0xe6, 0xc7, 0x99, 0x4d, 0xea, 0x3b, 0xe4, 0x98, 0x04, + 0x06, 0xeb, 0x74, 0x2c, 0xfb, 0x00, 0x53, 0xdf, 0x8a, 0x7a, 0x0e, 0xe6, 0x24, 0xcc, 0x53, 0x94, + 0xfc, 0x5a, 0x46, 0x3e, 0x8c, 0xda, 0xd8, 0xb6, 0x59, 0xe4, 0xf3, 0xd0, 0x08, 0x79, 0x40, 0xb0, + 0x47, 0xfd, 0x04, 0x46, 0xb3, 0x9c, 0x73, 0xf0, 0xad, 0x58, 0x6f, 0x66, 0x58, 0x7b, 0x01, 0xb5, + 0x49, 0x4e, 0x9f, 0xde, 0x84, 0xb7, 0x3e, 0x8b, 0x63, 0xfd, 0x84, 0xf0, 0x47, 0x2e, 0x6b, 0xef, + 0x60, 0x1a, 0x98, 0xe4, 0x28, 0x22, 0x21, 0x47, 0x73, 0x30, 0x41, 0x9d, 0x9a, 0xb6, 0xa2, 0xad, + 0xcd, 0x9a, 0x13, 0xd4, 0xd1, 0xbf, 0x80, 0xab, 0x82, 0x75, 0xc8, 0x17, 0xf6, 0x98, 0x1f, 0x12, + 0xf4, 0x31, 0xcc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xbb, + 0xe8, 0x2d, 0x53, 0xbf, 0x7b, 0x46, 0x6e, 0x85, 0xae, 0x82, 0x7e, 0xab, 0xc1, 0x5c, 0x76, 0x66, + 0x46, 0xa5, 0x3a, 0x0a, 0x27, 0xef, 0x7a, 0xeb, 0xac, 0xec, 0xea, 0xcc, 0xf7, 0x84, 0x47, 0x56, + 0xd1, 0x3b, 0x05, 0x1e, 0xc9, 0xcd, 0xe8, 0xe8, 0x27, 0x49, 0xc5, 0x1f, 0x9d, 0x4b, 0xd1, 0xfa, + 0x59, 0x67, 0xbc, 0x64, 0x6e, 0xaf, 0xdf, 0x7b, 0x0d, 0x09, 0x09, 0x76, 0x5d, 0xdb, 0xdc, 0xf9, + 0xfa, 0x65, 0x43, 0x7b, 0xf1, 0xb2, 0xa1, 0xfd, 0xfb, 0x65, 0x43, 0xfb, 0xe5, 0xab, 0x46, 0xe5, + 0xc5, 0xab, 0x46, 0xe5, 0x1f, 0xaf, 0x1a, 0x95, 0x1f, 0x7c, 0xd8, 0xa5, 0xfc, 0x20, 0x6a, 0xb7, + 0x6c, 0xe6, 0x65, 0x4d, 0xe9, 0x7f, 0x70, 0x57, 0x0c, 0x24, 0xc6, 0x80, 0x72, 0x2c, 0xcd, 0xe3, + 0x27, 0x3d, 0x12, 0xb6, 0x2f, 0x0a, 0xf2, 0xfb, 0xdf, 0x04, 0x00, 0x00, 0xff, 0xff, 0x55, 0xfb, + 0x6d, 0x6f, 0xdd, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2558,6 +2571,16 @@ func (m *StreamOrderbookUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.FilterOrdersBySubaccountId { + i-- + if m.FilterOrdersBySubaccountId { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(m.MarketIds) > 0 { dAtA12 := make([]byte, len(m.MarketIds)*10) var j11 int @@ -3284,6 +3307,9 @@ func (m *StreamOrderbookUpdatesRequest) Size() (n int) { } n += 1 + sovQuery(uint64(l)) + l } + if m.FilterOrdersBySubaccountId { + n += 2 + } return n } @@ -5089,6 +5115,26 @@ func (m *StreamOrderbookUpdatesRequest) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field MarketIds", wireType) } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FilterOrdersBySubaccountId", 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.FilterOrdersBySubaccountId = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])