diff --git a/packages/boot/test/bootstrapTests/ibcClientMock.js b/packages/boot/test/bootstrapTests/ibcClientMock.js index 2cfbbe92f7b..33458da604e 100644 --- a/packages/boot/test/bootstrapTests/ibcClientMock.js +++ b/packages/boot/test/bootstrapTests/ibcClientMock.js @@ -13,7 +13,7 @@ import { V as E } from '@agoric/vat-data/vow.js'; export const start = async (zcf, privateArgs, _baggage) => { const { portAllocator } = privateArgs; - const myPort = await E(portAllocator).allocateIBCPort(); + const myPort = await E(portAllocator).allocateCustomIBCPort(); const { log } = console; let connP; diff --git a/packages/boot/test/bootstrapTests/ibcServerMock.js b/packages/boot/test/bootstrapTests/ibcServerMock.js index 2c3d9ab3cb4..1370146c65e 100644 --- a/packages/boot/test/bootstrapTests/ibcServerMock.js +++ b/packages/boot/test/bootstrapTests/ibcServerMock.js @@ -19,7 +19,7 @@ const { log } = console; export const start = async (zcf, privateArgs, _baggage) => { const { portAllocator } = privateArgs; - const boundPort = await E(portAllocator).allocateIBCPort(); + const boundPort = await E(portAllocator).allocateCustomIBCPort(); /** @type {Array<[label: string, resolve: (value: any) => void, reject: (reason: any) => void]>} */ const queue = []; diff --git a/packages/network/README.md b/packages/network/README.md index 3155cecc7c3..55d813e7612 100644 --- a/packages/network/README.md +++ b/packages/network/README.md @@ -62,7 +62,7 @@ To get a listening port, you need a `NetworkInterface` object (such as the one o ```js // ask for a random allocation - ends with a slash E(home.network).getPortAllocator() - .then(portAllocator => E(portAllocator).allocateIBCPort()) + .then(portAllocator => E(portAllocator).allocateCustomIBCPort()) .then(port => usePort(port)); ``` diff --git a/packages/network/src/network.js b/packages/network/src/network.js index 66404d7e508..2a09b56b33e 100644 --- a/packages/network/src/network.js +++ b/packages/network/src/network.js @@ -1450,17 +1450,17 @@ export const preparePortAllocator = (zone, { watch }) => zone.exoClass( 'PortAllocator', M.interface('PortAllocator', { - allocateIBCPort: M.callWhen() + allocateCustomIBCPort: M.callWhen() .optional(M.string()) .returns(Shape.Vow$(Shape.Port)), allocateICAControllerPort: M.callWhen().returns(Shape.Vow$(Shape.Port)), - allocateLocalPort: M.callWhen() + allocateCustomLocalPort: M.callWhen() .optional(M.string()) .returns(Shape.Vow$(Shape.Port)), }), ({ protocol }) => ({ protocol, lastICAPortNum: 0n }), { - allocateIBCPort(specifiedName = '') { + allocateCustomIBCPort(specifiedName = '') { const { state } = this; let localAddr = `/ibc-port/`; @@ -1482,7 +1482,7 @@ export const preparePortAllocator = (zone, { watch }) => ), ); }, - allocateLocalPort(specifiedName = '') { + allocateCustomLocalPort(specifiedName = '') { const { state } = this; let localAddr = `/local/`; diff --git a/packages/network/test/test-network-misc.js b/packages/network/test/test-network-misc.js index 414fbafcc04..9c23e443b4d 100644 --- a/packages/network/test/test-network-misc.js +++ b/packages/network/test/test-network-misc.js @@ -186,10 +186,12 @@ test('verify port allocation', async t => { const makePortAllocator = preparePortAllocator(zone, powers); const portAllocator = makePortAllocator({ protocol }); - const ibcPort = await when(portAllocator.allocateIBCPort()); + const ibcPort = await when(portAllocator.allocateCustomIBCPort()); t.is(ibcPort.getLocalAddress(), '/ibc-port/port-1'); - const namedIbcPort = await when(portAllocator.allocateIBCPort('test-1')); + const namedIbcPort = await when( + portAllocator.allocateCustomIBCPort('test-1'), + ); t.is(namedIbcPort.getLocalAddress(), '/ibc-port/custom-test-1'); const icaControllerPort1 = await when( @@ -202,13 +204,15 @@ test('verify port allocation', async t => { ); t.is(icaControllerPort2.getLocalAddress(), '/ibc-port/icacontroller-2'); - const localPort = await when(portAllocator.allocateLocalPort()); + const localPort = await when(portAllocator.allocateCustomLocalPort()); t.is(localPort.getLocalAddress(), '/local/port-5'); - const namedLocalPort = await when(portAllocator.allocateLocalPort('local-1')); + const namedLocalPort = await when( + portAllocator.allocateCustomLocalPort('local-1'), + ); t.is(namedLocalPort.getLocalAddress(), '/local/custom-local-1'); - await t.throwsAsync(when(portAllocator.allocateIBCPort('/test-1')), { + await t.throwsAsync(when(portAllocator.allocateCustomIBCPort('/test-1')), { message: 'Invalid IBC port name: /test-1', }); }); diff --git a/packages/pegasus/src/proposals/core-proposal.js b/packages/pegasus/src/proposals/core-proposal.js index 9e6007574b6..dde255ccad1 100644 --- a/packages/pegasus/src/proposals/core-proposal.js +++ b/packages/pegasus/src/proposals/core-proposal.js @@ -104,7 +104,7 @@ export const listenPegasus = async ({ pegasusConnectionsAdmin.resolve(nameAdmin); const pegasus = await E(zoe).getPublicFacet(pegasusInstance); - const port = await E(portAllocator).allocateIBCPort('pegasus'); + const port = await E(portAllocator).allocateCustomIBCPort('pegasus'); return addPegasusTransferPort(port, pegasus, pegasusNameAdmin); }; harden(listenPegasus); diff --git a/packages/vats/src/proposals/network-proposal.js b/packages/vats/src/proposals/network-proposal.js index 50f11dd3e90..7b88b855ae4 100644 --- a/packages/vats/src/proposals/network-proposal.js +++ b/packages/vats/src/proposals/network-proposal.js @@ -60,16 +60,16 @@ export const registerNetworkProtocols = async (vats, dibcBridgeManager) => { * bootstrap space. * * The `portAllocator` is CLOSELY HELD in the core space, where later, we claim - * ports using `E(portAllocator).allocateIBCPort`, for example. + * ports using `E(portAllocator).allocateCustomIBCPort`, for example. * * Contracts are expected to use the services of the network and IBC vats by way * of such ports. * * Testing facilities include: * - * - loopback ports: `E(portAllocator).allocateLocalPort()` - * - an echo port: `E(portAllocator).allocateIBCPort("echo")d - * /ibc-port/custom-echo + * - loopback ports: `E(portAllocator).allocateCustomLocalPort()` + * - an echo port: `E(portAllocator).allocateCustomIBCPort("echo")` + * - echo port addrees: /ibc-port/custom-echo * * @param {BootstrapPowers & { * consume: { loadCriticalVat: VatLoader }; @@ -139,7 +139,7 @@ export const setupNetworkProtocols = async ( const portP = when(E(allocator).allocateICAControllerPort()); ibcportP.push(portP); } else { - const portP = when(E(allocator).allocateIBCPort()); + const portP = when(E(allocator).allocateCustomIBCPort()); ibcportP.push(portP); } } @@ -152,7 +152,7 @@ export const setupNetworkProtocols = async ( await registerNetworkProtocols(vats, dibcBridgeManager); // Add an echo listener on our ibc-port network (whether real or virtual). - const echoPort = await when(E(allocator).allocateIBCPort('echo')); + const echoPort = await when(E(allocator).allocateCustomIBCPort('echo')); const { listener } = await E(vats.network).makeEchoConnectionKit(); await when(E(echoPort).addListener(listener)); return E(client).assignBundle([_a => ({ ibcport: makePorts() })]); diff --git a/packages/vats/test/test-network.js b/packages/vats/test/test-network.js index ca07074d983..0dde76387f8 100644 --- a/packages/vats/test/test-network.js +++ b/packages/vats/test/test-network.js @@ -130,7 +130,7 @@ test('network - ibc', async t => { // Actually test the ibc port binding. // TODO: Do more tests on the returned Port object. t.log('Opening a Listening Port'); - const p = await when(E(portAllocator).allocateIBCPort()); + const p = await when(E(portAllocator).allocateCustomIBCPort()); const ev1 = await events.next(); t.assert(!ev1.done); t.deepEqual(ev1.value, ['bindPort', { packet: { source_port: 'port-1' } }]);