Skip to content

Commit

Permalink
fix: remove unused 'state' arg from makeLiveslots() (#1893)
Browse files Browse the repository at this point in the history
* fix: remove unused 'state' arg from makeLiveslots()
  • Loading branch information
warner authored Oct 21, 2020
1 parent 165205f commit c2f7910
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
7 changes: 2 additions & 5 deletions packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { insistCapData } from '../capdata';
* a new root object and its initial associated object graph, if any.
*
* @param {*} syscall Kernel syscall interface that the vat will have access to
* @param {*} _state Object to store and retrieve state; not used // TODO fix wart
* @param {*} forVatID Vat ID label, for use in debug diagostics
* @param {*} vatPowers
* @param {*} vatParameters
Expand All @@ -34,7 +33,7 @@ import { insistCapData } from '../capdata';
*
* buildRootObject(vatPowers, vatParameters)
*/
function build(syscall, _state, forVatID, vatPowers, vatParameters) {
function build(syscall, forVatID, vatPowers, vatParameters) {
const enableLSDebug = false;
function lsdebug(...args) {
if (enableLSDebug) {
Expand Down Expand Up @@ -568,7 +567,6 @@ function build(syscall, _state, forVatID, vatPowers, vatParameters) {
* a new root object and its initial associated object graph, if any.
*
* @param {*} syscall Kernel syscall interface that the vat will have access to
* @param {*} state Object to store and retrieve state
* @param {*} forVatID Vat ID label, for use in debug diagostics
* @param {*} vatPowers
* @param {*} vatParameters
Expand Down Expand Up @@ -598,13 +596,12 @@ function build(syscall, _state, forVatID, vatPowers, vatParameters) {
*/
export function makeLiveSlots(
syscall,
state,
forVatID = 'unknown',
vatPowers = harden({}),
vatParameters = harden({}),
) {
const allVatPowers = { ...vatPowers, getInterfaceOf, Remotable, makeMarshal };
const r = build(syscall, state, forVatID, allVatPowers, vatParameters);
const r = build(syscall, forVatID, allVatPowers, vatParameters);
const { vatGlobals, dispatch, setBuildRootObject } = r; // omit 'm'
return harden({ vatGlobals, dispatch, setBuildRootObject });
}
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/src/kernel/vatManager/localVatManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ export function makeLocalVatManagerFactory(tools) {
vatParameters,
testLog: allVatPowers.testLog,
});
const state = null; // TODO remove from makeLiveSlots()

let dispatch;
if (typeof vatNS.buildRootObject === 'function') {
const { buildRootObject } = vatNS;
const r = makeLiveSlots(syscall, state, vatID, vatPowers, vatParameters);
const r = makeLiveSlots(syscall, vatID, vatPowers, vatParameters);
r.setBuildRootObject(buildRootObject);
dispatch = r.dispatch;
} else if (enableSetup) {
Expand All @@ -148,6 +147,7 @@ export function makeLocalVatManagerFactory(tools) {
`vat source bundle default export is not a function`,
);
const helpers = harden({}); // DEPRECATED, todo remove from setup()
const state = null; // TODO remove from setup()
dispatch = setup(syscall, state, helpers, vatPowers);
} else {
throw Error(`vat source bundle lacks buildRootObject() function`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ parentPort.on('message', ([type, ...margs]) => {
sendUplink(['testLog', ...args]);
}

const state = null;
const vatID = 'demo-vatID';
// todo: maybe add transformTildot, makeGetMeter/transformMetering to
// vatPowers, but only if options tell us they're wanted. Maybe
Expand All @@ -121,7 +120,7 @@ parentPort.on('message', ([type, ...margs]) => {
makeMarshal,
testLog,
};
const r = makeLiveSlots(syscall, state, vatID, vatPowers, vatParameters);
const r = makeLiveSlots(syscall, vatID, vatPowers, vatParameters);
r.setBuildRootObject(vatNS.buildRootObject);
dispatch = r.dispatch;
workerLog(`got dispatch:`, Object.keys(dispatch).join(','));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ fromParent.on('data', data => {
sendUplink(['testLog', ...args]);
}

const state = null;
const vatID = 'demo-vatID';
// todo: maybe add transformTildot, makeGetMeter/transformMetering to
// vatPowers, but only if options tell us they're wanted. Maybe
Expand All @@ -142,7 +141,7 @@ fromParent.on('data', data => {
makeMarshal,
testLog,
};
const r = makeLiveSlots(syscall, state, vatID, vatPowers, vatParameters);
const r = makeLiveSlots(syscall, vatID, vatPowers, vatParameters);
r.setBuildRootObject(vatNS.buildRootObject);
dispatch = r.dispatch;
workerLog(`got dispatch:`, Object.keys(dispatch).join(','));
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/test/test-liveslots.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function buildSyscall() {
}

function makeDispatch(syscall, build) {
const { setBuildRootObject, dispatch } = makeLiveSlots(syscall, null, 'vatA');
const { setBuildRootObject, dispatch } = makeLiveSlots(syscall, 'vatA');
setBuildRootObject(build);
return dispatch;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/test/test-vpid-liveslots.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function resolutionOf(vpid, mode, targets) {
}

function makeDispatch(syscall, build) {
const { setBuildRootObject, dispatch } = makeLiveSlots(syscall, null, 'vatA');
const { setBuildRootObject, dispatch } = makeLiveSlots(syscall, 'vatA');
setBuildRootObject(build);
return dispatch;
}
Expand Down

0 comments on commit c2f7910

Please sign in to comment.