From d1201a1a1de324ae5e21736057f3bb03f97d2bc7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Tue, 3 Dec 2019 13:09:40 -0600 Subject: [PATCH] fix(captp): use new @agoric/eventual-send interface --- packages/agoric-cli/package.json | 2 +- packages/captp/lib/captp.js | 8 ++++---- packages/captp/package.json | 2 +- packages/captp/test/loopback.js | 7 +++---- packages/cosmic-swingset/package.json | 6 +++--- yarn.lock | 5 ----- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index 42777e09f4d..c2e567500ba 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@agoric/bundle-source": "^1.0.3", - "@agoric/captp": "^1.1.0", + "@agoric/captp": "^1.2.0", "@agoric/evaluate": "^2.1.3", "@agoric/eventual-send": "^0.5.0", "chalk": "^2.4.2", diff --git a/packages/captp/lib/captp.js b/packages/captp/lib/captp.js index d67ad9eda62..70d352123ea 100644 --- a/packages/captp/lib/captp.js +++ b/packages/captp/lib/captp.js @@ -31,7 +31,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) { let slot; if (!valToSlot.has(val)) { // new export - if (Promise.resolve(val) === val) { + if (HandledPromise.resolve(val) === val) { lastPromiseID += 1; const promiseID = lastPromiseID; slot = `p+${promiseID}`; @@ -82,7 +82,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) { function makeRemote(target) { const handler = { - GET(_o, prop) { + get(_o, prop) { const [questionID, pr] = makeQuestion(); send({ type: 'CTP_CALL', @@ -92,7 +92,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) { }); return harden(pr.p); }, - POST(_o, prop, args) { + applyMethod(_o, prop, args) { // Support: o~.[prop](...args) remote method invocation const [questionID, pr] = makeQuestion(); send({ @@ -106,7 +106,7 @@ export function makeCapTP(ourId, send, bootstrapObj = undefined) { }; const pr = {}; - pr.p = Promise.makeHandled((res, rej, resolveWithPresence) => { + pr.p = new HandledPromise((res, rej, resolveWithPresence) => { pr.rej = rej; pr.resPres = () => resolveWithPresence(handler); pr.res = res; diff --git a/packages/captp/package.json b/packages/captp/package.json index df931ddcf82..e0f565c4926 100644 --- a/packages/captp/package.json +++ b/packages/captp/package.json @@ -1,6 +1,6 @@ { "name": "@agoric/captp", - "version": "1.1.0", + "version": "1.2.0", "description": "Capability Transfer Protocol for distributed objects", "keywords": [ "agoric", diff --git a/packages/captp/test/loopback.js b/packages/captp/test/loopback.js index 2452459e1c5..c3e853e634f 100644 --- a/packages/captp/test/loopback.js +++ b/packages/captp/test/loopback.js @@ -48,14 +48,13 @@ test('try loopback captp', async t => { }), )); const rightRef = leftBootstrap(); - const { comment, bang } = await E.C(rightRef).G.encourager.M.encourage( + const { comment, bang } = await E(E.G(rightRef).encourager).encourage( 'buddy', - ).P; + ); t.equal(comment, 'good work, buddy', 'got encouragement'); t.equal(await E(bang).trigger(), 'buddy BANG!', 'called on promise'); pr.res('resolution'); - t.equal(await E.G(rightRef).promise, 'resolution', 'got resolution'); - t.equal(await E.C(rightRef).G.promise.P, 'resolution', 'chained resolution'); + t.equal(await E.G(rightRef).promise, 'resolution', 'get resolution'); } catch (e) { t.isNot(e, e, 'unexpected exception'); } finally { diff --git a/packages/cosmic-swingset/package.json b/packages/cosmic-swingset/package.json index 2aff80fdae0..293a4e59473 100644 --- a/packages/cosmic-swingset/package.json +++ b/packages/cosmic-swingset/package.json @@ -19,10 +19,10 @@ "license": "Apache-2.0", "dependencies": { "@agoric/bundle-source": "^1.0.4", - "@agoric/captp": "^1.0.2", + "@agoric/captp": "^1.2.0", "@agoric/ertp": "^0.2.0", - "@agoric/evaluate": "^2.1.3", - "@agoric/eventual-send": "^0.4.4", + "@agoric/evaluate": "^2.2.0", + "@agoric/eventual-send": "^0.5.0", "@agoric/harden": "0.0.4", "@agoric/swingset-vat": "^0.3.0", "@agoric/zoe": "^0.1.0", diff --git a/yarn.lock b/yarn.lock index 9a48cc4cc78..6d06f15b5d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,11 +7,6 @@ resolved "https://registry.yarnpkg.com/@agoric/babel-parser/-/babel-parser-7.6.4.tgz#8dd5d36554cc758c29042713b5aa57dc58ee5273" integrity sha512-3FQC3eP2hekhz1zn+2LcSL7tAG2dGgSqbmCeRfIFqhVS8bbE1hR7EvrC6jYlvqdU6yzlly43VykyRy9MHBvUAw== -"@agoric/eventual-send@^0.4.4", "@agoric/eventual-send@^0.4.5": - version "0.4.5" - resolved "https://registry.yarnpkg.com/@agoric/eventual-send/-/eventual-send-0.4.5.tgz#73d4238b856eef6086b45e3bcf219aeb9e516056" - integrity sha512-d4jngAU8LWmntZ3PXcFoOygC/tqHOl+JlA318LXuxK1/3/oU5UfNoYboa0Bm8xms8KEtcKFtPpcD5EgGzXO1NQ== - "@agoric/harden@0.0.4", "@agoric/harden@^0.0.4": version "0.0.4" resolved "https://registry.yarnpkg.com/@agoric/harden/-/harden-0.0.4.tgz#b0d0b2fdfc1a8c7e60454374824442f5b37ea8bd"