Skip to content

Commit

Permalink
fixup! feat(fast-usdc): skipAdvance when preconditions fail
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Feb 14, 2025
1 parent 1a632b7 commit 8d1e131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/fast-usdc/src/exos/advancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const prepareAdvancerKit = (
});
} catch (error) {
log('Advancer error:', error);
statusManager.skipAdvance(evidence, ['PRECONDITIONS_FAILED']);
statusManager.skipAdvance(evidence, [error.message]);
}
},
/** @param {ChainAddress} intermediateRecipient */
Expand Down
17 changes: 14 additions & 3 deletions packages/fast-usdc/test/exos/advancer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ test('updates status to ADVANCE_SKIPPED on insufficient pool funds', async t =>
storage.getDeserialized(`fun.txns.${evidence.txHash}`),
[
{ evidence, status: PendingTxStatus.Observed },
{ risksIdentified: ['PRECONDITIONS_FAILED'], status: 'ADVANCE_SKIPPED' },
{
risksIdentified: [
'Cannot borrow. Requested {"brand":"[Alleged: USDC brand]","value":"[293999999n]"} must be less than pool balance {"brand":"[Alleged: USDC brand]","value":"[1n]"}.',
],
status: 'ADVANCE_SKIPPED',
},
],
'ADVANCE_SKIPPED status on insufficient pool funds',
);
Expand Down Expand Up @@ -345,7 +350,10 @@ test('updates status to ADVANCE_SKIPPED if makeChainAddress fails', async t => {
storage.getDeserialized(`fun.txns.${evidence.txHash}`),
[
{ evidence, status: PendingTxStatus.Observed },
{ risksIdentified: ['PRECONDITIONS_FAILED'], status: 'ADVANCE_SKIPPED' },
{
risksIdentified: ['Chain info not found for bech32Prefix "random"'],
status: 'ADVANCE_SKIPPED',
},
],
'ADVANCE_SKIPPED status on makeChainAddress failure',
);
Expand Down Expand Up @@ -555,7 +563,10 @@ test('updates status to ADVANCE_SKIPPED if pre-condition checks fail', async t =
storage.getDeserialized(`fun.txns.${evidence.txHash}`),
[
{ evidence, status: PendingTxStatus.Observed },
{ risksIdentified: ['PRECONDITIONS_FAILED'], status: 'ADVANCE_SKIPPED' },
{
risksIdentified: ['query: {} - Must have missing properties ["EUD"]'],
status: 'ADVANCE_SKIPPED',
},
],
'tx is recorded as ADVANCE_SKIPPED',
);
Expand Down

0 comments on commit 8d1e131

Please sign in to comment.