Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(vats): Remove makeBridgeTargetKit from prepareTransferTools #9471

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/orchestration/test/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { makeIssuerKit } from '@agoric/ertp';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js';
import { prepareLocalChainTools } from '@agoric/vats/src/localchain.js';
import { prepareBridgeTargetModule } from '@agoric/vats/src/bridge-target.js';
import { prepareTransferTools } from '@agoric/vats/src/transfer.js';
import { makeFakeBankManagerKit } from '@agoric/vats/tools/bank-utils.js';
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
Expand Down Expand Up @@ -66,11 +67,14 @@ export const commonSetup = async t => {
);

const transferBridge = makeFakeTransferBridge(rootZone);
const { makeTransferMiddlewareKit, makeBridgeTargetKit } =
prepareTransferTools(
rootZone.subZone('transfer'),
prepareVowTools(rootZone.subZone('vows')),
);
const { makeBridgeTargetKit } = prepareBridgeTargetModule(
rootZone.subZone('bridge'),
);
const { makeTransferMiddlewareKit } = prepareTransferTools(
rootZone.subZone('transfer'),
prepareVowTools(rootZone.subZone('vows')),
);

const { finisher, interceptorFactory, transferMiddleware } =
makeTransferMiddlewareKit();
const bridgeTargetKit = makeBridgeTargetKit(
Expand Down
13 changes: 2 additions & 11 deletions packages/vats/src/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import { E } from '@endo/far';
import { M } from '@endo/patterns';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { coerceToByteSource, byteSourceToBase64 } from '@agoric/network';
import {
prepareBridgeTargetModule,
TargetAppI,
AppTransformerI,
} from './bridge-target.js';
import { TargetAppI, AppTransformerI } from './bridge-target.js';

/**
* @import {TargetApp, TargetHost} from './bridge-target.js'
Expand Down Expand Up @@ -260,15 +256,10 @@ const prepareTransferMiddlewareKit = (zone, makeTransferInterceptor) =>
*/
export const prepareTransferTools = (zone, vowTools) => {
const makeTransferInterceptor = prepareTransferInterceptor(zone, vowTools);
const { makeBridgeTargetKit } = prepareBridgeTargetModule(
zone.subZone('bridge-target'),
);

const makeTransferMiddlewareKit = prepareTransferMiddlewareKit(
zone,
makeTransferInterceptor,
);

return harden({ makeTransferMiddlewareKit, makeBridgeTargetKit });
return harden({ makeTransferMiddlewareKit });
};
harden(prepareTransferTools);
11 changes: 7 additions & 4 deletions packages/vats/test/localchain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getInterfaceOf } from '@endo/marshal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { prepareVowTools } from '@agoric/vow/vat.js';
import { prepareLocalChainTools } from '../src/localchain.js';
import { prepareBridgeTargetModule } from '../src/bridge-target.js';
import { prepareTransferTools } from '../src/transfer.js';
import { makeFakeBankManagerKit } from '../tools/bank-utils.js';
import {
Expand Down Expand Up @@ -45,14 +46,16 @@ const makeTestContext = async _t => {
);

const transferZone = makeDurableZone(provideBaggage('transfer'));
const transferBridge = makeFakeTransferBridge(transferZone.subZone('bridge'));
const transferTools = prepareTransferTools(
const bridgeZone = transferZone.subZone('bridge');
const transferBridge = makeFakeTransferBridge(bridgeZone);
const { makeBridgeTargetKit } = prepareBridgeTargetModule(bridgeZone);
const { makeTransferMiddlewareKit } = prepareTransferTools(
transferZone,
prepareVowTools(transferZone.subZone('vows')),
);
const { finisher, interceptorFactory, transferMiddleware } =
transferTools.makeTransferMiddlewareKit();
const bridgeTargetKit = transferTools.makeBridgeTargetKit(
makeTransferMiddlewareKit();
const bridgeTargetKit = makeBridgeTargetKit(
transferBridge,
VTRANSFER_IBC_EVENT,
interceptorFactory,
Expand Down
Loading