diff --git a/apps/minifront/src/state/ibc.ts b/apps/minifront/src/state/ibc.ts index 778ee2161..393c833ad 100644 --- a/apps/minifront/src/state/ibc.ts +++ b/apps/minifront/src/state/ibc.ts @@ -94,8 +94,12 @@ export const createIbcSendSlice = (): SliceCreator => (set, get) = const getTimeout = async ( chain: Chain, ): Promise<{ timeoutTime: bigint; timeoutHeight: Height }> => { - const twoDaysInMilliseconds = 2 * 24 * 60 * 60 * 1000; // 2 days * 24 hours/day * 60 minutes/hour * 60 seconds/minute * 1000 milliseconds/second - const timeoutTime = BigInt(Date.now() + twoDaysInMilliseconds); + // timeout 2 days from now, in nanoseconds since epoch + const twoDaysMs = BigInt(2 * 24 * 60 * 60 * 1000); // 2 days * 24 hours/day * 60 minutes/hour * 60 seconds/minute * 1000 milliseconds per second + // truncate resolution at seconds, to obfuscate clock skew + const lowPrecisionNowMs = BigInt(Math.floor(Date.now() / 1000) * 1000); // ms/1000 to second, floor, second*1000 to ms + // (now + two days) as nanoseconds + const timeoutTime = (lowPrecisionNowMs + twoDaysMs) * 1_000_000n; // 1 million nanoseconds per millisecond const { clientStates } = await ibcClient.clientStates({}); const unpacked = clientStates diff --git a/packages/ui/components/ui/tx/view/isc20-withdrawal.tsx b/packages/ui/components/ui/tx/view/isc20-withdrawal.tsx index 0dfa4d8f4..1ef4b3aed 100644 --- a/packages/ui/components/ui/tx/view/isc20-withdrawal.tsx +++ b/packages/ui/components/ui/tx/view/isc20-withdrawal.tsx @@ -42,7 +42,7 @@ export const Ics20WithdrawalComponent = ({ value }: { value: Ics20Withdrawal }) )} - {new Date(Number(value.timeoutTime)).toString()} + {new Date(Number(BigInt(value.timeoutTime) / 1_000_000n)).toString()} }