diff --git a/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js b/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js
index 73b92ad3761..3eeca6456d4 100644
--- a/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js
+++ b/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js
@@ -15,7 +15,7 @@ export function buildRootObject(vatPowers, vatParameters) {
return E(aliceP).testBasicFunctionality();
}
- const obj0 = {
+ const obj0 = Far('root', {
async bootstrap(vats) {
switch (arg0) {
case 'basicFunctionality': {
@@ -27,6 +27,6 @@ export function buildRootObject(vatPowers, vatParameters) {
}
}
},
- };
- return Far('root', obj0);
+ });
+ return obj0;
}
diff --git a/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js b/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js
index 8fbdfee7f6f..f25a47ac384 100644
--- a/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js
+++ b/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js
@@ -17,7 +17,7 @@ export function buildRootObject(vatPowers, vatParameters) {
return E(aliceP).testSplitPayments();
}
- const obj0 = {
+ const obj0 = Far('root', {
async bootstrap(vats) {
switch (arg0) {
case 'splitPayments': {
@@ -29,6 +29,6 @@ export function buildRootObject(vatPowers, vatParameters) {
}
}
},
- };
- return Far('root', obj0);
+ });
+ return obj0;
}
diff --git a/packages/SwingSet/src/kernel/liveSlots.js b/packages/SwingSet/src/kernel/liveSlots.js
index 0f45c5ac31f..5ca1151cc57 100644
--- a/packages/SwingSet/src/kernel/liveSlots.js
+++ b/packages/SwingSet/src/kernel/liveSlots.js
@@ -267,14 +267,18 @@ function build(
},
};
- let presence;
+ let remotePresence;
const p = new HandledPromise((_res, _rej, resolveWithPresence) => {
- const remote = resolveWithPresence(fulfilledHandler);
- presence = Remotable(iface, undefined, remote);
+ // Use Remotable rather than Far to make a remote from a presence
+ remotePresence = Remotable(
+ iface,
+ undefined,
+ resolveWithPresence(fulfilledHandler),
+ );
// remote === presence, actually
- // todo: mfig says to swap remote and presence (resolveWithPresence
- // gives us a Presence, Remotable gives us a Remote). I think that
+ // todo: mfig says resolveWithPresence
+ // gives us a Presence, Remotable gives us a Remote. I think that
// implies we have a lot of renaming to do, 'makeRemote' instead of
// 'makeImportedPresence', etc. I'd like to defer that for a later
// cleanup/renaming pass.
@@ -297,7 +301,7 @@ function build(
// p.eventualSend('foo', [args]), which uses the fulfilledHandler.
// We harden the presence for the same safety reasons.
- return harden(presence);
+ return harden(remotePresence);
}
function makePipelinablePromise(vpid) {
diff --git a/packages/SwingSet/src/vats/plugin-manager.js b/packages/SwingSet/src/vats/plugin-manager.js
index 2244bf6c931..608b0313932 100644
--- a/packages/SwingSet/src/vats/plugin-manager.js
+++ b/packages/SwingSet/src/vats/plugin-manager.js
@@ -4,7 +4,7 @@ import { makeStore } from '@agoric/store';
import { makeCapTP } from '@agoric/captp';
import { makePromiseKit } from '@agoric/promise-kit';
import { E, HandledPromise } from '@agoric/eventual-send';
-import { Far } from '@agoric/marshal';
+import { Remotable, Far } from '@agoric/marshal';
import '@agoric/store/exported.js';
@@ -173,7 +173,8 @@ export function makePluginManager(pluginDevice, { D, ...vatPowers }) {
const actions = Far('actions', {
/**
- * Create a stable identity that just forwards to the current implementation.
+ * Create a stable identity that just forwards to the current
+ * implementation.
*
* @type {MakeStableForwarder}
*/
@@ -181,20 +182,25 @@ export function makePluginManager(pluginDevice, { D, ...vatPowers }) {
let pr;
// eslint-disable-next-line no-new
new HandledPromise((_resolve, _reject, resolveWithPresence) => {
- pr = resolveWithPresence({
- applyMethod(_p, name, args) {
- // console.warn('applying method epoch', currentEpoch);
- const targetP = E(walker).walk(pluginRootPK.promise);
- return HandledPromise.applyMethod(targetP, name, args);
- },
- get(_p, name) {
- // console.warn('applying get epoch', currentEpoch);
- const targetP = E(walker).walk(pluginRootPK.promise);
- return HandledPromise.get(targetP, name);
- },
- });
+ // Use Remotable rather than Far to make a remote from a presence
+ pr = Remotable(
+ 'Alleged: stableForwarder',
+ undefined,
+ resolveWithPresence({
+ applyMethod(_p, name, args) {
+ // console.warn('applying method epoch', currentEpoch);
+ const targetP = E(walker).walk(pluginRootPK.promise);
+ return HandledPromise.applyMethod(targetP, name, args);
+ },
+ get(_p, name) {
+ // console.warn('applying get epoch', currentEpoch);
+ const targetP = E(walker).walk(pluginRootPK.promise);
+ return HandledPromise.get(targetP, name);
+ },
+ }),
+ );
});
- return Far('stableForwarder', pr);
+ return pr;
},
});
diff --git a/packages/SwingSet/src/vats/vat-timerWrapper.js b/packages/SwingSet/src/vats/vat-timerWrapper.js
index 161aa668355..00faa15a923 100644
--- a/packages/SwingSet/src/vats/vat-timerWrapper.js
+++ b/packages/SwingSet/src/vats/vat-timerWrapper.js
@@ -9,7 +9,7 @@ export function buildRootObject(vatPowers) {
async function createTimerService(timerNode) {
/** @type {TimerService} */
- const timerService = {
+ const timerService = Far('timerService', {
getCurrentTimestamp() {
return Nat(D(timerNode).getLastPolled());
},
@@ -23,7 +23,7 @@ export function buildRootObject(vatPowers) {
// deprecated in favor of makeRepeater().
// TODO(#2164): remove before Beta
createRepeater(delaySecs, interval) {
- return this.makeRepeater(delaySecs, interval);
+ return timerService.makeRepeater(delaySecs, interval);
},
makeRepeater(delaySecs, interval) {
Nat(delaySecs);
@@ -62,8 +62,8 @@ export function buildRootObject(vatPowers) {
return notifier;
},
- };
- return Far('timerService', timerService);
+ });
+ return timerService;
}
return Far('root', { createTimerService });
diff --git a/packages/SwingSet/test/basedir-controller-3/vat-right.js b/packages/SwingSet/test/basedir-controller-3/vat-right.js
index 197855ec3c6..7d935d1c217 100644
--- a/packages/SwingSet/test/basedir-controller-3/vat-right.js
+++ b/packages/SwingSet/test/basedir-controller-3/vat-right.js
@@ -1,11 +1,11 @@
import { Far } from '@agoric/marshal';
export function buildRootObject(vatPowers) {
- const obj0 = {
+ const obj0 = Far('root', {
bar(arg2, self) {
vatPowers.testLog(`right.obj0.bar ${arg2} ${self === obj0}`);
return 3;
},
- };
- return Far('root', obj0);
+ });
+ return obj0;
}
diff --git a/packages/SwingSet/test/basedir-message-patterns/vat-a.js b/packages/SwingSet/test/basedir-message-patterns/vat-a.js
index 62e4607cd4a..1382d49eb3e 100644
--- a/packages/SwingSet/test/basedir-message-patterns/vat-a.js
+++ b/packages/SwingSet/test/basedir-message-patterns/vat-a.js
@@ -8,7 +8,7 @@ export function buildRootObject(vatPowers) {
const root = Far('root', {
init(bob, bert, carol) {
const { setA, setB, setC, objA } = buildPatterns(vatPowers.testLog);
- alice = Far('alice', objA);
+ alice = objA;
const a = harden({ alice, amy });
setA(a);
setB(harden({ bob, bert }));
diff --git a/packages/SwingSet/test/basedir-message-patterns/vat-b.js b/packages/SwingSet/test/basedir-message-patterns/vat-b.js
index 99455aec973..bd71e4da6ef 100644
--- a/packages/SwingSet/test/basedir-message-patterns/vat-b.js
+++ b/packages/SwingSet/test/basedir-message-patterns/vat-b.js
@@ -18,7 +18,7 @@ export function buildRootObject(vatPowers) {
const root = Far('root', {
init() {
const { setB, objB } = buildPatterns(vatPowers.testLog);
- const bob = Far('bob', objB);
+ const bob = objB;
const b = harden({ bob, bert, bill });
setB(b);
return harden({ bob, bert });
diff --git a/packages/SwingSet/test/basedir-message-patterns/vat-c.js b/packages/SwingSet/test/basedir-message-patterns/vat-c.js
index a778ba47fa0..726c92a794f 100644
--- a/packages/SwingSet/test/basedir-message-patterns/vat-c.js
+++ b/packages/SwingSet/test/basedir-message-patterns/vat-c.js
@@ -5,7 +5,7 @@ export function buildRootObject(vatPowers) {
const root = Far('root', {
init() {
const { setC, objC } = buildPatterns(vatPowers.testLog);
- const carol = Far('carol', objC);
+ const carol = objC;
const c = harden({ carol });
setC(c);
return harden({ carol });
diff --git a/packages/SwingSet/test/basedir-promises/vat-left.js b/packages/SwingSet/test/basedir-promises/vat-left.js
index 554e6bd440a..9a2cb366fc0 100644
--- a/packages/SwingSet/test/basedir-promises/vat-left.js
+++ b/packages/SwingSet/test/basedir-promises/vat-left.js
@@ -3,7 +3,7 @@ import { Far } from '@agoric/marshal';
export function buildRootObject(vatPowers) {
const log = vatPowers.testLog;
- const obj0 = {
+ const obj0 = Far('root', {
callRight(arg1, right) {
log(`left.callRight ${arg1}`);
E(right)
@@ -44,6 +44,6 @@ export function buildRootObject(vatPowers) {
}),
);
},
- };
- return Far('root', obj0);
+ });
+ return obj0;
}
diff --git a/packages/SwingSet/test/message-patterns.js b/packages/SwingSet/test/message-patterns.js
index 84c794486d4..b71cb106507 100644
--- a/packages/SwingSet/test/message-patterns.js
+++ b/packages/SwingSet/test/message-patterns.js
@@ -73,9 +73,9 @@ export function buildPatterns(log) {
}
const patterns = new Map();
- const objA = { toString: () => 'obj-alice' };
- const objB = { toString: () => 'obj-bob' };
- const objC = { toString: () => 'obj-carol' };
+ let objA = { toString: () => 'obj-alice' };
+ let objB = { toString: () => 'obj-bob' };
+ let objC = { toString: () => 'obj-carol' };
const out = {};
const outPipelined = {};
@@ -948,16 +948,16 @@ export function buildPatterns(log) {
}
out.a100 = ['true', 'true'];
+ objA = Far('alice', objA);
+ objB = Far('bob', objB);
+ objC = Far('carol', objC);
+
// TODO: kernel-allocated promise, either comms or kernel resolves it,
// comms needs to send into kernel again
// TODO: vat-allocated promise, either comms or kernel resolves it, comms
// needs to send into kernel again
-
- // note: we don't harden() this return value because certain callers
- // (vat-a/b/c.js) need to Far() the objA/B/C pieces (which isn't convenient
- // to do here), and you can't Far() something that's already hardened.
- return {
+ return harden({
setA,
setB,
setC,
@@ -967,5 +967,5 @@ export function buildPatterns(log) {
objC,
expected: out,
expected_pipelined: outPipelined,
- };
+ });
}
diff --git a/packages/SwingSet/test/test-network.js b/packages/SwingSet/test/test-network.js
index 65a12fbb1d7..78b92886602 100644
--- a/packages/SwingSet/test/test-network.js
+++ b/packages/SwingSet/test/test-network.js
@@ -173,7 +173,7 @@ test('protocol connection listen', async t => {
const connectionHandler = makeEchoConnectionHandler();
await port2.connect(
'/net/ordered/ordered/some-portname',
- harden({
+ Far('connectionHandlerWithOpen', {
...connectionHandler,
async onOpen(connection, localAddr, remoteAddr, c) {
if (connectionHandler.onOpen) {
diff --git a/packages/captp/src/captp.js b/packages/captp/src/captp.js
index 9bfd68a6cd6..eeee3c3f7ae 100644
--- a/packages/captp/src/captp.js
+++ b/packages/captp/src/captp.js
@@ -319,12 +319,12 @@ export const makeCapTP = (
// Make a new handled promise for the slot.
const pr = makeRemoteKit(slot);
if (slot[0] === 'o' || slot[0] === 't') {
- // A new remote presence
- const pres = pr.resPres();
if (iface === undefined) {
iface = `Alleged: Presence ${ourId} ${slot}`;
}
- val = Remotable(iface, undefined, pres);
+ // A new remote presence
+ // Use Remotable rather than Far to make a remote from a presence
+ val = Remotable(iface, undefined, pr.resPres());
} else {
// A new promise
imports.set(Number(slot.slice(2)), pr);
diff --git a/packages/governance/src/committeeRegistrar.js b/packages/governance/src/committeeRegistrar.js
index 1ed7eb66bf6..c6d1309dfcf 100644
--- a/packages/governance/src/committeeRegistrar.js
+++ b/packages/governance/src/committeeRegistrar.js
@@ -26,7 +26,7 @@ const start = zcf => {
};
const makeCommitteeVoterInvitation = index => {
- const handler = voterSeat => {
+ const handler = Far('handler', voterSeat => {
return Far(`voter${index}`, {
castBallot: ballotp => {
E.when(ballotp, ballot => {
@@ -41,7 +41,7 @@ const start = zcf => {
return E(voter).submitVote(voterSeat, ballot);
},
});
- };
+ });
return zcf.makeInvitation(handler, `Voter${index}`);
};
diff --git a/packages/notifier/src/asyncIterableAdaptor.js b/packages/notifier/src/asyncIterableAdaptor.js
index 58a34a991af..56aab947a5b 100644
--- a/packages/notifier/src/asyncIterableAdaptor.js
+++ b/packages/notifier/src/asyncIterableAdaptor.js
@@ -3,6 +3,7 @@
///
import { E } from '@agoric/eventual-send';
+import { Far } from '@agoric/marshal';
import './types.js';
@@ -36,13 +37,13 @@ import './types.js';
* @returns {AsyncIterable}
*/
export const makeAsyncIterableFromNotifier = notifierP => {
- return harden({
+ return Far('asyncIterableFromNotifier', {
[Symbol.asyncIterator]: () => {
/** @type {UpdateCount} */
let localUpdateCount;
/** @type {Promise<{value: T, done: boolean}> | undefined} */
let myIterationResultP;
- return harden({
+ return Far('asyncIteratorFromNotifier', {
next: () => {
if (!myIterationResultP) {
// In this adaptor, once `next()` is called and returns an
diff --git a/packages/notifier/src/notifier.js b/packages/notifier/src/notifier.js
index 45efc76be35..21acd0c300e 100644
--- a/packages/notifier/src/notifier.js
+++ b/packages/notifier/src/notifier.js
@@ -20,7 +20,7 @@ import './types.js';
export const makeNotifier = baseNotifierP => {
const asyncIterable = makeAsyncIterableFromNotifier(baseNotifierP);
- return harden({
+ return Far('notifier', {
...asyncIterable,
getSharableNotifierInternals: () => baseNotifierP,
});
@@ -55,7 +55,7 @@ export const makeNotifierKit = (...args) => {
const final = () => currentUpdateCount === undefined;
- const baseNotifier = harden({
+ const baseNotifier = Far('baseNotifier', {
// NaN matches nothing
getUpdateSince(updateCount = NaN) {
if (
diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js
index d85ea5a1b3e..269127b3006 100644
--- a/packages/pegasus/src/pegasus.js
+++ b/packages/pegasus/src/pegasus.js
@@ -326,7 +326,7 @@ const makePegasus = (zcf, board, namesByAddress) => {
* @type {Set}
*/
const pegs = new Set();
- return {
+ return Far('pegConnectionHandler', {
async onOpen(c) {
// Register C with the table of Peg receivers.
connectionToLocalDenomState.init(c, {
@@ -362,7 +362,7 @@ const makePegasus = (zcf, board, namesByAddress) => {
}
updater.updateState([...pegToConnection.keys()]);
},
- };
+ });
},
/**
* Peg a remote asset over a network connection.
diff --git a/packages/pegasus/test/test-peg.js b/packages/pegasus/test/test-peg.js
index fab5886e99b..76ef239c911 100644
--- a/packages/pegasus/test/test-peg.js
+++ b/packages/pegasus/test/test-peg.js
@@ -29,7 +29,7 @@ async function testRemotePeg(t) {
* @type {import('@agoric/ertp').DepositFacet?}
*/
let localDepositFacet;
- const fakeBoard = harden({
+ const fakeBoard = Far('fakeBoard', {
getValue(id) {
if (id === '0x1234') {
return localDepositFacet;
@@ -38,7 +38,7 @@ async function testRemotePeg(t) {
throw Error(`unrecognized board id ${id}`);
},
});
- const fakeNamesByAddress = harden({
+ const fakeNamesByAddress = Far('fakeNamesByAddress', {
lookup(...keys) {
t.is(keys[0], 'agoric1234567', 'unrecognized fakeNamesByAddress');
t.is(keys[1], 'depositFacet', 'lookup not for the depositFacet');
diff --git a/packages/solo/src/web.js b/packages/solo/src/web.js
index 4ae601c2323..01dea34d1bb 100644
--- a/packages/solo/src/web.js
+++ b/packages/solo/src/web.js
@@ -208,15 +208,6 @@ export async function makeHTTPListener(basedir, port, host, rawInboundCommand) {
server.listen(port, host, () => log.info('Listening on', `${host}:${port}`));
- const wsActions = {
- noop() {
- // do nothing.
- },
- heartbeat() {
- this.isAlive = true;
- },
- };
-
const pingInterval = setInterval(function ping() {
wss.clients.forEach(ws => {
if (!ws.isAlive) {
@@ -224,7 +215,7 @@ export async function makeHTTPListener(basedir, port, host, rawInboundCommand) {
return;
}
ws.isAlive = false;
- ws.ping(wsActions.noop);
+ ws.ping(() => {});
});
}, 30000);
@@ -242,7 +233,9 @@ export async function makeHTTPListener(basedir, port, host, rawInboundCommand) {
// Manage connection pings.
ws.isAlive = true;
- ws.on('pong', wsActions.heartbeat);
+ ws.on('pong', () => {
+ ws.isAlive = true;
+ });
// Register the point-to-point channel.
channels.set(channelID, ws);
diff --git a/packages/swingset-runner/demo/zoeTests/bootstrap.js b/packages/swingset-runner/demo/zoeTests/bootstrap.js
index 7fcda6ac602..d2c0ace502c 100644
--- a/packages/swingset-runner/demo/zoeTests/bootstrap.js
+++ b/packages/swingset-runner/demo/zoeTests/bootstrap.js
@@ -93,7 +93,7 @@ const makeVats = (log, vats, zoe, installations, startingValues) => {
};
export function buildRootObject(_vatPowers, vatParameters) {
- const obj0 = {
+ const obj0 = Far('root', {
async bootstrap(vats, devices) {
const vatAdminSvc = await E(vats.vatAdmin).createVatAdminService(
devices.vatAdmin,
@@ -140,6 +140,6 @@ export function buildRootObject(_vatPowers, vatParameters) {
);
await E(aliceP).startTest(testName, bobP, carolP, daveP);
},
- };
- return Far('root', obj0);
+ });
+ return obj0;
}
diff --git a/packages/vats/src/nameHub.js b/packages/vats/src/nameHub.js
index 0ba8fb1a5af..5f438701d48 100644
--- a/packages/vats/src/nameHub.js
+++ b/packages/vats/src/nameHub.js
@@ -18,7 +18,7 @@ export const makeNameHubKit = () => {
const keyToRecord = makeLegacyMap('nameKey');
/** @type {NameHub} */
- const nameHub = {
+ const nameHub = Far('nameHub', {
async lookup(...path) {
if (path.length === 0) {
return nameHub;
@@ -43,10 +43,10 @@ export const makeNameHubKit = () => {
keys() {
return keyToRecord.keys();
},
- };
+ });
/** @type {NameAdmin} */
- const nameAdmin = {
+ const nameAdmin = Far('nameAdmin', {
reserve(key) {
assert.typeof(key, 'string');
if (keyToRecord.has(key)) {
@@ -85,13 +85,11 @@ export const makeNameHubKit = () => {
// This delete may throw. Reflect it to callers.
keyToRecord.delete(key);
},
- };
+ });
- const nameHubKit = {
- nameHub: Far('nameHub', nameHub),
- nameAdmin: Far('nameAdmin', nameAdmin),
- };
-
- harden(nameHubKit);
+ const nameHubKit = harden({
+ nameHub,
+ nameAdmin,
+ });
return nameHubKit;
};
diff --git a/packages/vats/src/virtual-purse.js b/packages/vats/src/virtual-purse.js
index a228cf58fad..01b58bd8f06 100644
--- a/packages/vats/src/virtual-purse.js
+++ b/packages/vats/src/virtual-purse.js
@@ -96,7 +96,7 @@ function makeVirtualPurse(vpc, kit) {
}).catch(fail);
/** @type {EOnly} */
- const depositFacet = {
+ const depositFacet = Far('Virtual Deposit Facet', {
async receive(payment, optAmount = undefined) {
if (isPromise(payment)) {
throw TypeError(
@@ -116,11 +116,10 @@ function makeVirtualPurse(vpc, kit) {
.pushAmount(amt)
.then(_ => amt);
},
- };
- Far('Virtual Deposit Facet', depositFacet);
+ });
/** @type {EOnly} */
- const purse = {
+ const purse = Far('Virtual Purse', {
deposit: depositFacet.receive,
getAllegedBrand() {
return brand;
@@ -149,8 +148,8 @@ function makeVirtualPurse(vpc, kit) {
});
return pmt;
},
- };
- return Far('Virtual Purse', purse);
+ });
+ return purse;
}
harden(makeVirtualPurse);
diff --git a/packages/zoe/src/contractFacet/zcfZygote.js b/packages/zoe/src/contractFacet/zcfZygote.js
index 20829c1eecb..22c0ee6e910 100644
--- a/packages/zoe/src/contractFacet/zcfZygote.js
+++ b/packages/zoe/src/contractFacet/zcfZygote.js
@@ -2,7 +2,7 @@
import { assert, details as X, makeAssert } from '@agoric/assert';
import { E } from '@agoric/eventual-send';
-import { Far } from '@agoric/marshal';
+import { Far, Remotable } from '@agoric/marshal';
import { AssetKind, AmountMath } from '@agoric/ertp';
import { makeNotifierKit, observeNotifier } from '@agoric/notifier';
import { makePromiseKit } from '@agoric/promise-kit';
@@ -212,7 +212,10 @@ export const makeZCFZygote = (
};
/** @type {ContractFacet} */
- const zcf = Far('zcf', {
+ const zcf = Remotable('Alleged: zcf', undefined, {
+ // Using Remotable rather than Far because too many complications
+ // imposing checking wrappers: makeInvitation and setJig want to
+ // accept raw functions. assert cannot be a valid passable!
reallocate,
assertUniqueKeyword,
saveIssuer: async (issuerP, keyword) => {
@@ -226,7 +229,7 @@ export const makeZCFZygote = (
return record;
},
makeInvitation: (
- offerHandler = () => {},
+ offerHandler = Far('default offer handler', () => {}),
description,
customProperties = harden({}),
relativeFee = undefined,
diff --git a/packages/zoe/src/contracts/oracle.js b/packages/zoe/src/contracts/oracle.js
index ce66c675d63..8653d1cc2f6 100644
--- a/packages/zoe/src/contracts/oracle.js
+++ b/packages/zoe/src/contracts/oracle.js
@@ -27,7 +27,7 @@ const start = async zcf => {
const { zcfSeat: feeSeat } = zcf.makeEmptySeatKit();
/** @type {OracleCreatorFacet} */
- const realCreatorFacet = {
+ const realCreatorFacet = Far('realCreatorFacet', {
makeWithdrawInvitation(total = false) {
return zcf.makeInvitation(seat => {
const gains = total
@@ -52,7 +52,7 @@ const start = async zcf => {
};
return zcf.makeInvitation(shutdown, 'shutdown');
},
- };
+ });
const creatorFacet = Far('creatorFacet', {
initialize(privateParams) {
diff --git a/packages/zoe/src/contracts/priceAggregator.js b/packages/zoe/src/contracts/priceAggregator.js
index 8b46a849a51..0039205cee6 100644
--- a/packages/zoe/src/contracts/priceAggregator.js
+++ b/packages/zoe/src/contracts/priceAggregator.js
@@ -79,7 +79,7 @@ const start = async zcf => {
// Wake every POLL_INTERVAL and run the queriers.
const repeaterP = E(timer).makeRepeater(0n, POLL_INTERVAL);
/** @type {TimerWaker} */
- const waker = {
+ const waker = Far('waker', {
async wake(timestamp) {
// Run all the queriers.
const querierPs = [];
@@ -90,7 +90,7 @@ const start = async zcf => {
});
await Promise.all(querierPs);
},
- };
+ });
E(repeaterP).schedule(waker);
/**
diff --git a/packages/zoe/test/autoswapJig.js b/packages/zoe/test/autoswapJig.js
index 79324117a7e..96ae96377e5 100644
--- a/packages/zoe/test/autoswapJig.js
+++ b/packages/zoe/test/autoswapJig.js
@@ -1,7 +1,7 @@
// @ts-check
import { E } from '@agoric/eventual-send';
-import { Far } from '@agoric/marshal';
+import { Remotable } from '@agoric/marshal';
import { AmountMath } from '@agoric/ertp';
import { natSafeMath } from '../src/contractSupport/index.js';
@@ -124,7 +124,9 @@ export const makeTrader = async (purses, zoe, publicFacet, centralIssuer) => {
const getPoolAllocation = issuer =>
E(publicFacet).getPoolAllocation(issuer.getBrand());
- const trader = Far('trader', {
+ const trader = Remotable('Alleged: trader', undefined, {
+ // Using Remotable rather than Far because the methods accept
+ // an ava ExecutionContext as `t`, which is not a passable.
offerAndTrade: async (outAmount, inAmount, swapIn) => {
const proposal = harden({
want: { Out: outAmount },
diff --git a/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js b/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js
index 14df872d0d8..e1cbe63b867 100644
--- a/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js
+++ b/packages/zoe/test/unitTests/contracts/brokenAutoRefund.js
@@ -1,5 +1,7 @@
// @ts-check
+import { Far } from '@agoric/marshal';
+
/**
* This is a a broken contact to test zoe's error handling
*
@@ -10,7 +12,12 @@ const start = zcf => {
seat.exit();
return `The offer was accepted`;
};
- const makeRefundInvitation = () => zcf.makeInvitation(refund, 'getRefund');
+ // The Far would not normally happen in the erroneous accident
+ // we're "testing". However, if we omit it, we get a completely
+ // different error which is besides the point of this test.
+ const makeRefundInvitation = Far('broken make refund', () =>
+ zcf.makeInvitation(refund, 'getRefund'),
+ );
// should be makeRefundInvitation(). Intentionally wrong to provoke
// an error.
// @ts-ignore invalid arguments for testing
diff --git a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js
index 7eeef2e2ae6..50b25505586 100644
--- a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js
+++ b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js
@@ -283,14 +283,17 @@ test('quoteAtTime', /** @param {ExecutionContext} t */ async t => {
/** @type {PromiseRecord} */
const userQuotePK = makePromiseKit();
- await E(userTimer).setWakeup(1n, {
- async wake(_timestamp) {
- userQuotePK.resolve(
- E(pa).quoteGiven(AmountMath.make(23n, brandIn), usdBrand),
- );
- await userQuotePK.promise;
- },
- });
+ await E(userTimer).setWakeup(
+ 1n,
+ Far('wakeHandler', {
+ async wake(_timestamp) {
+ userQuotePK.resolve(
+ E(pa).quoteGiven(AmountMath.make(23n, brandIn), usdBrand),
+ );
+ await userQuotePK.promise;
+ },
+ }),
+ );
const quoteAtUserTime = userQuotePK.promise;
/** @type {PriceQuote | undefined} */
diff --git a/packages/zoe/tools/fakeVatAdmin.js b/packages/zoe/tools/fakeVatAdmin.js
index 04c1127a316..0e2bfc51ca1 100644
--- a/packages/zoe/tools/fakeVatAdmin.js
+++ b/packages/zoe/tools/fakeVatAdmin.js
@@ -34,11 +34,11 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
const admin = Far('vatAdmin', {
createMeter: () => {
const notifierKit = makeNotifierKit();
- return harden({ getNotifier: () => notifierKit.notifier });
+ return Far('fakeMeter', { getNotifier: () => notifierKit.notifier });
},
createUnlimitedMeter: () => {
const notifierKit = makeNotifierKit();
- return harden({ getNotifier: () => notifierKit.notifier });
+ return Far('fakeMeter', { getNotifier: () => notifierKit.notifier });
},
createVat: bundle => {
return harden({
diff --git a/packages/zoe/tools/manualTimer.js b/packages/zoe/tools/manualTimer.js
index b48fbba4e07..89d4b5da924 100644
--- a/packages/zoe/tools/manualTimer.js
+++ b/packages/zoe/tools/manualTimer.js
@@ -42,7 +42,7 @@ export default function buildManualTimer(log, startValue = 0n, timeStep = 1n) {
let nextWakeup;
/** @type {TimerWaker} */
- const repeaterWaker = {
+ const repeaterWaker = Far('repeatWaker', {
async wake(timestamp) {
assert.typeof(timestamp, 'bigint');
assert(
@@ -56,7 +56,7 @@ export default function buildManualTimer(log, startValue = 0n, timeStep = 1n) {
timer.setWakeup(nextWakeup, repeaterWaker);
await Promise.allSettled(wakers.map(waker => E(waker).wake(timestamp)));
},
- };
+ });
/** @type {TimerRepeater} */
const repeater = Far('TimerRepeater', {
@@ -151,13 +151,13 @@ export default function buildManualTimer(log, startValue = 0n, timeStep = 1n) {
);
const { notifier, updater } = makeNotifierKit();
/** @type {TimerWaker} */
- const repeaterWaker = {
+ const repeaterWaker = Far('repeatWaker', {
async wake(timestamp) {
assert.typeof(timestamp, 'bigint');
updater.updateState(timestamp);
timer.setWakeup(ticks + interval, repeaterWaker);
},
- };
+ });
timer.setWakeup(ticks + delaySecs, repeaterWaker);
return notifier;
},
diff --git a/packages/zoe/tools/scriptedOracle.js b/packages/zoe/tools/scriptedOracle.js
index 3c87c972f08..e49dcf17de7 100644
--- a/packages/zoe/tools/scriptedOracle.js
+++ b/packages/zoe/tools/scriptedOracle.js
@@ -1,5 +1,6 @@
// @ts-check
import { E } from '@agoric/eventual-send';
+import { Far } from '@agoric/marshal';
/**
* Start an instance of an Oracle that follows a script. The Oracle has access
@@ -26,7 +27,7 @@ export async function makeScriptedOracle(
feeIssuer,
) {
/** @type {OracleHandler} */
- const oracleHandler = harden({
+ const oracleHandler = Far('oracleHandler', {
async onQuery(query) {
const time = await E(timer).getCurrentTimestamp();
const event = script[`${time}`] || 'Nothing to report';