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..088e742386 100644 --- a/protocol/lib/metrics/metric_keys.go +++ b/protocol/lib/metrics/metric_keys.go @@ -69,7 +69,9 @@ 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" 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 fb10dfb3ec..c53b76e2c0 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" @@ -38,6 +39,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[satypes.SubaccountId][]uint32 maxUpdatesInCache uint32 maxSubscriptionChannelSize uint32 @@ -53,6 +56,9 @@ type OrderbookSubscription struct { // Clob pair ids to subscribe to. clobPairIds []uint32 + // Subaccount ids to subscribe to. + subaccountIds []satypes.SubaccountId + // Stream messageSender types.OutgoingMessageSender @@ -72,11 +78,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, @@ -125,6 +132,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, @@ -135,9 +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: sIds, messageSender: messageSender, updatesChannel: make(chan []clobtypes.StreamUpdate, sm.maxSubscriptionChannelSize), } @@ -152,12 +165,24 @@ func (sm *FullNodeStreamingManagerImpl) Subscribe( sm.nextSubscriptionId, ) } + 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{} + } + 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 @@ -228,6 +253,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), ) @@ -237,74 +277,110 @@ 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 toOrderbookStreamUpdate( 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, + BlockHeight: blockHeight, + ExecMode: uint32(execMode), + }, + } +} + +func toSubaccountStreamUpdates( + 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 +} + +func (sm *FullNodeStreamingManagerImpl) sendStreamUpdates( + subscriptionId uint32, + streamUpdates []clobtypes.StreamUpdate, +) { + 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, + ), ) - select { - case subscription.updatesChannel <- streamUpdates: - default: - sm.logger.Error( - fmt.Sprintf( - "Streaming subscription id %+v channel full capacity. Dropping subscription connection.", - subscriptionId, - ), - ) - removeSubscription = true - } + return + } + + 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) } } +// 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, toOrderbookStreamUpdate(offchainUpdates, blockHeight, execMode)...) + streamUpdates = append(streamUpdates, toSubaccountStreamUpdates(saUpdates, blockHeight, execMode)...) + sm.sendStreamUpdates(subscriptionId, streamUpdates) +} + +// 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() + _, exists := sm.subaccountIdToSubscriptionIdMapping[subaccountId] + return exists +} + // SendOrderbookUpdates groups updates by their clob pair ids and // sends messages to the subscribers. func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( @@ -350,7 +426,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(streamUpdates, clobPairIds) + sm.AddOrderUpdatesToCache(streamUpdates, clobPairIds) } // SendOrderbookFillUpdates groups fills by their clob pair ids and @@ -393,7 +469,7 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookFillUpdates( clobPairIds = append(clobPairIds, clobPairId) } - sm.AddUpdatesToCache(streamUpdates, clobPairIds) + sm.AddOrderUpdatesToCache(streamUpdates, clobPairIds) } // SendTakerOrderStatus sends out a taker order and its status to the full node streaming service. @@ -410,7 +486,7 @@ func (sm *FullNodeStreamingManagerImpl) SendTakerOrderStatus( clobPairId = takerOrder.OrderId.ClobPairId } - sm.AddUpdatesToCache( + sm.AddOrderUpdatesToCache( []clobtypes.StreamUpdate{ { UpdateMessage: &clobtypes.StreamUpdate_TakerOrder{ @@ -424,9 +500,41 @@ func (sm *FullNodeStreamingManagerImpl) SendTakerOrderStatus( ) } -// AddUpdatesToCache adds a series of updates to the full node streaming cache. +// 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, + 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) +} + +// 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) AddUpdatesToCache( +func (sm *FullNodeStreamingManagerImpl) AddOrderUpdatesToCache( updates []clobtypes.StreamUpdate, clobPairIds []uint32, ) { @@ -446,6 +554,40 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( ) } + // Remove all subscriptions and wipe the buffer if buffer overflows. + sm.RemoveSubscriptionsAndClearBufferIfFull() + 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, +) { + sm.Lock() + defer sm.Unlock() + + metrics.IncrCounter( + metrics.GrpcAddUpdateToBufferCount, + float32(len(updates)), + ) + + sm.streamUpdateCache = append(sm.streamUpdateCache, updates...) + for _, subaccountId := range subaccountIds { + sm.streamUpdateSubscriptionCache = append( + sm.streamUpdateSubscriptionCache, + sm.subaccountIdToSubscriptionIdMapping[*subaccountId], + ) + } + sm.RemoveSubscriptionsAndClearBufferIfFull() + sm.EmitMetrics() +} + +// 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) 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. " + @@ -456,7 +598,6 @@ func (sm *FullNodeStreamingManagerImpl) AddUpdatesToCache( sm.streamUpdateCache = nil sm.streamUpdateSubscriptionCache = nil } - sm.EmitMetrics() } func (sm *FullNodeStreamingManagerImpl) FlushStreamUpdates() { @@ -521,6 +662,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, ) { @@ -542,8 +684,12 @@ func (sm *FullNodeStreamingManagerImpl) InitializeNewStreams( } allUpdates.Append(updatesByClobPairId[clobPairId]) } + saUpdates := []*satypes.StreamSubaccountUpdate{} + for _, subaccountId := range subscription.subaccountIds { + saUpdates = append(saUpdates, getSubaccountSnapshot(subaccountId)) + } - sm.SendSnapshot(allUpdates, subscriptionId, blockHeight, execMode) + sm.SendCombinedSnapshot(allUpdates, saUpdates, subscriptionId, blockHeight, execMode) }, ) } diff --git a/protocol/streaming/noop_streaming_manager.go b/protocol/streaming/noop_streaming_manager.go index 749bcf2b67..24810fefe2 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, @@ -49,8 +51,20 @@ func (sm *NoopGrpcStreamingManager) SendTakerOrderStatus( ) { } +func (sm *NoopGrpcStreamingManager) SendSubaccountUpdates( + subaccountUpdates []satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, +) { +} + +func (sm *NoopGrpcStreamingManager) TracksSubaccountId(id satypes.SubaccountId) bool { + return false +} + 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 66fcf808e5..7930853be6 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, @@ -20,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, ) @@ -39,6 +42,12 @@ type FullNodeStreamingManager interface { blockHeight uint32, execMode sdk.ExecMode, ) + SendSubaccountUpdates( + subaccountUpdates []satypes.StreamSubaccountUpdate, + blockHeight uint32, + execMode sdk.ExecMode, + ) + TracksSubaccountId(id satypes.SubaccountId) bool } 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/keeper/keeper.go b/protocol/x/clob/keeper/keeper.go index 0fbf4535b4..85e958423e 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: true, + } + }, lib.MustConvertIntegerToUint32(ctx.BlockHeight()), ctx.ExecMode(), ) 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, 0x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, 0x9a, 0x78, 0x53, 0x87, 0xbf, 0xca, 0xf0, 0x5a, 0x29, - 0xf4, 0x18, 0xbd, 0xed, 0x8a, 0xf9, 0x0e, 0xcd, 0x8a, 0xe2, 0x93, 0x4c, 0x16, 0x6a, 0x5c, 0x41, - 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, 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,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xae, 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, + // 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, 0x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 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, 0x8d, 0x24, 0xa2, 0xee, 0xa8, 0x2b, + 0xe2, 0xd8, 0x81, 0x73, 0x29, 0x77, 0x82, 0x08, 0xa3, 0x9c, 0x10, 0x46, 0x07, 0xc7, 0x22, 0x0a, + 0x4e, 0xee, 0x16, 0x15, 0x79, 0x13, 0xce, 0x33, 0x60, 0xeb, 0x54, 0xa7, 0x78, 0x2b, 0xb0, 0x1f, + 0x84, 0xf7, 0x40, 0x74, 0xae, 0xe6, 0xa1, 0x97, 0xdd, 0x0b, 0x51, 0xcd, 0x73, 0x73, 0x85, 0x84, + 0xad, 0x99, 0xc9, 0x3d, 0x33, 0xe2, 0x12, 0xe1, 0xaf, 0xf2, 0xcf, 0x12, 0x14, 0x92, 0x5c, 0x8b, + 0x28, 0x37, 0xe1, 0x34, 0xf7, 0x5d, 0xb3, 0x75, 0x03, 0x3b, 0xd8, 0xa5, 0x62, 0x8b, 0xa9, 0x84, + 0x2d, 0xee, 0x13, 0xb7, 0xba, 0x81, 0x3d, 0x87, 0xb9, 0x58, 0x8b, 0x0c, 0xc4, 0x8e, 0x03, 0xa4, + 0x49, 0x8a, 0xc6, 0x21, 0xb7, 0x65, 0xd9, 0xb6, 0xa6, 0x3b, 0x61, 0x4f, 0x67, 0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 0xfd, 0x6a, 0x82, 0x5c, 0xe8, 0x6f, 0x9a, 0x98, 0xd1, 0xdb, 0x69, 0x7b, + 0x27, 0xcd, 0xec, 0x85, 0x6b, 0x47, 0xd4, 0x16, 0xe8, 0x32, 0xe8, 0xb3, 0xa8, 0xa3, 0xb6, 0x8e, + 0x6a, 0x68, 0xe6, 0xa8, 0x63, 0x53, 0x34, 0x67, 0x16, 0x66, 0xdf, 0xc0, 0x82, 0x03, 0x98, 0x91, + 0x16, 0xd7, 0x5e, 0xbc, 0x2a, 0x4a, 0x2f, 0x5f, 0x15, 0xa5, 0x7f, 0x5e, 0x15, 0xa5, 0xe7, 0xaf, + 0x8b, 0x99, 0x97, 0xaf, 0x8b, 0x99, 0x3f, 0x5f, 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..c32b8772d7 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" @@ -253,6 +254,47 @@ func (k Keeper) getSettledUpdates( return settledUpdates, subaccountIdToFundingPayments, nil } +func GenerateStreamSubaccountUpdate( + settledUpdate types.SettledUpdate, + fundingPayments map[uint32]dtypes.SerializableInt, +) types.StreamSubaccountUpdate { + // 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(), + } + } + + 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: assetPositions, + UpdatedPerpetualPositions: perpetualPositions, + 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. @@ -369,6 +411,19 @@ func (k Keeper) UpdateSubaccounts( ), ) + // if GRPC streaming is on, emit a generated subaccount update to stream. + if streamingManager := k.GetFullNodeStreamingManager(); streamingManager.Enabled() { + if k.GetFullNodeStreamingManager().TracksSubaccountId(*u.SettledSubaccount.Id) { + subaccountUpdate := GenerateStreamSubaccountUpdate(u, fundingPayments) + 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. @@ -735,3 +790,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, 0xd9, 0x45, 0xbb, 0x93, 0x6e, 0x24, 0x52, 0x0a, 0xa5, 0x20, 0x63, 0x26, + 0xe8, 0x80, 0x66, 0xa6, 0x9e, 0x99, 0xa2, 0x6f, 0xd1, 0xc7, 0xea, 0xd2, 0x65, 0x97, 0xc5, 0xbc, + 0x48, 0x31, 0xc6, 0x31, 0x52, 0x14, 0x77, 0xf9, 0xcf, 0x7f, 0xce, 0xf7, 0x67, 0x0e, 0x07, 0x3b, + 0x6c, 0xc1, 0xe6, 0x72, 0x26, 0x94, 0x08, 0xc4, 0xc4, 0x03, 0x3d, 0xa4, 0x41, 0x20, 0x74, 0xa4, + 0xc0, 0x03, 0x35, 0x0b, 0xe9, 0x94, 0x47, 0x23, 0x37, 0xb1, 0x89, 0x95, 0xed, 0x74, 0x33, 0x9d, + 0x8d, 0x8b, 0xc3, 0x0c, 0xf3, 0xbd, 0x81, 0xb4, 0xe3, 0x3c, 0xfe, 0xdf, 0x4f, 0xc0, 0x7d, 0x63, + 0x3d, 0x49,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x0f, 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, + ) }