From 5cfa6618af942ee0cb1ee0bf957d44db1b0e33f8 Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Mon, 25 Nov 2024 13:11:38 -0500 Subject: [PATCH] indexer codegen --- .../codegen/dydxprotocol/blocktime/params.ts | 67 ++++++++++ .../dydxprotocol/blocktime/tx.rpc.msg.ts | 12 +- .../src/codegen/dydxprotocol/blocktime/tx.ts | 119 +++++++++++++++++- 3 files changed, 196 insertions(+), 2 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/params.ts index 7f327d2f3c3..b7ae9428b7d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/params.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/params.ts @@ -19,6 +19,28 @@ export interface DowntimeParamsSDKType { */ durations: DurationSDKType[]; } +/** SynchronyParams defines the parameters for block synchrony. */ + +export interface SynchronyParams { + /** + * next_block_delay replaces the locally configured timeout_commit in + * CometBFT. It determines the amount of time the CometBFT waits after the If + * the application sends next_block_delay = 0 to the consensus engine, the + * latter defaults back to using timeout_commit. + */ + nextBlockDelay?: Duration; +} +/** SynchronyParams defines the parameters for block synchrony. */ + +export interface SynchronyParamsSDKType { + /** + * next_block_delay replaces the locally configured timeout_commit in + * CometBFT. It determines the amount of time the CometBFT waits after the If + * the application sends next_block_delay = 0 to the consensus engine, the + * latter defaults back to using timeout_commit. + */ + next_block_delay?: DurationSDKType; +} function createBaseDowntimeParams(): DowntimeParams { return { @@ -63,4 +85,49 @@ export const DowntimeParams = { return message; } +}; + +function createBaseSynchronyParams(): SynchronyParams { + return { + nextBlockDelay: undefined + }; +} + +export const SynchronyParams = { + encode(message: SynchronyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nextBlockDelay !== undefined) { + Duration.encode(message.nextBlockDelay, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SynchronyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSynchronyParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.nextBlockDelay = Duration.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): SynchronyParams { + const message = createBaseSynchronyParams(); + message.nextBlockDelay = object.nextBlockDelay !== undefined && object.nextBlockDelay !== null ? Duration.fromPartial(object.nextBlockDelay) : undefined; + return message; + } + }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.rpc.msg.ts index c878a926c08..d0db3c98ff2 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.rpc.msg.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.rpc.msg.ts @@ -1,11 +1,14 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgUpdateDowntimeParams, MsgUpdateDowntimeParamsResponse } from "./tx"; +import { MsgUpdateDowntimeParams, MsgUpdateDowntimeParamsResponse, MsgUpdateSynchronyParams, MsgUpdateSynchronyParamsResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** UpdateDowntimeParams updates the DowntimeParams in state. */ updateDowntimeParams(request: MsgUpdateDowntimeParams): Promise; + /** UpdateSynchronyParams updates the SynchronyParams in state. */ + + updateSynchronyParams(request: MsgUpdateSynchronyParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -13,6 +16,7 @@ export class MsgClientImpl implements Msg { constructor(rpc: Rpc) { this.rpc = rpc; this.updateDowntimeParams = this.updateDowntimeParams.bind(this); + this.updateSynchronyParams = this.updateSynchronyParams.bind(this); } updateDowntimeParams(request: MsgUpdateDowntimeParams): Promise { @@ -21,4 +25,10 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgUpdateDowntimeParamsResponse.decode(new _m0.Reader(data))); } + updateSynchronyParams(request: MsgUpdateSynchronyParams): Promise { + const data = MsgUpdateSynchronyParams.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.blocktime.Msg", "UpdateSynchronyParams", data); + return promise.then(data => MsgUpdateSynchronyParamsResponse.decode(new _m0.Reader(data))); + } + } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.ts index 33655a77327..9d56e359681 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.ts @@ -1,4 +1,4 @@ -import { DowntimeParams, DowntimeParamsSDKType } from "./params"; +import { DowntimeParams, DowntimeParamsSDKType, SynchronyParams, SynchronyParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** MsgUpdateDowntimeParams is the Msg/UpdateDowntimeParams request type. */ @@ -29,6 +29,34 @@ export interface MsgUpdateDowntimeParamsResponse {} */ export interface MsgUpdateDowntimeParamsResponseSDKType {} +/** MsgUpdateSynchronyParams is the Msg/UpdateSynchronyParams request type. */ + +export interface MsgUpdateSynchronyParams { + authority: string; + /** Defines the parameters to update. All parameters must be supplied. */ + + params?: SynchronyParams; +} +/** MsgUpdateSynchronyParams is the Msg/UpdateSynchronyParams request type. */ + +export interface MsgUpdateSynchronyParamsSDKType { + authority: string; + /** Defines the parameters to update. All parameters must be supplied. */ + + params?: SynchronyParamsSDKType; +} +/** + * MsgUpdateSynchronyParamsResponse is the Msg/UpdateSynchronyParams response + * type. + */ + +export interface MsgUpdateSynchronyParamsResponse {} +/** + * MsgUpdateSynchronyParamsResponse is the Msg/UpdateSynchronyParams response + * type. + */ + +export interface MsgUpdateSynchronyParamsResponseSDKType {} function createBaseMsgUpdateDowntimeParams(): MsgUpdateDowntimeParams { return { @@ -117,4 +145,93 @@ export const MsgUpdateDowntimeParamsResponse = { return message; } +}; + +function createBaseMsgUpdateSynchronyParams(): MsgUpdateSynchronyParams { + return { + authority: "", + params: undefined + }; +} + +export const MsgUpdateSynchronyParams = { + encode(message: MsgUpdateSynchronyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + + if (message.params !== undefined) { + SynchronyParams.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateSynchronyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateSynchronyParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + + case 2: + message.params = SynchronyParams.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgUpdateSynchronyParams { + const message = createBaseMsgUpdateSynchronyParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? SynchronyParams.fromPartial(object.params) : undefined; + return message; + } + +}; + +function createBaseMsgUpdateSynchronyParamsResponse(): MsgUpdateSynchronyParamsResponse { + return {}; +} + +export const MsgUpdateSynchronyParamsResponse = { + encode(_: MsgUpdateSynchronyParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateSynchronyParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateSynchronyParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgUpdateSynchronyParamsResponse { + const message = createBaseMsgUpdateSynchronyParamsResponse(); + return message; + } + }; \ No newline at end of file