Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Agoric/agoric-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d87c3709dd29588cd2be443993c6f93cce773991
Choose a base ref
..
head repository: Agoric/agoric-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 90e156cb40cbc8c92282fb12c2646186660a1235
Choose a head ref
Showing with 20 additions and 6 deletions.
  1. +20 −6 packages/SwingSet/src/kernel/kernel.js
26 changes: 20 additions & 6 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
@@ -824,7 +824,10 @@ export default function buildKernel(
const disconnectionCapData = kser(disconnectObject);
/** @type { import('../types-external.js').KernelDeliveryStopVat } */
const stopVatKD = harden(['stopVat', disconnectionCapData]);
const stopVatVD = vatWarehouse.kernelDeliveryToVatDelivery(vatID, stopVatKD);
const stopVatVD = vatWarehouse.kernelDeliveryToVatDelivery(
vatID,
stopVatKD,
);
const stopVatStatus = await deliverAndLogToVat(vatID, stopVatKD, stopVatVD);
const stopVatResults = deliveryCrankResults(vatID, stopVatStatus, false);

@@ -842,7 +845,7 @@ export default function buildKernel(
* @param {SwingSetCapData} _errorCapData
* @returns {RawMethargs}
*/
const makeFailureMethargs = (_errorCapData) => {
const makeFailureMethargs = _errorCapData => {
insistCapData(_errorCapData); // kser(Error)
// const error = kunser(_errorCD)
// actually we shouldn't reveal the details, so instead we do:
@@ -863,7 +866,9 @@ export default function buildKernel(
await vatWarehouse.stopWorker(vatID);

// notify vat-admin of the failed upgrade
const vatAdminMethargs = makeFailureMethargs(stopVatResults.terminate.info);
const vatAdminMethargs = makeFailureMethargs(
stopVatResults.terminate.info,
);

// we still report computrons to the runPolicy
const results = harden({
@@ -910,20 +915,29 @@ export default function buildKernel(
// deliver a startVat with the new vatParameters
/** @type { import('../types-external.js').KernelDeliveryStartVat } */
const startVatKD = harden(['startVat', vatParameters]);
const startVatVD = vatWarehouse.kernelDeliveryToVatDelivery(vatID, startVatKD);
const startVatVD = vatWarehouse.kernelDeliveryToVatDelivery(
vatID,
startVatKD,
);
// decref vatParameters now that translation did incref
for (const kref of vatParameters.slots) {
kernelKeeper.decrementRefCount(kref, 'upgrade-vat-event');
}
const startVatStatus = await deliverAndLogToVat(vatID, startVatKD, startVatVD);
const startVatStatus = await deliverAndLogToVat(
vatID,
startVatKD,
startVatVD,
);
const startVatResults = deliveryCrankResults(vatID, startVatStatus, false);
computrons = addComputrons(computrons, startVatResults.computrons);

if (startVatResults.terminate) {
// unwind just like above
// eslint-disable-next-line @jessie.js/no-nested-await
await vatWarehouse.stopWorker(vatID);
const vatAdminMethargs = makeFailureMethargs(startVatResults.terminate.info);
const vatAdminMethargs = makeFailureMethargs(
startVatResults.terminate.info,
);
const results = harden({
...startVatResults,
computrons,