From 055c7805212d08363b0f66fd91141a0d9d49ed40 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 7 May 2024 21:10:56 -0700 Subject: [PATCH] refactor(async-flow): simplify with zonified vow --- packages/async-flow/package.json | 1 - packages/async-flow/src/async-flow.js | 6 +-- packages/async-flow/test/test-async-flow.js | 37 +++++++------------ packages/async-flow/test/test-bad-host.js | 23 ++++-------- packages/async-flow/test/test-convert.js | 17 +++------ packages/async-flow/test/test-equate.js | 17 +++------ packages/async-flow/test/test-log-store.js | 21 ++++------- .../test/test-replay-membrane-settlement.js | 23 +++++------- .../async-flow/test/test-replay-membrane.js | 30 ++++++--------- .../async-flow/test/test-weak-bijection.js | 17 +++------ 10 files changed, 71 insertions(+), 121 deletions(-) diff --git a/packages/async-flow/package.json b/packages/async-flow/package.json index 49e622306dc..c6cb7bbade1 100644 --- a/packages/async-flow/package.json +++ b/packages/async-flow/package.json @@ -27,7 +27,6 @@ "@agoric/base-zone": "^0.1.0", "@agoric/store": "^0.9.2", "@agoric/vow": "^0.1.0", - "@agoric/vat-data": "^0.5.2", "@endo/pass-style": "^1.4.0", "@endo/common": "^1.2.2", "@endo/errors": "^1.2.2", diff --git a/packages/async-flow/src/async-flow.js b/packages/async-flow/src/async-flow.js index 1aded0831e8..0ac88b70e4d 100644 --- a/packages/async-flow/src/async-flow.js +++ b/packages/async-flow/src/async-flow.js @@ -2,8 +2,7 @@ import { annotateError, Fail, makeError, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { M } from '@endo/patterns'; import { PromiseWatcherI } from '@agoric/base-zone'; -import { toPassableCap, VowShape } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; +import { prepareVowTools, toPassableCap, VowShape } from '@agoric/vow'; import { makeReplayMembrane } from './replay-membrane.js'; import { prepareLogStore } from './log-store.js'; import { prepareWeakBijection } from './weak-bijection.js'; @@ -41,8 +40,7 @@ const AdminAsyncFlowI = M.interface('AsyncFlowAdmin', { */ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => { const { - // TODO https://github.com/Agoric/agoric-sdk/issues/9231 - vowTools = prepareWatchableVowTools(outerZone), + vowTools = prepareVowTools(outerZone), makeLogStore = prepareLogStore(outerZone), makeWeakBijection = prepareWeakBijection(outerZone), } = outerOptions; diff --git a/packages/async-flow/test/test-async-flow.js b/packages/async-flow/test/test-async-flow.js index d67a1941a6d..7886a777066 100644 --- a/packages/async-flow/test/test-async-flow.js +++ b/packages/async-flow/test/test-async-flow.js @@ -13,7 +13,6 @@ import { makePromiseKit } from '@endo/promise-kit'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { isVow } from '@agoric/vow/src/vow-utils.js'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; @@ -49,15 +48,13 @@ const prepareOrchestra = (zone, k = 1) => const firstLogLen = 7; -// TODO https://github.com/Agoric/agoric-sdk/issues/9231 - /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testFirstPlay = async (t, zone, vowTools) => { +const testFirstPlay = async (t, zone) => { t.log('firstPlay started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -130,10 +127,10 @@ const testFirstPlay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testBadReplay = async (t, zone, vowTools) => { +const testBadReplay = async (t, zone) => { t.log('badReplay started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -196,10 +193,10 @@ const testBadReplay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testGoodReplay = async (t, zone, vowTools) => { +const testGoodReplay = async (t, zone) => { t.log('goodReplay started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -299,10 +296,10 @@ const testGoodReplay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testAfterPlay = async (t, zone, vowTools) => { +const testAfterPlay = async (t, zone) => { t.log('testAfterPlay started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -334,41 +331,35 @@ const testAfterPlay = async (t, zone, vowTools) => { await test.serial('test heap async-flow', async t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools); + return testFirstPlay(t, zone); }); await test.serial('test virtual async-flow', async t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools); + return testFirstPlay(t, zone); }); await test.serial('test durable async-flow', async t => { annihilate(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - await testFirstPlay(t, zone1, vowTools1); + await testFirstPlay(t, zone1); await eventLoopIteration(); nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - await testBadReplay(t, zone2, vowTools2); + await testBadReplay(t, zone2); await eventLoopIteration(); nextLife(); const zone3 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools3 = prepareWatchableVowTools(zone3); - await testGoodReplay(t, zone3, vowTools3); + await testGoodReplay(t, zone3); await eventLoopIteration(); nextLife(); const zone4 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools4 = prepareWatchableVowTools(zone4); - return testAfterPlay(t, zone4, vowTools4); + return testAfterPlay(t, zone4); }); diff --git a/packages/async-flow/test/test-bad-host.js b/packages/async-flow/test/test-bad-host.js index 12ad3d9b718..55c9c7291c1 100644 --- a/packages/async-flow/test/test-bad-host.js +++ b/packages/async-flow/test/test-bad-host.js @@ -11,7 +11,6 @@ import { M } from '@endo/patterns'; import { makePromiseKit } from '@endo/promise-kit'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; @@ -40,15 +39,13 @@ const prepareBadHost = zone => /** @typedef {ReturnType>} BadHost */ -// TODO https://github.com/Agoric/agoric-sdk/issues/9231 - /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testBadHostFirstPlay = async (t, zone, vowTools) => { +const testBadHostFirstPlay = async (t, zone) => { t.log('badHost firstPlay started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -106,10 +103,10 @@ const testBadHostFirstPlay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testBadHostReplay1 = async (t, zone, vowTools) => { +const testBadHostReplay1 = async (t, zone) => { t.log('badHost replay1 started'); + const vowTools = prepareVowTools(zone); const { asyncFlow, adminAsyncFlow } = prepareAsyncFlowTools(zone, { vowTools, }); @@ -183,27 +180,23 @@ const testBadHostReplay1 = async (t, zone, vowTools) => { await test.serial('test heap async-flow bad host', async t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - return testBadHostFirstPlay(t, zone, vowTools); + return testBadHostFirstPlay(t, zone); }); await test.serial('test virtual async-flow bad host', async t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - return testBadHostFirstPlay(t, zone, vowTools); + return testBadHostFirstPlay(t, zone); }); await test.serial('test durable async-flow bad host', async t => { annihilate(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - await testBadHostFirstPlay(t, zone1, vowTools1); + await testBadHostFirstPlay(t, zone1); await eventLoopIteration(); nextLife(); const zone3 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools3 = prepareWatchableVowTools(zone3); - return testBadHostReplay1(t, zone3, vowTools3); + return testBadHostReplay1(t, zone3); }); diff --git a/packages/async-flow/test/test-convert.js b/packages/async-flow/test/test-convert.js index 49af6ba0350..ab4cb38fd7a 100644 --- a/packages/async-flow/test/test-convert.js +++ b/packages/async-flow/test/test-convert.js @@ -10,7 +10,6 @@ import { import { X, makeError, q } from '@endo/errors'; import { Far, getInterfaceOf, passStyleOf } from '@endo/pass-style'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { isVow } from '@agoric/vow/src/vow-utils.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; @@ -22,10 +21,10 @@ import { prepareWeakBijection } from '../src/weak-bijection.js'; /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools * @param {boolean} [showOnConsole] */ -const testConvert = (t, zone, { makeVowKit }, showOnConsole = false) => { +const testConvert = (t, zone, showOnConsole = false) => { + const { makeVowKit } = prepareVowTools(zone); const makeBijection = prepareWeakBijection(zone); const bij = zone.makeOnce('bij', makeBijection); @@ -89,15 +88,13 @@ const testConvert = (t, zone, { makeVowKit }, showOnConsole = false) => { test('test heap convert', t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - testConvert(t, zone, vowTools, asyncFlowVerbose()); + testConvert(t, zone, asyncFlowVerbose()); }); test.serial('test virtual convert', t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - testConvert(t, zone, vowTools); + testConvert(t, zone); }); test.serial('test durable convert', t => { @@ -105,14 +102,12 @@ test.serial('test durable convert', t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - testConvert(t, zone1, vowTools1); + testConvert(t, zone1); // These converters keep their state only in the bijection, // which loses all its memory between incarnations. nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - testConvert(t, zone2, vowTools2); + testConvert(t, zone2); }); diff --git a/packages/async-flow/test/test-equate.js b/packages/async-flow/test/test-equate.js index f08d03f1cf0..92004ae1432 100644 --- a/packages/async-flow/test/test-equate.js +++ b/packages/async-flow/test/test-equate.js @@ -10,7 +10,6 @@ import { import { X, makeError } from '@endo/errors'; import { Far } from '@endo/pass-style'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { isVow } from '@agoric/vow/src/vow-utils.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; @@ -22,10 +21,10 @@ import { makeEquate } from '../src/equate.js'; /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools * @param {boolean} [showOnConsole] */ -const testEquate = (t, zone, { makeVowKit }, showOnConsole = false) => { +const testEquate = (t, zone, showOnConsole = false) => { + const { makeVowKit } = prepareVowTools(zone); const makeBijection = prepareWeakBijection(zone); const bij = zone.makeOnce('bij', makeBijection); @@ -92,15 +91,13 @@ const testEquate = (t, zone, { makeVowKit }, showOnConsole = false) => { test('test heap equate', t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - testEquate(t, zone, vowTools, asyncFlowVerbose()); + testEquate(t, zone, asyncFlowVerbose()); }); test.serial('test virtual equate', t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - testEquate(t, zone, vowTools); + testEquate(t, zone); }); test.serial('test durable equate', t => { @@ -108,14 +105,12 @@ test.serial('test durable equate', t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - testEquate(t, zone1, vowTools1); + testEquate(t, zone1); // equate keeps its state only in the bijection, // which loses all its memory between incarnations. nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - testEquate(t, zone2, vowTools2); + testEquate(t, zone2); }); diff --git a/packages/async-flow/test/test-log-store.js b/packages/async-flow/test/test-log-store.js index 29e2d9f3b17..6bce6abb993 100644 --- a/packages/async-flow/test/test-log-store.js +++ b/packages/async-flow/test/test-log-store.js @@ -8,7 +8,6 @@ import { import { Fail } from '@endo/errors'; import { prepareVowTools, toPassableCap } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; @@ -18,9 +17,9 @@ import { prepareLogStore } from '../src/log-store.js'; /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testLogStorePlay = async (t, zone, { makeVowKit }) => { +const testLogStorePlay = async (t, zone) => { + const { makeVowKit } = prepareVowTools(zone); const makeLogStore = prepareLogStore(zone); const log = zone.makeOnce('log', () => makeLogStore()); @@ -56,9 +55,9 @@ const testLogStorePlay = async (t, zone, { makeVowKit }) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} _vowTools */ -const testLogStoreReplay = async (t, zone, _vowTools) => { +const testLogStoreReplay = async (t, zone) => { + prepareVowTools(zone); prepareLogStore(zone); const log = /** @type {LogStore} */ ( @@ -89,15 +88,13 @@ const testLogStoreReplay = async (t, zone, _vowTools) => { await test('test heap log-store', async t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - return testLogStorePlay(t, zone, vowTools); + return testLogStorePlay(t, zone); }); await test.serial('test virtual log-store', async t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - return testLogStorePlay(t, zone, vowTools); + return testLogStorePlay(t, zone); }); await test.serial('test durable log-store', async t => { @@ -105,11 +102,9 @@ await test.serial('test durable log-store', async t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - await testLogStorePlay(t, zone1, vowTools1); + await testLogStorePlay(t, zone1); nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - return testLogStoreReplay(t, zone2, vowTools2); + return testLogStoreReplay(t, zone2); }); diff --git a/packages/async-flow/test/test-replay-membrane-settlement.js b/packages/async-flow/test/test-replay-membrane-settlement.js index 89d1b83ddf0..7276f57300b 100644 --- a/packages/async-flow/test/test-replay-membrane-settlement.js +++ b/packages/async-flow/test/test-replay-membrane-settlement.js @@ -9,7 +9,6 @@ import { import { Fail } from '@endo/errors'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; @@ -32,13 +31,13 @@ const preparePingee = zone => /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testFirstPlay = async (t, zone, vowTools) => { +const testFirstPlay = async (t, zone) => { + const vowTools = prepareVowTools(zone); + const { makeVowKit } = vowTools; const makeLogStore = prepareLogStore(zone); const makeBijection = prepareWeakBijection(zone); const makePingee = preparePingee(zone); - const { makeVowKit } = vowTools; const { vow: v1, resolver: r1 } = zone.makeOnce('v1', () => makeVowKit()); const { vow: _v2, resolver: _r2 } = zone.makeOnce('v2', () => makeVowKit()); @@ -74,9 +73,9 @@ const testFirstPlay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testReplay = async (t, zone, vowTools) => { +const testReplay = async (t, zone) => { + const vowTools = prepareVowTools(zone); prepareLogStore(zone); prepareWeakBijection(zone); preparePingee(zone); @@ -128,15 +127,13 @@ const testReplay = async (t, zone, vowTools) => { await test.serial('test heap replay-membrane settlement', async t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools); + return testFirstPlay(t, zone); }); await test.serial('test virtual replay-membrane settlement', async t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools); + return testFirstPlay(t, zone); }); await test.serial('test durable replay-membrane settlement', async t => { @@ -144,11 +141,9 @@ await test.serial('test durable replay-membrane settlement', async t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - await testFirstPlay(t, zone1, vowTools1); + await testFirstPlay(t, zone1); nextLife(); const zone3 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools3 = prepareWatchableVowTools(zone3); - return testReplay(t, zone3, vowTools3); + return testReplay(t, zone3); }); diff --git a/packages/async-flow/test/test-replay-membrane.js b/packages/async-flow/test/test-replay-membrane.js index 74ef71d10dc..1f3f218d6d4 100644 --- a/packages/async-flow/test/test-replay-membrane.js +++ b/packages/async-flow/test/test-replay-membrane.js @@ -10,7 +10,6 @@ import { import { Fail } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; @@ -50,14 +49,14 @@ const prepareOrchestra = (zone, k = 1) => /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools * @param {boolean} [showOnConsole] */ -const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { +const testFirstPlay = async (t, zone, showOnConsole = false) => { + const vowTools = prepareVowTools(zone); + const { makeVowKit } = vowTools; const makeLogStore = prepareLogStore(zone); const makeBijection = prepareWeakBijection(zone); const makeOrchestra = prepareOrchestra(zone); - const { makeVowKit } = vowTools; const { vow: v1, resolver: r1 } = makeVowKit(); const { vow: v2, resolver: r2 } = makeVowKit(); @@ -117,9 +116,9 @@ const testFirstPlay = async (t, zone, vowTools, showOnConsole = false) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testBadReplay = async (t, zone, vowTools) => { +const testBadReplay = async (t, zone) => { + const vowTools = prepareVowTools(zone); prepareLogStore(zone); prepareWeakBijection(zone); prepareOrchestra(zone); @@ -163,9 +162,9 @@ const testBadReplay = async (t, zone, vowTools) => { /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testGoodReplay = async (t, zone, vowTools) => { +const testGoodReplay = async (t, zone) => { + const vowTools = prepareVowTools(zone); prepareLogStore(zone); prepareWeakBijection(zone); prepareOrchestra(zone, 2); // 2 is new incarnation behavior change @@ -246,15 +245,13 @@ const testGoodReplay = async (t, zone, vowTools) => { await test.serial('test heap replay-membrane', async t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools, asyncFlowVerbose()); + return testFirstPlay(t, zone, asyncFlowVerbose()); }); await test.serial('test virtual replay-membrane', async t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - return testFirstPlay(t, zone, vowTools); + return testFirstPlay(t, zone); }); await test.serial('test durable replay-membrane', async t => { @@ -262,16 +259,13 @@ await test.serial('test durable replay-membrane', async t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - await testFirstPlay(t, zone1, vowTools1); + await testFirstPlay(t, zone1); nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - await testBadReplay(t, zone2, vowTools2); + await testBadReplay(t, zone2); nextLife(); const zone3 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools3 = prepareWatchableVowTools(zone3); - return testGoodReplay(t, zone3, vowTools3); + return testGoodReplay(t, zone3); }); diff --git a/packages/async-flow/test/test-weak-bijection.js b/packages/async-flow/test/test-weak-bijection.js index b6766ecbf88..e4900e6f9da 100644 --- a/packages/async-flow/test/test-weak-bijection.js +++ b/packages/async-flow/test/test-weak-bijection.js @@ -8,7 +8,6 @@ import { import { Far } from '@endo/pass-style'; import { prepareVowTools } from '@agoric/vow'; -import { prepareVowTools as prepareWatchableVowTools } from '@agoric/vat-data/vow.js'; import { isVow } from '@agoric/vow/src/vow-utils.js'; import { makeHeapZone } from '@agoric/zone/heap.js'; import { makeVirtualZone } from '@agoric/zone/virtual.js'; @@ -19,9 +18,9 @@ import { prepareWeakBijection } from '../src/weak-bijection.js'; /** * @param {any} t * @param {Zone} zone - * @param {VowTools} vowTools */ -const testBijection = (t, zone, { makeVowKit }) => { +const testBijection = (t, zone) => { + const { makeVowKit } = prepareVowTools(zone); const makeBijection = prepareWeakBijection(zone); const bij = zone.makeOnce('bij', makeBijection); @@ -61,15 +60,13 @@ const testBijection = (t, zone, { makeVowKit }) => { test('test heap bijection', t => { const zone = makeHeapZone('heapRoot'); - const vowTools = prepareVowTools(zone); - testBijection(t, zone, vowTools); + testBijection(t, zone); }); test.serial('test virtual bijection', t => { annihilate(); const zone = makeVirtualZone('virtualRoot'); - const vowTools = prepareVowTools(zone); - testBijection(t, zone, vowTools); + testBijection(t, zone); }); test.serial('test durable bijection', t => { @@ -77,13 +74,11 @@ test.serial('test durable bijection', t => { nextLife(); const zone1 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools1 = prepareWatchableVowTools(zone1); - testBijection(t, zone1, vowTools1); + testBijection(t, zone1); // Bijections persist but revive empty since all the guests disappear anyway nextLife(); const zone2 = makeDurableZone(getBaggage(), 'durableRoot'); - const vowTools2 = prepareWatchableVowTools(zone2); - testBijection(t, zone2, vowTools2); + testBijection(t, zone2); });