Skip to content

Commit

Permalink
fix(network): use new ERef and FarRef
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jun 14, 2024
1 parent fd3a6f0 commit a18dc71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions packages/boot/test/bootstrapTests/ibcClientMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { Far } from '@endo/far';
import { V as E } from '@agoric/vow/vat.js';

/**
* @import {ListenHandler, PortAllocator} from '@agoric/network';
* @import {Connection, PortAllocator} from '@agoric/network';
* @import {FarRef, ERef} from '@agoric/vow';
*/

/**
* @param {ZCF} zcf
* @param {{
* portAllocator: ERef<PortAllocator>;
* portAllocator: FarRef<PortAllocator>;
* }} privateArgs
* @param {import('@agoric/vat-data').Baggage} _baggage
*/
Expand All @@ -20,7 +21,13 @@ export const start = async (zcf, privateArgs, _baggage) => {
const myPort = await E(portAllocator).allocateCustomIBCPort();

const { log } = console;
/**
* @type {FarRef<Connection>}
*/
let connP;
/**
* @type {ERef<string>}
*/
let ackP;

const creatorFacet = Far('CF', {
Expand Down
8 changes: 4 additions & 4 deletions packages/network/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ export const preparePortAllocator = (zone, { watch }) =>
*/
({ protocol }) => ({ protocol, lastICAPortNum: 0n, lastICQPortNum: 0n }),
{
allocateCustomIBCPort(specifiedName = '') {
async allocateCustomIBCPort(specifiedName = '') {
const { state } = this;
let localAddr = `/ibc-port/`;

Expand All @@ -1488,7 +1488,7 @@ export const preparePortAllocator = (zone, { watch }) =>
// Allocate an IBC port with a unique generated name.
return watch(E(state.protocol).bindPort(localAddr));
},
allocateICAControllerPort() {
async allocateICAControllerPort() {
const { state } = this;
state.lastICAPortNum += 1n;
return watch(
Expand All @@ -1497,7 +1497,7 @@ export const preparePortAllocator = (zone, { watch }) =>
),
);
},
allocateICQControllerPort() {
async allocateICQControllerPort() {
const { state } = this;
state.lastICQPortNum += 1n;
return watch(
Expand All @@ -1506,7 +1506,7 @@ export const preparePortAllocator = (zone, { watch }) =>
),
);
},
allocateCustomLocalPort(specifiedName = '') {
async allocateCustomLocalPort(specifiedName = '') {
const { state } = this;

let localAddr = `/local/`;
Expand Down

0 comments on commit a18dc71

Please sign in to comment.