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(orchestration): chain-info #9712

Merged
merged 5 commits into from
Jul 15, 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
5 changes: 5 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ jobs:
with:
datadog-token: ${{ secrets.DATADOG_API_KEY }}

test-multichain-e2e:
needs: pre_check
if: needs.pre_check.outputs.should_run == 'true'
uses: ./.github/workflows/multichain-e2e.yml

finalize-integration-result:
needs:
- pre_check
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/multichain-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ name: Multichain E2E Tests

on:
workflow_dispatch:
push:
branches:
# $default-branch
- master
- 'release-*'
- 'dev-*'
tags:
- '@agoric/sdk@*'
workflow_call:

jobs:
multichain-e2e:
Expand Down Expand Up @@ -75,3 +68,18 @@ jobs:
- name: Run @agoric/multichain-testing E2E Tests
run: yarn test
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric validator logs
if: always()
run: kubectl logs agoriclocal-genesis-0 --container=validator || true
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric-osmosis relayer logs
if: always()
run: kubectl logs hermes-agoric-osmosis-0 --container=relayer || true
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric-cosmos relayer logs
if: always()
run: kubectl logs hermes-agoric-gaia-0 --container=relayer || true
working-directory: ./agoric-sdk/multichain-testing
22 changes: 20 additions & 2 deletions packages/boot/test/bootstrapTests/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ test.serial('config', async t => {
node: 'agoricNames.chainConnection',
});
}
{
const connection = await EV(agoricNames).lookup(
'chainConnection',
'agoric-3_osmosis-1',
);
t.like(connection, {
id: 'connection-1',
client_id: '07-tendermint-1',
counterparty: {
client_id: '07-tendermint-2109',
connection_id: 'connection-1649',
},
transferChannel: {
counterPartyChannelId: 'channel-320',
channelId: 'channel-1',
},
});
}
});

test.skip('stakeOsmo - queries', async t => {
Expand Down Expand Up @@ -223,8 +241,8 @@ test.serial('revise chain info', async t => {
'cosmoshub-4_hot-1',
);
t.like(connection, {
id: 'connection-99',
client_id: '07-tendermint-3',
id: 'connection-1',
client_id: '07-tendermint-2',
});
});

Expand Down
204 changes: 102 additions & 102 deletions packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.md

Large diffs are not rendered by default.

Binary file not shown.
39 changes: 36 additions & 3 deletions packages/orchestration/src/chain-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { connectionKey } from './exos/chain-hub.js';
import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
import { CosmosChainInfoShape } from './typeGuards.js';

/** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */
/** @import {CosmosChainInfo, EthChainInfo, IBCConnectionInfo} from './types.js'; */

/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */

Expand Down Expand Up @@ -65,6 +65,35 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (

/** @typedef {typeof knownChains} KnownChains */

/**
* Utility to reverse connection info perspective.
*
* @param {IBCConnectionInfo} connInfo
* @returns {IBCConnectionInfo}
*/
const reverseConnInfo = connInfo => {
0xpatrickdev marked this conversation as resolved.
Show resolved Hide resolved
const { transferChannel } = connInfo;
return {
id: connInfo.counterparty.connection_id,
client_id: connInfo.counterparty.client_id,
counterparty: {
client_id: connInfo.client_id,
connection_id: connInfo.id,
prefix: {
key_prefix: '',
},
},
state: connInfo.state,
transferChannel: {
...transferChannel,
channelId: transferChannel.counterPartyChannelId,
counterPartyChannelId: transferChannel.channelId,
portId: transferChannel.counterPartyPortId,
counterPartyPortId: transferChannel.portId,
},
};
};

/**
* @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
* @param {string} name
Expand All @@ -90,12 +119,16 @@ export const registerChain = async (
.then(() => log(`registered agoricNames chain.${name}`)),
];

const { chainId } = chainInfo;
// FIXME updates redundantly, twice per edge
for (const [counterChainId, connInfo] of Object.entries(connections)) {
const key = connectionKey(chainInfo.chainId, counterChainId);
const key = connectionKey(chainId, counterChainId);
const normalizedConnInfo =
chainId < counterChainId ? connInfo : reverseConnInfo(connInfo);

promises.push(
E(connAdmin)
.update(key, connInfo)
.update(key, normalizedConnInfo)
.then(() => log(`registering agoricNames chainConnection.${key}`)),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/src/exos/remote-chain-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ const prepareRemoteChainFacadeKit = (
return watch(
E(orchestration).makeAccount(
remoteChainInfo.chainId,
connectionInfo.id,
connectionInfo.counterparty.connection_id,
connectionInfo.id,
),
this.facets.makeAccountWatcher,
);
Expand Down
Loading
Loading