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

fix: adopt VTRANSFER_IBC_EVENT as an action-type #9671

Merged
merged 2 commits into from
Jul 9, 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
3 changes: 2 additions & 1 deletion packages/boot/test/bootstrapTests/vtransfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import type { TestFn } from 'ava';
import type { ScopedBridgeManager } from '@agoric/vats';
import type { TransferMiddleware } from '@agoric/vats/src/transfer.js';
import type { TransferVat } from '@agoric/vats/src/vat-transfer.js';
import { BridgeId, VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { BridgeId } from '@agoric/internal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal/src/action-types.js';
import { makeSwingsetTestKit } from '../../tools/supports.ts';

const makeDefaultTestContext = async t => {
Expand Down
5 changes: 5 additions & 0 deletions packages/cosmic-swingset/src/launch-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ export async function launch({
break;
}

case ActionType.VTRANSFER_IBC_EVENT: {
p = doBridgeInbound(BRIDGE_ID.VTRANSFER, action, inboundNum);
break;
}

case ActionType.PLEASE_PROVISION: {
p = doBridgeInbound(BRIDGE_ID.PROVISION, action, inboundNum);
break;
Expand Down
1 change: 1 addition & 0 deletions packages/internal/src/action-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export const VBANK_BALANCE_UPDATE = 'VBANK_BALANCE_UPDATE';
export const WALLET_ACTION = 'WALLET_ACTION';
export const WALLET_SPEND_ACTION = 'WALLET_SPEND_ACTION';
export const INSTALL_BUNDLE = 'INSTALL_BUNDLE';
export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see a comment above declaration of IBC_EVENT that following exports describe internal events for which handling code is expected in packages/cosmic-swingset/src/launch-chain.js.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this action needs a comment any more than any other of the actions above? I'd be ok restructuring to highlight which actions come through the queue and which come through the pipe.

2 changes: 0 additions & 2 deletions packages/internal/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const BridgeId = /** @type {const} */ ({
harden(BridgeId);
/** @typedef {(typeof BridgeId)[keyof typeof BridgeId]} BridgeIdValue */

export const VTRANSFER_IBC_EVENT = 'VTRANSFER_IBC_EVENT';

export const CosmosInitKeyToBridgeId = {
vbankPort: BridgeId.BANK,
vibcPort: BridgeId.DIBC,
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/test/supports.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeIssuerKit } from '@agoric/ertp';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal/src/action-types.js';
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';
Expand Down
3 changes: 2 additions & 1 deletion packages/vats/src/proposals/transfer-proposal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
import { E } from '@endo/far';
import { BridgeId as BRIDGE_ID, VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { BridgeId as BRIDGE_ID } from '@agoric/internal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal/src/action-types.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really confused why the transfer vat needs to be aware of the action type in the first place. This seems like a layering violation. No other action type leaks past the cosmic-swingset layer.

import { makeScopedBridge } from '../bridge.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Fail, b } from '@endo/errors';
import { E } from '@endo/far';
import { M } from '@endo/patterns';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal/src/action-types.js';
import { coerceToByteSource, byteSourceToBase64 } from '@agoric/network';
import { TargetAppI, AppTransformerI } from './bridge-target.js';

Expand Down
3 changes: 2 additions & 1 deletion packages/vats/test/localchain.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// @ts-check
import { test as anyTest } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { NonNullish, VTRANSFER_IBC_EVENT } from '@agoric/internal';
import { NonNullish } from '@agoric/internal';
import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp';
import { reincarnate } from '@agoric/swingset-liveslots/tools/setup-vat-data.js';
import { withAmountUtils } from '@agoric/zoe/tools/test-utils.js';
import { makeDurableZone } from '@agoric/zone/durable.js';
import { getInterfaceOf } from '@endo/marshal';
import { VTRANSFER_IBC_EVENT } from '@agoric/internal/src/action-types.js';
import { prepareVowTools, heapVowE as E } from '@agoric/vow/vat.js';
import { prepareLocalChainTools } from '../src/localchain.js';
import { prepareBridgeTargetModule } from '../src/bridge-target.js';
Expand Down
Loading