Skip to content

Commit

Permalink
Merge pull request #8070 from Agoric/8041-resetLockedQuote
Browse files Browse the repository at this point in the history
fix: reset lockedQuote even when nothing will be auctioned
  • Loading branch information
Chris-Hibbert authored Jul 25, 2023
2 parents ced08aa + c5b4e33 commit 5bd1690
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/inter-protocol/src/vaultFactory/vaultManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ export const prepareVaultManagerKit = (
);

state.lockedQuote = storedCollateralQuote;
facets.helper.writeMetrics();
void facets.helper.writeMetrics();
return storedCollateralQuote;
},
/** @param {ERef<AuctioneerPublicFacet>} auctionPF */
Expand Down Expand Up @@ -1101,6 +1101,7 @@ export const prepareVaultManagerKit = (
state.lockedQuote = undefined;

if (vaultData.getSize() === 0) {
void helper.writeMetrics();
return;
}
trace(
Expand Down Expand Up @@ -1164,7 +1165,7 @@ export const prepareVaultManagerKit = (
liquidatingVaults.delete(vault);
}

await facets.helper.writeMetrics();
void helper.writeMetrics();
},
},
},
Expand Down
27 changes: 24 additions & 3 deletions packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,17 @@ test('liquidate two loans', async t => {
manualTimer,
);

totalDebt += 7n;
totalDebt += 6n;
await aethVaultMetrics.assertChange({
lockedQuote: null,
totalDebt: { value: totalDebt },
});
totalDebt += 1n;
await aethVaultMetrics.assertChange({
lockedQuote: makeRatioFromAmounts(
aeth.make(1_000_000n),
run.make(7_000_000n),
),
totalDebt: { value: totalDebt },
});
totalDebt += 6n;
Expand Down Expand Up @@ -3156,7 +3165,13 @@ test('Bug 7796 missing lockedPrice', async t => {
const penaltyAeth = 309_850n;

await aethVaultMetrics.assertChange({
lockedQuote: { denominator: { value: 9_990_000n } },
lockedQuote: null,
});
await aethVaultMetrics.assertChange({
lockedQuote: makeRatioFromAmounts(
aeth.make(1_000_000n),
run.make(9_990_000n),
),
});
await aethVaultMetrics.assertChange({
liquidatingDebt: { value: totalDebt },
Expand Down Expand Up @@ -3346,7 +3361,13 @@ test('Bug 7851 & no bidders', async t => {
);

await aethVaultMetrics.assertChange({
lockedQuote: { denominator: { value: 9_990_000n } },
lockedQuote: null,
});
await aethVaultMetrics.assertChange({
lockedQuote: makeRatioFromAmounts(
aeth.make(1_000_000n),
run.make(9_990_000n),
),
});
await aethVaultMetrics.assertChange({
liquidatingDebt: { value: aliceDebt },
Expand Down

0 comments on commit 5bd1690

Please sign in to comment.