Skip to content

Commit

Permalink
Log duplicate deposits in spoke pool client
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Feb 10, 2025
1 parent b0a7a23 commit 55783b7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,21 @@ export class SpokePoolClient extends BaseAbstractClient {
}

if (this.depositHashes[getRelayEventKey(deposit)] !== undefined) {
// Sanity check that this event is not a duplicate, even though the relay data hash is a duplicate.
const allDeposits = this._getDuplicateDeposits(deposit).concat(this.depositHashes[getRelayEventKey(deposit)]);
if (
allDeposits.some((e) => {
return e.transactionHash === deposit.transactionHash && e.logIndex === deposit.logIndex;
})
) {
this.logger.warn({
at: "SpokePoolClient#update",
chainId: this.chainId,
message: "Duplicate deposit found with same transaction hash and log index",
deposit,
});
continue;
}
assign(this.duplicateDepositHashes, [getRelayEventKey(deposit)], [deposit]);
continue;
}
Expand Down

0 comments on commit 55783b7

Please sign in to comment.