Skip to content

Commit

Permalink
Address code rabbit suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwik committed Nov 28, 2023
1 parent 77a5255 commit f82c8a1
Show file tree
Hide file tree
Showing 28 changed files with 16 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
AssetCreateEventV1,
IndexerTendermintBlock,
Expand Down Expand Up @@ -41,9 +40,6 @@ describe('assetHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
FundingEventV1,
FundingEventV1_Type,
Expand Down Expand Up @@ -47,9 +46,6 @@ describe('fundingHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
IndexerTendermintBlock,
IndexerTendermintEvent,
Expand Down Expand Up @@ -44,9 +43,6 @@ describe('liquidityTierHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
logger, stats,
} from '@dydxprotocol-indexer/base';
import { logger } from '@dydxprotocol-indexer/base';
import {
IndexerTendermintBlock, IndexerTendermintEvent, Timestamp,
LiquidationOrderV1,
Expand Down Expand Up @@ -91,9 +89,6 @@ describe('LiquidationHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger, stats } from '@dydxprotocol-indexer/base';
import { logger } from '@dydxprotocol-indexer/base';
import {
IndexerOrder,
IndexerOrder_Side,
Expand Down Expand Up @@ -92,9 +92,6 @@ describe('OrderHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
PerpetualMarketCreateEventV1,
IndexerTendermintBlock,
Expand Down Expand Up @@ -45,9 +44,6 @@ describe('perpetualMarketHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
expectOrderSubaccountKafkaMessage,
} from '../../helpers/indexer-proto-helpers';
import { getPrice, getSize, getTriggerPrice } from '../../../src/lib/helper';
import { stats } from '@dydxprotocol-indexer/base';
import { STATEFUL_ORDER_ORDER_FILL_EVENT_TYPE } from '../../../src/constants';
import { ORDER_FLAG_CONDITIONAL } from '@dydxprotocol-indexer/v4-proto-parser';
import Long from 'long';
Expand All @@ -50,9 +49,6 @@ describe('conditionalOrderPlacementHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
createIndexerTendermintEvent,
expectVulcanKafkaMessage,
} from '../../helpers/indexer-proto-helpers';
import { stats } from '@dydxprotocol-indexer/base';
import { STATEFUL_ORDER_ORDER_FILL_EVENT_TYPE } from '../../../src/constants';
import { producer } from '@dydxprotocol-indexer/kafka';
import { ORDER_FLAG_CONDITIONAL } from '@dydxprotocol-indexer/v4-proto-parser';
Expand All @@ -44,9 +43,6 @@ describe('conditionalOrderTriggeredHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
} from '../../helpers/indexer-proto-helpers';
import { StatefulOrderPlacementHandler } from '../../../src/handlers/stateful-order/stateful-order-placement-handler';
import { getPrice, getSize } from '../../../src/lib/helper';
import { stats } from '@dydxprotocol-indexer/base';
import { STATEFUL_ORDER_ORDER_FILL_EVENT_TYPE } from '../../../src/constants';
import { producer } from '@dydxprotocol-indexer/kafka';
import { ORDER_FLAG_LONG_TERM } from '@dydxprotocol-indexer/v4-proto-parser';
Expand All @@ -50,9 +49,6 @@ describe('statefulOrderPlacementHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
expectVulcanKafkaMessage,
} from '../../helpers/indexer-proto-helpers';
import { StatefulOrderRemovalHandler } from '../../../src/handlers/stateful-order/stateful-order-removal-handler';
import { stats } from '@dydxprotocol-indexer/base';
import { STATEFUL_ORDER_ORDER_FILL_EVENT_TYPE } from '../../../src/constants';
import { producer } from '@dydxprotocol-indexer/kafka';
import { createPostgresFunctions } from '../../../src/helpers/postgres/postgres-functions';
Expand All @@ -40,9 +39,6 @@ describe('statefulOrderRemovalHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
IndexerTendermintBlock,
IndexerTendermintEvent,
Expand Down Expand Up @@ -64,9 +63,6 @@ describe('subaccountUpdateHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
logger,
ParseMessageError,
stats,
} from '@dydxprotocol-indexer/base';
import {
IndexerTendermintBlock,
Expand Down Expand Up @@ -56,9 +55,6 @@ describe('transferHandler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
PerpetualMarketFromDatabase,
PerpetualMarketTable,
Expand Down Expand Up @@ -38,9 +37,6 @@ describe('update-clob-pair-handler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { stats } from '@dydxprotocol-indexer/base';
import {
PerpetualMarketFromDatabase,
PerpetualMarketTable,
Expand Down Expand Up @@ -37,9 +36,6 @@ describe('update-perpetual-handler', () => {
beforeAll(async () => {
await dbHelpers.migrate();
await createPostgresFunctions();
jest.spyOn(stats, 'increment');
jest.spyOn(stats, 'timing');
jest.spyOn(stats, 'gauge');
});

beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion indexer/services/ender/src/handlers/asset-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AssetCreationHandler extends Handler<AssetCreateEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'AssetCreationHandler#handleViaSqlFunction',
at: 'AssetCreationHandler#internalHandle',
message: 'Failed to handle AssetCreateEventV1',
error,
});
Expand Down
2 changes: 1 addition & 1 deletion indexer/services/ender/src/handlers/funding-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class FundingHandler extends Handler<FundingEventMessage> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'FundingHandler#handleViaSqlFunction',
at: 'FundingHandler#internalHandle',
message: 'Failed to handle FundingEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class LiquidityTierHandler extends Handler<LiquidityTierUpsertEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'LiquidityTierHandler#handleViaSqlFunction',
at: 'LiquidityTierHandler#internalHandle',
message: 'Failed to handle LiquidityTierUpsertEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class MarketCreateHandler extends Handler<MarketEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'MarketCreateHandler#handleViaSqlFunction',
at: 'MarketCreateHandler#internalHandle',
message: 'Failed to handle MarketEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MarketModifyHandler extends Handler<MarketEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'MarketModifyHandler#handleViaSqlFunction',
at: 'MarketModifyHandler#internalHandle',
message: 'Failed to handle MarketEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class MarketPriceUpdateHandler extends Handler<MarketEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'MarketPriceUpdateHandler#handleViaSqlFunction',
at: 'MarketPriceUpdateHandler#internalHandle',
message: 'Failed to handle MarketEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class DeleveragingHandler extends AbstractOrderFillHandler<DeleveragingEv
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'DeleveragingHandler#handleViaSqlFunction',
at: 'DeleveragingHandler#internalHandle',
message: 'Failed to handle DeleveragingEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class LiquidationHandler extends AbstractOrderFillHandler<OrderFillWithLi
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'liquidationHandler#handleViaSqlFunction',
at: 'liquidationHandler#internalHandle',
message: 'Failed to handle OrderFillEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class OrderHandler extends AbstractOrderFillHandler<OrderFillWithLiquidit
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'orderHandler#handleViaSqlFunction',
at: 'orderHandler#internalHandle',
message: 'Failed to handle OrderFillEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PerpetualMarketCreationHandler extends Handler<PerpetualMarketCreat
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'PerpetualMarketCreationHandler#handleViaSqlFunction',
at: 'PerpetualMarketCreationHandler#internalHandle',
message: 'Failed to handle PerpetualMarketCreateEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SubaccountUpdateHandler extends Handler<SubaccountUpdate> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'subaccountUpdateHandler#handleViaSqlFunction',
at: 'subaccountUpdateHandler#internalHandle',
message: 'Failed to handle SubaccountUpdateEventV1',
error,
});
Expand Down
2 changes: 1 addition & 1 deletion indexer/services/ender/src/handlers/transfer-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class TransferHandler extends Handler<TransferEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'TransferHandler#handleViaSqlFunction',
at: 'TransferHandler#internalHandle',
message: 'Failed to handle TransferEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class UpdateClobPairHandler extends Handler<UpdateClobPairEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'UpdateClobPairHandler#handleViaSqlFunction',
at: 'UpdateClobPairHandler#internalHandle',
message: 'Failed to handle UpdateClobPairEventV1',
error,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class UpdatePerpetualHandler extends Handler<UpdatePerpetualEventV1> {
{ txId: this.txId },
).catch((error: Error) => {
logger.error({
at: 'UpdatePerpetualHandler#handleViaSqlFunction',
at: 'UpdatePerpetualHandler#internalHandle',
message: 'Failed to handle UpdatePerpetualEventV1',
error,
});
Expand Down

0 comments on commit f82c8a1

Please sign in to comment.