Skip to content

Commit

Permalink
fix(swingset)!: remove stats from vatAdmin API
Browse files Browse the repository at this point in the history
The "Admin Node" returned by `vatAdmin~.createVatDynamically()` had a method
named `adminData()`, which returned some statistics like the number of
objects imported into the vat. This wasn't super-useful and exposes a little
too much information about the kernel's internals, especially as GC starts to
get more interesting. So we've decided to remove this API.

closes #3331
  • Loading branch information
warner committed Jun 16, 2021
1 parent da4991d commit bc053ef
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 43 deletions.
7 changes: 0 additions & 7 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,6 @@ export default function buildKernel(
});
}

function collectVatStats(vatID) {
insistVatID(vatID);
const vatKeeper = kernelKeeper.provideVatKeeper(vatID);
return vatKeeper.vatStats();
}

async function start() {
if (started) {
throw Error('kernel.start already called');
Expand All @@ -891,7 +885,6 @@ export default function buildKernel(
// later when it is created and a root object is available
return vatID;
},
stats: collectVatStats,
terminate: (vatID, reason) => terminateVat(vatID, true, reason),
};

Expand Down
11 changes: 1 addition & 10 deletions packages/SwingSet/src/kernel/vatAdmin/vatAdmin-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
import { Far } from '@agoric/marshal';

export function buildRootDeviceNode({ endowments, serialize }) {
const {
pushCreateVatEvent,
stats: kernelVatStatsFn,
terminate: kernelTerminateVatFn,
} = endowments;
const { pushCreateVatEvent, terminate: kernelTerminateVatFn } = endowments;

// The Root Device Node.
return Far('root', {
Expand All @@ -42,10 +38,5 @@ export function buildRootDeviceNode({ endowments, serialize }) {
terminateWithFailure(vatID, reason) {
kernelTerminateVatFn(vatID, serialize(reason));
},
// Call the registered kernel function to request vat stats. Clean up the
// outgoing and incoming arguments.
adminStats(vatID) {
return kernelVatStatsFn(`${vatID}`);
},
});
}
3 changes: 0 additions & 3 deletions packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export function buildRootObject(vatPowers) {
terminateWithFailure(reason) {
D(vatAdminNode).terminateWithFailure(vatID, reason);
},
adminData() {
return D(vatAdminNode).adminStats(vatID);
},
done() {
return doneP;
},
Expand Down
11 changes: 0 additions & 11 deletions packages/SwingSet/test/vat-admin/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ export function buildRootObject(vatPowers, vatParameters) {
);
return;
}
case 'vatStats': {
log(`starting stats test`);
const { root, adminNode } = await E(vatAdminSvc).createVat(
bundles.newVatBundle,
);
log(await E(adminNode).adminData());
const c = E(root).createRcvr(1);
log(await E(c).increment(3));
log(await E(adminNode).adminData());
return;
}
default:
assert.fail(X`unknown argv mode '${argv[0]}'`);
}
Expand Down
12 changes: 0 additions & 12 deletions packages/SwingSet/test/vat-admin/test-innerVat.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,3 @@ test('error creating vat from non-bundle', async t => {
]);
await c.run();
});

test('VatAdmin get vat stats', async t => {
const c = await doTestSetup(t, 'vatStats');
await c.run();
t.deepEqual(c.dump().log, [
'starting stats test',
'{"deviceCount":0,"objectCount":0,"promiseCount":0,"transcriptCount":0}',
'4',
'{"deviceCount":0,"objectCount":0,"promiseCount":2,"transcriptCount":2}',
]);
await c.run();
});

0 comments on commit bc053ef

Please sign in to comment.