Skip to content

Commit

Permalink
fix: some missing Fars (#3498)
Browse files Browse the repository at this point in the history
* fix: some missing Fars. Preparing for when we require Remotables to be declared.

Co-authored-by: Chris Hibbert <Chris-Hibbert@users.noreply.github.com>
  • Loading branch information
erights and Chris-Hibbert authored Jul 21, 2021
1 parent 4a72860 commit 8f77271
Show file tree
Hide file tree
Showing 61 changed files with 150 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { E } from '@agoric/eventual-send';
import { assert, details as X } from '@agoric/assert';
import { Far } from '@agoric/marshal';
import { makeIssuerKit, AmountMath } from '../../../src';

export function buildRootObject(vatPowers, vatParameters) {
Expand Down Expand Up @@ -27,5 +28,5 @@ export function buildRootObject(vatPowers, vatParameters) {
}
},
};
return harden(obj0);
return Far('root', obj0);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';
import { AmountMath } from '../../../src';

function makeAliceMaker(log) {
return harden({
return Far('aliceMaker', {
make(issuer, brand, oldPaymentP) {
const alice = harden({
const alice = Far('alice', {
async testBasicFunctionality() {
// isLive
const alive = await E(issuer).isLive(oldPaymentP);
Expand Down Expand Up @@ -62,7 +63,7 @@ function makeAliceMaker(log) {
}

export function buildRootObject(vatPowers) {
return harden({
return Far('root', {
makeAliceMaker() {
return harden(makeAliceMaker(vatPowers.testLog));
},
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/test/gc/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function buildRootObject() {
let B = Far('B', { hello() {} });
let target;

return harden({
return Far('root', {
async bootstrap(vats) {
target = vats.target;
},
Expand Down
3 changes: 2 additions & 1 deletion packages/dapp-svelte-wallet/api/src/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
import { E } from '@agoric/eventual-send';
import { makeNotifierKit, observeIteration } from '@agoric/notifier';
import { Far } from '@agoric/marshal';

import { makeWallet } from './lib-wallet';
import pubsub from './pubsub';
Expand Down Expand Up @@ -594,7 +595,7 @@ export function buildRootObject(_vatPowers) {
);
}

return harden({
return Far('root', {
startup,
getWallet,
setHTTPObject,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check

import { makeNotifierKit } from '@agoric/notifier';
import { Far } from '@agoric/marshal';

import '@agoric/zoe/exported';

Expand All @@ -21,9 +22,9 @@ export const start = zcf => {
updater.updateState('first offer made');
return harden({
uiNotifier: notifier,
invitationMakers: {
invitationMakers: Far('second thing inviter', {
SecondThing: makeDoSecondThingInvitation,
},
}),
});
};

Expand Down
5 changes: 3 additions & 2 deletions packages/governance/src/ballotBuilder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check

import { assert, details as X } from '@agoric/assert';
import { Far } from '@agoric/marshal';

// CHOOSE_N: voter indicates up to N they find acceptable (N might be 1).
// ORDER: voter lists their choices from most to least favorite.
Expand Down Expand Up @@ -50,11 +51,11 @@ const buildEqualWeightBallot = (
instance,
});

return {
return Far('ballot details', {
getBallotCounter: () => instance,
getDetails,
choose,
};
});
};

/** @type {BuildBallot} */
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { makeIssuerKit, AmountMath } from '@agoric/ertp';
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

/* eslint-disable-next-line import/no-unresolved, import/extensions */
import exchangeBundle from './bundle-simpleExchange';
Expand All @@ -10,7 +11,7 @@ export function buildRootObject(_vatPowers, vatParameters) {
let round = 0;
let quiet = false;

return harden({
return Far('root', {
async bootstrap(vats, devices) {
let primeContracts = false;
for (const arg of vatParameters.argv) {
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/exchangeBenchmark/exchanger.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check

import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';
import { showPurseBalance, setupPurses } from './helpers';
import { makePrintLog } from './printLog';

Expand Down Expand Up @@ -106,7 +107,7 @@ async function build(name, zoe, issuers, payments, publicFacet) {
}

export function buildRootObject(_vatPowers, vatParameters) {
return harden({
return Far('root', {
build: (zoe, issuers, payments, publicFacet) =>
build(vatParameters.name, zoe, issuers, payments, publicFacet),
});
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/exchangeBenchmark/vat-zoe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { makeZoe } from '@agoric/zoe';
import { Far } from '@agoric/marshal';

export function buildRootObject(_vatPowers, vatParameters) {
return harden({
return Far('root', {
buildZoe: vatAdminSvc => makeZoe(vatAdminSvc, vatParameters.zcfBundleName),
});
}
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/justReply/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> bootstrap() called');
E(vats.alice)
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/justReply/vat-alice.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
sayHelloTo(other) {
log(`=> Alice.sayHelloTo`);
const answer = E(other).hello();
Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/justReply/vat-bob.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Far } from '@agoric/marshal';

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
hello() {
console.log(`=> Somebody said hello to Bob`);
return 'hi there!';
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/megaPong/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers, vatParameters) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
console.log('=> bootstrap() called');
E(vats.alice).setNickname('alice');
Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/meterExhaustion/vat-boomer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Far } from '@agoric/marshal';

export function buildRootObject() {
return harden({
return Far('root', {
explode() {
// eslint-disable-next-line no-unused-vars
const hugantuous = Array(4e9); // arbitrarily too big
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCase1/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> Alice: bootstrap() called');

Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/resolveCase1/vat-bob.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Far } from '@agoric/marshal';

const log = console.log;

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
thisIsYourPromise(p) {
log('=> Bob: thisIsYourPromise begins');
p.then(
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCase2/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> Alice: bootstrap() called');

Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/resolveCase2/vat-bob.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Far } from '@agoric/marshal';

const log = console.log;

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
thisIsYourPromise(p) {
log('=> Bob: thisIsYourPromise begins');
p.then(
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCase3/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> Alice: bootstrap() called');

Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/resolveCase3/vat-bob.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Far } from '@agoric/marshal';

const log = console.log;

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
thisIsYourPromise(p) {
log('=> Bob: thisIsYourPromise begins');
p.then(
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCircular/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

console.log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
bootstrap(vats) {
const pa = E(vats.bob).genPromise1();
const pb = E(vats.bob).genPromise2();
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCircular2/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

console.log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
bootstrap(vats) {
const pa = E(vats.bob).genPromise1();
const pb = E(vats.bob).genPromise2();
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCircular3/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
async bootstrap(vats) {
const pa = E(vats.bob).genPromise1();
const pb = E(vats.bob).genPromise2();
Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/resolveCircular3/vat-alice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Far } from '@agoric/marshal';

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
acceptPromise(_p) {
console.log('Alice got p');
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

console.log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
bootstrap(vats) {
const pX = E(vats.bob).genPromiseX();
const pY = E(vats.bob).genPromiseY();
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/resolveCrosswise/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
bootstrap(vats) {
const pa = E(vats.alice).genPromise();
const pb = E(vats.bob).genPromise();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> Alice: bootstrap() called');
const thingP = E(vats.bob).getThing();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';

const log = console.log;

log(`=> loading bootstrap.js`);

export function buildRootObject(_vatPowers) {
log(`=> setup called`);
return harden({
return Far('root', {
bootstrap(vats) {
log('=> Alice: bootstrap() called');

Expand Down
4 changes: 3 additions & 1 deletion packages/swingset-runner/demo/resolveInArrayCase1/vat-bob.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Far } from '@agoric/marshal';

const log = console.log;

export function buildRootObject(_vatPowers) {
return harden({
return Far('root', {
thisIsYourPromise(parr) {
const p = parr[0];
log('=> Bob: thisIsYourPromise begins');
Expand Down
Loading

0 comments on commit 8f77271

Please sign in to comment.