From c798adb55d61116fa5b4117bf2f4f0c4a2739f98 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 12 Jul 2024 09:14:38 -0700 Subject: [PATCH 1/3] chore(multichain): install cleanup --- multichain-testing/scripts/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/multichain-testing/scripts/install.sh b/multichain-testing/scripts/install.sh index faa8bac917e..2fdf862b21d 100644 --- a/multichain-testing/scripts/install.sh +++ b/multichain-testing/scripts/install.sh @@ -62,7 +62,6 @@ function set_helm_args() { return 0 fi for i in $(seq 0 $num_chains); do - chain=$(yq -r ".chains[$i].name" ${CONFIGFILE}) scripts=$(yq -r ".chains[$i].scripts" ${CONFIGFILE}) if [[ "$scripts" == "null" ]]; then return 0 @@ -114,7 +113,7 @@ while [ $# -gt 0 ]; do DRY_RUN=1 shift # past argument ;; - -* | --*) + -) echo "Unknown option $1" exit 1 ;; From 0ceb25cebf7ba6d8356ecf7fffe07eead623b7d1 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 12 Jul 2024 09:14:51 -0700 Subject: [PATCH 2/3] chore: bump HELM_CHART_VERSION to 0.2.10 https://github.com/cosmology-tech/starship/compare/devnet-0.2.2...devnet-0.2.10 --- .github/workflows/multichain-e2e.yml | 2 +- multichain-testing/Makefile | 2 +- multichain-testing/config.yaml | 1 + .../scripts/fetch-starship-chain-info.ts | 15 --------------- multichain-testing/scripts/install.sh | 2 +- multichain-testing/test/auto-stake-it.test.ts | 4 ---- multichain-testing/test/stake-ica.test.ts | 7 ------- 7 files changed, 4 insertions(+), 29 deletions(-) diff --git a/.github/workflows/multichain-e2e.yml b/.github/workflows/multichain-e2e.yml index 1ac66c7a8d6..718e9d2974d 100644 --- a/.github/workflows/multichain-e2e.yml +++ b/.github/workflows/multichain-e2e.yml @@ -43,7 +43,7 @@ jobs: # uses ghcr.io/agoric/agoric-sdk:dev image (latest master) values: ./agoric-sdk/multichain-testing/config.yaml port-forward: true - version: 0.2.2 + version: 0.2.10 timeout: 30m namespace: agoric-multichain diff --git a/multichain-testing/Makefile b/multichain-testing/Makefile index 52275118340..7fa7fa1d1fd 100644 --- a/multichain-testing/Makefile +++ b/multichain-testing/Makefile @@ -5,7 +5,7 @@ FILE = config.yaml HELM_REPO = starship HELM_CHART = devnet -HELM_VERSION = v0.2.2 +HELM_VERSION = v0.2.10 ############################################################################### ### All commands ### diff --git a/multichain-testing/config.yaml b/multichain-testing/config.yaml index a82dbac5e8b..32027465055 100644 --- a/multichain-testing/config.yaml +++ b/multichain-testing/config.yaml @@ -71,6 +71,7 @@ chains: allow_messages: ['*'] faucet: enabled: true + type: starship ports: rest: 1314 rpc: 26654 diff --git a/multichain-testing/scripts/fetch-starship-chain-info.ts b/multichain-testing/scripts/fetch-starship-chain-info.ts index f809e031e16..5ffa1bc79ad 100755 --- a/multichain-testing/scripts/fetch-starship-chain-info.ts +++ b/multichain-testing/scripts/fetch-starship-chain-info.ts @@ -29,21 +29,6 @@ const ibc: { data: IBCInfo[]; } = await fetch(`${BASE_URL}ibc`).then(r => r.json()); -// UNTIL https://github.com/cosmology-tech/starship/issues/494 -const backmap = { - agoriclocal: 'agoric', - osmosislocal: 'osmosis', - gaialocal: 'cosmoshub', -}; -for (const ibcInfo of ibc.data) { - ibcInfo.chain_1.chain_name = backmap[ibcInfo.chain_1.chain_name]; - ibcInfo.chain_2.chain_name = backmap[ibcInfo.chain_2.chain_name]; - for (const c of ibcInfo.channels) { - // @ts-expect-error XXX bad typedef - c.tags.preferred = c.tags.perferred; - } -} - const chainInfo = await convertChainInfo({ chains, ibcData: ibc.data, diff --git a/multichain-testing/scripts/install.sh b/multichain-testing/scripts/install.sh index 2fdf862b21d..930212af9e4 100644 --- a/multichain-testing/scripts/install.sh +++ b/multichain-testing/scripts/install.sh @@ -24,7 +24,7 @@ NAMESPACE="" HELM_REPO="starship" HELM_CHART="starship/devnet" HELM_REPO_URL="https://cosmology-tech.github.io/starship/" -HELM_CHART_VERSION="0.2.2" +HELM_CHART_VERSION="0.2.8" HELM_NAME="agoric-multichain-testing" # check_helm function verifies the helm binary is installed diff --git a/multichain-testing/test/auto-stake-it.test.ts b/multichain-testing/test/auto-stake-it.test.ts index 89dcead678d..06cea4c4f10 100644 --- a/multichain-testing/test/auto-stake-it.test.ts +++ b/multichain-testing/test/auto-stake-it.test.ts @@ -208,10 +208,6 @@ const autoStakeItScenario = test.macro({ await fundAndTransfer(chainName, lcaAddress, transferAmount); // 7. verify the COA has active delegations - if (chainName === 'cosmoshub') { - // FIXME: delegations are not visible on cosmoshub - return t.pass('skipping verifying delegations on cosmoshub'); - } const { delegation_responses } = await retryUntilCondition( () => remoteQueryClient.queryDelegations(icaAddress), ({ delegation_responses }) => !!delegation_responses.length, diff --git a/multichain-testing/test/stake-ica.test.ts b/multichain-testing/test/stake-ica.test.ts index 78f520e6045..3be46210d9b 100644 --- a/multichain-testing/test/stake-ica.test.ts +++ b/multichain-testing/test/stake-ica.test.ts @@ -102,13 +102,6 @@ const stakeScenario = test.macro(async (t, scenario: StakeIcaScenario) => { `address for ${scenario.chain} is valid`, ); - if (scenario.chain === 'cosmoshub') { - // see https://github.com/cosmos/cosmjs/pull/1593 for upstream fix - t.pass( - `SKIP ${scenario.chain}. @cosmjs/faucet does not support ICA address length.`, - ); - return; - } const { creditFromFaucet, getRestEndpoint } = useChain(scenario.chain); const queryClient = makeQueryClient(getRestEndpoint()); From 2968d3cc57fdcd909ba7a280b9b47971c6038e79 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 12 Jul 2024 15:05:43 -0700 Subject: [PATCH 3/3] chore: bump starship to 2.4.0 Co-authored-by: 0xPatrick <0xpatrickdev@users.noreply.github.com> --- multichain-testing/package.json | 2 +- .../patches/starshipjs+2.0.0.patch | 35 ------------------- multichain-testing/test/auto-stake-it.test.ts | 4 +-- multichain-testing/test/smart-wallet.test.ts | 4 ++- multichain-testing/test/stake-ica.test.ts | 2 +- multichain-testing/test/tools/wallet.test.ts | 2 +- multichain-testing/tools/ibc-transfer.ts | 2 +- multichain-testing/tools/registry.ts | 8 +++-- multichain-testing/yarn.lock | 22 ++++++++---- 9 files changed, 31 insertions(+), 50 deletions(-) delete mode 100644 multichain-testing/patches/starshipjs+2.0.0.patch diff --git a/multichain-testing/package.json b/multichain-testing/package.json index 7088cc34fb2..781b7825dc3 100644 --- a/multichain-testing/package.json +++ b/multichain-testing/package.json @@ -36,7 +36,7 @@ "execa": "^9.2.0", "fs-extra": "^11.2.0", "patch-package": "^8.0.0", - "starshipjs": "2.0.0", + "starshipjs": "2.4.0", "tsimp": "^2.0.10", "tsx": "^4.15.6", "typescript": "^5.3.3" diff --git a/multichain-testing/patches/starshipjs+2.0.0.patch b/multichain-testing/patches/starshipjs+2.0.0.patch deleted file mode 100644 index d8c2ab9a825..00000000000 --- a/multichain-testing/patches/starshipjs+2.0.0.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/node_modules/starshipjs/hooks.js b/node_modules/starshipjs/hooks.js -index fb3e3cf..6b6567b 100644 ---- a/node_modules/starshipjs/hooks.js -+++ b/node_modules/starshipjs/hooks.js -@@ -14,7 +14,7 @@ const useRegistry = async (configFile) => { - const registryUrl = `http://localhost:${config.registry.ports.rest}`; - const urls = []; - config.chains?.forEach((chain) => { -- urls.push(`${registryUrl}/chains/${chain.name}`, `${registryUrl}/chains/${chain.name}/assets`); -+ urls.push(`${registryUrl}/chains/${chain.id}`, `${registryUrl}/chains/${chain.id}/assets`); - }); - config.relayers?.forEach((relayer) => { - urls.push(`${registryUrl}/ibc/${relayer.chains[0]}/${relayer.chains[1]}`, `${registryUrl}/ibc/${relayer.chains[1]}/${relayer.chains[0]}`); -@@ -35,10 +35,10 @@ const useChain = (chainName) => { - const chainInfo = registry.getChainInfo(chainName); - const chainID = chainInfo.chain.chain_id; - const getRpcEndpoint = () => { -- return `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.rpc}`; -+ return `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.rpc}`; - }; - const getRestEndpoint = () => { -- return `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.rest}`; -+ return `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.rest}`; - }; - const getGenesisMnemonic = async () => { - const url = `http://localhost:${config.registry.ports.rest}/chains/${chainID}/keys`; -@@ -50,7 +50,7 @@ const useChain = (chainName) => { - return chainInfo.fetcher.getChainAssetList(chainName).assets[0]; - }; - const creditFromFaucet = async (address, denom = null) => { -- const faucetEndpoint = `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.faucet}/credit`; -+ const faucetEndpoint = `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.faucet}/credit`; - if (!denom) { - denom = getCoin().base; - } diff --git a/multichain-testing/test/auto-stake-it.test.ts b/multichain-testing/test/auto-stake-it.test.ts index 06cea4c4f10..0c1ab6abbe7 100644 --- a/multichain-testing/test/auto-stake-it.test.ts +++ b/multichain-testing/test/auto-stake-it.test.ts @@ -117,7 +117,7 @@ const autoStakeItScenario = test.macro({ const { portId, channelId } = agoricConns[remoteChainInfo.chainId].transferChannel; const agoricQueryClient = makeQueryClient( - useChain('agoric').getRestEndpoint(), + await useChain('agoric').getRestEndpoint(), ); const stakingDenom = remoteChainInfo?.stakingTokens?.[0].denom; if (!stakingDenom) throw Error(`staking denom found for ${chainName}`); @@ -131,7 +131,7 @@ const autoStakeItScenario = test.macro({ // 3. Find a remoteChain validator to delegate to const remoteQueryClient = makeQueryClient( - useChain(chainName).getRestEndpoint(), + await useChain(chainName).getRestEndpoint(), ); const { validators } = await remoteQueryClient.queryValidators(); const validatorAddress = validators[0]?.operator_address; diff --git a/multichain-testing/test/smart-wallet.test.ts b/multichain-testing/test/smart-wallet.test.ts index ceaea0aa555..4dc3d664e45 100644 --- a/multichain-testing/test/smart-wallet.test.ts +++ b/multichain-testing/test/smart-wallet.test.ts @@ -29,7 +29,9 @@ test('provision smart wallet', async t => { ); t.like(walletCurrent, { liveOffers: [], offerToPublicSubscriberPaths: [] }); - const agQueryClient = makeQueryClient(useChain('agoric').getRestEndpoint()); + const agQueryClient = makeQueryClient( + await useChain('agoric').getRestEndpoint(), + ); const { balances } = await agQueryClient.queryBalances(wallets.user1); t.deepEqual( balances, diff --git a/multichain-testing/test/stake-ica.test.ts b/multichain-testing/test/stake-ica.test.ts index 3be46210d9b..df3e8c9ba1d 100644 --- a/multichain-testing/test/stake-ica.test.ts +++ b/multichain-testing/test/stake-ica.test.ts @@ -103,7 +103,7 @@ const stakeScenario = test.macro(async (t, scenario: StakeIcaScenario) => { ); const { creditFromFaucet, getRestEndpoint } = useChain(scenario.chain); - const queryClient = makeQueryClient(getRestEndpoint()); + const queryClient = makeQueryClient(await getRestEndpoint()); t.log(`Requesting faucet funds for ${address}`); // XXX fails intermittently until https://github.com/cosmology-tech/starship/issues/417 diff --git a/multichain-testing/test/tools/wallet.test.ts b/multichain-testing/test/tools/wallet.test.ts index 01c9119feec..8667d5cbcfc 100644 --- a/multichain-testing/test/tools/wallet.test.ts +++ b/multichain-testing/test/tools/wallet.test.ts @@ -16,7 +16,7 @@ const walletScenario = test.macro(async (t, scenario: string) => { t.regex(addr, new RegExp(`^${prefix}1`)); t.log('Made temp wallet:', addr); - const apiUrl = useChain(scenario).getRestEndpoint(); + const apiUrl = await useChain(scenario).getRestEndpoint(); const queryClient = makeQueryClient(apiUrl); t.log('Made query client'); diff --git a/multichain-testing/tools/ibc-transfer.ts b/multichain-testing/tools/ibc-transfer.ts index b4384f13313..173f8c9aaa6 100644 --- a/multichain-testing/tools/ibc-transfer.ts +++ b/multichain-testing/tools/ibc-transfer.ts @@ -126,7 +126,7 @@ export const createFundedWalletAndClient = async ( // TODO use telescope generated rpc client from @agoric/cosmic-proto // https://github.com/Agoric/agoric-sdk/issues/9200 const client = await SigningStargateClient.connectWithSigner( - getRpcEndpoint(), + await getRpcEndpoint(), wallet, ); return { client, wallet, address }; diff --git a/multichain-testing/tools/registry.ts b/multichain-testing/tools/registry.ts index 3d29c9baf0a..d4b15c5b8b7 100644 --- a/multichain-testing/tools/registry.ts +++ b/multichain-testing/tools/registry.ts @@ -8,6 +8,7 @@ export const makeGetFile = type GetFilePathFn = ReturnType; export const makeSetupRegistry = (getFile: GetFilePathFn) => { + let initialized = false; /** * @param {Object} opts * @param {string} [opts.config='../config.yaml'] - The path to the starship configuration file. @@ -20,8 +21,11 @@ export const makeSetupRegistry = (getFile: GetFilePathFn) => { * ``` */ const setupRegistry = async ({ config = '../config.yaml' } = {}) => { - ConfigContext.setConfigFile(getFile(config)); - ConfigContext.setRegistry(await useRegistry(ConfigContext.configFile!)); + if (initialized) return { useChain }; + const configFile = getFile(config); + const fetcher = await useRegistry(configFile); + await ConfigContext.init(configFile, fetcher); + initialized = true; return { useChain }; }; diff --git a/multichain-testing/yarn.lock b/multichain-testing/yarn.lock index 7c87c33808a..37e3e4fd458 100644 --- a/multichain-testing/yarn.lock +++ b/multichain-testing/yarn.lock @@ -608,7 +608,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0": +"@noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.2.0": version: 1.4.0 resolution: "@noble/hashes@npm:1.4.0" checksum: 10c0/8c3f005ee72e7b8f9cff756dfae1241485187254e3f743873e22073d63906863df5d4f13d441b7530ea614b7a093f0d889309f28b59850f33b66cb26a779a4a5 @@ -1319,6 +1319,15 @@ __metadata: languageName: node linkType: hard +"bip39@npm:^3.1.0": + version: 3.1.0 + resolution: "bip39@npm:3.1.0" + dependencies: + "@noble/hashes": "npm:^1.2.0" + checksum: 10c0/68f9673a0d6a851e9635f3af8a85f2a1ecef9066c76d77e6f0d58d274b5bf22a67f429da3997e07c0d2cf153a4d7321f9273e656cac0526f667575ddee28ef71 + languageName: node + linkType: hard + "blueimp-md5@npm:^2.10.0": version: 2.19.0 resolution: "blueimp-md5@npm:2.19.0" @@ -3843,7 +3852,7 @@ __metadata: execa: "npm:^9.2.0" fs-extra: "npm:^11.2.0" patch-package: "npm:^8.0.0" - starshipjs: "npm:2.0.0" + starshipjs: "npm:2.4.0" tsimp: "npm:^2.0.10" tsx: "npm:^4.15.6" typescript: "npm:^5.3.3" @@ -4081,14 +4090,15 @@ __metadata: languageName: node linkType: hard -"starshipjs@npm:2.0.0": - version: 2.0.0 - resolution: "starshipjs@npm:2.0.0" +"starshipjs@npm:2.4.0": + version: 2.4.0 + resolution: "starshipjs@npm:2.4.0" dependencies: "@chain-registry/client": "npm:1.18.1" + bip39: "npm:^3.1.0" js-yaml: "npm:^4.1.0" node-fetch: "npm:^2.6.9" - checksum: 10c0/8091142dac71b0f0544db87f0f6d101c4fa26792adda05f629dfb3c2f6d087233ede3672fa41ada2cd92d42ad07bbb17481049c491a2adba4a3114f363299121 + checksum: 10c0/e62cc540bc9e8700d3bdb61ac1261b71417f0e687c98a0e3733317d363e425c7188a205d9af70f5218e87f99195fbfb5b759b4f3f9d87823989ef6b4d90442d6 languageName: node linkType: hard