Skip to content

Commit 9f28f36

Browse files
committed
fixup! feat(orchestration): add more chain infos for fusdc
1 parent 8057723 commit 9f28f36

File tree

9 files changed

+31
-76
lines changed

9 files changed

+31
-76
lines changed

multichain-testing/scripts/fetch-starship-chain-info.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import fsp from 'node:fs/promises';
55
import prettier from 'prettier';
66

77
import { convertChainInfo } from '@agoric/orchestration/src/utils/registry.js';
8+
import { icaChainNames } from '@agoric/orchestration/scripts/fetch-chain-info.ts';
89

910
import type { IBCInfo, Chains } from '@chain-registry/types';
1011

@@ -32,7 +33,7 @@ const chainInfo = await convertChainInfo(
3233
chains,
3334
ibcData: ibc.data,
3435
},
35-
() => true,
36+
chainName => icaChainNames.has(chainName),
3637
);
3738

3839
const record = JSON.stringify(chainInfo, null, 2);

packages/boot/test/bootstrapTests/orchestration.test.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type { start as startStakeIca } from '@agoric/orchestration/src/examples/
1313
import type { Instance } from '@agoric/zoe/src/zoeService/utils.js';
1414
import type { TestFn } from 'ava';
1515
import { SIMULATED_ERRORS } from '@agoric/vats/tools/fake-bridge.js';
16-
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
1716
import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js';
1817
import { BridgeId } from '@agoric/internal';
1918
import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js';
@@ -25,6 +24,7 @@ import {
2524
insistManagerType,
2625
makeSwingsetHarness,
2726
} from '../../tools/supports.js';
27+
import { minimalChainInfos } from '../tools/chainInfo.js';
2828

