Skip to content

Commit

Permalink
Merge pull request #3337 from Agoric/3331-remove-stats
Browse files Browse the repository at this point in the history
fix(swingset)!: remove stats from vatAdmin API
  • Loading branch information
warner authored Jun 16, 2021
2 parents 49e4e1b + 8fd3fdd commit 3e06926
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 53 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();
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ test('startInstance', async t => {
creatorFacet,
publicFacet,
instance,
adminFacet,
creatorInvitationDetails,
} = await startInstance(startInstanceConfig);

t.is(addedPetname, 'automaticRefund');
t.truthy(creatorFacet);
t.is(await E(zoe).getPublicFacet(instance), publicFacet);
t.is(creatorInvitationDetails.description, 'getRefund');
t.is(await E(adminFacet).getVatStats(), undefined);
});
1 change: 0 additions & 1 deletion packages/pegasus/test/fakeVatAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default harden({
return makePromiseKit().promise;
},
terminate: () => {},
adminData: () => ({}),
},
});
},
Expand Down
2 changes: 0 additions & 2 deletions packages/zoe/src/internal-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@
* promise will fulfill to the completion value.
* @property {(reason: TerminationReason) => void} terminateWithFailure
* Terminate the vat in which the contract is running as a failure.
* @property {() => Object} adminData
* returns some statistics about the vat in which the contract is running.
*/

/**
Expand Down
1 change: 0 additions & 1 deletion packages/zoe/src/zoeService/startInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ export const makeStartInstance = (
}
const adminFacet = Far('adminFacet', {
getVatShutdownPromise: () => E(adminNode).done(),
getVatStats: () => E(adminNode).adminData(),
});

// Actually returned to the user.
Expand Down
1 change: 0 additions & 1 deletion packages/zoe/src/zoeService/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
/**
* @typedef {Object} AdminFacet
* @property {() => Promise<Completion>} getVatShutdownPromise
* @property {() => any} getVatStats
*/

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/zoe/test/unitTests/test-zoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ test(`zoe.startInstance no issuerKeywordRecord, no terms`, async t => {
isEmptyFacet(t, result.publicFacet);
t.deepEqual(Object.getOwnPropertyNames(result.adminFacet).sort(), [
'getVatShutdownPromise',
'getVatStats',
]);
});

Expand Down Expand Up @@ -108,7 +107,6 @@ test(`zoe.startInstance promise for installation`, async t => {
isEmptyFacet(t, result.publicFacet);
t.deepEqual(Object.getOwnPropertyNames(result.adminFacet).sort(), [
'getVatShutdownPromise',
'getVatStats',
]);
});

Expand Down
1 change: 0 additions & 1 deletion packages/zoe/tools/fakeVatAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
return kit.promise;
},
terminateWithFailure: () => {},
adminData: () => {},
}),
});
},
Expand Down

0 comments on commit 3e06926

Please sign in to comment.