From 3c551da84bd2385bd3c5f84dda704503a3022ceb Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 10 Jun 2024 18:23:50 -0700 Subject: [PATCH 01/16] test: rename config test leading 'boot' was sharing prefix with `bootstrapTests` --- .../{boot-config.test.js => configs.test.js} | 0 .../boot/test/snapshots/boot-config.test.js.snap | Bin 2131 -> 0 bytes ...boot-config.test.js.md => configs.test.js.md} | 4 ++-- .../boot/test/snapshots/configs.test.js.snap | Bin 0 -> 2128 bytes 4 files changed, 2 insertions(+), 2 deletions(-) rename packages/boot/test/{boot-config.test.js => configs.test.js} (100%) delete mode 100644 packages/boot/test/snapshots/boot-config.test.js.snap rename packages/boot/test/snapshots/{boot-config.test.js.md => configs.test.js.md} (99%) create mode 100644 packages/boot/test/snapshots/configs.test.js.snap diff --git a/packages/boot/test/boot-config.test.js b/packages/boot/test/configs.test.js similarity index 100% rename from packages/boot/test/boot-config.test.js rename to packages/boot/test/configs.test.js diff --git a/packages/boot/test/snapshots/boot-config.test.js.snap b/packages/boot/test/snapshots/boot-config.test.js.snap deleted file mode 100644 index 06ee7ce87db4ab26a5e4c0cdc7bd1e9337c05c25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2131 zcmV-Z2(0%(RzVNYo~qB8U8vBK-mVjU7ssG<@n|$=Rg4mo+&La)zTJ`3*l@E+Zan()a&R!9+yg ze7EFWq#_}^$&MylCMH)b%}B)F62W*pNn^50*IcmjNBaIl7!pB#fBf%PcfPqJ|GxP8 z&bMFw{WxSRP_v#qnEZ8;ka!caWO6!r^8Ck>G+P#=Aj(oflUHQL6BaxpTbcrMM3yuH z)+y?qo=kZ{f{4yQRru=V{N8l(XU=#!m5s%ZC)0FC0*ZB=gj5l>DxYqDW5z&mr|J5Wf^GO-5D;u_CgrA*7&solR4QBTh# zb)27d2$%jrlxq&Q5fAtA6%n~A?A@{t{0cwQil?4S)l*I&Q!JP;5Dv3nwdZ;9Zw z!KI%0RbVQYorfE^p-Bv8A@hnJFfOE5;L=w1E%_Vw=qnzD(xy`1GGXD0*4p;%Ub+O^ z(xg^ZG`ncBxa2LT*dNfWz99L#8ca6&1@a}OPgyL^0x%)16{_7`RkJkBVD^vVD<<-M zSt~|;rB<0`>06d<-I{|nhaW^xsePHJzLv_L1}uSe*+TUXwNnoEEsIk@q9~urtANH} zVl>Zoy9nhWwYwZ4xQ}Gg+ z&`)yU=;PA(Ks?}AkWD$V$)H#)v*e^DCrOC2Qr=PJrJ_}5)V$f%f*1}bA#DA2ZLK)0 zrxXsSIB*J!SLzw1?yu~S1Ee$9y~9Mwj9P!cC03PaTbhm7_mqMRL&p=;+g0(JZ&7sS zEl>B6r(ug$IB_e%3hg>pq4AW&WQ9L<+}USZxmHzOrROqFA+=|Qo`A&xuOSmqaUZ^O zo+u}Cg;2Rf>75Ibi03rTB6L1?avVO_;`pU3S8*V#{FOINk15^#zLgPGSCKxmkKv#n zIM{FbIyDVxx+ctm%}-g z8*OR~=i#{x@8gEIB~Q(s+`~xEF0B4WaF@NvQu5RbF#&V{DO+jC~mCEclJVd z&1oWUxZ202kh-pA4pw+C%spX>QD*ekOeRXkAibl%f47KMLc#Hs2T9M~EKYaS^qK3xbK&c0z5(3y&hDZS`ga2&L5 zKl(EVre-I*;IdmR4(0pvh|yTgNW9TAGUEr|h|pesF?+d#3u#E;^sn965aDCR_Q06iIJNG9Fuc#Qa=t(M z-D6}G^Azqy=CKgd>evZw61cPPcMA5z0li2VY?SmYS?RmBM(jGw-l)0j%W}|<_Dz}C>oR!)$GRDN#M~#t> zfo$Kv$2|GH&`~inNkhMrysbliB4u`&o$Q~vNgAn`H`trn|7}^&1xw`6khN%LP(G(O z7o((|{fXdVi}xJOtRMM($Prdz2T6dX>$Cbo{es&=v5|As&}@dY<)?B{rgnW7#e^z7 z4q7B0q4GN(NWEXC9F5+er;s0%?(T_KhNE>MOwtjIygl3WADD`4SClNw(5n6aQsdpXJMHx9OOEe7Nv6G{jIZD#CW~1obT?j>LqolSgX_2Rtd7Fl7 zC##ld+R1nduuTeZL3L3kt!9Gl7G!c&xpLtuyz23errRXo3~sle7h7*Hso?1gYvHq= zre0xc;@3ZIynsGA!+#ELuMd#8R#|ifsFzbM3;I|sg}yd((Vg3B{@S^zjf@HIw~;cI z#KNhR%DgN^fyvH-3tB!7pN<0p!~J!bnO!L<)xJ_8=0X*TnC<;IqPJ6EPe?ceSU@k`U;FR51!wKqg&lOV-Im^+{0F>Z J1kU?P000L|Fkt`y diff --git a/packages/boot/test/snapshots/boot-config.test.js.md b/packages/boot/test/snapshots/configs.test.js.md similarity index 99% rename from packages/boot/test/snapshots/boot-config.test.js.md rename to packages/boot/test/snapshots/configs.test.js.md index e3f52c89068..aed7e4a6b82 100644 --- a/packages/boot/test/snapshots/boot-config.test.js.md +++ b/packages/boot/test/snapshots/configs.test.js.md @@ -1,6 +1,6 @@ -# Snapshot report for `test/boot-config.test.js` +# Snapshot report for `test/configs.test.js` -The actual snapshot is saved in `boot-config.test.js.snap`. +The actual snapshot is saved in `configs.test.js.snap`. Generated by [AVA](https://avajs.dev). diff --git a/packages/boot/test/snapshots/configs.test.js.snap b/packages/boot/test/snapshots/configs.test.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..33ef5e287c925713164d0d881d5d99c1aea97cf5 GIT binary patch literal 2128 zcmV-W2(R}+RzV00000000B+T3c`1HWcnQ3EbuSv7vAaQH$YbI*{qKKIh*j= zKZtQ-fL+Y}$9M~5W=b91f;JwdKSe21`BG8}2SS!C31U!!6{CJfB#VG#Rfh{Z^DVTE zr^Nj`xIvsEqINH*j7Q@TZ81cx`nP27{H?DT3DZ6m_LdxnD^ywAefP2@afEnfD*xtdP|Zpiq0CG9SCvt-&#pb7AVT3AAl=qlNjOg_Y>NeE z6w{S{Mycp!Khg%o>}DE#6E6iR&{fwo$D-xR3md}2OI;?PRVo z$|2FHa|yV-Kq4W^`P?h9zpwf6OPj9zKvs@d_GyopM((#(1~gqp`pn&ihrefIzi0E* z)TB$QU&C+f+H*1cH3QcG)460Es0VkA+Rw1awLKkha{D#3#;f%?$Jym@j?#@*Sk2YQ z+=usZ!`qRkW-m_FBsF_+Ixf%2=||~D`mx_R*=w%bIoZ*P?1HLxBfqg~>+CWm%@I#; zxW;1BSY78b11oAT%spX>LA}mrq}J_@x0md^(97rYB;lA@1Q}%!h9@kFu#`yKQ7vXU z;}++HBOn<+0}v_uf4$iLi%U)As^eOUA8t2rdBmbf17tHofw|=$%B?E>>>I{z+)u^^ z=qFZexq)#ejy*`dXE`f z&7?E*21s$nSu{&%NRTmoCbLY%L*T}T#%zbdp?78p1ECgC1);yW6OJW@fLLZ#MnCgg zAk*xIv=PWDo%gf^lkiU!aVjYX2et;mng#sbR znw#x|%kHr_CEuSAjHsLex-oLS$~byw4-Tvy8=UHZTOrGq3c4dZ~+=D0F z!)L`iQEf@tPbrqzZro;7qk-KjI{D7+Y6c!0|9 za3J+=nldzccb-zlK_hohylFT(C&FeOp_BJ#oBjf;YJRinZ8!drb{bUpNb&m78XTsY%{k z+Uf+>=~?6Fk**yBMct?@`U138QZEbEi8=~>ZG15Yx0V0Kxv7ng4eqzmvZll#sg=rV zMe+iZTSP5r)k)OZ*ds9ftHaLhT1lxID;;8P6nEEy7XCU;-CVX(GYT-Rbo5TyV^O1O z#ZFT_#OR>2(9y|^r-0GPhHIPX)u&b?S#P4L+R)2ruW4$k9TA19@#OMzv}+@zk!lnn`bGz@3oP4B!C0%< Date: Mon, 10 Jun 2024 15:46:09 -0700 Subject: [PATCH 02/16] lint: .ts in scripts dir is also dev --- packages/eslint-config/eslint-config.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config/eslint-config.cjs b/packages/eslint-config/eslint-config.cjs index 650f0b5e90c..aed217ac02b 100644 --- a/packages/eslint-config/eslint-config.cjs +++ b/packages/eslint-config/eslint-config.cjs @@ -80,8 +80,8 @@ module.exports = { '**/*.config.*.js', // leading wildcard to work in CLI (package path) and IDE (repo path) '**/test/**', - '**/demo*/**/*js', - '**/scripts/**/*js', + '**/demo*/**', + '**/scripts/**', ], }, ], From 3e8a168541276d3095f312468bce865892aafdec Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 05:54:13 -0700 Subject: [PATCH 03/16] fix: omit 'connections' from agoricNames.chain --- packages/orchestration/src/utils/chainHub.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index fda7a005254..0bf6c21b277 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -124,12 +124,10 @@ export const registerChain = async (agoricNamesAdmin, name, chainInfo) => { await E(agoricNamesAdmin).provideChild('chainConnection'); mustMatch(chainInfo, CosmosChainInfoShape); - // XXX chainInfo.connections is redundant here. - await E(nameAdmin).update(name, chainInfo); + const { connections, ...vertex } = chainInfo; + await E(nameAdmin).update(name, vertex); - for await (const [destChainId, connInfo] of Object.entries( - chainInfo.connections, - )) { + for await (const [destChainId, connInfo] of Object.entries(connections)) { const key = connectionKey(chainInfo.chainId, destChainId); await E(connAdmin).update(key, connInfo); } From e6bc00828b3141b635e186d115812aef18764c91 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 10 Jun 2024 15:59:14 -0700 Subject: [PATCH 04/16] feat: script to fetch chain info --- packages/orchestration/package.json | 5 +- .../orchestration/scripts/fetch-chain-info.ts | 52 +++++++++++ .../orchestration/src/fetched-chain-info.js | 91 ++++++++++++++++++ patches/@chain-registry+client+1.47.4.patch | 21 +++++ yarn.lock | 92 +++++++++++++++++-- 5 files changed, 251 insertions(+), 10 deletions(-) create mode 100755 packages/orchestration/scripts/fetch-chain-info.ts create mode 100644 packages/orchestration/src/fetched-chain-info.js create mode 100644 patches/@chain-registry+client+1.47.4.patch diff --git a/packages/orchestration/package.json b/packages/orchestration/package.json index 029873261da..42c12b46947 100644 --- a/packages/orchestration/package.json +++ b/packages/orchestration/package.json @@ -10,6 +10,7 @@ }, "scripts": { "build": "exit 0", + "codegen": "scripts/fetch-chain-info.ts", "prepack": "tsc --build tsconfig.build.json", "postpack": "git clean -f '*.d.ts*'", "test": "ava", @@ -50,10 +51,12 @@ "@endo/patterns": "^1.4.0" }, "devDependencies": { + "@chain-registry/client": "^1.47.4", "@cosmjs/amino": "^0.32.3", "@cosmjs/proto-signing": "^0.32.3", "@endo/ses-ava": "^1.2.2", - "ava": "^5.3.1" + "ava": "^5.3.1", + "prettier": "^3.3.2" }, "ava": { "extensions": { diff --git a/packages/orchestration/scripts/fetch-chain-info.ts b/packages/orchestration/scripts/fetch-chain-info.ts new file mode 100755 index 00000000000..2836db9ed80 --- /dev/null +++ b/packages/orchestration/scripts/fetch-chain-info.ts @@ -0,0 +1,52 @@ +#!/usr/bin/env tsx +/** @file Fetch canonical chain info to generate the minimum needed for agoricNames */ +import { ChainRegistryClient } from '@chain-registry/client'; +import fsp from 'node:fs/promises'; +import prettier from 'prettier'; +import type { CosmosChainInfo } from '../src/cosmos-api.js'; + +// XXX script assumes it's run from the package path +// XXX .json would be more apt; UNTIL https://github.com/endojs/endo/issues/2110 +const outputFile = 'src/fetched-chain-info.js'; + +/** + * Names for which to fetch info + */ +const chainNames = [ + 'celestia', + 'cosmoshub', + 'dydx', + 'juno', + 'neutron', + 'noble', + 'omniflixhub', + 'osmosis', + 'secretnetwork', + 'stargaze', + 'stride', +]; + +const client = new ChainRegistryClient({ + chainNames, +}); + +// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method +await client.fetchUrls(); + +const chainInfo = {} as Record; + +for (const name of chainNames) { + const chain = client.getChain(name); + chainInfo[name] = { + chainId: chain.chain_id, + stakingTokens: chain.staking?.staking_tokens, + }; +} + +const src = `/** @file Generated by fetch-chain-info.ts */\nexport default ${JSON.stringify(chainInfo, null, 2)};`; +const prettySrc = await prettier.format(src, { + parser: 'typescript', + singleQuote: true, + trailingComma: 'all', +}); +await fsp.writeFile(outputFile, prettySrc); diff --git a/packages/orchestration/src/fetched-chain-info.js b/packages/orchestration/src/fetched-chain-info.js new file mode 100644 index 00000000000..20a56752835 --- /dev/null +++ b/packages/orchestration/src/fetched-chain-info.js @@ -0,0 +1,91 @@ +/** @file Generated by fetch-chain-info.ts */ +export default { + celestia: { + chainId: 'celestia', + stakingTokens: [ + { + denom: 'utia', + }, + ], + }, + cosmoshub: { + chainId: 'cosmoshub-4', + stakingTokens: [ + { + denom: 'uatom', + }, + ], + }, + dydx: { + chainId: 'dydx-mainnet-1', + stakingTokens: [ + { + denom: 'adydx', + }, + ], + }, + juno: { + chainId: 'juno-1', + stakingTokens: [ + { + denom: 'ujuno', + }, + ], + }, + neutron: { + chainId: 'neutron-1', + stakingTokens: [ + { + denom: 'untrn', + }, + ], + }, + noble: { + chainId: 'noble-1', + stakingTokens: [ + { + denom: 'ustake', + }, + ], + }, + omniflixhub: { + chainId: 'omniflixhub-1', + stakingTokens: [ + { + denom: 'uflix', + }, + ], + }, + osmosis: { + chainId: 'osmosis-1', + stakingTokens: [ + { + denom: 'uosmo', + }, + ], + }, + secretnetwork: { + chainId: 'secret-4', + stakingTokens: [ + { + denom: 'uscrt', + }, + ], + }, + stargaze: { + chainId: 'stargaze-1', + stakingTokens: [ + { + denom: 'ustars', + }, + ], + }, + stride: { + chainId: 'stride-1', + stakingTokens: [ + { + denom: 'ustrd', + }, + ], + }, +}; diff --git a/patches/@chain-registry+client+1.47.4.patch b/patches/@chain-registry+client+1.47.4.patch new file mode 100644 index 00000000000..69b1b514c29 --- /dev/null +++ b/patches/@chain-registry+client+1.47.4.patch @@ -0,0 +1,21 @@ +diff --git a/node_modules/@chain-registry/client/fetcher.js b/node_modules/@chain-registry/client/fetcher.js +index 92177df..d4d9883 100644 +--- a/node_modules/@chain-registry/client/fetcher.js ++++ b/node_modules/@chain-registry/client/fetcher.js +@@ -8,6 +8,7 @@ const utils_1 = require("@chain-registry/utils"); + const bfs_path_1 = require("bfs-path"); + const cross_fetch_1 = __importDefault(require("cross-fetch")); + const chain_info_1 = require("./chain-info"); ++const { error } = require("console"); + const fetchUrl = (url) => { + return (0, cross_fetch_1.default)(url).then((res) => { + if (res.status >= 400) { +@@ -152,7 +153,7 @@ class ChainRegistryFetcher { + this.update(data); + } + async fetchUrls() { +- return Promise.all(this.urls.map((url) => this.fetch(url))); ++ return Promise.all(this.urls.map((url) => this.fetch(url).catch(reason => console.error("Failed to fetch", url)))); + } + } + exports.ChainRegistryFetcher = ChainRegistryFetcher; diff --git a/yarn.lock b/yarn.lock index cbed3f4d19d..2f68ae27e00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1096,6 +1096,30 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@chain-registry/client@^1.47.4": + version "1.47.4" + resolved "https://registry.yarnpkg.com/@chain-registry/client/-/client-1.47.4.tgz#886233b5b718ca34c4ea9143fd3478009cd09f3c" + integrity sha512-7e0MEY1xVyRScXTWK2T8u0j0NZn1vXctStdWGZsp9sLee0+2eSvZbW0uYIKdH+7XvwRhx+knkbBtKU29QHKjAA== + dependencies: + "@chain-registry/types" "^0.44.4" + "@chain-registry/utils" "^1.45.4" + bfs-path "^1.0.2" + cross-fetch "^3.1.5" + +"@chain-registry/types@^0.44.4": + version "0.44.4" + resolved "https://registry.yarnpkg.com/@chain-registry/types/-/types-0.44.4.tgz#d903e9c35477da88026807c5cac4caed2235c4dd" + integrity sha512-EHow6xgTM0pe5mfm7kp1ApbJI83Bb0vXaG+LBxLcGXC6VfqCIVcT7Ki5PsdbYfHrfekoH1urXORUJo51F4ihQA== + +"@chain-registry/utils@^1.45.4": + version "1.45.4" + resolved "https://registry.yarnpkg.com/@chain-registry/utils/-/utils-1.45.4.tgz#ab077fa5ee6e204bf7e60adb8f773702330049b9" + integrity sha512-N0702U78CkucKA2e/g19/GFn9wEEJAeFvlDuX+vZ2cMmgAUuSCNXpYLV55crPaPq/s4RTeulJL7DVBb+irQQsg== + dependencies: + "@chain-registry/types" "^0.44.4" + bignumber.js "9.1.2" + sha.js "^2.4.11" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -3690,18 +3714,23 @@ debug "^4.3.4" ts-api-utils "^1.3.0" +"@typescript-eslint/types@7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.13.0.tgz#0cca95edf1f1fdb0cfe1bb875e121b49617477c5" + integrity sha512-QWuwm9wcGMAuTsxP+qz6LBBd3Uq8I5Nv8xb0mk54jmNoCyDspnMvVsOxI6IsMmway5d1S9Su2+sCKv1st2l6eA== + "@typescript-eslint/types@7.7.1": version "7.7.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.1.tgz#f903a651fb004c75add08e4e9e207f169d4b98d7" integrity sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w== "@typescript-eslint/typescript-estree@7.7.1", "@typescript-eslint/typescript-estree@^7.7.1": - version "7.7.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz#5cafde48fe390fe1c1b329b2ce0ba8a73c1e87b2" - integrity sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ== + version "7.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.0.tgz#4cc24fc155088ebf3b3adbad62c7e60f72c6de1c" + integrity sha512-cAvBvUoobaoIcoqox1YatXOnSl3gx92rCZoMRPzMNisDiM12siGilSM4+dJAekuuHTibI2hVC2fYK79iSFvWjw== dependencies: - "@typescript-eslint/types" "7.7.1" - "@typescript-eslint/visitor-keys" "7.7.1" + "@typescript-eslint/types" "7.13.0" + "@typescript-eslint/visitor-keys" "7.13.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -3722,6 +3751,14 @@ "@typescript-eslint/typescript-estree" "7.7.1" semver "^7.6.0" +"@typescript-eslint/visitor-keys@7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.0.tgz#2eb7ce8eb38c2b0d4a494d1fe1908e7071a1a353" + integrity sha512-nxn+dozQx+MK61nn/JP+M4eCkHDSxSLDpgE3WcQo0+fkjEolnaB5jswvIKC4K56By8MMgIho7f1PVxERHEo8rw== + dependencies: + "@typescript-eslint/types" "7.13.0" + eslint-visitor-keys "^3.4.3" + "@typescript-eslint/visitor-keys@7.7.1": version "7.7.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz#da2294796220bb0f3b4add5ecbb1b9c3f4f65798" @@ -4313,6 +4350,16 @@ better-sqlite3@^9.1.1: bindings "^1.5.0" prebuild-install "^7.1.1" +bfs-path@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bfs-path/-/bfs-path-1.0.2.tgz#9b5fa4b8c4ad226597fc4d2ee15398bdcc644a07" + integrity sha512-KTKx2JJtAAAT7C/rJYDXXWA2VLPycAS4kwFktKsxUo0hj4UTtw/Gm5PJuY7Uf3xSlIQNo7HRCSWei2ivncVwbQ== + +bignumber.js@9.1.2: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + bin-links@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.3.tgz#3842711ef3db2cd9f16a5f404a996a12db355a6e" @@ -5112,6 +5159,13 @@ cosmjs-types@^0.9.0: resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.9.0.tgz#c3bc482d28c7dfa25d1445093fdb2d9da1f6cfcc" integrity sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ== +cross-fetch@^3.1.5: + version "3.1.8" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" + integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== + dependencies: + node-fetch "^2.6.12" + cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -7103,7 +7157,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -8961,6 +9015,13 @@ node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: dependencies: whatwg-url "^5.0.0" +node-fetch@^2.6.12: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + node-gyp-build@<4.0, node-gyp-build@^3.9.0: version "3.9.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-3.9.0.tgz#53a350187dd4d5276750da21605d1cb681d09e25" @@ -9859,6 +9920,11 @@ prettier@^3.0.0, prettier@^3.2.5: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== +prettier@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" + integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== + pretty-format@^29.5.0: version "29.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a" @@ -9937,9 +10003,9 @@ proto-list@~1.2.1: integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= protobufjs@^6.8.8, protobufjs@^7.2.4, protobufjs@^7.2.6: - version "7.2.6" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215" - integrity sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw== + version "7.3.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.3.0.tgz#a32ec0422c039798c41a0700306a6e305b9cb32c" + integrity sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" @@ -10538,6 +10604,14 @@ sh-syntax@^0.4.1: dependencies: tslib "^2.6.2" +sha.js@^2.4.11: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shallow-clone@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" From 54138722931534b0c039754ac586ddf3d6eb684b Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 10 Jun 2024 16:12:17 -0700 Subject: [PATCH 05/16] chore: pare CosmosChainInfo to essentials --- packages/orchestration/src/chain-info.js | 28 +++---------------- packages/orchestration/src/cosmos-api.ts | 9 +++--- packages/orchestration/src/facade.js | 4 --- packages/orchestration/src/typeGuards.js | 6 ++-- packages/orchestration/src/utils/chainHub.js | 2 +- .../test/examples/sendAnywhere.test.ts | 6 ---- 6 files changed, 11 insertions(+), 44 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index 8e343c157b1..eaa620acab6 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -65,47 +65,27 @@ export const wellKnownChainInfo = delay_period: 0n, }, }, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, }, // https://github.com/cosmos/chain-registry/blob/master/stride/chain.json stride: { chainId: 'stride-1', - connections: {}, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - ibcHooksEnabled: true, stakingTokens: [{ denom: 'ustride' }], + connections: {}, }, cosmos: { chainId: 'cosmoslocal', - connections: {}, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - ibcHooksEnabled: true, stakingTokens: [{ denom: 'uatom' }], + connections: {}, }, celestia: { chainId: 'celestia', - connections: {}, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - ibcHooksEnabled: true, stakingTokens: [{ denom: 'utia' }], + connections: {}, }, osmosis: { chainId: 'osmosislocal', - connections: {}, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - ibcHooksEnabled: true, stakingTokens: [{ denom: 'uosmo' }], + connections: {}, }, }) ); diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index 5306de19b60..0a1e5f186fa 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -67,11 +67,10 @@ export type IBCConnectionInfo = { */ export type CosmosChainInfo = { chainId: string; - connections: Record; // chainId or wellKnownName - icaEnabled: boolean; - icqEnabled: boolean; - pfmEnabled: boolean; - ibcHooksEnabled: boolean; + + connections?: Record; // chainId or wellKnownName + // UNTIL https://github.com/Agoric/agoric-sdk/issues/9326 + icqEnabled?: boolean; /** * cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117 diff --git a/packages/orchestration/src/facade.js b/packages/orchestration/src/facade.js index 7ea851128c6..0cb417d2d80 100644 --- a/packages/orchestration/src/facade.js +++ b/packages/orchestration/src/facade.js @@ -21,10 +21,6 @@ const mockLocalChainInfo = { allegedName: 'agoric', chainId: 'agoriclocal', connections: anyVal, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, }; /** diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index d55a60230a9..aba82f6161c 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -75,13 +75,11 @@ export const IBCConnectionInfoShape = M.splitRecord({ export const CosmosChainInfoShape = M.splitRecord( { chainId: M.string(), - connections: M.record(), }, { + connections: M.record(), stakingTokens: M.arrayOf({ denom: M.string() }), - icaEnabled: M.boolean(), + // UNTIL https://github.com/Agoric/agoric-sdk/issues/9326 icqEnabled: M.boolean(), - pfmEnabled: M.boolean(), - ibcHooksEnabled: M.boolean(), }, ); diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index 0bf6c21b277..d3f9bbeacb7 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -124,7 +124,7 @@ export const registerChain = async (agoricNamesAdmin, name, chainInfo) => { await E(agoricNamesAdmin).provideChild('chainConnection'); mustMatch(chainInfo, CosmosChainInfoShape); - const { connections, ...vertex } = chainInfo; + const { connections = {}, ...vertex } = chainInfo; await E(nameAdmin).update(name, vertex); for await (const [destChainId, connInfo] of Object.entries(connections)) { diff --git a/packages/orchestration/test/examples/sendAnywhere.test.ts b/packages/orchestration/test/examples/sendAnywhere.test.ts index 9b09ec50f8d..40dad02758f 100644 --- a/packages/orchestration/test/examples/sendAnywhere.test.ts +++ b/packages/orchestration/test/examples/sendAnywhere.test.ts @@ -20,12 +20,6 @@ type StartFn = const chainInfoDefaults = { connections: {}, - allowedMessages: [], - allowedQueries: [], - ibcHooksEnabled: false, - icaEnabled: false, - icqEnabled: false, - pfmEnabled: false, }; const connectionDefaults = { From 6fbdeae46a71512cbd95603a71b406867a37511c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 10 Jun 2024 16:34:56 -0700 Subject: [PATCH 06/16] feat: use fetched chain info --- .../test/bootstrapTests/orchestration.test.ts | 6 +- .../snapshots/orchestration.test.ts.md | 150 ------------------ .../snapshots/orchestration.test.ts.snap | Bin 1376 -> 0 bytes packages/orchestration/src/chain-info.js | 130 +++++++-------- .../orchestration/src/orchestration-api.ts | 4 +- .../orchestration/test/chain-info.test.js | 28 ++++ .../test/examples/sendAnywhere.test.ts | 2 +- .../test/exos/local-chain-account-kit.test.ts | 2 +- .../test/snapshots/chain-info.test.js.md | 139 ++++++++++++++++ .../test/snapshots/chain-info.test.js.snap | Bin 0 -> 1160 bytes 10 files changed, 226 insertions(+), 235 deletions(-) delete mode 100644 packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.md delete mode 100644 packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.snap create mode 100644 packages/orchestration/test/chain-info.test.js create mode 100644 packages/orchestration/test/snapshots/chain-info.test.js.md create mode 100644 packages/orchestration/test/snapshots/chain-info.test.js.snap diff --git a/packages/boot/test/bootstrapTests/orchestration.test.ts b/packages/boot/test/bootstrapTests/orchestration.test.ts index aba48194a3c..9fdd84690ab 100644 --- a/packages/boot/test/bootstrapTests/orchestration.test.ts +++ b/packages/boot/test/bootstrapTests/orchestration.test.ts @@ -33,12 +33,12 @@ test.serial('config', async t => { const agoricNames = await EV.vat('bootstrap').consumeItem('agoricNames'); - const cosmosChainInfo = await EV(agoricNames).lookup('chain', 'cosmos'); + const cosmosChainInfo = await EV(agoricNames).lookup('chain', 'cosmoshub'); t.like(cosmosChainInfo, { - chainId: 'cosmoslocal', + chainId: 'cosmoshub-4', stakingTokens: [{ denom: 'uatom' }], }); - const cosmosInfo = readLatest(`published.agoricNames.chain.cosmos`); + const cosmosInfo = readLatest(`published.agoricNames.chain.cosmoshub`); t.deepEqual(cosmosInfo, cosmosChainInfo); }); diff --git a/packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.md b/packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.md deleted file mode 100644 index a74f1956f18..00000000000 --- a/packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.md +++ /dev/null @@ -1,150 +0,0 @@ -# Snapshot report for `test/bootstrapTests/orchestration.test.ts` - -The actual snapshot is saved in `orchestration.test.ts.snap`. - -Generated by [AVA](https://avajs.dev). - -## config - -> Snapshot 1 - - [ - [ - 'agoric', - { - chainId: 'agoriclocal', - connections: { - cosmoslocal: { - client_id: '07-tendermint-3', - counterparty: { - client_id: '07-tendermint-2', - connection_id: 'connection-1', - prefix: { - key_prefix: '', - }, - }, - delay_period: 0n, - id: 'connection-1', - state: 3, - transferChannel: { - channelId: 'channel-1', - counterPartyChannelId: 'channel-1', - counterPartyPortId: 'transfer', - ordering: 1, - portId: 'transfer', - state: 3, - version: 'ics20-1', - }, - versions: [ - { - features: [ - '', - '', - ], - identifier: '', - }, - ], - }, - osmosislocal: { - client_id: '07-tendermint-2', - counterparty: { - client_id: '07-tendermint-2', - connection_id: 'connection-1', - prefix: { - key_prefix: '', - }, - }, - delay_period: 0n, - id: 'connection-0', - state: 3, - transferChannel: { - channelId: 'channel-0', - counterPartyChannelId: 'channel-1', - counterPartyPortId: 'transfer', - ordering: 1, - portId: 'transfer', - state: 3, - version: 'ics20-1', - }, - versions: [ - { - features: [ - '', - '', - ], - identifier: '', - }, - ], - }, - }, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - }, - ], - [ - 'celestia', - { - chainId: 'celestia', - connections: {}, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - stakingTokens: [ - { - denom: 'utia', - }, - ], - }, - ], - [ - 'cosmos', - { - chainId: 'cosmoslocal', - connections: {}, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - stakingTokens: [ - { - denom: 'uatom', - }, - ], - }, - ], - [ - 'osmosis', - { - chainId: 'osmosislocal', - connections: {}, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - stakingTokens: [ - { - denom: 'uosmo', - }, - ], - }, - ], - [ - 'stride', - { - chainId: 'stride-1', - connections: {}, - ibcHooksEnabled: true, - icaEnabled: true, - icqEnabled: true, - pfmEnabled: true, - stakingTokens: [ - { - denom: 'ustride', - }, - ], - }, - ], - ] diff --git a/packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.snap b/packages/boot/test/bootstrapTests/snapshots/orchestration.test.ts.snap deleted file mode 100644 index d522487d3f6cc4696d7554246b412afeca4b1fa5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1376 zcmV-m1)ussRzVY00000000B!m~E&ORT#&AXXkZaXJ0g}%*xCPwA2DKqDZllYvqSt2#U+x z-PwDmyLaX`GdH|oghJ38SWrZvg$6<23WCtmB#F>Z)n~){U?B2UOXS^>d zNYZ}TJ!kg!{LgvLInQ&R-M!7BmR}zYckFW_H)=V}y6-jJVK?;b@o>bC!X0}X4LhdFFa(SNHKA98c2^MClR`|jEXzXV5E>#c#I}w|UWmQzPZ2kd zwVRo^`CGfG#LXoFgxVfZ*(6{r7|l1U6=3S~?{DBvXttjXZ(0`>^_Py!dr;HLsU z7x0Y)ULk|01pFvK%Ot^N@2jvCDre)&y3=yP$hBi~ zU=~uZ`{9@$#@q|Da7K)|9q{OEf?*W64JYPIrNf!RxJQBe6xgP~YYKdd4qJpc!E*0Ka;VTt>RVDKUDf5a3i!|7v!Jr1uYVfWG zUubYjlguwonHxG3by%;%!#Zr&VUG@nbU2|)=1WuNXLL{vSZTm!1AGHsHsAvTzBVND zYm(+ggpRP<%R9Xd^%2|kHaDjF`Obl8`E|R6C<*b4!Sq(->%QkX^~m+TP|~s7q58eP zKN@cG?4g#^(aTs8m2>O%T)>mF1LMsx87Lx*Io#?yza=4-nE!d7N>Md9_+=jU~yn^t;m@4G16K74*|o1G-NYE3M5@}h8A$Js#d)|R4^AF-=HZ>Zw3k}yemj_lBYF5e57h$PT7bai&cmIl;IcM3a(Sq2aXb$-!|aaQ%*=CR2COKIH^qC+D1t=WAoZpDu*w zGIkcvmzL)6{PEIEo(oyM;duVoR8O6VOOiP`ZNiTHv3Y^*c%BDnOiY#4rcig5;JFg) zFTv@ObdL2@h$G{jh?OT=-D`LvueNDRzHaPDvqf*kW5TJ zXgGoE4R<3*K8E`Eykz7kOjbYL5S#A1^>FR#_Uxzcqea#DKDv&0a3(} */ ( - harden({ - agoric: { - chainId: 'agoriclocal', - connections: { - cosmoslocal: { - id: 'connection-1', - client_id: '07-tendermint-3', - counterparty: { - client_id: '07-tendermint-2', - connection_id: 'connection-1', - prefix: { - key_prefix: '', - }, +const knownChains = /** @satisfies {Record} */ ( + harden({ + ...fetchedChainInfo, + agoric: { + chainId: 'agoriclocal', + connections: { + 'cosmoshub-4': { + id: 'connection-1', + client_id: '07-tendermint-3', + counterparty: { + client_id: '07-tendermint-2', + connection_id: 'connection-1', + prefix: { + key_prefix: '', }, + }, + state: 3 /* IBCConnectionState.STATE_OPEN */, + transferChannel: { + portId: 'transfer', + channelId: 'channel-1', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 1 /* Order.ORDER_UNORDERED */, state: 3 /* IBCConnectionState.STATE_OPEN */, - transferChannel: { - portId: 'transfer', - channelId: 'channel-1', - counterPartyChannelId: 'channel-1', - counterPartyPortId: 'transfer', - ordering: 1 /* Order.ORDER_UNORDERED */, - state: 3 /* IBCConnectionState.STATE_OPEN */, - version: 'ics20-1', - }, - versions: [{ identifier: '', features: ['', ''] }], - delay_period: 0n, + version: 'ics20-1', }, - osmosislocal: { - id: 'connection-0', + versions: [{ identifier: '', features: ['', ''] }], + delay_period: 0n, + }, + osmosislocal: { + id: 'connection-0', + client_id: '07-tendermint-2', + counterparty: { client_id: '07-tendermint-2', - counterparty: { - client_id: '07-tendermint-2', - connection_id: 'connection-1', - prefix: { - key_prefix: '', - }, + connection_id: 'connection-1', + prefix: { + key_prefix: '', }, + }, + state: 3 /* IBCConnectionState.STATE_OPEN */, + transferChannel: { + portId: 'transfer', + channelId: 'channel-0', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 1 /* Order.ORDER_UNORDERED */, state: 3 /* IBCConnectionState.STATE_OPEN */, - transferChannel: { - portId: 'transfer', - channelId: 'channel-0', - counterPartyChannelId: 'channel-1', - counterPartyPortId: 'transfer', - ordering: 1 /* Order.ORDER_UNORDERED */, - state: 3 /* IBCConnectionState.STATE_OPEN */, - version: 'ics20-1', - }, - versions: [{ identifier: '', features: ['', ''] }], - delay_period: 0n, + version: 'ics20-1', }, + versions: [{ identifier: '', features: ['', ''] }], + delay_period: 0n, }, }, - // https://github.com/cosmos/chain-registry/blob/master/stride/chain.json - stride: { - chainId: 'stride-1', - stakingTokens: [{ denom: 'ustride' }], - connections: {}, - }, - cosmos: { - chainId: 'cosmoslocal', - stakingTokens: [{ denom: 'uatom' }], - connections: {}, - }, - celestia: { - chainId: 'celestia', - stakingTokens: [{ denom: 'utia' }], - connections: {}, - }, - osmosis: { - chainId: 'osmosislocal', - stakingTokens: [{ denom: 'uosmo' }], - connections: {}, - }, - }) - ); + }, + }) +); + +/** @typedef {typeof knownChains} KnownChains */ /** * @param {ERef} agoricNamesAdmin * @param {(...messages: string[]) => void} log */ export const registerChainNamespace = async (agoricNamesAdmin, log) => { - for await (const [name, info] of Object.entries(wellKnownChainInfo)) { + for await (const [name, info] of Object.entries(knownChains)) { log(`registering agoricNames chain.${name}`); await registerChain(agoricNamesAdmin, name, info); } diff --git a/packages/orchestration/src/orchestration-api.ts b/packages/orchestration/src/orchestration-api.ts index 9653caae2ae..ae6414d8ee0 100644 --- a/packages/orchestration/src/orchestration-api.ts +++ b/packages/orchestration/src/orchestration-api.ts @@ -17,11 +17,9 @@ import type { CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, - wellKnownChainInfo, + KnownChains, } from './types.js'; -type KnownChains = typeof wellKnownChainInfo; - /** * A denom that designates a path to a token type on some blockchain. * diff --git a/packages/orchestration/test/chain-info.test.js b/packages/orchestration/test/chain-info.test.js new file mode 100644 index 00000000000..c035a365df3 --- /dev/null +++ b/packages/orchestration/test/chain-info.test.js @@ -0,0 +1,28 @@ +import test from 'ava'; +import { makeAgoricNamesAccess } from '@agoric/vats'; +import { registerChainNamespace } from '../src/chain-info.js'; + +test('chain-info', async t => { + const { agoricNames, agoricNamesAdmin } = await makeAgoricNamesAccess(t.log); + await registerChainNamespace(agoricNamesAdmin, t.log); + const chainNames = await agoricNames.lookup('chain'); + t.like(await chainNames.lookup('cosmoshub'), { + chainId: 'cosmoshub-4', + stakingTokens: [{ denom: 'uatom' }], + }); + t.deepEqual(chainNames.keys(), [ + 'agoric', + 'celestia', + 'cosmoshub', + 'dydx', + 'juno', + 'neutron', + 'noble', + 'omniflixhub', + 'osmosis', + 'secretnetwork', + 'stargaze', + 'stride', + ]); + t.snapshot(chainNames.entries()); +}); diff --git a/packages/orchestration/test/examples/sendAnywhere.test.ts b/packages/orchestration/test/examples/sendAnywhere.test.ts index 40dad02758f..79cabf13478 100644 --- a/packages/orchestration/test/examples/sendAnywhere.test.ts +++ b/packages/orchestration/test/examples/sendAnywhere.test.ts @@ -163,7 +163,7 @@ test('send using arbitrary chain info', async t => { inv, { give: { Send: anAmt } }, { Send }, - { destAddr: 'cosmos1destAddr', chainName: 'cosmos' }, + { destAddr: 'cosmos1destAddr', chainName: 'cosmoshub' }, ); await E(userSeat).getOfferResult(); const history = inspectLocalBridge(); diff --git a/packages/orchestration/test/exos/local-chain-account-kit.test.ts b/packages/orchestration/test/exos/local-chain-account-kit.test.ts index 7dc5819c644..a1e9f1a4a28 100644 --- a/packages/orchestration/test/exos/local-chain-account-kit.test.ts +++ b/packages/orchestration/test/exos/local-chain-account-kit.test.ts @@ -164,7 +164,7 @@ test('transfer', async t => { t.true(AmountMath.isEqual(depositResp, stake.units(100)), 'deposit'); const destination: ChainAddress = { - chainId: 'cosmoslocal', + chainId: 'cosmoshub-4', address: 'cosmos1pleab', addressEncoding: 'bech32', }; diff --git a/packages/orchestration/test/snapshots/chain-info.test.js.md b/packages/orchestration/test/snapshots/chain-info.test.js.md new file mode 100644 index 00000000000..78db97d41ed --- /dev/null +++ b/packages/orchestration/test/snapshots/chain-info.test.js.md @@ -0,0 +1,139 @@ +# Snapshot report for `test/chain-info.test.js` + +The actual snapshot is saved in `chain-info.test.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## chain-info + +> Snapshot 1 + + [ + [ + 'agoric', + { + chainId: 'agoriclocal', + }, + ], + [ + 'celestia', + { + chainId: 'celestia', + stakingTokens: [ + { + denom: 'utia', + }, + ], + }, + ], + [ + 'cosmoshub', + { + chainId: 'cosmoshub-4', + stakingTokens: [ + { + denom: 'uatom', + }, + ], + }, + ], + [ + 'dydx', + { + chainId: 'dydx-mainnet-1', + stakingTokens: [ + { + denom: 'adydx', + }, + ], + }, + ], + [ + 'juno', + { + chainId: 'juno-1', + stakingTokens: [ + { + denom: 'ujuno', + }, + ], + }, + ], + [ + 'neutron', + { + chainId: 'neutron-1', + stakingTokens: [ + { + denom: 'untrn', + }, + ], + }, + ], + [ + 'noble', + { + chainId: 'noble-1', + stakingTokens: [ + { + denom: 'ustake', + }, + ], + }, + ], + [ + 'omniflixhub', + { + chainId: 'omniflixhub-1', + stakingTokens: [ + { + denom: 'uflix', + }, + ], + }, + ], + [ + 'osmosis', + { + chainId: 'osmosis-1', + stakingTokens: [ + { + denom: 'uosmo', + }, + ], + }, + ], + [ + 'secretnetwork', + { + chainId: 'secret-4', + stakingTokens: [ + { + denom: 'uscrt', + }, + ], + }, + ], + [ + 'stargaze', + { + chainId: 'stargaze-1', + stakingTokens: [ + { + denom: 'ustars', + }, + ], + }, + ], + [ + 'stride', + { + chainId: 'stride-1', + stakingTokens: [ + { + denom: 'ustrd', + }, + ], + }, + ], + ] diff --git a/packages/orchestration/test/snapshots/chain-info.test.js.snap b/packages/orchestration/test/snapshots/chain-info.test.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..87fb8a8b9a7699283a02fc5e57314acc66de70fe GIT binary patch literal 1160 zcmV;31b6#ERzV_x#z}nccaaJ5Q@i%gU_Ix(+dd>Y%I$jKHV} zg{bCs$Gh?NW^`vRwJ?wfG9kMD7*P<4k9rUl{Q<=kqz55A3hIFniXs@%gZ@GEpqk%~ zhx?t}TiAW{{lRNL`_yG72_#8M6oCLlHhBa$QE3I#}{9T%M zvGP0*t%ByFRWFa7qYUV%0pRM&7REoR)_C&_(|{FvEH#`TQmO9;cp$58lBLTaHRpO4Y*f8 zTf&D8c+`MEKv%+T20UlLJ^=?M+;71927D&qQVEY4@U;P_1iVVZ^9KBEfNgfd6%r1c zFk-@50k4yA!i4)xcviq0C7dx~y9uufc#DK@oA90qp9*-JY&t#byJ1adY1UMwA@}F;ScdCoDlC%{z+U||q*_wXTf)iHW6xPPctwBB2jD>P=a8UKn zFBbf6!HTk=r2@UD4C~9#l+-EEePx(0!!bz*3iQV^oGU}c7IdgUM{O9lVUwiG3Ur4J zyKOim=}3W|u;CjU{*?5Z0$t|7at9uC1iijM>kfnt%uBkuKtFci3kOb1I$EIrI8ds< zSVhpWPCB5vz{~n%p;6U=x1q7nWO$J zh?1VdstcoH><*Q;y}!I#Hc!T8{VPUZ4PClXXwA1~imDL!_ zvr5&zvIZ`hb$Q~N{t}&hAm(Ws`%AOiQ!{Upw7;;*#hIG#?cIL&rUq{w_EncKThq^0 z;X<|ZjJCvKuK!krzXYmCWVqnCov0?!unQvsEsPUzD$h$O2P*nAD%k<2Tw!!HiK zt-%G!t}HOugC(9|%M0vI4<;mASzyn25J7CV^cI=68vg=>0hGEk5C8z7=R|t| literal 0 HcmV?d00001 From 81589dee4997e543e419343e8ab30a4c8cf644c3 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 08:19:02 -0700 Subject: [PATCH 07/16] feat: chainHub logging --- packages/orchestration/src/chain-info.js | 3 +-- packages/orchestration/src/utils/chainHub.js | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index 485e7cdde19..7de676ef14a 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -72,7 +72,6 @@ const knownChains = /** @satisfies {Record} */ ( */ export const registerChainNamespace = async (agoricNamesAdmin, log) => { for await (const [name, info] of Object.entries(knownChains)) { - log(`registering agoricNames chain.${name}`); - await registerChain(agoricNamesAdmin, name, info); + await registerChain(agoricNamesAdmin, name, info, log); } }; diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index d3f9bbeacb7..643f97b4065 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -117,18 +117,26 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => { * @param {ERef} agoricNamesAdmin * @param {string} name * @param {CosmosChainInfo} chainInfo + * @param {(...messages: string[]) => void} log */ -export const registerChain = async (agoricNamesAdmin, name, chainInfo) => { +export const registerChain = async ( + agoricNamesAdmin, + name, + chainInfo, + log = () => {}, +) => { const { nameAdmin } = await E(agoricNamesAdmin).provideChild('chain'); const { nameAdmin: connAdmin } = await E(agoricNamesAdmin).provideChild('chainConnection'); mustMatch(chainInfo, CosmosChainInfoShape); const { connections = {}, ...vertex } = chainInfo; + log(`registering agoricNames chain.${name}`); await E(nameAdmin).update(name, vertex); for await (const [destChainId, connInfo] of Object.entries(connections)) { const key = connectionKey(chainInfo.chainId, destChainId); + log(`registering agoricNames chainConnection.${key}`); await E(connAdmin).update(key, connInfo); } }; From c91d1921d5ab32496a66bac2ba4d98913f37918c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 06:15:46 -0700 Subject: [PATCH 08/16] use chainHub for agoric info --- packages/orchestration/src/facade.js | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/orchestration/src/facade.js b/packages/orchestration/src/facade.js index 0cb417d2d80..c152ead7996 100644 --- a/packages/orchestration/src/facade.js +++ b/packages/orchestration/src/facade.js @@ -15,26 +15,23 @@ import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAcc /** @type {any} */ const anyVal = null; -// FIXME look up real values -// UNTIL https://github.com/Agoric/agoric-sdk/issues/9063 -const mockLocalChainInfo = { - allegedName: 'agoric', - chainId: 'agoriclocal', - connections: anyVal, -}; - /** * @param {Remote} localchain * @param {ReturnType< * typeof import('./exos/local-chain-account-kit.js').prepareLocalChainAccountKit * >} makeLocalChainAccountKit + * @param {ChainInfo} localInfo * @returns {Chain} */ -const makeLocalChainFacade = (localchain, makeLocalChainAccountKit) => { +const makeLocalChainFacade = ( + localchain, + makeLocalChainAccountKit, + localInfo, +) => { return { /** @returns {Promise} */ async getChainInfo() { - return mockLocalChainInfo; + return localInfo; }, async makeAccount() { @@ -56,7 +53,7 @@ const makeLocalChainFacade = (localchain, makeLocalChainAccountKit) => { const addressStr = account.getAddress(); return { address: addressStr, - chainId: mockLocalChainInfo.chainId, + chainId: localInfo.chainId, addressEncoding: 'bech32', }; }, @@ -193,12 +190,16 @@ export const makeOrchestrationFacade = ({ /** @type {Orchestrator} */ const orc = { async getChain(name) { + const chainInfo = await chainHub.getChainInfo(name); + if (name === 'agoric') { - return makeLocalChainFacade(localchain, makeLocalChainAccountKit); + return makeLocalChainFacade( + localchain, + makeLocalChainAccountKit, + chainInfo, + ); } - const chainInfo = await chainHub.getChainInfo(name); - return makeRemoteChainFacade(chainInfo, { orchestration: orchestrationService, timer: timerService, From 2ca0a13eca7efb4df309b08f5526bb96e5af01d4 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 06:26:55 -0700 Subject: [PATCH 09/16] chore(types): infer PortAllocator signatures --- packages/network/src/network.js | 6 ++++++ packages/network/src/types.js | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/network/src/network.js b/packages/network/src/network.js index 156c8dd34a4..bc1f79c98dc 100644 --- a/packages/network/src/network.js +++ b/packages/network/src/network.js @@ -1468,6 +1468,11 @@ export const preparePortAllocator = (zone, { watch }) => .optional(M.string()) .returns(Shape.Vow$(Shape.Port)), }), + /** + * + * @param {object} opts + * @param {Protocol} opts.protocol + */ ({ protocol }) => ({ protocol, lastICAPortNum: 0n, lastICQPortNum: 0n }), { allocateCustomIBCPort(specifiedName = '') { @@ -1517,3 +1522,4 @@ export const preparePortAllocator = (zone, { watch }) => }, }, ); +/** @typedef {ReturnType>} PortAllocator */ diff --git a/packages/network/src/types.js b/packages/network/src/types.js index e056672bc5a..d40be9ad1a0 100644 --- a/packages/network/src/types.js +++ b/packages/network/src/types.js @@ -200,5 +200,3 @@ export {}; * ) => PromiseVow} outbound * Create an outbound connection */ - -/** @typedef {ReturnType>} PortAllocator */ From 5b3b0e83ba7d76ccb0e912ca1afa534ef9e1fd9b Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 06:31:29 -0700 Subject: [PATCH 10/16] test: misc cleanup --- packages/orchestration/src/exos/local-chain-account-kit.js | 1 - packages/orchestration/test/staking-ops.test.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/orchestration/src/exos/local-chain-account-kit.js b/packages/orchestration/src/exos/local-chain-account-kit.js index 02a68998031..950c37745dc 100644 --- a/packages/orchestration/src/exos/local-chain-account-kit.js +++ b/packages/orchestration/src/exos/local-chain-account-kit.js @@ -237,7 +237,6 @@ export const prepareLocalChainAccountKit = ( // TODO #9211 lookup denom from brand if ('brand' in amount) throw Fail`ERTP Amounts not yet supported`; - // TODO #8879 chainInfo and #9063 well-known chains const agoricChainInfo = await chainHub.getChainInfo('agoric'); const { transferChannel } = await chainHub.getConnectionInfo( agoricChainInfo.chainId, diff --git a/packages/orchestration/test/staking-ops.test.ts b/packages/orchestration/test/staking-ops.test.ts index 6daf8722874..4059ac372f8 100644 --- a/packages/orchestration/test/staking-ops.test.ts +++ b/packages/orchestration/test/staking-ops.test.ts @@ -122,7 +122,7 @@ const makeScenario = () => { const chainAddress: ChainAddress = harden({ address: addr, addressEncoding: 'bech32', - chainId: 'FIXME', + chainId: 'mock-1', }); const account: IcaAccount = Far('MockAccount', { From b8f0a33b0c88002169225a185b88234cab56b98c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 06:36:34 -0700 Subject: [PATCH 11/16] =?UTF-8?q?test:=20stakeAtom=20example=20=E2=86=92?= =?UTF-8?q?=20stakeIca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/bootstrapTests/orchestration.test.ts | 9 +++++---- .../scripts/orchestration/init-stakeAtom.js | 4 ++-- ...takeAtom.contract.js => stakeIca.contract.js} | 5 ++--- .../src/proposals/start-stakeAtom.js | 16 ++++++++-------- .../test/examples/stake-atom.contract.test.ts | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) rename packages/orchestration/src/examples/{stakeAtom.contract.js => stakeIca.contract.js} (96%) diff --git a/packages/boot/test/bootstrapTests/orchestration.test.ts b/packages/boot/test/bootstrapTests/orchestration.test.ts index 9fdd84690ab..eb809b6c7fb 100644 --- a/packages/boot/test/bootstrapTests/orchestration.test.ts +++ b/packages/boot/test/bootstrapTests/orchestration.test.ts @@ -3,7 +3,7 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { Fail } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; import type { CosmosValidatorAddress } from '@agoric/orchestration'; -import type { start as startStakeAtom } from '@agoric/orchestration/src/examples/stakeAtom.contract.js'; +import type { start as startStakeIca } from '@agoric/orchestration/src/examples/stakeIca.contract.js'; import type { Instance } from '@agoric/zoe/src/zoeService/utils.js'; import { M, matches } from '@endo/patterns'; import type { TestFn } from 'ava'; @@ -53,9 +53,10 @@ test.serial('stakeAtom - repl-style', async t => { ); const agoricNames = await EV.vat('bootstrap').consumeItem('agoricNames'); - const instance: Instance = await EV( - agoricNames, - ).lookup('instance', 'stakeAtom'); + const instance: Instance = await EV(agoricNames).lookup( + 'instance', + 'stakeAtom', + ); t.truthy(instance, 'stakeAtom instance is available'); const zoe: ZoeService = await EV.vat('bootstrap').consumeItem('zoe'); diff --git a/packages/builders/scripts/orchestration/init-stakeAtom.js b/packages/builders/scripts/orchestration/init-stakeAtom.js index f3919ab399f..68166a7601d 100644 --- a/packages/builders/scripts/orchestration/init-stakeAtom.js +++ b/packages/builders/scripts/orchestration/init-stakeAtom.js @@ -16,8 +16,8 @@ export const defaultProposalBuilder = async ( 'getManifestForStakeAtom', { installKeys: { - stakeAtom: publishRef( - install('@agoric/orchestration/src/examples/stakeAtom.contract.js'), + stakeIca: publishRef( + install('@agoric/orchestration/src/examples/stakeIca.contract.js'), ), }, hostConnectionId, diff --git a/packages/orchestration/src/examples/stakeAtom.contract.js b/packages/orchestration/src/examples/stakeIca.contract.js similarity index 96% rename from packages/orchestration/src/examples/stakeAtom.contract.js rename to packages/orchestration/src/examples/stakeIca.contract.js index eb5812c805d..cf2285fa944 100644 --- a/packages/orchestration/src/examples/stakeAtom.contract.js +++ b/packages/orchestration/src/examples/stakeIca.contract.js @@ -1,5 +1,4 @@ /** @file Example contract that uses orchestration */ -// TODO rename to "stakeIca" or something else that conveys is parameterized nature import { makeTracer, StorageNodeShape } from '@agoric/internal'; import { TimerServiceShape } from '@agoric/time'; @@ -38,11 +37,11 @@ export const privateArgsShape = meta.privateArgsShape; * hostConnectionId: IBCConnectionID; * controllerConnectionId: IBCConnectionID; * bondDenom: string; - * }} StakeAtomTerms + * }} StakeIcaTerms */ /** - * @param {ZCF} zcf + * @param {ZCF} zcf * @param {{ * orchestration: OrchestrationService; * storageNode: StorageNode; diff --git a/packages/orchestration/src/proposals/start-stakeAtom.js b/packages/orchestration/src/proposals/start-stakeAtom.js index 03c035845f1..6f44971675a 100644 --- a/packages/orchestration/src/proposals/start-stakeAtom.js +++ b/packages/orchestration/src/proposals/start-stakeAtom.js @@ -2,7 +2,7 @@ import { makeTracer } from '@agoric/internal'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; import { E } from '@endo/far'; -/** @import {StakeAtomSF, StakeAtomTerms} from '../examples/stakeAtom.contract' */ +/** @import {StakeAtomSF, StakeIcaTerms} from '../examples/stakeIca.contract' */ const trace = makeTracer('StartStakeAtom', true); @@ -10,13 +10,13 @@ const trace = makeTracer('StartStakeAtom', true); * @param {BootstrapPowers & { * installation: { * consume: { - * stakeAtom: Installation< - * import('../examples/stakeAtom.contract.js').start + * stakeIca: Installation< + * import('../examples/stakeIca.contract.js').start * >; * }; * }; * }} powers - * @param {{ options: StakeAtomTerms }} options + * @param {{ options: StakeIcaTerms }} options */ export const startStakeAtom = async ( { @@ -29,7 +29,7 @@ export const startStakeAtom = async ( startUpgradable, }, installation: { - consume: { stakeAtom }, + consume: { stakeIca }, }, instance: { produce: { stakeAtom: produceInstance }, @@ -53,7 +53,7 @@ export const startStakeAtom = async ( /** @type {StartUpgradableOpts} */ const startOpts = { label: 'stakeAtom', - installation: stakeAtom, + installation: stakeIca, issuerKeywordRecord: harden({ ATOM: atomIssuer }), terms: { hostConnectionId, @@ -89,7 +89,7 @@ export const getManifestForStakeAtom = ( startUpgradable: true, }, installation: { - consume: { stakeAtom: true }, + consume: { stakeIca: true }, }, instance: { produce: { stakeAtom: true }, @@ -97,7 +97,7 @@ export const getManifestForStakeAtom = ( }, }, installations: { - stakeAtom: restoreRef(installKeys.stakeAtom), + stakeIca: restoreRef(installKeys.stakeIca), }, options, }; diff --git a/packages/orchestration/test/examples/stake-atom.contract.test.ts b/packages/orchestration/test/examples/stake-atom.contract.test.ts index 652997171c4..fa465e4c83e 100644 --- a/packages/orchestration/test/examples/stake-atom.contract.test.ts +++ b/packages/orchestration/test/examples/stake-atom.contract.test.ts @@ -9,9 +9,9 @@ import { commonSetup } from '../supports.js'; const dirname = path.dirname(new URL(import.meta.url).pathname); -const contractFile = `${dirname}/../../src/examples/stakeAtom.contract.js`; +const contractFile = `${dirname}/../../src/examples/stakeIca.contract.js`; type StartFn = - typeof import('@agoric/orchestration/src/examples/stakeAtom.contract.js').start; + typeof import('@agoric/orchestration/src/examples/stakeIca.contract.js').start; const startContract = async ({ orchestration, From fa012fde9cf1af2560bcb12e910f713124fead4f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 06:55:08 -0700 Subject: [PATCH 12/16] chore: pare IBCConnectionInfo to essentials --- packages/orchestration/src/chain-info.js | 4 ---- packages/orchestration/src/cosmos-api.ts | 2 -- packages/orchestration/src/typeGuards.js | 5 ----- .../orchestration/test/examples/sendAnywhere.test.ts | 11 ----------- 4 files changed, 22 deletions(-) diff --git a/packages/orchestration/src/chain-info.js b/packages/orchestration/src/chain-info.js index 7de676ef14a..6363b9655f2 100644 --- a/packages/orchestration/src/chain-info.js +++ b/packages/orchestration/src/chain-info.js @@ -33,8 +33,6 @@ const knownChains = /** @satisfies {Record} */ ( state: 3 /* IBCConnectionState.STATE_OPEN */, version: 'ics20-1', }, - versions: [{ identifier: '', features: ['', ''] }], - delay_period: 0n, }, osmosislocal: { id: 'connection-0', @@ -56,8 +54,6 @@ const knownChains = /** @satisfies {Record} */ ( state: 3 /* IBCConnectionState.STATE_OPEN */, version: 'ics20-1', }, - versions: [{ identifier: '', features: ['', ''] }], - delay_period: 0n, }, }, }, diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index 0a1e5f186fa..6c50ce3eb75 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -49,8 +49,6 @@ export type IBCConnectionInfo = { key_prefix: string; }; }; - versions: { identifier: string; features: string[] }[]; - delay_period: bigint; transferChannel: { portId: string; channelId: IBCChannelID; diff --git a/packages/orchestration/src/typeGuards.js b/packages/orchestration/src/typeGuards.js index aba82f6161c..6cc02a4dbad 100644 --- a/packages/orchestration/src/typeGuards.js +++ b/packages/orchestration/src/typeGuards.js @@ -64,11 +64,6 @@ export const IBCConnectionInfoShape = M.splitRecord({ key_prefix: M.string(), }, }, - versions: M.arrayOf({ - identifier: M.string(), - features: M.arrayOf(M.string()), - }), - delay_period: M.nat(), transferChannel: IBCChannelInfoShape, }); diff --git a/packages/orchestration/test/examples/sendAnywhere.test.ts b/packages/orchestration/test/examples/sendAnywhere.test.ts index 79cabf13478..1f8aee96148 100644 --- a/packages/orchestration/test/examples/sendAnywhere.test.ts +++ b/packages/orchestration/test/examples/sendAnywhere.test.ts @@ -22,16 +22,6 @@ const chainInfoDefaults = { connections: {}, }; -const connectionDefaults = { - versions: [ - { - identifier: '1', - features: ['ORDER_ORDERED', 'ORDER_UNORDERED'], - }, - ], - delay_period: 0n, -}; - const txChannelDefaults = { counterPartyPortId: 'transfer', version: 'ics20-1', @@ -95,7 +85,6 @@ test('send using arbitrary chain info', async t => { }) as CosmosChainInfo; t.log('admin adds chain using creatorFacet', hotChainInfo.chainId); const agoricToHotConnection = { - ...connectionDefaults, id: 'connection-1', client_id: '07-tendermint-1', state: 3, // STATE_OPEN From fd6e46c116af986f0437ed7a81f8cf9c27b7bb25 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 07:45:03 -0700 Subject: [PATCH 13/16] feat: fetch IBC connection info --- .../orchestration/scripts/fetch-chain-info.ts | 77 +- packages/orchestration/src/cosmos-api.ts | 29 +- .../orchestration/src/fetched-chain-info.js | 1661 +++++++++++++++++ .../test/snapshots/chain-info.test.js.md | 1 + .../test/snapshots/chain-info.test.js.snap | Bin 1160 -> 1185 bytes 5 files changed, 1754 insertions(+), 14 deletions(-) diff --git a/packages/orchestration/scripts/fetch-chain-info.ts b/packages/orchestration/scripts/fetch-chain-info.ts index 2836db9ed80..f91c412d434 100755 --- a/packages/orchestration/scripts/fetch-chain-info.ts +++ b/packages/orchestration/scripts/fetch-chain-info.ts @@ -1,9 +1,17 @@ #!/usr/bin/env tsx /** @file Fetch canonical chain info to generate the minimum needed for agoricNames */ +import { + State as IBCChannelState, + Order, +} from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js'; +import { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js'; +import type { IBCChannelID, IBCConnectionID } from '@agoric/vats'; import { ChainRegistryClient } from '@chain-registry/client'; +import type { IBCInfo } from '@chain-registry/types'; +import assert from 'node:assert'; import fsp from 'node:fs/promises'; import prettier from 'prettier'; -import type { CosmosChainInfo } from '../src/cosmos-api.js'; +import type { CosmosChainInfo, IBCConnectionInfo } from '../src/cosmos-api.js'; // XXX script assumes it's run from the package path // XXX .json would be more apt; UNTIL https://github.com/endojs/endo/issues/2110 @@ -33,14 +41,81 @@ const client = new ChainRegistryClient({ // chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method await client.fetchUrls(); +function toConnectionEntry(ibcInfo: IBCInfo, name: string) { + // IbcInfo encodes the undirected edge as a tuple of (chain_1, chain_2) in alphabetical order + const fromChain1 = ibcInfo.chain_1.chain_name === name; + const [from, to] = fromChain1 + ? [ibcInfo.chain_1, ibcInfo.chain_2] + : [ibcInfo.chain_2, ibcInfo.chain_1]; + assert.equal(from.chain_name, name); + const transferChannels = ibcInfo.channels.filter( + c => + c.chain_1.port_id === 'transfer' && + // @ts-expect-error tags does not specify keys + c.tags?.preferred, + ); + if (transferChannels.length > 1) { + console.warn( + 'multiple preferred transfer channels [', + from.chain_name, + to.chain_name, + ']:', + transferChannels, + '(choosing first)', + ); + } + const [channel] = transferChannels; + const [channelFrom, channelTo] = fromChain1 + ? [channel.chain_2, channel.chain_1] + : [channel.chain_1, channel.chain_2]; + const record = { + id: from.connection_id as IBCConnectionID, + client_id: from.client_id, + counterparty: { + client_id: to.client_id, + connection_id: to.connection_id as IBCConnectionID, + prefix: { + key_prefix: 'FIXME', + }, + }, + state: IBCConnectionState.STATE_OPEN, // XXX presumably + transferChannel: { + channelId: channelFrom.channel_id as IBCChannelID, + portId: channelFrom.port_id, + counterPartyChannelId: channelTo.channel_id as IBCChannelID, + counterPartyPortId: channelTo.port_id, + // FIXME mapping, our guard expects a numerical enum + ordering: Order.ORDER_NONE_UNSPECIFIED, + state: IBCChannelState.STATE_OPEN, // XXX presumably + version: channel.version, + }, + } as IBCConnectionInfo; + return [to.chain_name, record]; +} + const chainInfo = {} as Record; for (const name of chainNames) { + console.log('processing', name); + const chain = client.getChain(name); chainInfo[name] = { chainId: chain.chain_id, stakingTokens: chain.staking?.staking_tokens, }; + // UNTIL https://github.com/Agoric/agoric-sdk/issues/9326 + if (name === 'osmosis') { + chainInfo[name].icqEnabled = true; + } + + const ibcData = client.getChainIbcData(name); + chainInfo[name].connections = Object.fromEntries( + ibcData + .map(datum => toConnectionEntry(datum, name)) + // sort alphbetically for consistency + // eslint-disable-next-line no-nested-ternary + .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)), + ); } const src = `/** @file Generated by fetch-chain-info.ts */\nexport default ${JSON.stringify(chainInfo, null, 2)};`; diff --git a/packages/orchestration/src/cosmos-api.ts b/packages/orchestration/src/cosmos-api.ts index 6c50ce3eb75..a900f6b7152 100644 --- a/packages/orchestration/src/cosmos-api.ts +++ b/packages/orchestration/src/cosmos-api.ts @@ -5,20 +5,19 @@ import type { UnbondingDelegation, } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js'; import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js'; -import type { Brand, Payment, Purse } from '@agoric/ertp/src/types.js'; +import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js'; +import type { + State as IBCChannelState, + Order, +} from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js'; +import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js'; +import type { Brand, Purse } from '@agoric/ertp/src/types.js'; import type { Port } from '@agoric/network'; +import { IBCChannelID } from '@agoric/vats'; import type { LocalIbcAddress, RemoteIbcAddress, } from '@agoric/vats/tools/ibc-utils.js'; -import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js'; -import type { State as IBCConnectionState } from '@agoric/cosmic-proto/ibc/core/connection/v1/connection.js'; -import type { - Order, - State as IBCChannelState, -} from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js'; -import { IBCChannelID, IBCConnectionID } from '@agoric/vats'; -import { MapStore } from '@agoric/store'; import type { AmountArg, ChainAddress, DenomAmount } from './types.js'; /** A helper type for type extensions. */ @@ -39,21 +38,25 @@ export type CosmosValidatorAddress = ChainAddress & { /** Represents an IBC Connection between two chains, which can contain multiple Channels. */ export type IBCConnectionInfo = { - id: IBCConnectionID; // e.g. connection-0 + // XXX really IBCConnectionID but our chain info fetcher doesn't know + id: string; // e.g. connection-0 client_id: string; // '07-tendermint-0' state: IBCConnectionState; counterparty: { client_id: string; - connection_id: IBCConnectionID; + // XXX really IBCConnectionID but our chain info fetcher doesn't know + connection_id: string; prefix: { key_prefix: string; }; }; transferChannel: { portId: string; - channelId: IBCChannelID; + // XXX really IBCChannelID but our chain info fetcher doesn't know + channelId: string; counterPartyPortId: string; - counterPartyChannelId: IBCChannelID; + // XXX really IBCChannelID but our chain info fetcher doesn't know + counterPartyChannelId: string; ordering: Order; state: IBCChannelState; version: string; // e.eg. 'ics20-1' diff --git a/packages/orchestration/src/fetched-chain-info.js b/packages/orchestration/src/fetched-chain-info.js index 20a56752835..c55b0d94095 100644 --- a/packages/orchestration/src/fetched-chain-info.js +++ b/packages/orchestration/src/fetched-chain-info.js @@ -7,6 +7,113 @@ export default { denom: 'utia', }, ], + connections: { + neutron: { + id: 'connection-7', + client_id: '07-tendermint-29', + counterparty: { + client_id: '07-tendermint-48', + connection_id: 'connection-36', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-35', + portId: 'transfer', + counterPartyChannelId: 'channel-8', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-2', + client_id: '07-tendermint-10', + counterparty: { + client_id: '07-tendermint-3012', + connection_id: 'connection-2503', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-6994', + portId: 'transfer', + counterPartyChannelId: 'channel-2', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-15', + client_id: '07-tendermint-52', + counterparty: { + client_id: '07-tendermint-174', + connection_id: 'connection-131', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-91', + portId: 'transfer', + counterPartyChannelId: 'channel-14', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-56', + client_id: '07-tendermint-86', + counterparty: { + client_id: '07-tendermint-359', + connection_id: 'connection-296', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-291', + portId: 'transfer', + counterPartyChannelId: 'channel-33', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-4', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-137', + connection_id: 'connection-125', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-162', + portId: 'transfer', + counterPartyChannelId: 'channel-4', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, cosmoshub: { chainId: 'cosmoshub-4', @@ -15,6 +122,176 @@ export default { denom: 'uatom', }, ], + connections: { + juno: { + id: 'connection-372', + client_id: '07-tendermint-439', + counterparty: { + client_id: '07-tendermint-3', + connection_id: 'connection-2', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-207', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-809', + client_id: '07-tendermint-1119', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-569', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-790', + client_id: '07-tendermint-1116', + counterparty: { + client_id: '07-tendermint-4', + connection_id: 'connection-12', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-4', + portId: 'transfer', + counterPartyChannelId: 'channel-536', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + omniflixhub: { + id: 'connection-501', + client_id: '07-tendermint-656', + counterparty: { + client_id: '07-tendermint-23', + connection_id: 'connection-19', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-12', + portId: 'transfer', + counterPartyChannelId: 'channel-306', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-257', + client_id: '07-tendermint-259', + counterparty: { + client_id: '07-tendermint-1', + connection_id: 'connection-1', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-141', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-401', + client_id: '07-tendermint-492', + counterparty: { + client_id: '07-tendermint-1', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-235', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-918', + client_id: '07-tendermint-1188', + counterparty: { + client_id: '07-tendermint-320', + connection_id: 'connection-256', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-239', + portId: 'transfer', + counterPartyChannelId: 'channel-730', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-635', + client_id: '07-tendermint-913', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-391', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, dydx: { chainId: 'dydx-mainnet-1', @@ -23,6 +300,92 @@ export default { denom: 'adydx', }, ], + connections: { + neutron: { + id: 'connection-17', + client_id: '07-tendermint-11', + counterparty: { + client_id: '07-tendermint-72', + connection_id: 'connection-51', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-48', + portId: 'transfer', + counterPartyChannelId: 'channel-11', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-0', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-59', + connection_id: 'connection-57', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-33', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-7', + client_id: '07-tendermint-3', + counterparty: { + client_id: '07-tendermint-3009', + connection_id: 'connection-2500', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-6787', + portId: 'transfer', + counterPartyChannelId: 'channel-3', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-1', + client_id: '07-tendermint-1', + counterparty: { + client_id: '07-tendermint-133', + connection_id: 'connection-123', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-160', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, juno: { chainId: 'juno-1', @@ -31,6 +394,155 @@ export default { denom: 'ujuno', }, ], + connections: { + cosmoshub: { + id: 'connection-2', + client_id: '07-tendermint-3', + counterparty: { + client_id: '07-tendermint-439', + connection_id: 'connection-372', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-207', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-524', + client_id: '07-tendermint-557', + counterparty: { + client_id: '07-tendermint-97', + connection_id: 'connection-71', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-4328', + portId: 'transfer', + counterPartyChannelId: 'channel-548', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-322', + client_id: '07-tendermint-334', + counterparty: { + client_id: '07-tendermint-3', + connection_id: 'connection-8', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-3', + portId: 'transfer', + counterPartyChannelId: 'channel-224', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-0', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-1457', + connection_id: 'connection-1142', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-42', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-68', + client_id: '07-tendermint-108', + counterparty: { + client_id: '07-tendermint-23', + connection_id: 'connection-9', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-8', + portId: 'transfer', + counterPartyChannelId: 'channel-48', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-30', + client_id: '07-tendermint-44', + counterparty: { + client_id: '07-tendermint-13', + connection_id: 'connection-11', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-5', + portId: 'transfer', + counterPartyChannelId: 'channel-20', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-205', + client_id: '07-tendermint-263', + counterparty: { + client_id: '07-tendermint-31', + connection_id: 'connection-19', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-24', + portId: 'transfer', + counterPartyChannelId: 'channel-139', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, neutron: { chainId: 'neutron-1', @@ -39,6 +551,197 @@ export default { denom: 'untrn', }, ], + connections: { + celestia: { + id: 'connection-36', + client_id: '07-tendermint-48', + counterparty: { + client_id: '07-tendermint-29', + connection_id: 'connection-7', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-8', + portId: 'transfer', + counterPartyChannelId: 'channel-35', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + cosmoshub: { + id: 'connection-0', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-1119', + connection_id: 'connection-809', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-569', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + dydx: { + id: 'connection-51', + client_id: '07-tendermint-72', + counterparty: { + client_id: '07-tendermint-11', + connection_id: 'connection-17', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-11', + portId: 'transfer', + counterPartyChannelId: 'channel-48', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-71', + client_id: '07-tendermint-97', + counterparty: { + client_id: '07-tendermint-557', + connection_id: 'connection-524', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-548', + portId: 'transfer', + counterPartyChannelId: 'channel-4328', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-31', + client_id: '07-tendermint-40', + counterparty: { + client_id: '07-tendermint-25', + connection_id: 'connection-34', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-18', + portId: 'transfer', + counterPartyChannelId: 'channel-30', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-18', + client_id: '07-tendermint-19', + counterparty: { + client_id: '07-tendermint-2823', + connection_id: 'connection-2338', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-874', + portId: 'transfer', + counterPartyChannelId: 'channel-10', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-63', + client_id: '07-tendermint-85', + counterparty: { + client_id: '07-tendermint-199', + connection_id: 'connection-192', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-144', + portId: 'transfer', + counterPartyChannelId: 'channel-1551', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-23', + client_id: '07-tendermint-31', + counterparty: { + client_id: '07-tendermint-283', + connection_id: 'connection-211', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-191', + portId: 'transfer', + counterPartyChannelId: 'channel-18', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-15', + client_id: '07-tendermint-18', + counterparty: { + client_id: '07-tendermint-125', + connection_id: 'connection-113', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-123', + portId: 'transfer', + counterPartyChannelId: 'channel-8', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, noble: { chainId: 'noble-1', @@ -47,6 +750,176 @@ export default { denom: 'ustake', }, ], + connections: { + cosmoshub: { + id: 'connection-12', + client_id: '07-tendermint-4', + counterparty: { + client_id: '07-tendermint-1116', + connection_id: 'connection-790', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-536', + portId: 'transfer', + counterPartyChannelId: 'channel-4', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + dydx: { + id: 'connection-57', + client_id: '07-tendermint-59', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-33', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-8', + client_id: '07-tendermint-3', + counterparty: { + client_id: '07-tendermint-334', + connection_id: 'connection-322', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-224', + portId: 'transfer', + counterPartyChannelId: 'channel-3', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-34', + client_id: '07-tendermint-25', + counterparty: { + client_id: '07-tendermint-40', + connection_id: 'connection-31', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-30', + portId: 'transfer', + counterPartyChannelId: 'channel-18', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + omniflixhub: { + id: 'connection-65', + client_id: '07-tendermint-68', + counterparty: { + client_id: '07-tendermint-51', + connection_id: 'connection-49', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-38', + portId: 'transfer', + counterPartyChannelId: 'channel-44', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-2', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-2704', + connection_id: 'connection-2241', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-750', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-33', + client_id: '07-tendermint-24', + counterparty: { + client_id: '07-tendermint-170', + connection_id: 'connection-127', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-88', + portId: 'transfer', + counterPartyChannelId: 'channel-17', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-25', + client_id: '07-tendermint-16', + counterparty: { + client_id: '07-tendermint-287', + connection_id: 'connection-214', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-204', + portId: 'transfer', + counterPartyChannelId: 'channel-11', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, omniflixhub: { chainId: 'omniflixhub-1', @@ -55,6 +928,71 @@ export default { denom: 'uflix', }, ], + connections: { + cosmoshub: { + id: 'connection-19', + client_id: '07-tendermint-23', + counterparty: { + client_id: '07-tendermint-656', + connection_id: 'connection-501', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-306', + portId: 'transfer', + counterPartyChannelId: 'channel-12', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-49', + client_id: '07-tendermint-51', + counterparty: { + client_id: '07-tendermint-68', + connection_id: 'connection-65', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-44', + portId: 'transfer', + counterPartyChannelId: 'channel-38', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-8', + client_id: '07-tendermint-8', + counterparty: { + client_id: '07-tendermint-1829', + connection_id: 'connection-1431', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-199', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, osmosis: { chainId: 'osmosis-1', @@ -63,6 +1001,219 @@ export default { denom: 'uosmo', }, ], + icqEnabled: true, + connections: { + celestia: { + id: 'connection-2503', + client_id: '07-tendermint-3012', + counterparty: { + client_id: '07-tendermint-10', + connection_id: 'connection-2', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-2', + portId: 'transfer', + counterPartyChannelId: 'channel-6994', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + cosmoshub: { + id: 'connection-1', + client_id: '07-tendermint-1', + counterparty: { + client_id: '07-tendermint-259', + connection_id: 'connection-257', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-141', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + dydx: { + id: 'connection-2500', + client_id: '07-tendermint-3009', + counterparty: { + client_id: '07-tendermint-3', + connection_id: 'connection-7', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-3', + portId: 'transfer', + counterPartyChannelId: 'channel-6787', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-1142', + client_id: '07-tendermint-1457', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-42', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-2338', + client_id: '07-tendermint-2823', + counterparty: { + client_id: '07-tendermint-19', + connection_id: 'connection-18', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-10', + portId: 'transfer', + counterPartyChannelId: 'channel-874', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-2241', + client_id: '07-tendermint-2704', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-2', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-750', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + omniflixhub: { + id: 'connection-1431', + client_id: '07-tendermint-1829', + counterparty: { + client_id: '07-tendermint-8', + connection_id: 'connection-8', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-199', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-1244', + client_id: '07-tendermint-1588', + counterparty: { + client_id: '07-tendermint-2', + connection_id: 'connection-1', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-88', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-1223', + client_id: '07-tendermint-1562', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-0', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-0', + portId: 'transfer', + counterPartyChannelId: 'channel-75', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-1657', + client_id: '07-tendermint-2119', + counterparty: { + client_id: '07-tendermint-1', + connection_id: 'connection-2', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-5', + portId: 'transfer', + counterPartyChannelId: 'channel-326', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, secretnetwork: { chainId: 'secret-4', @@ -71,6 +1222,176 @@ export default { denom: 'uscrt', }, ], + connections: { + celestia: { + id: 'connection-131', + client_id: '07-tendermint-174', + counterparty: { + client_id: '07-tendermint-52', + connection_id: 'connection-15', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-14', + portId: 'transfer', + counterPartyChannelId: 'channel-91', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + cosmoshub: { + id: 'connection-0', + client_id: '07-tendermint-1', + counterparty: { + client_id: '07-tendermint-492', + connection_id: 'connection-401', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-235', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-9', + client_id: '07-tendermint-23', + counterparty: { + client_id: '07-tendermint-108', + connection_id: 'connection-68', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-48', + portId: 'transfer', + counterPartyChannelId: 'channel-8', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-192', + client_id: '07-tendermint-199', + counterparty: { + client_id: '07-tendermint-85', + connection_id: 'connection-63', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1551', + portId: 'transfer', + counterPartyChannelId: 'channel-144', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-127', + client_id: '07-tendermint-170', + counterparty: { + client_id: '07-tendermint-24', + connection_id: 'connection-33', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-17', + portId: 'transfer', + counterPartyChannelId: 'channel-88', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-1', + client_id: '07-tendermint-2', + counterparty: { + client_id: '07-tendermint-1588', + connection_id: 'connection-1244', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-88', + portId: 'transfer', + counterPartyChannelId: 'channel-1', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-25', + client_id: '07-tendermint-43', + counterparty: { + client_id: '07-tendermint-177', + connection_id: 'connection-110', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-48', + portId: 'transfer', + counterPartyChannelId: 'channel-19', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-40', + client_id: '07-tendermint-75', + counterparty: { + client_id: '07-tendermint-37', + connection_id: 'connection-25', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-40', + portId: 'transfer', + counterPartyChannelId: 'channel-37', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, stargaze: { chainId: 'stargaze-1', @@ -79,6 +1400,176 @@ export default { denom: 'ustars', }, ], + connections: { + celestia: { + id: 'connection-296', + client_id: '07-tendermint-359', + counterparty: { + client_id: '07-tendermint-86', + connection_id: 'connection-56', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-33', + portId: 'transfer', + counterPartyChannelId: 'channel-291', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + cosmoshub: { + id: 'connection-256', + client_id: '07-tendermint-320', + counterparty: { + client_id: '07-tendermint-1188', + connection_id: 'connection-918', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-730', + portId: 'transfer', + counterPartyChannelId: 'channel-239', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-11', + client_id: '07-tendermint-13', + counterparty: { + client_id: '07-tendermint-44', + connection_id: 'connection-30', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-20', + portId: 'transfer', + counterPartyChannelId: 'channel-5', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-211', + client_id: '07-tendermint-283', + counterparty: { + client_id: '07-tendermint-31', + connection_id: 'connection-23', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-18', + portId: 'transfer', + counterPartyChannelId: 'channel-191', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + noble: { + id: 'connection-214', + client_id: '07-tendermint-287', + counterparty: { + client_id: '07-tendermint-16', + connection_id: 'connection-25', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-11', + portId: 'transfer', + counterPartyChannelId: 'channel-204', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-0', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-1562', + connection_id: 'connection-1223', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-75', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-110', + client_id: '07-tendermint-177', + counterparty: { + client_id: '07-tendermint-43', + connection_id: 'connection-25', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-19', + portId: 'transfer', + counterPartyChannelId: 'channel-48', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stride: { + id: 'connection-128', + client_id: '07-tendermint-195', + counterparty: { + client_id: '07-tendermint-30', + connection_id: 'connection-18', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-19', + portId: 'transfer', + counterPartyChannelId: 'channel-106', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, stride: { chainId: 'stride-1', @@ -87,5 +1578,175 @@ export default { denom: 'ustrd', }, ], + connections: { + celestia: { + id: 'connection-125', + client_id: '07-tendermint-137', + counterparty: { + client_id: '07-tendermint-0', + connection_id: 'connection-4', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-4', + portId: 'transfer', + counterPartyChannelId: 'channel-162', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + cosmoshub: { + id: 'connection-0', + client_id: '07-tendermint-0', + counterparty: { + client_id: '07-tendermint-913', + connection_id: 'connection-635', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-391', + portId: 'transfer', + counterPartyChannelId: 'channel-0', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + dydx: { + id: 'connection-123', + client_id: '07-tendermint-133', + counterparty: { + client_id: '07-tendermint-1', + connection_id: 'connection-1', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-1', + portId: 'transfer', + counterPartyChannelId: 'channel-160', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + juno: { + id: 'connection-19', + client_id: '07-tendermint-31', + counterparty: { + client_id: '07-tendermint-263', + connection_id: 'connection-205', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-139', + portId: 'transfer', + counterPartyChannelId: 'channel-24', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + neutron: { + id: 'connection-113', + client_id: '07-tendermint-125', + counterparty: { + client_id: '07-tendermint-18', + connection_id: 'connection-15', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-8', + portId: 'transfer', + counterPartyChannelId: 'channel-123', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + osmosis: { + id: 'connection-2', + client_id: '07-tendermint-1', + counterparty: { + client_id: '07-tendermint-2119', + connection_id: 'connection-1657', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-326', + portId: 'transfer', + counterPartyChannelId: 'channel-5', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + secretnetwork: { + id: 'connection-25', + client_id: '07-tendermint-37', + counterparty: { + client_id: '07-tendermint-75', + connection_id: 'connection-40', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-37', + portId: 'transfer', + counterPartyChannelId: 'channel-40', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + stargaze: { + id: 'connection-18', + client_id: '07-tendermint-30', + counterparty: { + client_id: '07-tendermint-195', + connection_id: 'connection-128', + prefix: { + key_prefix: 'FIXME', + }, + }, + state: 3, + transferChannel: { + channelId: 'channel-106', + portId: 'transfer', + counterPartyChannelId: 'channel-19', + counterPartyPortId: 'transfer', + ordering: 0, + state: 3, + version: 'ics20-1', + }, + }, + }, }, }; diff --git a/packages/orchestration/test/snapshots/chain-info.test.js.md b/packages/orchestration/test/snapshots/chain-info.test.js.md index 78db97d41ed..7153e0dd24b 100644 --- a/packages/orchestration/test/snapshots/chain-info.test.js.md +++ b/packages/orchestration/test/snapshots/chain-info.test.js.md @@ -96,6 +96,7 @@ Generated by [AVA](https://avajs.dev). 'osmosis', { chainId: 'osmosis-1', + icqEnabled: true, stakingTokens: [ { denom: 'uosmo', diff --git a/packages/orchestration/test/snapshots/chain-info.test.js.snap b/packages/orchestration/test/snapshots/chain-info.test.js.snap index 87fb8a8b9a7699283a02fc5e57314acc66de70fe..351ff9eea0fd27af2e59ae33c252264f2460cea5 100644 GIT binary patch literal 1185 zcmV;S1YY|=RzV`|4wzuorsD0QiF zT^ChEl~E<7e&{@)q*PIXQo3B7mWD33q@}6LXVTKr<;k?n>GIpOv~`IADzD4sY3b;4 zV_Ft;xi>9~x_m1wOX-`LXASt;fZvSX9UDD6c9i*-0sk5>&+LVkgySYGHDRrQj)V`H z@Q4Y%fMp4Hn(%}P&k0zS@Q4YooA921^CbMlgfC1uFW>?RFPiYX369kZua|Jlf`t~W z5^%AE_ge6P1&<53M8c*8yDT^;;4%phTkx6%?+AFiY&s+DyD?=jFKw#asItB7Q9G#X zp7_Y>bm0Fvr|!4>I0-y0f9@j-^(dZ-;>qa=P2Jp;snyui*saw){nU=>Fw)BJqw=9Y zowTD+!x#I&To_HXe9cbxVWns)47Rm`-IreEV!wy$R}NwgN9`-ak=U=d{Ur30C!=;# z^ZWX6Cr-TfcJHaqcAI^q9VhLe(Q!w*&QZo^Hk`4$O<`}C*x}a`WzLq>YE}2opEmq$ z!{WT4xeQ&Khjn?_DQO`?U&zDZJbW(cNQVBHhhOthaReRB(3%6Q9oQo2)fu|if&C5~ zmvmu)_UoP?gTgOmDy(1hu(vY*-r0_fL2uZTKWgZ96z{h7F3klRphevPP}FiZr>C& z{V*OVtTa0=YIo|qBg5rY(wS15@`5n*liDgBd3v}=I~_pXsPBi1Ds-n*H!W8hDlM-^ zSvPCNa9Jal&AV>mhW?4>T<_W)ifLL8EC%&m>q2j$<#(*%>c=I+y@1mht=%qqb-1wN zrNP_%6dw<}H$9!ZVL$Z=bCltfp;GQW$Zc`r8w<*?NT8xb%gV4)po&Cymtl=SS4p(K z3=a!*jYONvuvMUIC7LWlD9|E_c9&tFKsQNrVCFj=66h9*UYYq$ZwRzPqT@5)>7+m_ z<<+TkHUFTj@9VSc3u0}L^sZ}Sy-BS1iuEzE{!*;}5bODs-u0SF_a7F+uRyaRPKUfa zNQ~!a$V-xyGVD|ZK9tPOunQIVMY6FBb6lvng3ZscRW95m*>xHAm_x#z}nccaaJ5Q@i%gU_Ix(+dd>Y%I$jKHV} zg{bCs$Gh?NW^`vRwJ?wfG9kMD7*P<4k9rUl{Q<=kqz55A3hIFniXs@%gZ@GEpqk%~ zhx?t}TiAW{{lRNL`_yG72_#8M6oCLlHhBa$QE3I#}{9T%M zvGP0*t%ByFRWFa7qYUV%0pRM&7REoR)_C&_(|{FvEH#`TQmO9;cp$58lBLTaHRpO4Y*f8 zTf&D8c+`MEKv%+T20UlLJ^=?M+;71927D&qQVEY4@U;P_1iVVZ^9KBEfNgfd6%r1c zFk-@50k4yA!i4)xcviq0C7dx~y9uufc#DK@oA90qp9*-JY&t#byJ1adY1UMwA@}F;ScdCoDlC%{z+U||q*_wXTf)iHW6xPPctwBB2jD>P=a8UKn zFBbf6!HTk=r2@UD4C~9#l+-EEePx(0!!bz*3iQV^oGU}c7IdgUM{O9lVUwiG3Ur4J zyKOim=}3W|u;CjU{*?5Z0$t|7at9uC1iijM>kfnt%uBkuKtFci3kOb1I$EIrI8ds< zSVhpWPCB5vz{~n%p;6U=x1q7nWO$J zh?1VdstcoH><*Q;y}!I#Hc!T8{VPUZ4PClXXwA1~imDL!_ zvr5&zvIZ`hb$Q~N{t}&hAm(Ws`%AOiQ!{Upw7;;*#hIG#?cIL&rUq{w_EncKThq^0 z;X<|ZjJCvKuK!krzXYmCWVqnCov0?!unQvsEsPUzD$h$O2P*nAD%k<2Tw!!HiK zt-%G!t}HOugC(9|%M0vI4<;mASzyn25J7CV^cI=68vg=>0hGEk5C8z7=R|t| From 808ec59e02789a1942e1746a3c4f80a5686158af Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 08:10:51 -0700 Subject: [PATCH 14/16] chore(types): parametric getChainInfo --- packages/orchestration/src/utils/chainHub.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index 643f97b4065..9c9e0e55117 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -6,6 +6,7 @@ import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js'; /** * @import {NameHub} from '@agoric/vats'; * @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js'; + * @import {ChainInfo, KnownChains} from '../chain-info.js'; * @import {Remote} from '@agoric/internal'; * @import {Zone} from '@agoric/zone'; */ @@ -59,12 +60,18 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => { chainInfos.init(name, chainInfo); }, /** - * @param {string} chainName - * @returns {Promise} + * @template {string} K + * @param {K} chainName + * @returns {Promise< + * K extends keyof KnownChains + * ? Omit + * : ChainInfo + * >} */ async getChainInfo(chainName) { // Either from registerChain or memoized remote lookup() if (chainInfos.has(chainName)) { + // @ts-expect-error cast return chainInfos.get(chainName); } From 90557406b3f69e623f17ca421d987062319fa500 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 08:14:49 -0700 Subject: [PATCH 15/16] test: stakeAtom with agoricNames info --- .../src/proposals/start-stakeAtom.js | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/packages/orchestration/src/proposals/start-stakeAtom.js b/packages/orchestration/src/proposals/start-stakeAtom.js index 6f44971675a..5316b9c76bf 100644 --- a/packages/orchestration/src/proposals/start-stakeAtom.js +++ b/packages/orchestration/src/proposals/start-stakeAtom.js @@ -1,8 +1,12 @@ import { makeTracer } from '@agoric/internal'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; import { E } from '@endo/far'; +import { makeChainHub } from '../utils/chainHub.js'; -/** @import {StakeAtomSF, StakeIcaTerms} from '../examples/stakeIca.contract' */ +/** + * @import {IBCConnectionID} from '@agoric/vats'; + * @import {StakeAtomSF, StakeIcaTerms} from '../examples/stakeIca.contract'; + */ const trace = makeTracer('StartStakeAtom', true); @@ -16,33 +20,25 @@ const trace = makeTracer('StartStakeAtom', true); * }; * }; * }} powers - * @param {{ options: StakeIcaTerms }} options */ -export const startStakeAtom = async ( - { - consume: { - agoricNames, - board, - chainStorage, - chainTimerService, - orchestration, - startUpgradable, - }, - installation: { - consume: { stakeIca }, - }, - instance: { - produce: { stakeAtom: produceInstance }, - }, +export const startStakeAtom = async ({ + consume: { + agoricNames, + board, + chainStorage, + chainTimerService, + orchestration, + startUpgradable, }, - { options: { hostConnectionId, controllerConnectionId, bondDenom } }, -) => { + installation: { + consume: { stakeIca }, + }, + instance: { + produce: { stakeAtom: produceInstance }, + }, +}) => { const VSTORAGE_PATH = 'stakeAtom'; - trace('startStakeAtom', { - hostConnectionId, - controllerConnectionId, - bondDenom, - }); + trace('startStakeAtom'); await null; const storageNode = await makeStorageNodeChild(chainStorage, VSTORAGE_PATH); @@ -50,15 +46,25 @@ export const startStakeAtom = async ( const atomIssuer = await E(agoricNames).lookup('issuer', 'ATOM'); trace('ATOM Issuer', atomIssuer); + const chainHub = makeChainHub(await agoricNames); + + const cosmoshub = await chainHub.getChainInfo('cosmoshub'); + const connectionInfo = await chainHub.getConnectionInfo( + 'agoriclocal', + 'cosmoshub-4', + ); + /** @type {StartUpgradableOpts} */ const startOpts = { label: 'stakeAtom', installation: stakeIca, issuerKeywordRecord: harden({ ATOM: atomIssuer }), terms: { - hostConnectionId, - controllerConnectionId, - bondDenom, + hostConnectionId: /** @type {IBCConnectionID} */ (connectionInfo.id), + controllerConnectionId: /** @type {IBCConnectionID} */ ( + connectionInfo.counterparty.connection_id + ), + bondDenom: cosmoshub.stakingTokens[0].denom, }, privateArgs: { orchestration: await orchestration, From a8f6c6ca313d94271dc1e40cae169ed9b4863d8f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 11 Jun 2024 12:17:09 -0700 Subject: [PATCH 16/16] test: defer chainConnection encoding --- .../b:enable-orchestration/initial.test.js | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/a3p-integration/proposals/b:enable-orchestration/initial.test.js b/a3p-integration/proposals/b:enable-orchestration/initial.test.js index 24812305ea0..75e605cdc9a 100644 --- a/a3p-integration/proposals/b:enable-orchestration/initial.test.js +++ b/a3p-integration/proposals/b:enable-orchestration/initial.test.js @@ -20,31 +20,25 @@ test(`vat details`, async t => { } }); -test('chain info', async t => { - const cosmos = await agd - .query( - 'vstorage', - 'data', - '--output', - 'json', - 'published.agoricNames.chain.cosmos', - ) +const queryData = path => + agd + .query('vstorage', 'data', '--output', 'json', path) .then(res => JSON.parse(JSON.parse(JSON.parse(res.value).values[0]).body)); - console.log('chain.cosmos', cosmos); - t.like(cosmos, { chainId: 'cosmoslocal' }); - const names = await agd.query( - 'vstorage', - 'children', - '--output', - 'json', - 'published.agoricNames.chain', +test('chain info', async t => { + const chain = await queryData('published.agoricNames.chain.cosmoshub'); + + console.log('chain.cosmoshub', chain); + t.like(chain, { chainId: 'cosmoshub-4' }); +}); + +test.failing('chain connection', async t => { + // FIXME encoding + // message: `Command failed with exit code 1: agd query vstorage data --output json published.agoricNames.chainConnection.["agoriclocal","cosmoshub-4"] -o json␊ + // Error: rpc error: code = Unknown desc = path "published.agoricNames.chainConnection.[\\"agoriclocal\\",\\"cosmoshub-4\\"]" contains invalid characters: panic␊ + const connection = await queryData( + 'published.agoricNames.chainConnection.["agoriclocal","cosmoshub-4"]', ); - t.deepEqual(names.children, [ - 'agoric', - 'celestia', - 'cosmos', - 'osmosis', - 'stride', - ]); + console.log(connection); + t.like(connection, {}); });