diff --git a/packages/SwingSet/tools/bootstrap-relay.js b/packages/SwingSet/tools/bootstrap-relay.js index a1182e5fbbb..6fa802b397e 100644 --- a/packages/SwingSet/tools/bootstrap-relay.js +++ b/packages/SwingSet/tools/bootstrap-relay.js @@ -1,6 +1,7 @@ import { assert } from '@agoric/assert'; import { objectMap } from '@agoric/internal'; import { Far, E } from '@endo/far'; +import { makePromiseKit } from '@endo/promise-kit'; import { buildManualTimer } from './manual-timer.js'; const { Fail, quote: q } = assert; @@ -80,6 +81,12 @@ export const buildRootObject = () => { return remotable; }, + makePromiseKit: () => { + const { promise, ...resolverMethods } = makePromiseKit(); + const resolver = Far('resolver', resolverMethods); + return harden({ promise, resolver }); + }, + /** * Returns a copy of a remotable's logs. * diff --git a/packages/boot/test/upgrading/upgrade-vats.test.js b/packages/boot/test/upgrading/upgrade-vats.test.js index b3543b9332f..209b8d5b3e6 100644 --- a/packages/boot/test/upgrading/upgrade-vats.test.js +++ b/packages/boot/test/upgrading/upgrade-vats.test.js @@ -473,11 +473,13 @@ test('upgrade vat-vow', async t => { promiseFulfilled: ['hello'], promiseRejected: ['goodbye', true], }; + const promiseKit = await EV.vat('bootstrap').makePromiseKit(); const localVows = { vowForever: [], vowFulfilled: ['hello'], vowRejected: ['goodbye', true], vowPostUpgrade: [], + vowExternalPromise: [promiseKit.promise], vowPromiseForever: [undefined, false, true], }; await EV(vowRoot).makeLocalPromiseWatchers(localPromises); @@ -496,6 +498,10 @@ test('upgrade vat-vow', async t => { status: 'unsettled', resolver: {}, }, + vowExternalPromise: { + status: 'unsettled', + resolver: {}, + }, vowPromiseForever: { status: 'unsettled', resolver: {}, @@ -512,6 +518,7 @@ test('upgrade vat-vow', async t => { vowPostUpgrade: ['bonjour'], }; await EV(vowRoot).resolveVowWatchers(localVowsUpdates); + await EV(promiseKit.resolver).resolve('ciao'); t.deepEqual(dataOnly(await EV(vowRoot).getWatcherResults()), { promiseForever: { status: 'rejected', @@ -530,6 +537,7 @@ test('upgrade vat-vow', async t => { vowFulfilled: { status: 'fulfilled', value: 'hello' }, vowRejected: { status: 'rejected', reason: 'goodbye' }, vowPostUpgrade: { status: 'fulfilled', value: 'bonjour' }, + vowExternalPromise: { status: 'fulfilled', value: 'ciao' }, vowPromiseForever: { status: 'rejected', reason: {