diff --git a/packages/fast-usdc/src/exos/status-manager.js b/packages/fast-usdc/src/exos/status-manager.js index c49e955b25d..ca17487e01b 100644 --- a/packages/fast-usdc/src/exos/status-manager.js +++ b/packages/fast-usdc/src/exos/status-manager.js @@ -17,8 +17,11 @@ import { PendingTxStatus, TxStatus } from '../constants.js'; */ /** - * @typedef {`pendingTx:${string}`} PendingTxKey - * @typedef {`seenTx:${string}`} SeenTxKey + * @typedef {`pendingTx:${bigint}:${NobleAddress}`} PendingTxKey + * The string template is for developer visibility but not meant to ever be parsed. + * + * @typedef {`seenTx:${string}:${EvmHash}`} SeenTxKey + * The string template is for developer visibility but not meant to ever be parsed. */ /** @@ -31,7 +34,8 @@ import { PendingTxStatus, TxStatus } from '../constants.js'; * @returns {PendingTxKey} */ const makePendingTxKey = (addr, amount) => - `pendingTx:${JSON.stringify([addr, String(amount)])}`; + // amount can't contain colon + `pendingTx:${amount}:${addr}`; /** * Get the key for the pendingTxs MapStore. @@ -54,7 +58,8 @@ const pendingTxKeyOf = evidence => { */ const seenTxKeyOf = evidence => { const { txHash, chainId } = evidence; - return `seenTx:${JSON.stringify([txHash, chainId])}`; + // chainId can't contain colon + return `seenTx:${chainId}:${txHash}`; }; /** diff --git a/packages/fast-usdc/test/exos/status-manager.test.ts b/packages/fast-usdc/test/exos/status-manager.test.ts index 7932d81e630..71757ea731a 100644 --- a/packages/fast-usdc/test/exos/status-manager.test.ts +++ b/packages/fast-usdc/test/exos/status-manager.test.ts @@ -106,12 +106,12 @@ test('cannot process same tx twice', t => { t.throws(() => statusManager.advance(evidence), { message: - 'Transaction already seen: "seenTx:[\\"0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702\\",1]"', + 'Transaction already seen: "seenTx:1:0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702"', }); t.throws(() => statusManager.observe(evidence), { message: - 'Transaction already seen: "seenTx:[\\"0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702\\",1]"', + 'Transaction already seen: "seenTx:1:0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702"', }); // new txHash should not throw