From 88ef23dd3ea62d0056fd476d333346b6b884f574 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Mon, 20 Mar 2023 19:00:18 -0500 Subject: [PATCH 1/2] fix(action): handle missing Collateral allocation ``` 2023-03-20T23:18:07.574Z SwingSet: ls: v40: Error: "leftAmount" (an undefined) must be a pass-by-copy record, not "undefined" at construct () at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56) at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:242) at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:370) at assertRecord (.../marshal/src/typeGuards.js:70) at checkLRAndGetHelpers (.../ertp/src/amountMath.js:145) at isGTE (.../ertp/src/amountMath.js:190) at settleAtNewRate (.../inter-protocol/src/auction/auctionBook.js:356) ``` test --- packages/inter-protocol/test/auction/test-auctionContract.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/inter-protocol/test/auction/test-auctionContract.js b/packages/inter-protocol/test/auction/test-auctionContract.js index 21dab6eec00..a0625c30c82 100644 --- a/packages/inter-protocol/test/auction/test-auctionContract.js +++ b/packages/inter-protocol/test/auction/test-auctionContract.js @@ -873,6 +873,9 @@ test.serial('multiple bidders at one auction step', async t => { collateral.make(200n), ); + // regression test for getCurrentAllocation() bug + await driver.bidForCollateralSeat(currency.make(210n), collateral.make(200n)); + assert(nextAuctionSchedule.startTime.absValue); now = nextAuctionSchedule.startTime.absValue; await driver.advanceTo(now); From 479103e0fcdf46325b3733abc0bd741c44536d6b Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Mon, 20 Mar 2023 18:56:52 -0500 Subject: [PATCH 2/2] docs(auction): types for prepareAuctionHook the `any` type for `zcf` cascaded to the rest of the function --- packages/inter-protocol/src/auction/auctionBook.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index d4ca9b32e8d..3bfe114d35b 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -85,6 +85,10 @@ export const makeBidSpecShape = (currencyBrand, collateralBrand) => { /** @typedef {import('@agoric/vat-data').Baggage} Baggage */ +/** + * @param {Baggage} baggage + * @param {ZCF} zcf + */ export const prepareAuctionBook = (baggage, zcf) => { const makeScaledBidBook = prepareScaledBidBook(baggage); const makePriceBook = preparePriceBook(baggage);