Skip to content

Commit

Permalink
reduce noisiness of logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Feb 11, 2025
1 parent 04d3592 commit 7545cf2
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ export class SpokePoolClient extends BaseAbstractClient {
* @see _update
*/
public async update(eventsToQuery = this.queryableEventNames): Promise<void> {
const duplicateEvents: any[] = [];

Check failure on line 590 in src/clients/SpokePoolClient.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (this.hubPoolClient !== null && !this.hubPoolClient.isUpdated) {
throw new Error("HubPoolClient not updated");
}
Expand Down Expand Up @@ -663,12 +664,7 @@ export class SpokePoolClient extends BaseAbstractClient {
return e.transactionHash === deposit.transactionHash && e.logIndex === deposit.logIndex;
})
) {
this.logger.error({
at: "SpokePoolClient#update",
chainId: this.chainId,
message: "Duplicate deposit found with same transaction hash and log index",
deposit,
});
duplicateEvents.push(deposit);
continue;
}
assign(this.duplicateDepositHashes, [getRelayEventKey(deposit)], [deposit]);
Expand Down Expand Up @@ -736,12 +732,7 @@ export class SpokePoolClient extends BaseAbstractClient {

// Sanity check that this event is not a duplicate.
if (this.slowFillRequests[depositHash] !== undefined) {
this.logger.error({
at: "SpokePoolClient#update",
chainId: this.chainId,
message: "Duplicate slow fill request found",
slowFillRequest,
});
duplicateEvents.push(slowFillRequest);
continue;
}

Expand Down Expand Up @@ -783,12 +774,7 @@ export class SpokePoolClient extends BaseAbstractClient {
(f) => f.transactionHash === fill.transactionHash && f.logIndex === fill.logIndex
);
if (duplicateFill) {
this.logger.error({
at: "SpokePoolClient#update",
chainId: this.chainId,
message: "Duplicate fill found",
fill,
});
duplicateEvents.push(duplicateFill);
continue;
}

Expand Down Expand Up @@ -836,6 +822,12 @@ export class SpokePoolClient extends BaseAbstractClient {
}
}

if (duplicateEvents.length > 0) {
this.log("error", "Duplicate events found", {
duplicateEvents,
});
}

// Next iteration should start off from where this one ended.
this.currentTime = currentTime;
if (this.oldestTime === 0) this.oldestTime = oldestTime; // Set oldest time only after the first update.
Expand Down

0 comments on commit 7545cf2

Please sign in to comment.