diff --git a/src/interfaces/SpokePool.ts b/src/interfaces/SpokePool.ts index 37b228452..7d2f41037 100644 --- a/src/interfaces/SpokePool.ts +++ b/src/interfaces/SpokePool.ts @@ -19,6 +19,7 @@ export interface RelayData { fillDeadline: number; exclusiveRelayer: string; exclusivityDeadline: number; + _hash?: Record; } export interface Deposit extends RelayData { diff --git a/src/utils/SpokeUtils.ts b/src/utils/SpokeUtils.ts index 554b777f0..facda8a34 100644 --- a/src/utils/SpokeUtils.ts +++ b/src/utils/SpokeUtils.ts @@ -216,7 +216,9 @@ export async function getDepositIdAtBlock(contract: Contract, blockTag: number): * @returns The corresponding RelayData hash. */ export function getRelayDataHash(relayData: RelayData, destinationChainId: number): string { - return ethersUtils.keccak256( + relayData._hash ??= {}; + + return relayData._hash[destinationChainId] ??= ethersUtils.keccak256( ethersUtils.defaultAbiCoder.encode( [ "tuple(" +