Expire submitted quotes using latest inventory snapshot
All checks were successful
deploy / deploy (push) Successful in 32s
All checks were successful
deploy / deploy (push) Successful in 32s
Proof: Fixes quote outcome expiry so no-settlement submissions age to not_filled using the latest durable inventory snapshot, even when the last actual inventory movement is older. Assumptions: A later unchanged inventory snapshot after the quote deadline plus settlement grace is valid evidence that no matching settled inventory delta occurred in the repo-owned path. Still fake: Not-filled remains inferred from deadline plus inventory evidence until venue-native terminal outcome events are persisted.
This commit is contained in:
parent
c1a6024358
commit
61ba8f9208
2 changed files with 29 additions and 3 deletions
|
|
@ -37,9 +37,7 @@ export function deriveQuoteOutcomeRecords({
|
|||
inventorySnapshots,
|
||||
activeAssetIds,
|
||||
});
|
||||
const latestInventoryAt = inventoryDeltas.length
|
||||
? inventoryDeltas[inventoryDeltas.length - 1].observed_at
|
||||
: latestSnapshotTimestamp(inventorySnapshots);
|
||||
const latestInventoryAt = latestSnapshotTimestamp(inventorySnapshots);
|
||||
const candidatesByMovement = new Map();
|
||||
const candidatesByQuote = new Map();
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,34 @@ test('submitted quote without settlement becomes not filled only after deadline
|
|||
assert.equal(outcome.attributed_inventory_delta, null);
|
||||
});
|
||||
|
||||
test('older unrelated inventory movement does not block later no-fill expiry', () => {
|
||||
const [outcome] = deriveQuoteOutcomeRecords({
|
||||
submissions: [submittedResult('quote-after-old-move', '2026-04-02T18:20:00.000Z')],
|
||||
commands: [exactOutCommand('quote-after-old-move')],
|
||||
inventorySnapshots: [
|
||||
inventorySnapshot('2026-04-02T18:13:00.000Z', {
|
||||
[BTC.assetId]: '0',
|
||||
[EURE.assetId]: '100000000000000000000',
|
||||
}),
|
||||
inventorySnapshot('2026-04-02T18:13:33.000Z', {
|
||||
[BTC.assetId]: '1',
|
||||
[EURE.assetId]: '99999999999999999999',
|
||||
}),
|
||||
inventorySnapshot('2026-04-02T18:22:00.000Z', {
|
||||
[BTC.assetId]: '1',
|
||||
[EURE.assetId]: '99999999999999999999',
|
||||
}),
|
||||
],
|
||||
btcAsset: BTC,
|
||||
eureAsset: EURE,
|
||||
now: '2026-04-02T18:22:00.000Z',
|
||||
});
|
||||
|
||||
assert.equal(outcome.outcome_status, 'not_filled');
|
||||
assert.equal(outcome.outcome_reason, 'deadline_elapsed_without_settlement');
|
||||
assert.equal(outcome.payload.evidence.latest_inventory_observed_at, '2026-04-02T18:22:00.000Z');
|
||||
});
|
||||
|
||||
test('ambiguous inventory movement is not counted as completed settlement', () => {
|
||||
const outcomes = deriveQuoteOutcomeRecords({
|
||||
submissions: [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue