-
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
feat: CosmosChainInfo
includes pfmEnabled: bool
#10329
Conversation
1475022
to
efe74b3
Compare
Deploying agoric-sdk with Cloudflare Pages
|
efe74b3
to
0395222
Compare
{ opts, amount, destination }, | ||
{ opts, denomAmount, destination, isPfm }, |
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 renaming the amount
property a breaking change?
probably doesn't matter yet, but we should keep this sort of thing in mind
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 change will be part of a new PR, see comment, but thanks for pointing this out.
This interface is part of .transfer()'s internals, and doesn't get exposed to a consumer. I believe that means it's not a breaking change, but let me know if that's off base. Exo upgrade considerations are something I'm always looking to better understand.
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 state record gets written to virtual storage. Upgraded exos have to use the same state properties, IIUC.
I think our baggage test captures this. Once the contract is deployed, we're committed to the state in baggage. We can evolve it, but only in certain limited ways.
d019841
to
9e08694
Compare
Reviewers, we are moving the |
CosmosChainInfo
includes pfmEnabled: bool
38ded26
to
bfd8405
Compare
e0fbda5
to
d8057f2
Compare
5617071
to
784feb2
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.
Putting stuff that does not come from the chain registry into fetched-chain-info doesn't seem right to me.
Whatever consumes fetched-chain-info should mix in PFM_ENABLED, IMO.
#!/usr/bin/env tsx | ||
#!/usr/bin/env TS_BLANK_SPACE_EMIT=false node --import ts-blank-space/register |
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.
interesting!
icqEnabled: ICQ_ENABLED.includes( | ||
// @ts-expect-error string not assignable to `ICQ_ENABLED` const |
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.
suggestion: cast ICQ_ENABLED
to string[]
instead.
@@ -9,6 +9,7 @@ export default /** @type {const} } */ ({ | |||
}, | |||
], | |||
icqEnabled: false, | |||
pfmEnabled: true, |
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.
Putting stuff that does not come from the chain registry into fetched-chain-info doesn't seem right to me.
Whatever consumes fetched-chain-info should mix in PFM_ENABLED
, IMO.
784feb2
to
d08f946
Compare
2c1661d
to
b746eee
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.
Thanks for the clean commits. LGTM.
737a964
to
d6db026
Compare
- in order to determine whether its possible to route a transfer through a particular ibc chain, we must know if they have the PFM module installed
- adds `IcqEnabled` and `PfmEnabled` constants to support `CosmosChainInfo` - this data is not available via a well-known registry like cosmos/chain-registry, but necessary for the Orchestration API - exports `withChainCapabilities` helper so consumers can include this data with fetched-chain-info.js
- use `ts-blank-space` since `tsx` is no longer in `node_modules/.bin` - prefer yarn command instead of standalone script
- helper function that takes chainInfo and assetInfo and registers the data in ChainHub
- `withOrchestration` the baggage that was provided to it by the original caller - needed so users of `withOrchestration` can access baggage
- split start-send-anywhere.js into proposal and start script so we can pass options - init-send-anywhere.js takes `--chainInfo` and `--assetInfo` options - send-anywhere.contrac.js registers chainInfo and assetInfo from privateArgs in ChainHub
d6db026
to
2fa2f75
Compare
- this test is flaky and will be addressed as part of #10565
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 is how far I got before a meeting
[`ibc/${denomHash({ denom: 'uatom', channelId: chainInfo.agoric.connections['gaialocal'].transferChannel.channelId })}`]: | ||
{ | ||
baseName: 'cosmoshub', | ||
chainName: 'agoric', | ||
baseDenom: 'uatom', | ||
}, |
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 connect the relevant brand.
|
||
test.before(async t => { | ||
const { deleteTestKeys, setupTestKeys, ...rest } = await commonSetup(t); | ||
deleteTestKeys(accounts).catch(); | ||
const wallets = await setupTestKeys(accounts); | ||
t.context = { ...rest, wallets, deleteTestKeys }; | ||
const { startContract } = rest; | ||
await startContract(contractName, contractBuilder); | ||
|
||
const assetInfo = { |
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.
a helper for this comes to mind:
const assetInfo = Object.fromEntries([
assetOn('uosmo', 'osmosis'),
assetOn('uosmo', 'osmosis', 'agoric', chainInfo),
assetOn('uatom', 'cosmoshub'),
assetOn('uatom', 'cosmoshub', 'agoric', 'chainInfo),
])
|
||
await startContract(contractName, contractBuilder, { | ||
chainInfo: JSON.stringify(withChainCapabilities(chainInfo)), | ||
assetInfo: JSON.stringify(assetInfo), |
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.
Using LegibleCapData
would let us include brands in assetInfo
.
agoric-sdk/packages/fast-usdc/src/utils/config-marshal.js
Lines 69 to 73 in 8657c4c
/** | |
* The smallCaps body is a string, which simplifies some usage. | |
* But it's hard to read and write. | |
* | |
* The parsed structure makes a convenient notation for configuration etc. |
*/ | ||
|
||
const { keys } = Object; | ||
|
||
const defaultAssetInfo = { |
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.
again:
const defaultAssetInfo = Object.fromEntries([
assetOn('uusdc', 'noble'),
assetOn('uusdc', 'noble', 'agoric', chainInfo),
assetOn('uusdc', 'noble', 'osmosis', chainInfo),
]);
baseName: 'noble', | ||
chainName: 'agoric', | ||
baseDenom: 'uusdc', | ||
brandKey: 'USDC', |
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 consumes brandKey
? What's the type of defaultAssetInfo
?
brandKey
is another example of the sort of thing that LegibleCapData
is designed to address.
For background, see
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 is good feedback. I went with brandKey
since I'm not well versed in this area.
I created a ticket to track the removal of brandKey
in favor of this approach: #10580
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.
Thanks. I think it's an entirely internal interface, so it's not a big deal.
@@ -33,6 +35,8 @@ const contractName = 'fastUsdc'; | |||
* oracles: Record<string, string>; | |||
* feeConfig: FeeConfig; | |||
* feedPolicy: FeedPolicy & Passable; | |||
* chainInfo: Record<string, CosmosChainInfo & Passable>; | |||
* assetInfo: Record<Denom, DenomDetail & {brandKey?: string}>; |
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.
FastUSDCConfig
shouldn't need brandKey
. It's already designed to work with LegibleCapData
.
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.
assetInfo, | ||
) => { | ||
if (!chainInfo) { | ||
console.log('No chain info provided, returning early.'); |
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.
How about logging the keys of chainInfo
in any case?
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 see you've tackled this in #10572
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.
Yup
} | ||
} | ||
} | ||
|
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.
log registeredPairs for connection info?
} | ||
|
||
if (!assetInfo) { | ||
console.log('No asset info provided, returning early.'); |
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.
again, how about logging the keys of assetInfo
in any case?
Logging IBC denoms is kinda noisy, but probably not too bad.
* @param {ChainHub} chainHub | ||
* @param {Record<string, Brand<'nat'>>} brands | ||
* @param {Record<string, CosmosChainInfo> | undefined} chainInfo | ||
* @param {Record<Denom, DenomDetail & { brandKey?: string }> | undefined} assetInfo |
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.
Using LegibleCapData
would avoid the special case for brandKey
here.
refs: #10006
refs: #10445
Description
pfmEnabled: bool
toCosmosChainInfo
to support multi-hop forwarding logicwithChainCapabilities
helper that mixes inPfmEnabled
andIcqEnabled
constants toChainInfo
registerChainsAndAssets
helper that registers info in achainHub
in a contractstartFn
chainHub
initialization infast-usdc
andsend-anywhere
contractsSecurity Considerations
chain-capabilities.js
is authoritative, but consumers have the ability to provide their own data. It's not published to vstorage and will be mixed in to local ChainHub's in example contracts that rely on it.Scaling Considerations
chain-capabilities.js
over timeDocumentation Considerations
Testing Considerations
Upgrade Considerations
Library code, part of an NPM Orch release