Skip to content

Commit

Permalink
fix: downgraded to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jul 25, 2021
1 parent d259e54 commit 2ecba81
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/vats/vat-timerWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function buildRootObject(vatPowers) {

const index = D(timerNode).makeRepeater(delaySecs, interval);

const vatRepeater = harden({
const vatRepeater = Far('vatRepeater', {
schedule(h) {
return D(timerNode).schedule(index, h);
},
Expand Down
13 changes: 7 additions & 6 deletions packages/SwingSet/test/test-timer-device.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Far } from '@agoric/marshal';
import { test } from '../tools/prepare-test-env-ava.js';

import { makeTimerMap, curryPollFn } from '../src/devices/timer-src.js';
Expand Down Expand Up @@ -39,17 +40,17 @@ test('multiMap remove key', t => {
});

function fakeSO(o) {
return {
return Far('fake SO', {
wake(arg = null) {
o.wake(arg);
},
};
});
}

function makeHandler() {
let calls = 0;
const args = [];
return {
return Far('wake handler', {
getCalls() {
return calls;
},
Expand All @@ -60,19 +61,19 @@ function makeHandler() {
args.push(arg);
calls += 1;
},
};
});
}

function makeFakeTimer(initialVal) {
let fakeTime = initialVal;
return {
return Far('fake timer', {
getLastPolled() {
return fakeTime;
},
setTime(t) {
fakeTime = t;
},
};
});
}

test('Timer schedule single event', t => {
Expand Down
16 changes: 8 additions & 8 deletions packages/dapp-svelte-wallet/api/src/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function buildRootObject(_vatPowers) {
}

/** @type {WalletBridge} */
const bridge = {
const bridge = Far('bridge', {
async getPursesNotifier() {
await approve();
const pursesNotifier = walletAdmin.getAttenuatedPursesNotifier();
Expand Down Expand Up @@ -209,8 +209,8 @@ export function buildRootObject(_vatPowers) {
await approve();
return walletAdmin.getBrandPetnames(brands);
},
};
return harden(bridge);
});
return bridge;
};

/**
Expand All @@ -220,7 +220,7 @@ export function buildRootObject(_vatPowers) {
*
* @type {WalletBridge}
*/
const preapprovedBridge = {
const preapprovedBridge = Far('preapprovedBridge', {
addOffer(offer) {
return walletAdmin.addOffer(offer);
},
Expand Down Expand Up @@ -266,7 +266,7 @@ export function buildRootObject(_vatPowers) {
async getBrandPetnames(brands) {
return walletAdmin.getBrandPetnames(brands);
},
};
});
harden(preapprovedBridge);

async function getWallet(bank) {
Expand All @@ -281,7 +281,7 @@ export function buildRootObject(_vatPowers) {
*
* @type {WalletUser & { getAdminFacet: () => WalletAdminFacet }}
*/
const wallet = {
const wallet = Far('wallet', {
addPayment: walletAdmin.addPayment,
async getScopedBridge(suggestedDappPetname, dappOrigin) {
const approve = async () => {
Expand All @@ -304,7 +304,7 @@ export function buildRootObject(_vatPowers) {
getIssuers: walletAdmin.getIssuers,
getPurse: walletAdmin.getPurse,
getPurses: walletAdmin.getPurses,
};
});
return harden(wallet);
}

Expand Down Expand Up @@ -342,7 +342,7 @@ export function buildRootObject(_vatPowers) {
}

function getBridgeURLHandler() {
return harden({
return Far('bridgeURLHandler', {
/**
* @typedef {Object} WalletOtherSide the callbacks from a CapTP wallet
* client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ import fakeVatAdmin from '@agoric/zoe/tools/fakeVatAdmin';
import { makeBoard } from '@agoric/vats/src/lib-board';
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeNameHubKit } from '@agoric/vats/src/nameHub';
import { Far } from '@agoric/marshal';
import { makeWallet } from '../src/lib-wallet';

import '../src/types';

function makeFakeMyAddressNameAdmin() {
const { nameAdmin: rawMyAddressNameAdmin } = makeNameHubKit();
return {
return Far('fakeMyAddressNameAdmin', {
...rawMyAddressNameAdmin,
getMyAddress() {
return 'agoric1test1';
},
};
});
}

const setup = async () => {
Expand Down
10 changes: 8 additions & 2 deletions packages/marshal/src/passStyleOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '@agoric/assert/exported.js';
//
// TODO: once the policy changes to force remotables to be explicit, remove this
// flag entirely and fix code that uses it (as if it were always `false`).
const ALLOW_IMPLICIT_REMOTABLES = false;
const ALLOW_IMPLICIT_REMOTABLES = true;

const {
getPrototypeOf,
Expand Down Expand Up @@ -146,7 +146,7 @@ function isPassByCopyArray(val) {
*/
function isPassByCopyRecord(val) {
const proto = getPrototypeOf(val);
if (proto !== objectPrototype) {
if (proto !== objectPrototype && proto !== null) {
return false;
}
const descs = getOwnPropertyDescriptors(val);
Expand Down Expand Up @@ -368,6 +368,12 @@ function checkRemotable(val, check = x => x) {
const p = getPrototypeOf(val);

if (ALLOW_IMPLICIT_REMOTABLES && (p === null || p === objectPrototype)) {
const err = assert.error(
X`Remotables should be explicitly declared: ${q(val)}`,
);
console.warn('Missing Far:', err);
// eslint-disable-next-line no-debugger
debugger;
return true;
}
return checkRemotableProto(p, check, val);
Expand Down
4 changes: 3 additions & 1 deletion packages/marshal/test/test-marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ test('records', t => {
const NOACC = /Records must not contain accessors/;
const RECENUM = /Record fields must be enumerable/;
const NOMETH = /cannot serialize objects with non-methods/;
const EXPLICIT = /Remotables must now be explictly declared/;
// const EXPLICIT = /Remotables must now be explictly declared/;

// empty objects

Expand Down Expand Up @@ -502,6 +502,7 @@ test('records', t => {
slots: [],
});

/*
// { key: func }
// old: pass-by-ref without warning
// interim1: pass-by-ref with warning
Expand All @@ -511,6 +512,7 @@ test('records', t => {
shouldThrow(['enumSymbolFunc'], EXPLICIT);
shouldThrow(['nonenumStringFunc'], EXPLICIT);
shouldThrow(['nonenumSymbolFunc'], EXPLICIT);
*/

// Far('iface', { key: data, key: func }) : rejected
// (some day this might add auxilliary data, but not now
Expand Down
6 changes: 4 additions & 2 deletions packages/solo/src/scratch.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Far } from '@agoric/marshal';

export default function makeScratchPad() {
const map = new Map();
async function get(idP) {
Expand All @@ -16,9 +18,9 @@ export default function makeScratchPad() {
}
return harden(ids.sort());
}
return {
return Far('scratchPad', {
get,
set,
list,
};
});
}
4 changes: 2 additions & 2 deletions packages/solo/test/test-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test.serial('home.localTimerService makeNotifier', async t => {
function makeHandler() {
let calls = 0;
const args = [];
return {
return Far('wake handler', {
getCalls() {
return calls;
},
Expand All @@ -146,7 +146,7 @@ function makeHandler() {
args.push(arg);
calls += 1;
},
};
});
}

// TODO(2164): createRepeater was replaced by makeRepeater. Remove it pre-Beta
Expand Down
4 changes: 2 additions & 2 deletions packages/vats/src/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export function getReplHandler(replObjects, send) {
},
};

const commandHandler = harden({
const commandHandler = Far('commandHandler', {
onOpen(_obj, meta) {
replHandles.add(meta.channelHandle);
},
Expand All @@ -289,7 +289,7 @@ export function getReplHandler(replObjects, send) {
},
});

return harden({
return Far('replHandler', {
getCommandHandler() {
return commandHandler;
},
Expand Down
5 changes: 3 additions & 2 deletions packages/zoe/test/unitTests/test-manualTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { test } from '@agoric/zoe/tools/prepare-test-env-ava';

import { E } from '@agoric/eventual-send';
import { Far } from '@agoric/marshal';
import buildManualTimer from '../../tools/manualTimer';

test('manualTimer makeNotifier', async t => {
Expand All @@ -20,7 +21,7 @@ test('manualTimer makeNotifier', async t => {
function makeHandler() {
let calls = 0n;
const args = [];
return {
return Far('wake handler', {
getCalls() {
return calls;
},
Expand All @@ -31,7 +32,7 @@ function makeHandler() {
args.push(arg);
calls += 1n;
},
};
});
}

test('manualTimer makeRepeater', async t => {
Expand Down

0 comments on commit 2ecba81

Please sign in to comment.