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 b603256197..0c3450582c 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,9 @@ export interface StreamOrderbookUpdatesRequest { /** Market ids for price updates. */ marketIds: number[]; + /** Filter order updates in addition to position updates */ + + filterOrders: boolean; } /** * StreamOrderbookUpdatesRequest is a request message for the @@ -293,6 +296,9 @@ export interface StreamOrderbookUpdatesRequestSDKType { /** Market ids for price updates. */ market_ids: number[]; + /** Filter order updates in addition to position updates */ + + filter_orders: boolean; } /** * StreamOrderbookUpdatesResponse is a response message for the @@ -1298,7 +1304,8 @@ function createBaseStreamOrderbookUpdatesRequest(): StreamOrderbookUpdatesReques return { clobPairId: [], subaccountIds: [], - marketIds: [] + marketIds: [], + filterOrders: false }; } @@ -1323,6 +1330,11 @@ export const StreamOrderbookUpdatesRequest = { } writer.ldelim(); + + if (message.filterOrders === true) { + writer.uint32(32).bool(message.filterOrders); + } + return writer; }, @@ -1365,6 +1377,10 @@ export const StreamOrderbookUpdatesRequest = { break; + case 4: + message.filterOrders = reader.bool(); + break; + default: reader.skipType(tag & 7); break; @@ -1379,6 +1395,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.filterOrders = object.filterOrders ?? false; return message; } diff --git a/proto/dydxprotocol/clob/query.proto b/proto/dydxprotocol/clob/query.proto index 5584a1e950..9b3fcc7f05 100644 --- a/proto/dydxprotocol/clob/query.proto +++ b/proto/dydxprotocol/clob/query.proto @@ -186,6 +186,9 @@ message StreamOrderbookUpdatesRequest { // Market ids for price updates. repeated uint32 market_ids = 3; + + // Filter order updates in addition to position updates + bool filter_orders = 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 939c7d2979..24354a3061 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,41 @@ type OrderbookSubscription struct { nextSnapshotBlock uint32 } +func NewOrderbookSubscription( + subscriptionId uint32, + clobPairIds []uint32, + subaccountIds []satypes.SubaccountId, + marketIds []uint32, + messageSender types.OutgoingMessageSender, + updatesChannel chan []clobtypes.StreamUpdate, +) *OrderbookSubscription { + return &OrderbookSubscription{ + subscriptionId: subscriptionId, + initialized: &atomic.Bool{}, // False by default. + clobPairIds: clobPairIds, + subaccountIds: subaccountIds, + marketIds: marketIds, + messageSender: messageSender, + updatesChannel: updatesChannel, + } +} + +func (sm *FullNodeStreamingManagerImpl) NewOrderbookSubscription( + clobPairIds []uint32, + subaccountIds []satypes.SubaccountId, + marketIds []uint32, + messageSender types.OutgoingMessageSender, +) *OrderbookSubscription { + return NewOrderbookSubscription( + sm.getNextAvailableSubscriptionId(), + clobPairIds, + subaccountIds, + marketIds, + messageSender, + make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), + ) +} + func (sub *OrderbookSubscription) IsInitialized() bool { return sub.initialized.Load() } @@ -187,11 +220,68 @@ func (sm *FullNodeStreamingManagerImpl) getNextAvailableSubscriptionId() uint32 return id } +// Filter StreamUpdates for subaccountIdNumbers +// If a StreamUpdate_OrderUpdate contains no updates for subscribed subaccounts, drop message +// If a StreamUpdate_OrderUpdate contains updates for subscribed subaccounts, construct a new +// StreamUpdate_OrderUpdate with updates only for subscribed subaccounts +func (sub *OrderbookSubscription) FilterSubaccountStreamUpdates( + output chan []clobtypes.StreamUpdate, + logger log.Logger, +) { + subaccountIdNumbers := make([]uint32, len(sub.subaccountIds)) + for i, subaccountId := range sub.subaccountIds { + subaccountIdNumbers[i] = subaccountId.Number + } + + // If reflection becomes too expensive, split updatesChannel by message type + for updates := range sub.updatesChannel { + filteredUpdates := []clobtypes.StreamUpdate{} + for _, update := range updates { + switch updateMessage := update.UpdateMessage.(type) { + case *clobtypes.StreamUpdate_OrderbookUpdate: + orderBookUpdates := []ocutypes.OffChainUpdateV1{} + for _, orderBookUpdate := range updateMessage.OrderbookUpdate.Updates { + orderBookUpdateSubaccountIdNumber, err := streaming_util.GetOffChainUpdateV1SubaccountIdNumber(orderBookUpdate) + if err == nil { + if slices.Contains(subaccountIdNumbers, orderBookUpdateSubaccountIdNumber) { + orderBookUpdates = append(orderBookUpdates, orderBookUpdate) + } + } else { + logger.Error(err.Error()) + } + } + // Drop the StreamUpdate_OrderbookUpdate if all updates inside were dropped + if len(orderBookUpdates) > 0 { + if len(orderBookUpdates) < len(updateMessage.OrderbookUpdate.Updates) { + update = clobtypes.StreamUpdate{ + BlockHeight: update.BlockHeight, + ExecMode: update.ExecMode, + UpdateMessage: &clobtypes.StreamUpdate_OrderbookUpdate{ + OrderbookUpdate: &clobtypes.StreamOrderbookUpdate{ + Snapshot: updateMessage.OrderbookUpdate.Snapshot, + Updates: orderBookUpdates, + }, + }, + } + } + filteredUpdates = append(filteredUpdates, update) + } + default: + filteredUpdates = append(filteredUpdates, update) + } + } + if len(filteredUpdates) > 0 { + output <- filteredUpdates + } + } +} + // Subscribe subscribes to the orderbook updates stream. func (sm *FullNodeStreamingManagerImpl) Subscribe( clobPairIds []uint32, subaccountIds []*satypes.SubaccountId, marketIds []uint32, + filterOrders bool, messageSender types.OutgoingMessageSender, ) ( err error, @@ -207,17 +297,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 @@ -265,9 +346,27 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.EmitMetrics() sm.Unlock() + // If filterOrders, listen to filtered channel and start filter goroutine + // Error if filterOrders but no subaccounts are subscribed + filteredUpdateChannel := subscription.updatesChannel + if filterOrders { + if len(subaccountIds) == 0 { + sm.logger.Error( + fmt.Sprintf( + "filterOrders requires subaccountIds for subscription id: %+v", + subscription.subscriptionId, + ), + ) + } else { + filteredUpdateChannel = make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize) + defer close(filteredUpdateChannel) + go subscription.FilterSubaccountStreamUpdates(filteredUpdateChannel, sm.logger) + } + } + // Use current goroutine to consistently poll subscription channel for updates // to send through stream. - for updates := range subscription.updatesChannel { + for updates := range filteredUpdateChannel { metrics.IncrCounterWithLabels( metrics.GrpcSendResponseToSubscriberCount, 1, @@ -1080,12 +1179,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 0000000000..8d8e63eaeb --- /dev/null +++ b/protocol/streaming/full_node_streaming_manager_test.go @@ -0,0 +1,477 @@ +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" + pv1types "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/require" +) + +const ( + maxSubscriptionChannelSize = 2 ^ 10 + owner = "foo" + noMessagesMaxSleep = 10 * time.Millisecond +) + +func OpenOrder( + order *pv1types.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 *pv1types.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 *pv1types.IndexerOrderId, + newOrder *pv1types.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 *pv1types.IndexerOrderId, totalFilledQuantums uint64) ocutypes.OffChainUpdateV1 { + return ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderUpdate{ + OrderUpdate: &ocutypes.OrderUpdateV1{ + OrderId: orderId, + TotalFilledQuantums: totalFilledQuantums, + }, + }, + } +} + +func toStreamUpdate(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: true, + }, + }, + } +} + +type MockMessageSender struct{} + +func (mms *MockMessageSender) Send(*clobtypes.StreamOrderbookUpdatesResponse) error { + return nil +} + +func NewOrderbookSubscription( + ids []uint32, + updatesChannel chan []clobtypes.StreamUpdate, +) *streaming.OrderbookSubscription { + sIds := []satypes.SubaccountId{} + for _, id := range ids { + sIds = append(sIds, satypes.SubaccountId{Owner: owner, Number: id}) + } + return streaming.NewOrderbookSubscription( + 0, + []uint32{}, + sIds, + []uint32{}, + &MockMessageSender{}, + updatesChannel, + ) +} + +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: true, + }, + }, + } +} + +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: 1 ^ -6, + Price: 1, + }, + Snapshot: true, + }, + }, + } +} + +func NewIndexerOrderId(owner string, id uint32) pv1types.IndexerOrderId { + return pv1types.IndexerOrderId{ + SubaccountId: pv1types.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 pv1types.IndexerOrderId) pv1types.IndexerOrder { + return pv1types.IndexerOrder{ + OrderId: id, + Side: pv1types.IndexerOrder_SIDE_BUY, + Quantums: uint64(10 ^ 6), + Subticks: 1, + GoodTilOneof: &pv1types.IndexerOrder_GoodTilBlock{ + GoodTilBlock: 10 ^ 9, + }, + TimeInForce: 10 ^ 9, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: pv1types.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(10 ^ 6), + Subticks: 1, + GoodTilOneof: &clobtypes.Order_GoodTilBlock{ + GoodTilBlock: 10 ^ 9, + }, + TimeInForce: 10 ^ 9, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: clobtypes.Order_CONDITION_TYPE_UNSPECIFIED, + ConditionalOrderTriggerSubticks: 0, + } +} + +type TestCase struct { + updates *[]clobtypes.StreamUpdate + subaccountIds []uint32 + filteredUpdates *[]clobtypes.StreamUpdate +} + +func TestFilterStreamUpdates(t *testing.T) { + logger := &mocks.Logger{} + + subaccountIdNumber := uint32(1337) + orderId := NewIndexerOrderId("foo", subaccountIdNumber) + order := NewIndexerOrder(orderId) + + otherSubaccountIdNumber := uint32(2600) + otherOrderId := NewIndexerOrderId("bar", otherSubaccountIdNumber) + otherOrder := NewIndexerOrder(otherOrderId) + + 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(openOrder, cancelOrder, replaceOrder, updateOrder) + otherStreamUpdate := toStreamUpdate(otherOpenOrder, otherCancelOrder, otherReplaceOrder, otherUpdateOrder) + bothStreamUpdate := toStreamUpdate( + 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{ + "baseInScope": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate}, + subaccountIds: []uint32{orderId.SubaccountId.Number}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate}, + }, + "baseNotInScope": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate}, + subaccountIds: []uint32{0}, + filteredUpdates: nil, + }, + "otherInScope": { + updates: &[]clobtypes.StreamUpdate{otherStreamUpdate}, + subaccountIds: []uint32{otherSubaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{otherStreamUpdate}, + }, + "otherNotInScope": { + updates: &[]clobtypes.StreamUpdate{otherStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: nil, + }, + "bothInScope": { + updates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber, otherSubaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + }, + "bothOtherInScope": { + updates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []uint32{otherSubaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{otherStreamUpdate}, + }, + "bothBaseInScope": { + updates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate}, + }, + "bothNoneInScopeWrongId": { + updates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []uint32{404}, + filteredUpdates: nil, + }, + "bothNoneInScopeNoId": { + updates: &[]clobtypes.StreamUpdate{bothStreamUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: nil, + }, + "noUpdates": { + updates: &[]clobtypes.StreamUpdate{}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: nil, + }, + "noUpdatesNoId": { + updates: &[]clobtypes.StreamUpdate{}, + subaccountIds: []uint32{}, + filteredUpdates: nil, + }, + "orderBookFillUpdates": { + updates: &[]clobtypes.StreamUpdate{*orderBookFillUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*orderBookFillUpdate}, + }, + "orderBookFillUpdatesDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate, otherStreamUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*orderBookFillUpdate}, + }, + "orderBookFillUpdatesFilterUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + }, + "orderBookFillUpdatesFilterAndDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate, otherStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *orderBookFillUpdate}, + }, + "takerOrderUpdates": { + updates: &[]clobtypes.StreamUpdate{*takerOrderUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*takerOrderUpdate}, + }, + "takerOrderUpdatesDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate, otherStreamUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*takerOrderUpdate}, + }, + "takerOrderUpdatesFilterUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + }, + "takerOrderUpdatesFilterAndDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate, otherStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *takerOrderUpdate}, + }, + "subaccountUpdates": { + updates: &[]clobtypes.StreamUpdate{*subaccountUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*subaccountUpdate}, + }, + "subaccountUpdatesDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate, otherStreamUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*subaccountUpdate}, + }, + "subaccountUpdatesFilterUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + }, + "subaccountUpdatesFilterAndDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate, otherStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *subaccountUpdate}, + }, + "priceUpdates": { + updates: &[]clobtypes.StreamUpdate{*priceUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*priceUpdate}, + }, + "priceUpdatesDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate, otherStreamUpdate}, + subaccountIds: []uint32{}, + filteredUpdates: &[]clobtypes.StreamUpdate{*priceUpdate}, + }, + "priceUpdatesFilterUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + }, + "priceUpdatesFilterAndDropUpdate": { + updates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate, otherStreamUpdate}, + subaccountIds: []uint32{subaccountIdNumber}, + filteredUpdates: &[]clobtypes.StreamUpdate{baseStreamUpdate, *priceUpdate}, + }, + } + + for name, testCase := range tests { + t.Run(name, func(t *testing.T) { + func() { + filteredUpdatesChannel := make(chan []clobtypes.StreamUpdate, maxSubscriptionChannelSize) + defer close(filteredUpdatesChannel) + updatesChannel := make(chan []clobtypes.StreamUpdate, maxSubscriptionChannelSize) + defer close(updatesChannel) + + subscription := NewOrderbookSubscription(testCase.subaccountIds, updatesChannel) + go subscription.FilterSubaccountStreamUpdates(filteredUpdatesChannel, logger) + updatesChannel <- *testCase.updates + + if testCase.filteredUpdates != nil { + require.Equal(t, <-filteredUpdatesChannel, *testCase.filteredUpdates) + } else { + time.Sleep(noMessagesMaxSleep) + require.Equal(t, len(filteredUpdatesChannel), 0) + } + }() + }) + } +} diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index bb81af1b43..fc743d3fe1 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 41657e7301..53ea59a125 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, + filterOrders bool, srv OutgoingMessageSender, ) ( err error, diff --git a/protocol/streaming/util/util.go b/protocol/streaming/util/util.go index bbf37e3340..bdec459c5a 100644 --- a/protocol/streaming/util/util.go +++ b/protocol/streaming/util/util.go @@ -21,3 +21,24 @@ func GetOffchainUpdatesV1(offchainUpdates *clobtypes.OffchainUpdates) []ocutypes } return v1updates } + +// Error expected if OffChainUpdateV1.UpdateMessage message type is extended to more order events +func GetOffChainUpdateV1SubaccountIdNumber(update ocutypes.OffChainUpdateV1) (uint32, error) { + var orderSubaccountIdNumber uint32 + switch updateMessage := update.UpdateMessage.(type) { + case *ocutypes.OffChainUpdateV1_OrderPlace: + orderSubaccountIdNumber = updateMessage.OrderPlace.Order.OrderId.SubaccountId.Number + case *ocutypes.OffChainUpdateV1_OrderRemove: + orderSubaccountIdNumber = updateMessage.OrderRemove.RemovedOrderId.SubaccountId.Number + case *ocutypes.OffChainUpdateV1_OrderUpdate: + orderSubaccountIdNumber = updateMessage.OrderUpdate.OrderId.SubaccountId.Number + case *ocutypes.OffChainUpdateV1_OrderReplace: + orderSubaccountIdNumber = updateMessage.OrderReplace.Order.OrderId.SubaccountId.Number + default: + return 0, fmt.Errorf( + "UpdateMessage type not in {OrderPlace, OrderRemove, OrderUpdate, OrderReplace}: %+v", + updateMessage, + ) + } + return orderSubaccountIdNumber, nil +} diff --git a/protocol/streaming/util/util_test.go b/protocol/streaming/util/util_test.go new file mode 100644 index 0000000000..111cb8f4af --- /dev/null +++ b/protocol/streaming/util/util_test.go @@ -0,0 +1,118 @@ +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" +) + +func _ToPtr[V any](v V) *V { + return &v +} + +func TestGetOffChainUpdateV1SubaccountIdNumber(t *testing.T) { + subaccountIdNumber := uint32(1337) + orderId := pv1types.IndexerOrderId{ + SubaccountId: pv1types.IndexerSubaccountId{ + Owner: "foo", + Number: uint32(subaccountIdNumber), + }, + ClientId: 0, + OrderFlags: 0, + ClobPairId: 0, + } + order := pv1types.IndexerOrder{ + OrderId: orderId, + Side: pv1types.IndexerOrder_SIDE_BUY, + Quantums: uint64(10 ^ 6), + Subticks: 1, + GoodTilOneof: &pv1types.IndexerOrder_GoodTilBlock{ + GoodTilBlock: 10 ^ 9, + }, + TimeInForce: 10 ^ 9, + ReduceOnly: false, + ClientMetadata: 0, + ConditionType: pv1types.IndexerOrder_CONDITION_TYPE_UNSPECIFIED, + ConditionalOrderTriggerSubticks: 0, + } + newOrder := order + newOrder.Quantums += 10 ^ 6 + + orderPlaceTime := time.Now() + fillQuantums := uint64(1988) + + tests := map[string]struct { + update ocutypes.OffChainUpdateV1 + id uint32 + 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: subaccountIdNumber, + 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: subaccountIdNumber, + err: nil, + }, + "OrderUpdate": { + update: ocutypes.OffChainUpdateV1{ + UpdateMessage: &ocutypes.OffChainUpdateV1_OrderUpdate{ + OrderUpdate: &ocutypes.OrderUpdateV1{ + OrderId: &orderId, + TotalFilledQuantums: fillQuantums, + }, + }, + }, + id: subaccountIdNumber, + 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: subaccountIdNumber, + err: nil, + }, + } + for name, testCase := range tests { + t.Run(name, func(t *testing.T) { + id, err := util.GetOffChainUpdateV1SubaccountIdNumber(testCase.update) + fmt.Println("expected", id) + require.Equal(t, err, testCase.err) + require.Equal(t, id, testCase.id) + }) + } +} diff --git a/protocol/streaming/ws/websocket_server.go b/protocol/streaming/ws/websocket_server.go index 33a7434e42..a127fb1593 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 filterOrders from query parameters + filterOrders, err := parseFilterOrders(r) + if err != nil { + ws.logger.Error("Error parsing filterOrders", "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, + filterOrders, websocketMessageSender, ) if err != nil { @@ -169,6 +180,19 @@ func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) { return subaccountIds, nil } +// parseFilterOrders is a helper function to parse the filterOrders flag from the query parameters. +func parseFilterOrders(r *http.Request) (bool, error) { + filterOrdersParam := r.URL.Query().Get("filterOrders") + if filterOrdersParam == "" { + return false, nil + } + filterOrders, err := strconv.ParseBool(filterOrdersParam) + if err != nil { + return false, fmt.Errorf("invalid filterOrders: %s", filterOrdersParam) + } + return filterOrders, 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 029266901a..f770fead66 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.GetFilterOrders(), stream, ) if err != nil { diff --git a/protocol/x/clob/types/query.pb.go b/protocol/x/clob/types/query.pb.go index b259206910..5055651264 100644 --- a/protocol/x/clob/types/query.pb.go +++ b/protocol/x/clob/types/query.pb.go @@ -858,6 +858,8 @@ 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 in addition to position updates + FilterOrders bool `protobuf:"varint,4,opt,name=filter_orders,json=filterOrders,proto3" json:"filter_orders,omitempty"` } func (m *StreamOrderbookUpdatesRequest) Reset() { *m = StreamOrderbookUpdatesRequest{} } @@ -914,6 +916,13 @@ func (m *StreamOrderbookUpdatesRequest) GetMarketIds() []uint32 { return nil } +func (m *StreamOrderbookUpdatesRequest) GetFilterOrders() bool { + if m != nil { + return m.FilterOrders + } + return false +} + // StreamOrderbookUpdatesResponse is a response message for the // StreamOrderbookUpdates method. type StreamOrderbookUpdatesResponse struct { @@ -1440,118 +1449,119 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/clob/query.proto", fileDescriptor_3365c195b25c5bc0) } var fileDescriptor_3365c195b25c5bc0 = []byte{ - // 1770 bytes of a gzipped FileDescriptorProto + // 1789 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, - 0xf7, 0x66, 0xde, 0xbc, 0xf7, 0x66, 0xe1, 0xa6, 0x73, 0xea, 0x9c, 0x74, 0x03, 0xc6, 0x99, 0xcd, - 0x5c, 0xc3, 0x76, 0x59, 0xdb, 0x38, 0x8e, 0x48, 0x70, 0xda, 0x12, 0x32, 0x34, 0x97, 0x9e, 0x6e, - 0xc5, 0xd3, 0xf5, 0x37, 0x3b, 0xac, 0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- 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, 0x54, 0x9f, 0xdc, 0xca, 0x77, - 0xc5, 0x9f, 0x1e, 0x1c, 0x3c, 0x89, 0x05, 0x72, 0x91, 0xe7, 0x0f, 0x86, 0x03, 0xf1, 0xf7, 0x1a, - 0x5c, 0x2b, 0x38, 0x3c, 0xf4, 0x08, 0xc4, 0xfd, 0x93, 0x2d, 0x91, 0x4a, 0x39, 0x0b, 0x25, 0xad, - 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0x2f, 0xd1, 0xa9, 0x4b, 0xbc, 0xf5, 0x6c, 0xf0, + 0xfd, 0xc4, 0x31, 0xe7, 0xc2, 0xd4, 0x28, 0x44, 0xd7, 0x00, 0x3c, 0x1c, 0x1c, 0x12, 0x09, 0x35, + 0x29, 0x96, 0x9b, 0x91, 0x92, 0x78, 0xfa, 0x06, 0xcc, 0x75, 0xa8, 0xcb, 0x49, 0x60, 0x89, 0x1c, + 0x09, 0x6b, 0x53, 0x62, 0xb7, 0x67, 0xa5, 0x50, 0x78, 0x11, 0xea, 0x18, 0x1a, 0x65, 0x5e, 0xa9, + 0x18, 0x7d, 0x07, 0x2e, 0xa9, 0xde, 0x44, 0xd5, 0xdf, 0x95, 0x82, 0x2d, 0x93, 0x18, 0xd2, 0x34, + 0x39, 0x0b, 0xca, 0x4a, 0xff, 0xff, 0x24, 0xcc, 0xa6, 0xe7, 0xd1, 0x75, 0x98, 0x95, 0x67, 0xfc, + 0x80, 0xd0, 0xee, 0x01, 0x57, 0x01, 0xaf, 0x0a, 0xd9, 0xb6, 0x10, 0xa1, 0x25, 0x98, 0x21, 0xc7, + 0xc4, 0xb6, 0x3c, 0xe6, 0x10, 0x91, 0xc4, 0x73, 0xe6, 0x74, 0x2c, 0xd8, 0x61, 0x0e, 0x41, 0x9f, + 0xc3, 0x02, 0x4b, 0xd8, 0xaa, 0xbe, 0x49, 0x64, 0x72, 0x75, 0x73, 0xbd, 0x94, 0xda, 0x88, 0x7b, + 0xdb, 0x15, 0xf3, 0x0d, 0x96, 0x15, 0xc5, 0xb7, 0xb6, 0x3c, 0x94, 0xf1, 0x69, 0x11, 0xc1, 0x2a, + 0xbe, 0x3c, 0x47, 0x00, 0x1f, 0x51, 0xd7, 0xdd, 0xae, 0x98, 0x33, 0xc2, 0x36, 0x1e, 0xa0, 0x47, + 0x50, 0xe5, 0xf8, 0x30, 0x89, 0x7b, 0xed, 0x82, 0x40, 0xba, 0x51, 0x8a, 0xb4, 0x17, 0xeb, 0x0a, + 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d, 0x57, 0x4c, 0xa9, 0x88, 0xf6, 0x61, 0x31, 0x55, 0x37, + 0x55, 0x52, 0x4e, 0x94, 0x5e, 0x37, 0x72, 0xc5, 0x54, 0x0d, 0x4e, 0xe0, 0x16, 0xdc, 0x11, 0x19, + 0xfa, 0x02, 0x50, 0x2a, 0xd1, 0xad, 0x90, 0x63, 0x1e, 0x85, 0xea, 0x28, 0x36, 0xcf, 0x90, 0xef, + 0xcf, 0x84, 0x81, 0xb9, 0xc0, 0x47, 0x24, 0x5b, 0x73, 0x99, 0x13, 0xa4, 0xff, 0x41, 0x83, 0xab, + 0xc5, 0xb6, 0x71, 0x18, 0x33, 0x8b, 0xab, 0x5a, 0xc2, 0x52, 0x2a, 0x77, 0x00, 0x05, 0xc4, 0xc3, + 0xd4, 0xa7, 0x7e, 0xd7, 0x3a, 0x8a, 0xb0, 0xcf, 0x23, 0x2f, 0x54, 0x37, 0xe3, 0xe2, 0x60, 0xe6, + 0x33, 0x35, 0x81, 0xbe, 0x0b, 0x0d, 0xd6, 0xe3, 0xd4, 0xa3, 0x21, 0xa7, 0x36, 0x76, 0xdd, 0x13, + 0x51, 0x0f, 0x88, 0x33, 0x34, 0x95, 0x3d, 0xdd, 0x72, 0x56, 0xeb, 0x91, 0x50, 0x4a, 0x50, 0x36, + 0xff, 0x5c, 0x85, 0x0b, 0xe2, 0xe6, 0x41, 0x3f, 0xd3, 0x60, 0x3a, 0xb9, 0x47, 0xd0, 0xed, 0x82, + 0xa8, 0x94, 0x3c, 0xb7, 0xea, 0xeb, 0x65, 0xba, 0xa3, 0xef, 0x2d, 0xbd, 0xf9, 0xd3, 0xbf, 0xff, + 0xf7, 0x57, 0x13, 0x37, 0xd0, 0x75, 0x63, 0xcc, 0xab, 0xda, 0xf8, 0x11, 0x75, 0x7e, 0x8c, 0x7e, + 0xae, 0x41, 0x35, 0xf5, 0xe4, 0x29, 0x27, 0x94, 0x7f, 0x7b, 0xd5, 0xdf, 0x3d, 0x8d, 0x50, 0x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, 0x44, 0x64, 0x0d, 0xbd, 0x53, 0x10, 0x91, 0x5c, 0x13, 0x8e, 0x7e, 0x92, + 0x54, 0xfc, 0xd1, 0xbe, 0x14, 0x6d, 0x9c, 0xb5, 0xc7, 0x4b, 0x1a, 0xf3, 0xfa, 0xdd, 0xd7, 0xb0, + 0x90, 0x64, 0x37, 0xb4, 0xad, 0xdd, 0xaf, 0x5f, 0x36, 0xb4, 0x17, 0x2f, 0x1b, 0xda, 0x7f, 0x5e, + 0x36, 0xb4, 0x5f, 0xbe, 0x6a, 0x54, 0x5e, 0xbc, 0x6a, 0x54, 0xfe, 0xf9, 0xaa, 0x51, 0xf9, 0xc1, + 0x87, 0x5d, 0xca, 0x0f, 0xa2, 0x76, 0xcb, 0x66, 0x5e, 0xd6, 0x95, 0xfe, 0x07, 0x77, 0x44, 0x43, + 0x62, 0x0c, 0x24, 0xc7, 0xd2, 0x3d, 0x7e, 0xd2, 0x23, 0x61, 0xfb, 0xa2, 0x10, 0xbf, 0xff, 0x4d, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x26, 0x50, 0x05, 0xbe, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2558,6 +2568,16 @@ func (m *StreamOrderbookUpdatesRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.FilterOrders { + i-- + if m.FilterOrders { + 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 +3304,9 @@ func (m *StreamOrderbookUpdatesRequest) Size() (n int) { } n += 1 + sovQuery(uint64(l)) + l } + if m.FilterOrders { + n += 2 + } return n } @@ -5089,6 +5112,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 FilterOrders", 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.FilterOrders = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])