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 22, 2024
1 parent 01eaba8 commit fadbaf7
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import '@agoric/swingset-vat/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/swingset-vat/src/lib/kmarshal.js';

Expand Down Expand Up @@ -52,6 +54,18 @@ test('zoe vat upgrade trauma', async t => {
const messageObject = (presence, methodName, args) =>
run('messageVatObject', [{ presence, methodName, args }]);

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 @@ -206,9 +220,14 @@ 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 run('upgradeVat', [zoeVatConfig]);
t.is(incarnationNumber, 1, 'Zoe vat must be upgraded');
const { incarnationNumber: zoeIncarnationNumber } = await run('upgradeVat', [
zoeVatConfig,
]);
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 fadbaf7

Please sign in to comment.