-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: send-anywhere
pfm scenarios
#10591
base: pc/10445-transfer-pfm
Are you sure you want to change the base?
test: send-anywhere
pfm scenarios
#10591
Conversation
- to facililate registering the same denom across multiple chains in `ChainHub` - denoms are unique to a chain, but not all chains
- since denoms are only unique to a chain and all chains, require `holdingChainName` parameter for asset info lookups
- shape used for pfm ForwardInfo options
- provide `chainInfo` and `assetInfo` in commonPrivateArgs for contracts to use - register common assets used in testing - provide `populateChainHub` function for use in exo unit testing in favor of `registerAgoricBld`
this test can no longer rely on the IST brand being available, so we - added checks to ensure brands are accepted for `.transfer` and `.send` - filed #10449 since this surfaced a bug in `amountToCoin` - use Moolah issuer for "no denom for brand" failure path tests
- enables sending offers with brands
- chainInfo and assetInfo are provided as `commonPrivateArgs`. include them in `ContractMeta`
- auto-stake-it initializes `chainHub` with data so existing tests that use `.transfer()` pass
- no longer needed since we call `registerChainsAndAssets`
- no longer relies on buggy agoricNames - continues to test async-flow resumability and cross-chain vow settlement across upgrade Co-authored-by: 0xPatrick <[email protected]>
- test/bootstrapTests/orchestration.test.ts used a mixed of test and test.serial - the test without `.serial` interleaved and was confusing to debug - this mainly updates inline snapshots, which return different account and channel identifiers since all tests in this file share the same context
- basic-flows.contract.js is provided with `chainInfo` and `assetInfo` in `privateArgs` via builder options - needed for tests that use `localAccount.transfer()`, now reliant on asset info, to pass
5b9326d
to
46e6875
Compare
Deploying agoric-sdk with Cloudflare Pages
|
- create `register-interchain-bank-assets.js` for multichain-testing environment - allow users to submit offers using new brands like OSMO, ION - override existing brands like ATOM (ibc/toyatom) with starship denom - create `make-bank-asset-info.ts` to gather `InterchainAssetOptions` from starship env - update `make start` and ci `multichain-e2e-template.yaml` to call these scripts - deploy-cli.ts `deployBuilder` accepts `builderOpts`
- adds helper to fund agoric faucet with interchain tokens - allows callers to request `OSMO`, `ATOM`, etc, via `provisionSmartWallet`
46e6875
to
fc4e81a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
the comments here are mostly thinking-out-loud.
Putting register-interchain-bank-assets.js
under packages/builders/scripts
seems pretty odd; it's not a script. So I hope you'll move that. But I can still get behind this if you don't.
register-bank-assets: | ||
node_modules/.bin/tsx scripts/fetch-starship-chain-info.ts && \ | ||
node_modules/.bin/tsx scripts/deploy-cli.ts src/register-interchain-bank-assets.builder.js \ | ||
assets="$$(node_modules/.bin/tsx scripts/make-bank-asset-info.ts)" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it cost to get the scripts to know how to execute themselves?
register-bank-assets: | |
node_modules/.bin/tsx scripts/fetch-starship-chain-info.ts && \ | |
node_modules/.bin/tsx scripts/deploy-cli.ts src/register-interchain-bank-assets.builder.js \ | |
assets="$$(node_modules/.bin/tsx scripts/make-bank-asset-info.ts)" | |
register-bank-assets: | |
./scripts/fetch-starship-chain-info.ts && \ | |
./scripts/deploy-cli.ts src/register-interchain-bank-assets.builder.js \ | |
assets="$$(./scripts/make-bank-asset-info.ts)" | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see where we land in #10605 and incorporate that approach
@@ -101,5 +106,5 @@ wait-for-pods: | |||
node_modules/.bin/tsx scripts/pod-readiness.ts | |||
|
|||
.PHONY: start | |||
start: install wait-for-pods port-forward fund-provision-pool override-chain-registry | |||
start: install wait-for-pods port-forward fund-provision-pool override-chain-registry register-bank-assets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does deploy-cli.ts
know how to run multiple evals in one chain governance proposal? How about combining override-chain-registry
and register-bank-assets
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I won't tackle that here but I'll hope to make this update soon
const main = () => { | ||
if (!starshipChainInfo) { | ||
throw new Error( | ||
'starshipChainInfo not found. run `make override-chain-registry` or `node_modules/.bin/tsx scripts/fetch-starship-chain-info.ts` first.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the node_modules/.bin/
again jumps out at me... it looks like we're peeking into the internals of something.
'starshipChainInfo not found. run `make override-chain-registry` or `node_modules/.bin/tsx scripts/fetch-starship-chain-info.ts` first.', | |
'starshipChainInfo not found. run `make override-chain-registry` or `./scripts/fetch-starship-chain-info.ts` first.', |
const fundAndTransfer = makeFundAndTransfer( | ||
t, | ||
retryUntilCondition, | ||
useChain, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hoist this above return
?
@@ -0,0 +1,190 @@ | |||
/** | |||
* @file register-interchain-bank-assets.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like a builder script. It looks like on-chain core-eval code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the @file comment to mention this. Are you suggesting this should live in a different directory?
@@ -179,7 +179,7 @@ const ChainIdArgShape = M.or( | |||
const DefaultPfmTimeoutOpts = harden( | |||
/** @type {const} */ ({ | |||
retries: 3, | |||
timeout: '10min', | |||
timeout: /** @type {GoDuration} */ ('10m'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd... @type {const}
isn't enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch const
should be sufficient here
@@ -82,13 +81,32 @@ export const startSendAnywhere = async ( | |||
}), | |||
); | |||
|
|||
const safeLookup = async p => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name safeLookup
suggests that the .lookup(...)
call should be in this function. safeFulfill
maybe?
const parseAssets = () => { | ||
if (typeof assets !== 'string') { | ||
throw Error( | ||
'must provide --assets=JSON.stringify({ denom: Denom; keyword: string; decimalPlaces: number; }[])', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really a keyword? Or is it a misnomer where we really mean issuerName
?
'must provide --assets=JSON.stringify({ denom: Denom; keyword: string; decimalPlaces: number; }[])', | |
'must provide --assets=JSON.stringify({ denom: Denom; issuerName: string; decimalPlaces: number; }[])', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember this comment in the add-vault proposal. I'll look to make the corresponding change in the builder so we don't continue to carry the tech debt
test.serial(sendAnywhereScenario, 'cosmoshub', 1); | ||
test.serial(sendAnywhereScenario, 'cosmoshub', 2); | ||
test.serial(sendAnywhereScenario, 'osmosis', 1, 'IST'); | ||
test.serial(sendAnywhereScenario, 'osmosis', 2, 'ATOM'); // exercises PFM (agoric -> cosmoshub -> osmosis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it took me a while to grok what this test does, but I think I get it now.
For ref:
https://github.com/Agoric/agoric-sdk/actions/runs/12123427233/job/33798929261?pr=10591#step:13:3141
@@ -118,14 +119,14 @@ export const makeIBCTransferMsg = ( | |||
}; | |||
|
|||
export const createFundedWalletAndClient = async ( | |||
t: ExecutionContext, | |||
log: (...args: unknown[]) => void, | |||
chainName: string, | |||
useChain: MultichainRegistry['useChain'], | |||
) => { | |||
const { chain, creditFromFaucet, getRpcEndpoint } = useChain(chainName); | |||
const wallet = await createWallet(chain.bech32_prefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createWallet(...)
seems to generate random key material using ambient authority.
ah... ok; it takes key material as a default arg, a la...
I'd rather see this test take advantage of that and pass in the key material, but I suppose we'll get there in due course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but none of these tests rely on a specific key currently. For now, I've made mnemonic
an optional parameter to createFundedWalletAndClient
.
2368fb7
to
94e4b37
Compare
closes: #9966
closes: #10445
Description
Adds multi-hop (PFM) scenarios to the
examples/send-anywhere.contract.js
multichain (e2e) test. To support this change, this PR also includes:fundFaucet
helper inmultichain-testing
so developers can request ATOM, OSMO, etc inprovisionSmartWallet
GoDuration
type in@agoric/orchestration
that captures basic Go time duration strings and an update toDefaultPfmTimeoutOpts
(10min -> 10m)Security Considerations
@agoric/builders/scripts/testing/register-interchain-bank-assets.js
allows callers overwrite assets invbank
andagoricNames
. It's only intended for testing, and shouldn't be used in production. A production version might guard against accidental overrides.Scaling Considerations
None, mostly test code. Adds a little CI time to
multichain-testing
for the extra CoreEval.Documentation Considerations
None
Testing Considerations
Includes an E2E to test in
multichain-testing
that leveragesregister-interchain-bank-assets.js
. Also includes the first E2E test of PFM functionality added in #10584 and #10571.Upgrade Considerations
None, library code an NPM orch or FUSDC release.