Skip to content

Commit

Permalink
Revert "enable orderId logging in print-block script"
Browse files Browse the repository at this point in the history
This reverts commit b047742.
  • Loading branch information
jerryfan01234 committed Oct 1, 2024
1 parent 445735a commit aa17e0b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
5 changes: 3 additions & 2 deletions indexer/services/bazooka/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,15 @@ async function partitionKafkaTopics(): Promise<void> {
async function clearKafkaTopics(
existingKafkaTopics: string[],
): Promise<void> {
// 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,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions indexer/services/scripts/src/helpers/block-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
UpdateClobPairEventV1,
UpdatePerpetualEventV1,
} from '@dydxprotocol-indexer/v4-protos';
import { OrderTable } from '@dydxprotocol-indexer/postgres';

import { AnnotatedIndexerTendermintEvent, DydxIndexerSubtypes } from './types';

Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 0 additions & 2 deletions indexer/services/scripts/src/print-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -107,7 +106,6 @@ export async function printMessageAtHeight(
});
throw Error('Failed to parse event');
}

annotatedEvents.push(annotatedEvent);
});
const annotatedBlock: AnnotatedIndexerTendermintBlock = {
Expand Down

0 comments on commit aa17e0b

Please sign in to comment.