Skip to content

Commit

Permalink
test: demonstrate Zoe's survival through vatAdmmin vat upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Jan 4, 2024
1 parent a834bda commit 8f02172
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import '@agoric/swingset-liveslots/tools/prepare-test-env.js';
import test from 'ava';

import bundleSource from '@endo/bundle-source';
import { buildVatController } from '@agoric/swingset-vat';
import { kunser } from '@agoric/kmarshal';

Expand Down Expand Up @@ -53,6 +55,18 @@ test('zoe vat upgrade trauma', async t => {
return awaitRun(kpid);
};

const restartVatAdminVat = async controller => {
const vaBundle = await bundleSource(
new URL(
'../../../../SwingSet/src/vats/vat-admin/vat-vat-admin.js',
import.meta.url,
).pathname,
);
const bundleID = await controller.validateAndInstallBundle(vaBundle);
controller.upgradeStaticVat('vatAdmin', true, bundleID, {});
await controller.run();
};

/**
* @see {@link ../upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js}
*/
Expand Down Expand Up @@ -227,13 +241,16 @@ test('zoe vat upgrade trauma', async t => {
pausedFlows.push({ result, remainingSteps: flow.slice(i) });
}

// Null-upgrade vatAdmin.
await restartVatAdminVat(c);

// Null-upgrade Zoe.
const { incarnationNumber } = await messageToVat(
const { incarnationNumber: zoeIncarnationNumber } = await messageToVat(
'bootstrap',
'upgradeVat',
zoeVatConfig,
);
t.is(incarnationNumber, 1, 'Zoe vat must be upgraded');
t.is(zoeIncarnationNumber, 1, 'Zoe vat must be upgraded');

// Verify a complete run in the new Zoe.
await doSteps('post-upgrade', flow);
Expand Down

0 comments on commit 8f02172

Please sign in to comment.