Skip to content

Commit

Permalink
fix: adopt VTRANSFER_IBC_EVENT as an action-type (#9671)
Browse files Browse the repository at this point in the history
closes: #9670

Ensure that the `VTRANSFER_IBC_EVENT` messages are plumbed through the `cosmic-swingset` layer.

Prevents chain halt when the `x/vtransfer` facilities are used.

This bug was overlooked because end-to-end testing of this facility was not completed until a late stage. Earlier unit testing used mocks of the bridge device that did not have the same problematic behaviour. More automated end-to-end IBC testing in a close-to-production setting is needed.

Fixing this `cosmic-swingset` behaviour does not require upgrade of any other components.
  • Loading branch information
michaelfig authored and gibson042 committed Jul 9, 2024
1 parent 07b0130 commit 67569d4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
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';
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
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';

/**
* @param {BootstrapPowers & {
Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/transfer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
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
2 changes: 1 addition & 1 deletion packages/vats/test/localchain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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';
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

0 comments on commit 67569d4

Please sign in to comment.