From aa17e0b57258e7f9da137e90a7df6584e0924e6d Mon Sep 17 00:00:00 2001 From: Jerry Fan Date: Tue, 1 Oct 2024 16:31:04 -0400 Subject: [PATCH] Revert "enable orderId logging in print-block script" This reverts commit b047742ee660600e4583b4fae2e397bf998ef826. --- indexer/services/bazooka/src/index.ts | 5 +++-- .../api/v4/affiliates-controller.ts | 18 +++++------------- .../scripts/src/helpers/block-helpers.ts | 3 --- indexer/services/scripts/src/print-block.ts | 2 -- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/indexer/services/bazooka/src/index.ts b/indexer/services/bazooka/src/index.ts index 4397fb7068..8329bd69a0 100644 --- a/indexer/services/bazooka/src/index.ts +++ b/indexer/services/bazooka/src/index.ts @@ -264,14 +264,15 @@ async function partitionKafkaTopics(): Promise { async function clearKafkaTopics( existingKafkaTopics: string[], ): Promise { - // Concurrent calls on to clear all topics caused failures. + // Concurrent calls to clear all topics caused the failure: + // TypeError: Cannot destructure property 'partitions' of 'high.pop(...)' as it is undefined. for (const topic of KAFKA_TOPICS) { await clearKafkaTopic( 1, config.CLEAR_KAFKA_TOPIC_RETRY_MS, config.CLEAR_KAFKA_TOPIC_MAX_RETRIES, existingKafkaTopics, - topic // Assuming the topic is the last parameter + topic, ); } } diff --git a/indexer/services/comlink/src/controllers/api/v4/affiliates-controller.ts b/indexer/services/comlink/src/controllers/api/v4/affiliates-controller.ts index e5bff4557a..76e2433255 100644 --- a/indexer/services/comlink/src/controllers/api/v4/affiliates-controller.ts +++ b/indexer/services/comlink/src/controllers/api/v4/affiliates-controller.ts @@ -64,7 +64,7 @@ class AffiliatesController extends Controller { const isVolumeEligible = Number(walletRow.totalVolume) >= config.VOLUME_ELIGIBILITY_THRESHOLD; const isAffiliate = referredUserRows !== undefined ? referredUserRows.length > 0 : false; - // subaccountRows.length > 1 is not possible because subaccountNumber is unique for an address + // No need to check subaccountRows.length > 1 as subaccountNumber is unique for an address if (subaccountRows.length === 0) { // error logging will be performed by handleInternalServerError throw new UnexpectedServerError(`Subaccount 0 not found for address ${address}`); @@ -78,22 +78,14 @@ class AffiliatesController extends Controller { }, [], ); - - let referralCode: string = ''; - // usernameRows.length > 1 is not possible because subAccountId is unique (foreign key - // constraint) + // No need to check usernameRows.length > 1 as subAccountId is unique (foreign key constraint) + // This error can happen if a user calls this endpoint before subaccount-username-generator + // has generated the username if (usernameRows.length === 0) { - // This error can happen if a user calls this endpoint before subaccount-username-generator - // has generated the username stats.increment(`${config.SERVICE_NAME}.${controllerName}.get_metadata.subaccount_username_not_found`); - logger.warning({ - at: 'affiliates-controller#metadata', - message: `Could not find referral code for address: ${address}`, - }); throw new UnexpectedServerError(`Username not found for subaccount ${subaccountId}`); - } else { - referralCode = usernameRows[0].username; } + const referralCode = usernameRows[0].username; return { referralCode, diff --git a/indexer/services/scripts/src/helpers/block-helpers.ts b/indexer/services/scripts/src/helpers/block-helpers.ts index ccba917736..7ec74df7db 100644 --- a/indexer/services/scripts/src/helpers/block-helpers.ts +++ b/indexer/services/scripts/src/helpers/block-helpers.ts @@ -15,7 +15,6 @@ import { UpdateClobPairEventV1, UpdatePerpetualEventV1, } from '@dydxprotocol-indexer/v4-protos'; -import { OrderTable } from '@dydxprotocol-indexer/postgres'; import { AnnotatedIndexerTendermintEvent, DydxIndexerSubtypes } from './types'; @@ -53,8 +52,6 @@ export function annotateIndexerTendermintEvent( }; } case (DydxIndexerSubtypes.STATEFUL_ORDER.toString()): { - const temp = StatefulOrderEventV1.decode(eventDataBinary); - const orderId = OrderTable.orderIdToUuid(temp.orderRemoval!.removedOrderId!); return { ...event, dataBytes: new Uint8Array(), diff --git a/indexer/services/scripts/src/print-block.ts b/indexer/services/scripts/src/print-block.ts index 91c48e2e8a..05855229ca 100644 --- a/indexer/services/scripts/src/print-block.ts +++ b/indexer/services/scripts/src/print-block.ts @@ -15,7 +15,6 @@ import yargs from 'yargs'; import config from './config'; import { annotateIndexerTendermintEvent } from './helpers/block-helpers'; import { AnnotatedIndexerTendermintBlock, AnnotatedIndexerTendermintEvent } from './helpers/types'; -import { OrderTable } from '@dydxprotocol-indexer/postgres'; /** * Creates an IndexerTendermintBlock from a KafkaMessage. @@ -107,7 +106,6 @@ export async function printMessageAtHeight( }); throw Error('Failed to parse event'); } - annotatedEvents.push(annotatedEvent); }); const annotatedBlock: AnnotatedIndexerTendermintBlock = {