-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(multichain-testing):
stakeIca
contract e2e test (#9534)
closes: #8896 ## Description Adds e2e tests and relevant tooling for `stakeIca.contract.js` to `multichain-testing`. More specifically: - Adds `multichain-testing/tools/deploy.ts` to: 1) build a contract and proposal with `agoric run` (local bin), 2) copy files to container 3) run `installBundles` and `runCoreEval` - Adds logic to gather **chain info** from the starship environment (`registry` node on localhost:8081) and execute `revise-chain-info` proposal in local testing and CI - Tests happy-path wallet flows of `stakeIca` via `stakeOsmo` and `stakeAtom` instances Areas for improvement: - Notifiers for wallet offer results are not working correctly here. Instead of relying on them for wallet offer results we are polling vstorage on an interval (see `makeRetryUntilCondition`) for the initial offer, and verify the behavior by querying state on remote chains. If an offer result results in an error, that is not currently captured until #9643
- Loading branch information
Showing
22 changed files
with
1,750 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.tsimp | ||
.yarn/* | ||
!.yarn/patches/* | ||
revise-chain-info* | ||
start-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,26 +17,30 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
"@endo/errors": "^1.2.2", | ||
"@agoric/cosmic-proto": "0.4.1-dev-08f8549.0", | ||
"@cosmjs/crypto": "^0.32.2", | ||
"@cosmjs/proto-signing": "^0.32.2", | ||
"@cosmjs/stargate": "^0.32.2", | ||
"@endo/errors": "^1.2.2", | ||
"@endo/far": "^1.1.2", | ||
"@endo/nat": "^5.0.7", | ||
"@endo/ses-ava": "^1.2.2", | ||
"@types/eslint": "^8", | ||
"@types/fs-extra": "^11", | ||
"@types/node": "^20.11.13", | ||
"@typescript-eslint/eslint-plugin": "^6.20.0", | ||
"@typescript-eslint/parser": "^6.20.0", | ||
"ava": "^6.1.3", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"execa": "^9.2.0", | ||
"fs-extra": "^11.2.0", | ||
"patch-package": "^8.0.0", | ||
"prettier": "^3.2.4", | ||
"starshipjs": "2.0.0", | ||
"tsimp": "^2.0.10", | ||
"tsx": "^4.15.6", | ||
"typescript": "^5.3.3" | ||
}, | ||
"resolutions": { | ||
|
@@ -56,7 +60,8 @@ | |
"**/*.test.ts" | ||
], | ||
"concurrency": 1, | ||
"serial": true | ||
"serial": true, | ||
"timeout": "125s" | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env tsx | ||
import '@endo/init/debug.js'; | ||
|
||
import { execa } from 'execa'; | ||
import fse from 'fs-extra'; | ||
import childProcess from 'node:child_process'; | ||
|
||
import { makeAgdTools } from '../tools/agd-tools.js'; | ||
import { makeDeployBuilder } from '../tools/deploy.js'; | ||
|
||
async function main() { | ||
const builder = process.argv[2]; | ||
|
||
if (!builder) { | ||
console.error('USAGE: deploy-cli.ts <builder script>'); | ||
process.exit(1); | ||
} | ||
|
||
try { | ||
const agdTools = await makeAgdTools(console.log, childProcess); | ||
const deployBuilder = makeDeployBuilder(agdTools, fse.readJSON, execa); | ||
await deployBuilder(builder); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env tsx | ||
|
||
import nodeFetch from 'node-fetch'; | ||
import fsp from 'node:fs/promises'; | ||
import prettier from 'prettier'; | ||
|
||
import { convertChainInfo } from '@agoric/orchestration/src/utils/registry.js'; | ||
|
||
import type { IBCInfo, Chains } from '@chain-registry/types'; | ||
|
||
const fetch = nodeFetch.default; | ||
|
||
/** | ||
* Chain registry running in Starship | ||
* | ||
* https://github.com/cosmology-tech/starship/blob/main/starship/proto/registry/service.proto | ||
* | ||
* http://localhost:8081/chains | ||
* http://localhost:8081/chain_ids | ||
* http://localhost:8081/ibc | ||
*/ | ||
const BASE_URL = 'http://localhost:8081/'; | ||
|
||
const { chains }: { chains: Chains } = await fetch(`${BASE_URL}chains`).then( | ||
r => r.json(), | ||
); | ||
|
||
const ibc: { | ||
data: IBCInfo[]; | ||
} = await fetch(`${BASE_URL}ibc`).then(r => r.json()); | ||
|
||
// UNTIL https://github.com/cosmology-tech/starship/issues/494 | ||
const backmap = { | ||
agoriclocal: 'agoric', | ||
osmosislocal: 'osmosis', | ||
gaialocal: 'cosmoshub', | ||
}; | ||
for (const ibcInfo of ibc.data) { | ||
ibcInfo.chain_1.chain_name = backmap[ibcInfo.chain_1.chain_name]; | ||
ibcInfo.chain_2.chain_name = backmap[ibcInfo.chain_2.chain_name]; | ||
for (const c of ibcInfo.channels) { | ||
// @ts-expect-error XXX bad typedef | ||
c.tags.preferred = c.tags.perferred; | ||
} | ||
} | ||
|
||
const chainInfo = await convertChainInfo({ | ||
chains, | ||
ibcData: ibc.data, | ||
}); | ||
|
||
const record = JSON.stringify(chainInfo, null, 2); | ||
const src = `/** @file Generated by fetch-starship-chain-info.ts */\nexport default /** @type {const} } */ (${record});`; | ||
const prettySrc = await prettier.format(src, { | ||
parser: 'babel', // 'typescript' fails to preserve parens for typecast | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
}); | ||
await fsp.writeFile('./starship-chain-info.js', prettySrc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* global harden */ | ||
/// <reference types="ses" /> | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
import chainInfo from '../starship-chain-info.js'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async () => | ||
harden({ | ||
sourceSpec: '@agoric/orchestration/src/proposals/revise-chain-info.js', | ||
getManifestCall: [ | ||
'getManifestForReviseChains', | ||
{ | ||
chainInfo, | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreEval } = await makeHelpers(homeP, endowments); | ||
await writeCoreEval('revise-chain-info', defaultProposalBuilder); | ||
}; |
Oops, something went wrong.