diff --git a/packages/fast-usdc/src/constants.js b/packages/fast-usdc/src/constants.js index 1bda5e82b53..a03a8cf8827 100644 --- a/packages/fast-usdc/src/constants.js +++ b/packages/fast-usdc/src/constants.js @@ -4,6 +4,8 @@ * @enum {(typeof TxStatus)[keyof typeof TxStatus]} */ export const TxStatus = /** @type {const} */ ({ + /** tx was observed but not advanced */ + Observed: 'OBSERVED', /** IBC transfer is initiated */ Advancing: 'ADVANCING', /** IBC transfer is complete */ @@ -34,6 +36,8 @@ export const TerminalTxStatus = { * @enum {(typeof PendingTxStatus)[keyof typeof PendingTxStatus]} */ export const PendingTxStatus = /** @type {const} */ ({ + /** tx was observed but not advanced */ + Observed: 'OBSERVED', /** IBC transfer is initiated */ Advancing: 'ADVANCING', /** IBC transfer failed (timed out) */ diff --git a/packages/fast-usdc/src/exos/transaction-feed.js b/packages/fast-usdc/src/exos/transaction-feed.js index 4e39b52681f..67ffe79fbfd 100644 --- a/packages/fast-usdc/src/exos/transaction-feed.js +++ b/packages/fast-usdc/src/exos/transaction-feed.js @@ -69,8 +69,8 @@ export const stateShape = { /** * transaction-feed receives attestations from Oracles, records their - * evidence, and when enough oracles agree, (if no risks are identified) - * publishes the results for the advancer to act on. + * evidence, and when enough oracles agree, publishes the results for the + * advancer to act on. * * @param {Zone} zone * @param {ZCF} zcf diff --git a/packages/fast-usdc/test/exos/settler.test.ts b/packages/fast-usdc/test/exos/settler.test.ts index b3c1569494b..d17203bf751 100644 --- a/packages/fast-usdc/test/exos/settler.test.ts +++ b/packages/fast-usdc/test/exos/settler.test.ts @@ -303,7 +303,7 @@ test('happy path: disburse to LPs; StatusManager removes tx', async t => { await eventLoopIteration(); const { storage } = t.context; t.deepEqual(storage.getDeserialized(`fun.txns.${cctpTxEvidence.txHash}`), [ - { evidence: cctpTxEvidence, status: undefined }, + { evidence: cctpTxEvidence, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, { split: expectedSplit, status: 'DISBURSED' }, @@ -370,7 +370,7 @@ test('slow path: forward to EUD; remove pending tx', async t => { accounts.settlement.transferVResolver.resolve(undefined); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${cctpTxEvidence.txHash}`), [ - { evidence: cctpTxEvidence, status: undefined }, + { evidence: cctpTxEvidence, status: 'OBSERVED' }, { risksIdentified: ['TOO_LARGE_AMOUNT'], status: 'ADVANCE_SKIPPED' }, { status: 'FORWARDED' }, ]); @@ -445,7 +445,7 @@ test('skip advance: forward to EUD; remove pending tx', async t => { ); const { storage } = t.context; t.deepEqual(storage.getDeserialized(`fun.txns.${cctpTxEvidence.txHash}`), [ - { evidence: cctpTxEvidence, status: undefined }, + { evidence: cctpTxEvidence, status: 'OBSERVED' }, { status: 'ADVANCE_SKIPPED', risksIdentified: ['TOO_LARGE_AMOUNT'] }, { status: 'FORWARDED' }, ]); @@ -520,7 +520,7 @@ test('Settlement for unknown transaction (minted early)', async t => { accounts.settlement.transferVResolver.resolve(undefined); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${evidence.txHash}`), [ - { evidence, status: undefined }, + { evidence, status: 'OBSERVED' }, { status: 'FORWARDED' }, ]); }); @@ -574,7 +574,7 @@ test('Settlement for Advancing transaction (advance succeeds)', async t => { simulate.finishAdvance(cctpTxEvidence, true); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${cctpTxEvidence.txHash}`), [ - { evidence: cctpTxEvidence, status: undefined }, + { evidence: cctpTxEvidence, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, { split: expectedSplit, status: 'DISBURSED' }, @@ -638,7 +638,7 @@ test('Settlement for Advancing transaction (advance fails)', async t => { accounts.settlement.transferVResolver.resolve(undefined); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${cctpTxEvidence.txHash}`), [ - { evidence: cctpTxEvidence, status: undefined }, + { evidence: cctpTxEvidence, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCE_FAILED' }, { status: 'FORWARDED' }, @@ -688,7 +688,7 @@ test('slow path, and forward fails (terminal state)', async t => { ]); t.deepEqual(storage.getDeserialized(`fun.txns.${evidence.txHash}`), [ - { evidence, status: undefined }, + { evidence, status: 'OBSERVED' }, { status: 'FORWARD_FAILED' }, ]); }); diff --git a/packages/fast-usdc/test/exos/status-manager.test.ts b/packages/fast-usdc/test/exos/status-manager.test.ts index 3ae3737be1b..0c7f7828a63 100644 --- a/packages/fast-usdc/test/exos/status-manager.test.ts +++ b/packages/fast-usdc/test/exos/status-manager.test.ts @@ -64,7 +64,7 @@ test('ADVANCED transactions are published to vstorage', async t => { const { storage } = t.context; t.deepEqual(storage.getDeserialized(`fun.txns.${evidence.txHash}`), [ - { evidence, status: undefined }, + { evidence, status: 'OBSERVED' }, { status: 'ADVANCING' }, ]); }); @@ -92,7 +92,7 @@ test('ADVANCE_SKIPPED transactions are published to vstorage', async t => { const { storage } = t.context; t.deepEqual(storage.getDeserialized(`fun.txns.${evidence.txHash}`), [ - { evidence, status: undefined }, + { evidence, status: 'OBSERVED' }, { status: 'ADVANCE_SKIPPED', risksIdentified: ['RISK1'] }, ]); }); @@ -213,7 +213,7 @@ test('advanceOutcome transitions to ADVANCED and ADVANCE_FAILED', async t => { ]); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${e1.txHash}`), [ - { evidence: e1, status: undefined }, + { evidence: e1, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, ]); @@ -227,7 +227,7 @@ test('advanceOutcome transitions to ADVANCED and ADVANCE_FAILED', async t => { ]); await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${e2.txHash}`), [ - { evidence: e2, status: undefined }, + { evidence: e2, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCE_FAILED' }, ]); diff --git a/packages/fast-usdc/test/fast-usdc.contract.test.ts b/packages/fast-usdc/test/fast-usdc.contract.test.ts index 8d7a9fcdbce..682d464e15b 100644 --- a/packages/fast-usdc/test/fast-usdc.contract.test.ts +++ b/packages/fast-usdc/test/fast-usdc.contract.test.ts @@ -626,7 +626,7 @@ test.serial('STORY01: advancing happy path for 100 USDC', async t => { const sent1 = await cust1.sendFast(t, 108_000_000n, 'osmo1234advanceHappy'); await transmitTransferAck(); // ack IBC transfer for advance const expectedTransitions = [ - { evidence: sent1, status: undefined }, + { evidence: sent1, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, ]; @@ -835,7 +835,7 @@ test.serial('withdraw all liquidity while ADVANCING', async t => { await mint(sent); await utils.transmitTransferAck(); t.like(storage.getDeserialized(`fun.txns.${sent.txHash}`), [ - { evidence: sent, status: undefined }, + { evidence: sent, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, { status: 'DISBURSED' }, @@ -1019,7 +1019,7 @@ test.serial('Settlement for unknown transaction (operator down)', async t => { await eventLoopIteration(); t.deepEqual(storage.getDeserialized(`fun.txns.${sent.txHash}`), [ - { evidence: sent, status: undefined }, + { evidence: sent, status: 'OBSERVED' }, { status: 'FORWARDED' }, ]); }); @@ -1058,7 +1058,7 @@ test.serial('mint received while ADVANCING', async t => { const split = makeFeeTools(feeConfig).calculateSplit(usdc.make(5_000_000n)); t.deepEqual(storage.getDeserialized(`fun.txns.${sent.txHash}`), [ - { evidence: sent, status: undefined }, + { evidence: sent, status: 'OBSERVED' }, { status: 'ADVANCING' }, { status: 'ADVANCED' }, { split, status: 'DISBURSED' },