Skip to content

Commit

Permalink
fix: require virtual object selves to be declared Far
Browse files Browse the repository at this point in the history
Fixes bug #3562
  • Loading branch information
FUDCo committed Jul 30, 2021
1 parent 9506ddb commit 6bb337b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/SwingSet/src/kernel/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { assert, details as X, quote as q } from '@agoric/assert';
import { Nat } from '@agoric/nat';
import { getInterfaceOf } from '@agoric/marshal';
import { parseVatSlot } from '../parseVatSlots.js';
// import { kdebug } from './kdebug.js';

Expand Down Expand Up @@ -755,6 +756,10 @@ export function makeVirtualObjectManager(
init(...args);
}
innerSelf.representative = initialRepresentative;
assert(
getInterfaceOf(initialRepresentative),
`self must be declared Far`,
);
registerEntry(vobjID, initialRepresentative);
initializationsInProgress.delete(initialData);
const rawData = {};
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/test/virtualObjects/vat-vom-gc-bob.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export function buildRootObject(_vatPowers) {
init(label) {
state.label = label;
},
self: {
self: Far('thing', {
getLabel() {
return state.label;
},
},
}),
};
}

Expand Down

0 comments on commit 6bb337b

Please sign in to comment.