2929
const test: TestFn<
3030
WalletFactoryTestContext & {
@@ -331,15 +331,7 @@ test.serial('basic-flows', async t => {
331331
'@agoric/builders/scripts/orchestration/init-basic-flows.js',
332332
[
333333
'--chainInfo',
334-
JSON.stringify(
335-
withChainCapabilities({
336-
agoric: fetchedChainInfo.agoric,
337-
osmosis: fetchedChainInfo.osmosis,
338-
dydx: fetchedChainInfo.dydx,
339-
noble: fetchedChainInfo.noble,
340-
cosmoshub: fetchedChainInfo.cosmoshub,
341-
}),
342-
),
334+
JSON.stringify(withChainCapabilities(minimalChainInfos)),
343335
'--assetInfo',
344336
JSON.stringify([
345337
[
@@ -564,15 +556,7 @@ test.serial('basic-flows - portfolio holder', async t => {
564556
'@agoric/builders/scripts/orchestration/init-basic-flows.js',
565557
[
566558
'--chainInfo',
567-
JSON.stringify(
568-
withChainCapabilities({
569-
agoric: fetchedChainInfo.agoric,
570-
osmosis: fetchedChainInfo.osmosis,
571-
dydx: fetchedChainInfo.dydx,
572-
noble: fetchedChainInfo.noble,
573-
cosmoshub: fetchedChainInfo.cosmoshub,
574-
}),
575-
),
559+
JSON.stringify(withChainCapabilities(minimalChainInfos)),
576560
'--assetInfo',
577561
JSON.stringify([
578562
[

packages/boot/test/fast-usdc/fast-usdc.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,6 @@ test.serial('distributes fees per BLD staker decision', async t => {
386386
const ContractFee = 302000n; // see split above
387387
t.is(((ContractFee - 250000n) * 5n) / 10n, 26000n);
388388

389-
if (defaultManagerType === 'xs-worker') {
390-
// XXX for some reason the code after this when run under XS fails with:
391-
// message: 'unsettled value for "kp2526"',
392-
return;
393-
}
394-
395389
const cases = [
396390
{ dest: 'agoric1a', args: ['--fixedFees', '0.25'], rxd: '250000' },
397391
{ dest: 'agoric1b', args: ['--feePortion', '0.5'], rxd: '26000' },
@@ -529,12 +523,6 @@ test.serial('LP withdraws', async t => {
529523
test.serial('restart contract', async t => {
530524
const { EV } = t.context.runUtils;
531525
await null;
532-
if (defaultManagerType === 'xs-worker') {
533-
t.is(defaultManagerType, 'xs-worker');
534-
// XXX for some reason the code after this when run under XS fails with:
535-
// message: 'unsettled value for "kp2526"',
536-
return;
537-
}
538526
const kit = await EV.vat('bootstrap').consumeItem('fastUsdcKit');
539527
const actual = await EV(kit.adminFacet).restartContract(kit.privateArgs);
540528
t.deepEqual(actual, { incarnationNumber: 1 });
@@ -549,12 +537,6 @@ test.serial('replace operators', async t => {
549537
runUtils: { EV },
550538
walletFactoryDriver: wfd,
551539
} = t.context;
552-
if (defaultManagerType === 'xs-worker') {
553-
t.is(defaultManagerType, 'xs-worker');
554-
// XXX for some reason the code after this when run under XS fails with:
555-
// message: 'unsettled value for "kp2526"',
556-
return;
557-
}
558540
const { creatorFacet } = await EV.vat('bootstrap').consumeItem('fastUsdcKit');
559541

560542
const EUD = 'dydx1anything';
@@ -603,12 +585,6 @@ test.serial('replace operators', async t => {
603585
}
604586
}
605587

606-
if (defaultManagerType === 'xs-worker') {
607-
// XXX for some reason the code after this when run under XS fails with:
608-
// message: 'unsettled value for "kp2526"',
609-
return;
610-
}
611-
612588
// Add some new oracle operator
613589
const {
614590
// any one would do

packages/boot/test/orchestration/contract-upgrade.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import type { TestFn } from 'ava';
44

55
import { BridgeId } from '@agoric/internal';
66
import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js';
7-
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
87
import { withChainCapabilities } from '@agoric/orchestration';
98
import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js';
109
import {
1110
makeWalletFactoryContext,
1211
type WalletFactoryTestContext,
1312
} from '../bootstrapTests/walletFactory.js';
13+
import { minimalChainInfos } from '../tools/chainInfo.js';
1414

1515
const test: TestFn<WalletFactoryTestContext> = anyTest;
1616
test.before(async t => {
@@ -45,15 +45,7 @@ test('resume', async t => {
4545
await evalProposal(
4646
buildProposal('@agoric/builders/scripts/testing/init-send-anywhere.js', [
4747
'--chainInfo',
48-
JSON.stringify(
49-
withChainCapabilities({
50-
agoric: fetchedChainInfo.agoric,
51-
osmosis: fetchedChainInfo.osmosis,
52-
dydx: fetchedChainInfo.dydx,
53-
noble: fetchedChainInfo.noble,
54-
cosmoshub: fetchedChainInfo.cosmoshub,
55-
}),
56-
),
48+
JSON.stringify(withChainCapabilities(minimalChainInfos)),
5749
'--assetInfo',
5850
JSON.stringify([
5951
[

packages/boot/test/orchestration/restart-contracts.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import {
99
} from '@agoric/orchestration';
1010
import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js';
1111
import type { UpdateRecord } from '@agoric/smart-wallet/src/smartWallet.js';
12-
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
1312
import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js';
1413
import {
1514
makeWalletFactoryContext,
1615
type WalletFactoryTestContext,
1716
} from '../bootstrapTests/walletFactory.js';
17+
import { minimalChainInfos } from '../tools/chainInfo.js';
1818

1919
const test: TestFn<WalletFactoryTestContext> = anyTest;
2020
test.before(async t => {
@@ -39,15 +39,7 @@ test.serial('send-anywhere', async t => {
3939
await evalProposal(
4040
buildProposal('@agoric/builders/scripts/testing/init-send-anywhere.js', [
4141
'--chainInfo',
42-
JSON.stringify(
43-
withChainCapabilities({
44-
agoric: fetchedChainInfo.agoric,
45-
osmosis: fetchedChainInfo.osmosis,
46-
dydx: fetchedChainInfo.dydx,
47-
noble: fetchedChainInfo.noble,
48-
cosmoshub: fetchedChainInfo.cosmoshub,
49-
}),
50-
),
42+
JSON.stringify(withChainCapabilities(minimalChainInfos)),
5143
'--assetInfo',
5244
JSON.stringify([
5345
[

packages/boot/test/tools/chainInfo.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
2+
3+
export const minimalChainInfos = {
4+
agoric: fetchedChainInfo.agoric,
5+
osmosis: fetchedChainInfo.osmosis,
6+
dydx: fetchedChainInfo.dydx,
7+
noble: fetchedChainInfo.noble,
8+
cosmoshub: fetchedChainInfo.cosmoshub,
9+
};

packages/orchestration/scripts/fetch-chain-info.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const outputFile = 'src/fetched-chain-info.js';
1212
/**
1313
* Names for which to fetch info
1414
*/
15-
const icaChainNames = [
15+
export const icaChainNames = new Set([
1616
'agoric',
1717
'celestia',
1818
'cosmoshub',
@@ -26,7 +26,7 @@ const icaChainNames = [
2626
'stargaze',
2727
'stride',
2828
'umee',
29-
];
29+
]);
3030

3131
const nonIcaChainNames = [
3232
'migaloo',
@@ -65,8 +65,9 @@ const client = new ChainRegistryClient({
6565
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method
6666
await client.fetchUrls();
6767

68-
const icaChainSet = new Set(icaChainNames);
69-
const chainInfo = await convertChainInfo(client, name => icaChainSet.has(name));
68+
const chainInfo = await convertChainInfo(client, name =>
69+
icaChainNames.has(name),
70+
);
7071

7172
const record = JSON.stringify(chainInfo, null, 2);
7273
const src = `/** @file Generated by fetch-chain-info.ts */\nexport default /** @type {const} } */ (${record});`;

packages/orchestration/src/exos/chain-hub.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ const CHAIN_ID_SEPARATOR = '_';
7777
/**
7878
* Vstorage keys can be only alphanumerics, dash, or underscore, which are all
7979
* valid characters in chain IDs. So, double each occurence of
80-
* {@link CHAIN_ID_SEPARATOR} in the chain ID to make it clear that it's part of
81-
* the chain ID rather than a separator.
80+
* {@link CHAIN_ID_SEPARATOR} in the chain ID so the encoded tuple can be
81+
* decoded.
8282
*
8383
* @param {string} chainId
8484
* @see {@link https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-2.md}
8585
*/
86-
export const sanitizeChainId = chainId =>
86+
export const encodeChainId = chainId =>
8787
chainId.replaceAll(
8888
CHAIN_ID_SEPARATOR,
8989
`${CHAIN_ID_SEPARATOR}${CHAIN_ID_SEPARATOR}`,
@@ -98,8 +98,8 @@ export const sanitizeChainId = chainId =>
9898
* @param {string} chainId2
9999
*/
100100
export const connectionKey = (chainId1, chainId2) => {
101-
const chainId1Sanitized = sanitizeChainId(chainId1);
102-
const chainId2Sanitized = sanitizeChainId(chainId2);
101+
const chainId1Sanitized = encodeChainId(chainId1);
102+
const chainId2Sanitized = encodeChainId(chainId2);
103103

104104
return [chainId1Sanitized, chainId2Sanitized].sort().join(CHAIN_ID_SEPARATOR);
105105
};

packages/orchestration/src/utils/registry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function toConnectionEntry(ibcInfo, name, chainInfo) {
8282
* Converts the given chain info to our local config format
8383
*
8484
* @param {Pick<ChainRegistryClient, 'chains' | 'ibcData'>} registry
85-
* @param {(chainName: string) => boolean} icaEnabled
85+
* @param {(chainName: string) => boolean} isIcaEnabled
8686
*/
87-
export const convertChainInfo = async (registry, icaEnabled) => {
87+
export const convertChainInfo = async (registry, isIcaEnabled) => {
8888
/** @type {Record<string, CosmosChainInfo>} */
8989
const chainInfo = {};
9090

@@ -96,7 +96,7 @@ export const convertChainInfo = async (registry, icaEnabled) => {
9696
stakingTokens: chain.staking?.staking_tokens,
9797
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
9898
icqEnabled: chain.chain_name === 'osmosis',
99-
icaEnabled: icaEnabled(chain.chain_name),
99+
icaEnabled: isIcaEnabled(chain.chain_name),
100100
};
101101
}
102102

0 commit comments

Comments
 (0)