Skip to content

Commit

Permalink
Cherry-pick latest changes from dev0 to v4.x (#1350)
Browse files Browse the repository at this point in the history
* [OTE-221] Add query for PendingSendPacket (backport #1176) (#1221)


---------

Co-authored-by: Teddy Ding <teddy@dydx.exchange>
(cherry picked from commit e545bbf)

# Conflicts:
#	indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
#	indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
#	indexer/packages/v4-protos/src/codegen/google/bundle.ts
#	protocol/go.mod

* fix protos

* update go.mod

---------

Co-authored-by: Mohammed Affan <affanmd@nyu.edu>
Co-authored-by: affan <affan@dydx.exchange>

* [Backport v4.x] backport full node streaming to v4.x branch (#1270)

* [CT-645] Move off chain updates and v1 to a different package (#1131)

* [CT-645] Add protos for orderbook stream query service

* move removal reasons to a separate package

* [CT-645] Add protos for orderbook stream query service (#1133)

* [CT-645] Add protos for orderbook stream query service

* make update not nullable

* fix build

* [CT-644] instantiate grpc stream manager (#1134)

* [CT-644] instantiate grpc stream manager

* update type

* update channel type

* [CT-646] stream offchain updates through stream manager (#1138)

* [CT-646] stream offchain updates through stream manager

* comments

* fix lint

* get rid of finished

* comments

* comments

* [CT-652] add command line flag for full node streaming (#1145)

* [CT-647] construct the initial orderbook snapshot (#1147)

* [CT-647] construct the initial orderbook snapshot

* [CT-647] initialize new streams and send orderbook snapshot (#1152)

* [CT-647] initialize new streams and send orderbook snapshot

* use sync once

* comments

* [CT-700] separate indexer and grpc streaming events (#1209)

* [CT-700] separate indexer and grpc streaming events

* fix tests

* comments

* update

* [CT-700] only send response when there is at least one update (#1216)

* [CT-712] send order update when short term order state fill amounts are pruned (#1241)

* [CT-712] send fill amount updates for reverted operations (#1240)

* [CT-723] add block number + stage to grpc updates (#1252)

* [CT-723] add block number + stage to grpc updates

* add indexer changes

* [CT-727] avoid state reads when sending updates (#1261)

* [CT-712] send updates for both normal order matches and liquidation (#1280) (#1281)

* Fix lib.ErrorLogWithError: properly pass in args (#1306) (#1310)

(cherry picked from commit a91c1ca)

Co-authored-by: Jonathan Fung <121899091+jonfung-dydx@users.noreply.github.com>

* fix broken tests (#1312) (#1316)

(cherry picked from commit 5ec37d2)

Co-authored-by: Jonathan Fung <121899091+jonfung-dydx@users.noreply.github.com>

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Mohammed Affan <affanmd@nyu.edu>
Co-authored-by: affan <affan@dydx.exchange>
Co-authored-by: jayy04 <103467857+jayy04@users.noreply.github.com>
Co-authored-by: Jonathan Fung <121899091+jonfung-dydx@users.noreply.github.com>
  • Loading branch information
6 people authored Apr 8, 2024
1 parent b5fc8e3 commit 082af18
Show file tree
Hide file tree
Showing 81 changed files with 3,615 additions and 676 deletions.
256 changes: 129 additions & 127 deletions indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,103 +66,104 @@ import * as _69 from "./prices/tx";
import * as _70 from "./ratelimit/capacity";
import * as _71 from "./ratelimit/genesis";
import * as _72 from "./ratelimit/limit_params";
import * as _73 from "./ratelimit/query";
import * as _74 from "./ratelimit/tx";
import * as _75 from "./rewards/genesis";
import * as _76 from "./rewards/params";
import * as _77 from "./rewards/query";
import * as _78 from "./rewards/reward_share";
import * as _79 from "./rewards/tx";
import * as _80 from "./sending/genesis";
import * as _81 from "./sending/query";
import * as _82 from "./sending/transfer";
import * as _83 from "./sending/tx";
import * as _84 from "./stats/genesis";
import * as _85 from "./stats/params";
import * as _86 from "./stats/query";
import * as _87 from "./stats/stats";
import * as _88 from "./stats/tx";
import * as _89 from "./subaccounts/asset_position";
import * as _90 from "./subaccounts/genesis";
import * as _91 from "./subaccounts/perpetual_position";
import * as _92 from "./subaccounts/query";
import * as _93 from "./subaccounts/subaccount";
import * as _94 from "./vest/genesis";
import * as _95 from "./vest/query";
import * as _96 from "./vest/tx";
import * as _97 from "./vest/vest_entry";
import * as _105 from "./assets/query.lcd";
import * as _106 from "./blocktime/query.lcd";
import * as _107 from "./bridge/query.lcd";
import * as _108 from "./clob/query.lcd";
import * as _109 from "./delaymsg/query.lcd";
import * as _110 from "./epochs/query.lcd";
import * as _111 from "./feetiers/query.lcd";
import * as _112 from "./perpetuals/query.lcd";
import * as _113 from "./prices/query.lcd";
import * as _114 from "./ratelimit/query.lcd";
import * as _115 from "./rewards/query.lcd";
import * as _116 from "./stats/query.lcd";
import * as _117 from "./subaccounts/query.lcd";
import * as _118 from "./vest/query.lcd";
import * as _119 from "./assets/query.rpc.Query";
import * as _120 from "./blocktime/query.rpc.Query";
import * as _121 from "./bridge/query.rpc.Query";
import * as _122 from "./clob/query.rpc.Query";
import * as _123 from "./delaymsg/query.rpc.Query";
import * as _124 from "./epochs/query.rpc.Query";
import * as _125 from "./feetiers/query.rpc.Query";
import * as _126 from "./govplus/query.rpc.Query";
import * as _127 from "./perpetuals/query.rpc.Query";
import * as _128 from "./prices/query.rpc.Query";
import * as _129 from "./ratelimit/query.rpc.Query";
import * as _130 from "./rewards/query.rpc.Query";
import * as _131 from "./sending/query.rpc.Query";
import * as _132 from "./stats/query.rpc.Query";
import * as _133 from "./subaccounts/query.rpc.Query";
import * as _134 from "./vest/query.rpc.Query";
import * as _135 from "./blocktime/tx.rpc.msg";
import * as _136 from "./bridge/tx.rpc.msg";
import * as _137 from "./clob/tx.rpc.msg";
import * as _138 from "./delaymsg/tx.rpc.msg";
import * as _139 from "./feetiers/tx.rpc.msg";
import * as _140 from "./govplus/tx.rpc.msg";
import * as _141 from "./perpetuals/tx.rpc.msg";
import * as _142 from "./prices/tx.rpc.msg";
import * as _143 from "./ratelimit/tx.rpc.msg";
import * as _144 from "./rewards/tx.rpc.msg";
import * as _145 from "./sending/tx.rpc.msg";
import * as _146 from "./stats/tx.rpc.msg";
import * as _147 from "./vest/tx.rpc.msg";
import * as _148 from "./lcd";
import * as _149 from "./rpc.query";
import * as _150 from "./rpc.tx";
import * as _73 from "./ratelimit/pending_send_packet";
import * as _74 from "./ratelimit/query";
import * as _75 from "./ratelimit/tx";
import * as _76 from "./rewards/genesis";
import * as _77 from "./rewards/params";
import * as _78 from "./rewards/query";
import * as _79 from "./rewards/reward_share";
import * as _80 from "./rewards/tx";
import * as _81 from "./sending/genesis";
import * as _82 from "./sending/query";
import * as _83 from "./sending/transfer";
import * as _84 from "./sending/tx";
import * as _85 from "./stats/genesis";
import * as _86 from "./stats/params";
import * as _87 from "./stats/query";
import * as _88 from "./stats/stats";
import * as _89 from "./stats/tx";
import * as _90 from "./subaccounts/asset_position";
import * as _91 from "./subaccounts/genesis";
import * as _92 from "./subaccounts/perpetual_position";
import * as _93 from "./subaccounts/query";
import * as _94 from "./subaccounts/subaccount";
import * as _95 from "./vest/genesis";
import * as _96 from "./vest/query";
import * as _97 from "./vest/tx";
import * as _98 from "./vest/vest_entry";
import * as _106 from "./assets/query.lcd";
import * as _107 from "./blocktime/query.lcd";
import * as _108 from "./bridge/query.lcd";
import * as _109 from "./clob/query.lcd";
import * as _110 from "./delaymsg/query.lcd";
import * as _111 from "./epochs/query.lcd";
import * as _112 from "./feetiers/query.lcd";
import * as _113 from "./perpetuals/query.lcd";
import * as _114 from "./prices/query.lcd";
import * as _115 from "./ratelimit/query.lcd";
import * as _116 from "./rewards/query.lcd";
import * as _117 from "./stats/query.lcd";
import * as _118 from "./subaccounts/query.lcd";
import * as _119 from "./vest/query.lcd";
import * as _120 from "./assets/query.rpc.Query";
import * as _121 from "./blocktime/query.rpc.Query";
import * as _122 from "./bridge/query.rpc.Query";
import * as _123 from "./clob/query.rpc.Query";
import * as _124 from "./delaymsg/query.rpc.Query";
import * as _125 from "./epochs/query.rpc.Query";
import * as _126 from "./feetiers/query.rpc.Query";
import * as _127 from "./govplus/query.rpc.Query";
import * as _128 from "./perpetuals/query.rpc.Query";
import * as _129 from "./prices/query.rpc.Query";
import * as _130 from "./ratelimit/query.rpc.Query";
import * as _131 from "./rewards/query.rpc.Query";
import * as _132 from "./sending/query.rpc.Query";
import * as _133 from "./stats/query.rpc.Query";
import * as _134 from "./subaccounts/query.rpc.Query";
import * as _135 from "./vest/query.rpc.Query";
import * as _136 from "./blocktime/tx.rpc.msg";
import * as _137 from "./bridge/tx.rpc.msg";
import * as _138 from "./clob/tx.rpc.msg";
import * as _139 from "./delaymsg/tx.rpc.msg";
import * as _140 from "./feetiers/tx.rpc.msg";
import * as _141 from "./govplus/tx.rpc.msg";
import * as _142 from "./perpetuals/tx.rpc.msg";
import * as _143 from "./prices/tx.rpc.msg";
import * as _144 from "./ratelimit/tx.rpc.msg";
import * as _145 from "./rewards/tx.rpc.msg";
import * as _146 from "./sending/tx.rpc.msg";
import * as _147 from "./stats/tx.rpc.msg";
import * as _148 from "./vest/tx.rpc.msg";
import * as _149 from "./lcd";
import * as _150 from "./rpc.query";
import * as _151 from "./rpc.tx";
export namespace dydxprotocol {
export const assets = { ..._5,
..._6,
..._7,
..._8,
..._105,
..._119
..._106,
..._120
};
export const blocktime = { ..._9,
..._10,
..._11,
..._12,
..._13,
..._106,
..._120,
..._135
..._107,
..._121,
..._136
};
export const bridge = { ..._14,
..._15,
..._16,
..._17,
..._18,
..._19,
..._107,
..._121,
..._136
..._108,
..._122,
..._137
};
export const clob = { ..._20,
..._21,
Expand All @@ -178,9 +179,9 @@ export namespace dydxprotocol {
..._31,
..._32,
..._33,
..._108,
..._122,
..._137
..._109,
..._123,
..._138
};
export namespace daemons {
export const bridge = { ..._34
Expand All @@ -195,29 +196,29 @@ export namespace dydxprotocol {
..._39,
..._40,
..._41,
..._109,
..._123,
..._138
..._110,
..._124,
..._139
};
export const epochs = { ..._42,
..._43,
..._44,
..._110,
..._124
..._111,
..._125
};
export const feetiers = { ..._45,
..._46,
..._47,
..._48,
..._111,
..._125,
..._139
..._112,
..._126,
..._140
};
export const govplus = { ..._49,
..._50,
..._51,
..._126,
..._140
..._127,
..._141
};
export namespace indexer {
export const events = { ..._52
Expand All @@ -243,71 +244,72 @@ export namespace dydxprotocol {
..._62,
..._63,
..._64,
..._112,
..._127,
..._141
..._113,
..._128,
..._142
};
export const prices = { ..._65,
..._66,
..._67,
..._68,
..._69,
..._113,
..._128,
..._142
..._114,
..._129,
..._143
};
export const ratelimit = { ..._70,
..._71,
..._72,
..._73,
..._74,
..._114,
..._129,
..._143
..._75,
..._115,
..._130,
..._144
};
export const rewards = { ..._75,
..._76,
export const rewards = { ..._76,
..._77,
..._78,
..._79,
..._115,
..._130,
..._144
..._80,
..._116,
..._131,
..._145
};
export const sending = { ..._80,
..._81,
export const sending = { ..._81,
..._82,
..._83,
..._131,
..._145
..._84,
..._132,
..._146
};
export const stats = { ..._84,
..._85,
export const stats = { ..._85,
..._86,
..._87,
..._88,
..._116,
..._132,
..._146
..._89,
..._117,
..._133,
..._147
};
export const subaccounts = { ..._89,
..._90,
export const subaccounts = { ..._90,
..._91,
..._92,
..._93,
..._117,
..._133
..._94,
..._118,
..._134
};
export const vest = { ..._94,
..._95,
export const vest = { ..._95,
..._96,
..._97,
..._118,
..._134,
..._147
..._98,
..._119,
..._135,
..._148
};
export const ClientFactory = { ..._148,
..._149,
..._150
export const ClientFactory = { ..._149,
..._150,
..._151
};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse } from "./query";
import { QueryGetClobPairRequest, QueryClobPairResponse, QueryAllClobPairRequest, QueryClobPairAllResponse, MevNodeToNodeCalculationRequest, MevNodeToNodeCalculationResponse, QueryEquityTierLimitConfigurationRequest, QueryEquityTierLimitConfigurationResponse, QueryBlockRateLimitConfigurationRequest, QueryBlockRateLimitConfigurationResponse, QueryLiquidationsConfigurationRequest, QueryLiquidationsConfigurationResponse, StreamOrderbookUpdatesRequest, StreamOrderbookUpdatesResponse } from "./query";
/** Query defines the gRPC querier service. */

export interface Query {
Expand All @@ -22,6 +22,9 @@ export interface Query {
/** Queries LiquidationsConfiguration. */

liquidationsConfiguration(request?: QueryLiquidationsConfigurationRequest): Promise<QueryLiquidationsConfigurationResponse>;
/** Streams orderbook updates. */

streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise<StreamOrderbookUpdatesResponse>;
}
export class QueryClientImpl implements Query {
private readonly rpc: Rpc;
Expand All @@ -34,6 +37,7 @@ export class QueryClientImpl implements Query {
this.equityTierLimitConfiguration = this.equityTierLimitConfiguration.bind(this);
this.blockRateLimitConfiguration = this.blockRateLimitConfiguration.bind(this);
this.liquidationsConfiguration = this.liquidationsConfiguration.bind(this);
this.streamOrderbookUpdates = this.streamOrderbookUpdates.bind(this);
}

clobPair(request: QueryGetClobPairRequest): Promise<QueryClobPairResponse> {
Expand Down Expand Up @@ -74,6 +78,12 @@ export class QueryClientImpl implements Query {
return promise.then(data => QueryLiquidationsConfigurationResponse.decode(new _m0.Reader(data)));
}

streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise<StreamOrderbookUpdatesResponse> {
const data = StreamOrderbookUpdatesRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.clob.Query", "StreamOrderbookUpdates", data);
return promise.then(data => StreamOrderbookUpdatesResponse.decode(new _m0.Reader(data)));
}

}
export const createRpcQueryExtension = (base: QueryClient) => {
const rpc = createProtobufRpcClient(base);
Expand Down Expand Up @@ -101,6 +111,10 @@ export const createRpcQueryExtension = (base: QueryClient) => {

liquidationsConfiguration(request?: QueryLiquidationsConfigurationRequest): Promise<QueryLiquidationsConfigurationResponse> {
return queryService.liquidationsConfiguration(request);
},

streamOrderbookUpdates(request: StreamOrderbookUpdatesRequest): Promise<StreamOrderbookUpdatesResponse> {
return queryService.streamOrderbookUpdates(request);
}

};
Expand Down
Loading

0 comments on commit 082af18

Please sign in to comment.